amber-cli.js 2.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. // This file is used to make additional changes
  8. // when building an app to run in node.js.
  9. // Free to edit. You can break tests (cli test runner uses
  10. // this to build itself - it is a node executable).
  11. define("amber/Platform", ["amber_core/Platform-Node"], {});
  12. define("amber/compatibility", ["amber/node-compatibility"], {});
  13. define("jquery", {});
  14. define("config-node", function(){});
  15. define('amber/brikz',[], function () {
  16. return function Brikz(api, apiKey, initKey) {
  17. "use strict";
  18. //jshint eqnull:true
  19. var brikz = this,
  20. backup = {};
  21. apiKey = apiKey || 'exports';
  22. initKey = initKey || '__init__';
  23. function mixin(src, target, what) {
  24. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  25. if (src == null) {
  26. target[keys[i]] = undefined;
  27. } else {
  28. var value = src[keys[i]];
  29. if (typeof value !== "undefined") {
  30. target[keys[i]] = value;
  31. }
  32. }
  33. }
  34. return target;
  35. }
  36. Object.defineProperties(this, {
  37. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  38. });
  39. var exclude = mixin(this, {});
  40. this.rebuild = function () {
  41. Object.keys(backup).forEach(function (key) {
  42. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  43. });
  44. var oapi = mixin(api, {}),
  45. order = [],
  46. chk = {};
  47. function ensure(key) {
  48. if (key in exclude) {
  49. return null;
  50. }
  51. var b = brikz[key],
  52. bak = backup[key];
  53. mixin(null, api, api);
  54. while (typeof b === "function") {
  55. (b.deps || []).forEach(ensure);
  56. b = new b(brikz, api, bak);
  57. }
  58. brikz[key] = b;
  59. if (b && !chk[key]) {
  60. chk[key] = true;
  61. order.push(b);
  62. }
  63. if (b && !b[apiKey]) {
  64. b[apiKey] = mixin(api, {});
  65. }
  66. }
  67. Object.keys(brikz).forEach(ensure);
  68. mixin(oapi, mixin(null, api, api));
  69. order.forEach(function (brik) {
  70. mixin(brik[apiKey] || {}, api);
  71. });
  72. order.forEach(function (brik) {
  73. if (brik[initKey]) {
  74. brik[initKey]();
  75. if (brik[initKey].once) {
  76. delete brik[initKey];
  77. }
  78. }
  79. });
  80. backup = mixin(brikz, {});
  81. };
  82. };
  83. });
  84. /*!
  85. * @overview es6-promise - a tiny implementation of Promises/A+.
  86. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  87. * @license Licensed under MIT license
  88. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  89. * @version 3.3.1
  90. */
  91. (function (global, factory) {
  92. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  93. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  94. (global.ES6Promise = factory());
  95. }(this, (function () { 'use strict';
  96. function objectOrFunction(x) {
  97. return typeof x === 'function' || typeof x === 'object' && x !== null;
  98. }
  99. function isFunction(x) {
  100. return typeof x === 'function';
  101. }
  102. var _isArray = undefined;
  103. if (!Array.isArray) {
  104. _isArray = function (x) {
  105. return Object.prototype.toString.call(x) === '[object Array]';
  106. };
  107. } else {
  108. _isArray = Array.isArray;
  109. }
  110. var isArray = _isArray;
  111. var len = 0;
  112. var vertxNext = undefined;
  113. var customSchedulerFn = undefined;
  114. var asap = function asap(callback, arg) {
  115. queue[len] = callback;
  116. queue[len + 1] = arg;
  117. len += 2;
  118. if (len === 2) {
  119. // If len is 2, that means that we need to schedule an async flush.
  120. // If additional callbacks are queued before the queue is flushed, they
  121. // will be processed by this flush that we are scheduling.
  122. if (customSchedulerFn) {
  123. customSchedulerFn(flush);
  124. } else {
  125. scheduleFlush();
  126. }
  127. }
  128. };
  129. function setScheduler(scheduleFn) {
  130. customSchedulerFn = scheduleFn;
  131. }
  132. function setAsap(asapFn) {
  133. asap = asapFn;
  134. }
  135. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  136. var browserGlobal = browserWindow || {};
  137. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  138. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
  139. // test for web worker but not in IE10
  140. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  141. // node
  142. function useNextTick() {
  143. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  144. // see https://github.com/cujojs/when/issues/410 for details
  145. return function () {
  146. return process.nextTick(flush);
  147. };
  148. }
  149. // vertx
  150. function useVertxTimer() {
  151. return function () {
  152. vertxNext(flush);
  153. };
  154. }
  155. function useMutationObserver() {
  156. var iterations = 0;
  157. var observer = new BrowserMutationObserver(flush);
  158. var node = document.createTextNode('');
  159. observer.observe(node, { characterData: true });
  160. return function () {
  161. node.data = iterations = ++iterations % 2;
  162. };
  163. }
  164. // web worker
  165. function useMessageChannel() {
  166. var channel = new MessageChannel();
  167. channel.port1.onmessage = flush;
  168. return function () {
  169. return channel.port2.postMessage(0);
  170. };
  171. }
  172. function useSetTimeout() {
  173. // Store setTimeout reference so es6-promise will be unaffected by
  174. // other code modifying setTimeout (like sinon.useFakeTimers())
  175. var globalSetTimeout = setTimeout;
  176. return function () {
  177. return globalSetTimeout(flush, 1);
  178. };
  179. }
  180. var queue = new Array(1000);
  181. function flush() {
  182. for (var i = 0; i < len; i += 2) {
  183. var callback = queue[i];
  184. var arg = queue[i + 1];
  185. callback(arg);
  186. queue[i] = undefined;
  187. queue[i + 1] = undefined;
  188. }
  189. len = 0;
  190. }
  191. function attemptVertx() {
  192. try {
  193. var r = require;
  194. var vertx = r('vertx');
  195. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  196. return useVertxTimer();
  197. } catch (e) {
  198. return useSetTimeout();
  199. }
  200. }
  201. var scheduleFlush = undefined;
  202. // Decide what async method to use to triggering processing of queued callbacks:
  203. if (isNode) {
  204. scheduleFlush = useNextTick();
  205. } else if (BrowserMutationObserver) {
  206. scheduleFlush = useMutationObserver();
  207. } else if (isWorker) {
  208. scheduleFlush = useMessageChannel();
  209. } else if (browserWindow === undefined && typeof require === 'function') {
  210. scheduleFlush = attemptVertx();
  211. } else {
  212. scheduleFlush = useSetTimeout();
  213. }
  214. function then(onFulfillment, onRejection) {
  215. var _arguments = arguments;
  216. var parent = this;
  217. var child = new this.constructor(noop);
  218. if (child[PROMISE_ID] === undefined) {
  219. makePromise(child);
  220. }
  221. var _state = parent._state;
  222. if (_state) {
  223. (function () {
  224. var callback = _arguments[_state - 1];
  225. asap(function () {
  226. return invokeCallback(_state, child, callback, parent._result);
  227. });
  228. })();
  229. } else {
  230. subscribe(parent, child, onFulfillment, onRejection);
  231. }
  232. return child;
  233. }
  234. /**
  235. `Promise.resolve` returns a promise that will become resolved with the
  236. passed `value`. It is shorthand for the following:
  237. ```javascript
  238. let promise = new Promise(function(resolve, reject){
  239. resolve(1);
  240. });
  241. promise.then(function(value){
  242. // value === 1
  243. });
  244. ```
  245. Instead of writing the above, your code now simply becomes the following:
  246. ```javascript
  247. let promise = Promise.resolve(1);
  248. promise.then(function(value){
  249. // value === 1
  250. });
  251. ```
  252. @method resolve
  253. @static
  254. @param {Any} value value that the returned promise will be resolved with
  255. Useful for tooling.
  256. @return {Promise} a promise that will become fulfilled with the given
  257. `value`
  258. */
  259. function resolve(object) {
  260. /*jshint validthis:true */
  261. var Constructor = this;
  262. if (object && typeof object === 'object' && object.constructor === Constructor) {
  263. return object;
  264. }
  265. var promise = new Constructor(noop);
  266. _resolve(promise, object);
  267. return promise;
  268. }
  269. var PROMISE_ID = Math.random().toString(36).substring(16);
  270. function noop() {}
  271. var PENDING = void 0;
  272. var FULFILLED = 1;
  273. var REJECTED = 2;
  274. var GET_THEN_ERROR = new ErrorObject();
  275. function selfFulfillment() {
  276. return new TypeError("You cannot resolve a promise with itself");
  277. }
  278. function cannotReturnOwn() {
  279. return new TypeError('A promises callback cannot return that same promise.');
  280. }
  281. function getThen(promise) {
  282. try {
  283. return promise.then;
  284. } catch (error) {
  285. GET_THEN_ERROR.error = error;
  286. return GET_THEN_ERROR;
  287. }
  288. }
  289. function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  290. try {
  291. then.call(value, fulfillmentHandler, rejectionHandler);
  292. } catch (e) {
  293. return e;
  294. }
  295. }
  296. function handleForeignThenable(promise, thenable, then) {
  297. asap(function (promise) {
  298. var sealed = false;
  299. var error = tryThen(then, thenable, function (value) {
  300. if (sealed) {
  301. return;
  302. }
  303. sealed = true;
  304. if (thenable !== value) {
  305. _resolve(promise, value);
  306. } else {
  307. fulfill(promise, value);
  308. }
  309. }, function (reason) {
  310. if (sealed) {
  311. return;
  312. }
  313. sealed = true;
  314. _reject(promise, reason);
  315. }, 'Settle: ' + (promise._label || ' unknown promise'));
  316. if (!sealed && error) {
  317. sealed = true;
  318. _reject(promise, error);
  319. }
  320. }, promise);
  321. }
  322. function handleOwnThenable(promise, thenable) {
  323. if (thenable._state === FULFILLED) {
  324. fulfill(promise, thenable._result);
  325. } else if (thenable._state === REJECTED) {
  326. _reject(promise, thenable._result);
  327. } else {
  328. subscribe(thenable, undefined, function (value) {
  329. return _resolve(promise, value);
  330. }, function (reason) {
  331. return _reject(promise, reason);
  332. });
  333. }
  334. }
  335. function handleMaybeThenable(promise, maybeThenable, then$$) {
  336. if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
  337. handleOwnThenable(promise, maybeThenable);
  338. } else {
  339. if (then$$ === GET_THEN_ERROR) {
  340. _reject(promise, GET_THEN_ERROR.error);
  341. } else if (then$$ === undefined) {
  342. fulfill(promise, maybeThenable);
  343. } else if (isFunction(then$$)) {
  344. handleForeignThenable(promise, maybeThenable, then$$);
  345. } else {
  346. fulfill(promise, maybeThenable);
  347. }
  348. }
  349. }
  350. function _resolve(promise, value) {
  351. if (promise === value) {
  352. _reject(promise, selfFulfillment());
  353. } else if (objectOrFunction(value)) {
  354. handleMaybeThenable(promise, value, getThen(value));
  355. } else {
  356. fulfill(promise, value);
  357. }
  358. }
  359. function publishRejection(promise) {
  360. if (promise._onerror) {
  361. promise._onerror(promise._result);
  362. }
  363. publish(promise);
  364. }
  365. function fulfill(promise, value) {
  366. if (promise._state !== PENDING) {
  367. return;
  368. }
  369. promise._result = value;
  370. promise._state = FULFILLED;
  371. if (promise._subscribers.length !== 0) {
  372. asap(publish, promise);
  373. }
  374. }
  375. function _reject(promise, reason) {
  376. if (promise._state !== PENDING) {
  377. return;
  378. }
  379. promise._state = REJECTED;
  380. promise._result = reason;
  381. asap(publishRejection, promise);
  382. }
  383. function subscribe(parent, child, onFulfillment, onRejection) {
  384. var _subscribers = parent._subscribers;
  385. var length = _subscribers.length;
  386. parent._onerror = null;
  387. _subscribers[length] = child;
  388. _subscribers[length + FULFILLED] = onFulfillment;
  389. _subscribers[length + REJECTED] = onRejection;
  390. if (length === 0 && parent._state) {
  391. asap(publish, parent);
  392. }
  393. }
  394. function publish(promise) {
  395. var subscribers = promise._subscribers;
  396. var settled = promise._state;
  397. if (subscribers.length === 0) {
  398. return;
  399. }
  400. var child = undefined,
  401. callback = undefined,
  402. detail = promise._result;
  403. for (var i = 0; i < subscribers.length; i += 3) {
  404. child = subscribers[i];
  405. callback = subscribers[i + settled];
  406. if (child) {
  407. invokeCallback(settled, child, callback, detail);
  408. } else {
  409. callback(detail);
  410. }
  411. }
  412. promise._subscribers.length = 0;
  413. }
  414. function ErrorObject() {
  415. this.error = null;
  416. }
  417. var TRY_CATCH_ERROR = new ErrorObject();
  418. function tryCatch(callback, detail) {
  419. try {
  420. return callback(detail);
  421. } catch (e) {
  422. TRY_CATCH_ERROR.error = e;
  423. return TRY_CATCH_ERROR;
  424. }
  425. }
  426. function invokeCallback(settled, promise, callback, detail) {
  427. var hasCallback = isFunction(callback),
  428. value = undefined,
  429. error = undefined,
  430. succeeded = undefined,
  431. failed = undefined;
  432. if (hasCallback) {
  433. value = tryCatch(callback, detail);
  434. if (value === TRY_CATCH_ERROR) {
  435. failed = true;
  436. error = value.error;
  437. value = null;
  438. } else {
  439. succeeded = true;
  440. }
  441. if (promise === value) {
  442. _reject(promise, cannotReturnOwn());
  443. return;
  444. }
  445. } else {
  446. value = detail;
  447. succeeded = true;
  448. }
  449. if (promise._state !== PENDING) {
  450. // noop
  451. } else if (hasCallback && succeeded) {
  452. _resolve(promise, value);
  453. } else if (failed) {
  454. _reject(promise, error);
  455. } else if (settled === FULFILLED) {
  456. fulfill(promise, value);
  457. } else if (settled === REJECTED) {
  458. _reject(promise, value);
  459. }
  460. }
  461. function initializePromise(promise, resolver) {
  462. try {
  463. resolver(function resolvePromise(value) {
  464. _resolve(promise, value);
  465. }, function rejectPromise(reason) {
  466. _reject(promise, reason);
  467. });
  468. } catch (e) {
  469. _reject(promise, e);
  470. }
  471. }
  472. var id = 0;
  473. function nextId() {
  474. return id++;
  475. }
  476. function makePromise(promise) {
  477. promise[PROMISE_ID] = id++;
  478. promise._state = undefined;
  479. promise._result = undefined;
  480. promise._subscribers = [];
  481. }
  482. function Enumerator(Constructor, input) {
  483. this._instanceConstructor = Constructor;
  484. this.promise = new Constructor(noop);
  485. if (!this.promise[PROMISE_ID]) {
  486. makePromise(this.promise);
  487. }
  488. if (isArray(input)) {
  489. this._input = input;
  490. this.length = input.length;
  491. this._remaining = input.length;
  492. this._result = new Array(this.length);
  493. if (this.length === 0) {
  494. fulfill(this.promise, this._result);
  495. } else {
  496. this.length = this.length || 0;
  497. this._enumerate();
  498. if (this._remaining === 0) {
  499. fulfill(this.promise, this._result);
  500. }
  501. }
  502. } else {
  503. _reject(this.promise, validationError());
  504. }
  505. }
  506. function validationError() {
  507. return new Error('Array Methods must be provided an Array');
  508. };
  509. Enumerator.prototype._enumerate = function () {
  510. var length = this.length;
  511. var _input = this._input;
  512. for (var i = 0; this._state === PENDING && i < length; i++) {
  513. this._eachEntry(_input[i], i);
  514. }
  515. };
  516. Enumerator.prototype._eachEntry = function (entry, i) {
  517. var c = this._instanceConstructor;
  518. var resolve$$ = c.resolve;
  519. if (resolve$$ === resolve) {
  520. var _then = getThen(entry);
  521. if (_then === then && entry._state !== PENDING) {
  522. this._settledAt(entry._state, i, entry._result);
  523. } else if (typeof _then !== 'function') {
  524. this._remaining--;
  525. this._result[i] = entry;
  526. } else if (c === Promise) {
  527. var promise = new c(noop);
  528. handleMaybeThenable(promise, entry, _then);
  529. this._willSettleAt(promise, i);
  530. } else {
  531. this._willSettleAt(new c(function (resolve$$) {
  532. return resolve$$(entry);
  533. }), i);
  534. }
  535. } else {
  536. this._willSettleAt(resolve$$(entry), i);
  537. }
  538. };
  539. Enumerator.prototype._settledAt = function (state, i, value) {
  540. var promise = this.promise;
  541. if (promise._state === PENDING) {
  542. this._remaining--;
  543. if (state === REJECTED) {
  544. _reject(promise, value);
  545. } else {
  546. this._result[i] = value;
  547. }
  548. }
  549. if (this._remaining === 0) {
  550. fulfill(promise, this._result);
  551. }
  552. };
  553. Enumerator.prototype._willSettleAt = function (promise, i) {
  554. var enumerator = this;
  555. subscribe(promise, undefined, function (value) {
  556. return enumerator._settledAt(FULFILLED, i, value);
  557. }, function (reason) {
  558. return enumerator._settledAt(REJECTED, i, reason);
  559. });
  560. };
  561. /**
  562. `Promise.all` accepts an array of promises, and returns a new promise which
  563. is fulfilled with an array of fulfillment values for the passed promises, or
  564. rejected with the reason of the first passed promise to be rejected. It casts all
  565. elements of the passed iterable to promises as it runs this algorithm.
  566. Example:
  567. ```javascript
  568. let promise1 = resolve(1);
  569. let promise2 = resolve(2);
  570. let promise3 = resolve(3);
  571. let promises = [ promise1, promise2, promise3 ];
  572. Promise.all(promises).then(function(array){
  573. // The array here would be [ 1, 2, 3 ];
  574. });
  575. ```
  576. If any of the `promises` given to `all` are rejected, the first promise
  577. that is rejected will be given as an argument to the returned promises's
  578. rejection handler. For example:
  579. Example:
  580. ```javascript
  581. let promise1 = resolve(1);
  582. let promise2 = reject(new Error("2"));
  583. let promise3 = reject(new Error("3"));
  584. let promises = [ promise1, promise2, promise3 ];
  585. Promise.all(promises).then(function(array){
  586. // Code here never runs because there are rejected promises!
  587. }, function(error) {
  588. // error.message === "2"
  589. });
  590. ```
  591. @method all
  592. @static
  593. @param {Array} entries array of promises
  594. @param {String} label optional string for labeling the promise.
  595. Useful for tooling.
  596. @return {Promise} promise that is fulfilled when all `promises` have been
  597. fulfilled, or rejected if any of them become rejected.
  598. @static
  599. */
  600. function all(entries) {
  601. return new Enumerator(this, entries).promise;
  602. }
  603. /**
  604. `Promise.race` returns a new promise which is settled in the same way as the
  605. first passed promise to settle.
  606. Example:
  607. ```javascript
  608. let promise1 = new Promise(function(resolve, reject){
  609. setTimeout(function(){
  610. resolve('promise 1');
  611. }, 200);
  612. });
  613. let promise2 = new Promise(function(resolve, reject){
  614. setTimeout(function(){
  615. resolve('promise 2');
  616. }, 100);
  617. });
  618. Promise.race([promise1, promise2]).then(function(result){
  619. // result === 'promise 2' because it was resolved before promise1
  620. // was resolved.
  621. });
  622. ```
  623. `Promise.race` is deterministic in that only the state of the first
  624. settled promise matters. For example, even if other promises given to the
  625. `promises` array argument are resolved, but the first settled promise has
  626. become rejected before the other promises became fulfilled, the returned
  627. promise will become rejected:
  628. ```javascript
  629. let promise1 = new Promise(function(resolve, reject){
  630. setTimeout(function(){
  631. resolve('promise 1');
  632. }, 200);
  633. });
  634. let promise2 = new Promise(function(resolve, reject){
  635. setTimeout(function(){
  636. reject(new Error('promise 2'));
  637. }, 100);
  638. });
  639. Promise.race([promise1, promise2]).then(function(result){
  640. // Code here never runs
  641. }, function(reason){
  642. // reason.message === 'promise 2' because promise 2 became rejected before
  643. // promise 1 became fulfilled
  644. });
  645. ```
  646. An example real-world use case is implementing timeouts:
  647. ```javascript
  648. Promise.race([ajax('foo.json'), timeout(5000)])
  649. ```
  650. @method race
  651. @static
  652. @param {Array} promises array of promises to observe
  653. Useful for tooling.
  654. @return {Promise} a promise which settles in the same way as the first passed
  655. promise to settle.
  656. */
  657. function race(entries) {
  658. /*jshint validthis:true */
  659. var Constructor = this;
  660. if (!isArray(entries)) {
  661. return new Constructor(function (_, reject) {
  662. return reject(new TypeError('You must pass an array to race.'));
  663. });
  664. } else {
  665. return new Constructor(function (resolve, reject) {
  666. var length = entries.length;
  667. for (var i = 0; i < length; i++) {
  668. Constructor.resolve(entries[i]).then(resolve, reject);
  669. }
  670. });
  671. }
  672. }
  673. /**
  674. `Promise.reject` returns a promise rejected with the passed `reason`.
  675. It is shorthand for the following:
  676. ```javascript
  677. let promise = new Promise(function(resolve, reject){
  678. reject(new Error('WHOOPS'));
  679. });
  680. promise.then(function(value){
  681. // Code here doesn't run because the promise is rejected!
  682. }, function(reason){
  683. // reason.message === 'WHOOPS'
  684. });
  685. ```
  686. Instead of writing the above, your code now simply becomes the following:
  687. ```javascript
  688. let promise = Promise.reject(new Error('WHOOPS'));
  689. promise.then(function(value){
  690. // Code here doesn't run because the promise is rejected!
  691. }, function(reason){
  692. // reason.message === 'WHOOPS'
  693. });
  694. ```
  695. @method reject
  696. @static
  697. @param {Any} reason value that the returned promise will be rejected with.
  698. Useful for tooling.
  699. @return {Promise} a promise rejected with the given `reason`.
  700. */
  701. function reject(reason) {
  702. /*jshint validthis:true */
  703. var Constructor = this;
  704. var promise = new Constructor(noop);
  705. _reject(promise, reason);
  706. return promise;
  707. }
  708. function needsResolver() {
  709. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  710. }
  711. function needsNew() {
  712. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  713. }
  714. /**
  715. Promise objects represent the eventual result of an asynchronous operation. The
  716. primary way of interacting with a promise is through its `then` method, which
  717. registers callbacks to receive either a promise's eventual value or the reason
  718. why the promise cannot be fulfilled.
  719. Terminology
  720. -----------
  721. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  722. - `thenable` is an object or function that defines a `then` method.
  723. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  724. - `exception` is a value that is thrown using the throw statement.
  725. - `reason` is a value that indicates why a promise was rejected.
  726. - `settled` the final resting state of a promise, fulfilled or rejected.
  727. A promise can be in one of three states: pending, fulfilled, or rejected.
  728. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  729. state. Promises that are rejected have a rejection reason and are in the
  730. rejected state. A fulfillment value is never a thenable.
  731. Promises can also be said to *resolve* a value. If this value is also a
  732. promise, then the original promise's settled state will match the value's
  733. settled state. So a promise that *resolves* a promise that rejects will
  734. itself reject, and a promise that *resolves* a promise that fulfills will
  735. itself fulfill.
  736. Basic Usage:
  737. ------------
  738. ```js
  739. let promise = new Promise(function(resolve, reject) {
  740. // on success
  741. resolve(value);
  742. // on failure
  743. reject(reason);
  744. });
  745. promise.then(function(value) {
  746. // on fulfillment
  747. }, function(reason) {
  748. // on rejection
  749. });
  750. ```
  751. Advanced Usage:
  752. ---------------
  753. Promises shine when abstracting away asynchronous interactions such as
  754. `XMLHttpRequest`s.
  755. ```js
  756. function getJSON(url) {
  757. return new Promise(function(resolve, reject){
  758. let xhr = new XMLHttpRequest();
  759. xhr.open('GET', url);
  760. xhr.onreadystatechange = handler;
  761. xhr.responseType = 'json';
  762. xhr.setRequestHeader('Accept', 'application/json');
  763. xhr.send();
  764. function handler() {
  765. if (this.readyState === this.DONE) {
  766. if (this.status === 200) {
  767. resolve(this.response);
  768. } else {
  769. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  770. }
  771. }
  772. };
  773. });
  774. }
  775. getJSON('/posts.json').then(function(json) {
  776. // on fulfillment
  777. }, function(reason) {
  778. // on rejection
  779. });
  780. ```
  781. Unlike callbacks, promises are great composable primitives.
  782. ```js
  783. Promise.all([
  784. getJSON('/posts'),
  785. getJSON('/comments')
  786. ]).then(function(values){
  787. values[0] // => postsJSON
  788. values[1] // => commentsJSON
  789. return values;
  790. });
  791. ```
  792. @class Promise
  793. @param {function} resolver
  794. Useful for tooling.
  795. @constructor
  796. */
  797. function Promise(resolver) {
  798. this[PROMISE_ID] = nextId();
  799. this._result = this._state = undefined;
  800. this._subscribers = [];
  801. if (noop !== resolver) {
  802. typeof resolver !== 'function' && needsResolver();
  803. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  804. }
  805. }
  806. Promise.all = all;
  807. Promise.race = race;
  808. Promise.resolve = resolve;
  809. Promise.reject = reject;
  810. Promise._setScheduler = setScheduler;
  811. Promise._setAsap = setAsap;
  812. Promise._asap = asap;
  813. Promise.prototype = {
  814. constructor: Promise,
  815. /**
  816. The primary way of interacting with a promise is through its `then` method,
  817. which registers callbacks to receive either a promise's eventual value or the
  818. reason why the promise cannot be fulfilled.
  819. ```js
  820. findUser().then(function(user){
  821. // user is available
  822. }, function(reason){
  823. // user is unavailable, and you are given the reason why
  824. });
  825. ```
  826. Chaining
  827. --------
  828. The return value of `then` is itself a promise. This second, 'downstream'
  829. promise is resolved with the return value of the first promise's fulfillment
  830. or rejection handler, or rejected if the handler throws an exception.
  831. ```js
  832. findUser().then(function (user) {
  833. return user.name;
  834. }, function (reason) {
  835. return 'default name';
  836. }).then(function (userName) {
  837. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  838. // will be `'default name'`
  839. });
  840. findUser().then(function (user) {
  841. throw new Error('Found user, but still unhappy');
  842. }, function (reason) {
  843. throw new Error('`findUser` rejected and we're unhappy');
  844. }).then(function (value) {
  845. // never reached
  846. }, function (reason) {
  847. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  848. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  849. });
  850. ```
  851. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  852. ```js
  853. findUser().then(function (user) {
  854. throw new PedagogicalException('Upstream error');
  855. }).then(function (value) {
  856. // never reached
  857. }).then(function (value) {
  858. // never reached
  859. }, function (reason) {
  860. // The `PedgagocialException` is propagated all the way down to here
  861. });
  862. ```
  863. Assimilation
  864. ------------
  865. Sometimes the value you want to propagate to a downstream promise can only be
  866. retrieved asynchronously. This can be achieved by returning a promise in the
  867. fulfillment or rejection handler. The downstream promise will then be pending
  868. until the returned promise is settled. This is called *assimilation*.
  869. ```js
  870. findUser().then(function (user) {
  871. return findCommentsByAuthor(user);
  872. }).then(function (comments) {
  873. // The user's comments are now available
  874. });
  875. ```
  876. If the assimliated promise rejects, then the downstream promise will also reject.
  877. ```js
  878. findUser().then(function (user) {
  879. return findCommentsByAuthor(user);
  880. }).then(function (comments) {
  881. // If `findCommentsByAuthor` fulfills, we'll have the value here
  882. }, function (reason) {
  883. // If `findCommentsByAuthor` rejects, we'll have the reason here
  884. });
  885. ```
  886. Simple Example
  887. --------------
  888. Synchronous Example
  889. ```javascript
  890. let result;
  891. try {
  892. result = findResult();
  893. // success
  894. } catch(reason) {
  895. // failure
  896. }
  897. ```
  898. Errback Example
  899. ```js
  900. findResult(function(result, err){
  901. if (err) {
  902. // failure
  903. } else {
  904. // success
  905. }
  906. });
  907. ```
  908. Promise Example;
  909. ```javascript
  910. findResult().then(function(result){
  911. // success
  912. }, function(reason){
  913. // failure
  914. });
  915. ```
  916. Advanced Example
  917. --------------
  918. Synchronous Example
  919. ```javascript
  920. let author, books;
  921. try {
  922. author = findAuthor();
  923. books = findBooksByAuthor(author);
  924. // success
  925. } catch(reason) {
  926. // failure
  927. }
  928. ```
  929. Errback Example
  930. ```js
  931. function foundBooks(books) {
  932. }
  933. function failure(reason) {
  934. }
  935. findAuthor(function(author, err){
  936. if (err) {
  937. failure(err);
  938. // failure
  939. } else {
  940. try {
  941. findBoooksByAuthor(author, function(books, err) {
  942. if (err) {
  943. failure(err);
  944. } else {
  945. try {
  946. foundBooks(books);
  947. } catch(reason) {
  948. failure(reason);
  949. }
  950. }
  951. });
  952. } catch(error) {
  953. failure(err);
  954. }
  955. // success
  956. }
  957. });
  958. ```
  959. Promise Example;
  960. ```javascript
  961. findAuthor().
  962. then(findBooksByAuthor).
  963. then(function(books){
  964. // found books
  965. }).catch(function(reason){
  966. // something went wrong
  967. });
  968. ```
  969. @method then
  970. @param {Function} onFulfilled
  971. @param {Function} onRejected
  972. Useful for tooling.
  973. @return {Promise}
  974. */
  975. then: then,
  976. /**
  977. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  978. as the catch block of a try/catch statement.
  979. ```js
  980. function findAuthor(){
  981. throw new Error('couldn't find that author');
  982. }
  983. // synchronous
  984. try {
  985. findAuthor();
  986. } catch(reason) {
  987. // something went wrong
  988. }
  989. // async with promises
  990. findAuthor().catch(function(reason){
  991. // something went wrong
  992. });
  993. ```
  994. @method catch
  995. @param {Function} onRejection
  996. Useful for tooling.
  997. @return {Promise}
  998. */
  999. 'catch': function _catch(onRejection) {
  1000. return this.then(null, onRejection);
  1001. }
  1002. };
  1003. function polyfill() {
  1004. var local = undefined;
  1005. if (typeof global !== 'undefined') {
  1006. local = global;
  1007. } else if (typeof self !== 'undefined') {
  1008. local = self;
  1009. } else {
  1010. try {
  1011. local = Function('return this')();
  1012. } catch (e) {
  1013. throw new Error('polyfill failed because global object is unavailable in this environment');
  1014. }
  1015. }
  1016. var P = local.Promise;
  1017. if (P) {
  1018. var promiseToString = null;
  1019. try {
  1020. promiseToString = Object.prototype.toString.call(P.resolve());
  1021. } catch (e) {
  1022. // silently ignored
  1023. }
  1024. if (promiseToString === '[object Promise]' && !P.cast) {
  1025. return;
  1026. }
  1027. }
  1028. local.Promise = Promise;
  1029. }
  1030. polyfill();
  1031. // Strange compat..
  1032. Promise.polyfill = polyfill;
  1033. Promise.Promise = Promise;
  1034. return Promise;
  1035. })));
  1036. //# sourceMappingURL=es6-promise.map;
  1037. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  1038. promiseLib.polyfill();
  1039. });
  1040. // This file is injected dependencies by amber-compat-xxx modules.
  1041. // Therefore it is important that it _does_not_have_ define call.
  1042. ;
  1043. define("amber/node-compatibility", ["./es2015-polyfills"], function(){});
  1044. /* ====================================================================
  1045. |
  1046. | Amber Smalltalk
  1047. | http://amber-lang.net
  1048. |
  1049. ======================================================================
  1050. ======================================================================
  1051. |
  1052. | Copyright (c) 2010-2014
  1053. | Nicolas Petton <petton.nicolas@gmail.com>
  1054. |
  1055. | Copyright (c) 2012-2016
  1056. | The Amber team https://lolg.it/org/amber/members
  1057. | Amber contributors (see /CONTRIBUTORS)
  1058. |
  1059. | Amber is released under the MIT license
  1060. |
  1061. | Permission is hereby granted, free of charge, to any person obtaining
  1062. | a copy of this software and associated documentation files (the
  1063. | 'Software'), to deal in the Software without restriction, including
  1064. | without limitation the rights to use, copy, modify, merge, publish,
  1065. | distribute, sublicense, and/or sell copies of the Software, and to
  1066. | permit persons to whom the Software is furnished to do so, subject to
  1067. | the following conditions:
  1068. |
  1069. | The above copyright notice and this permission notice shall be
  1070. | included in all copies or substantial portions of the Software.
  1071. |
  1072. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1073. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1074. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1075. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1076. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1077. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1078. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1079. |
  1080. ==================================================================== */
  1081. //jshint eqnull:true
  1082. define('amber/kernel-fundamentals',['./compatibility'], function () {
  1083. "use strict";
  1084. function inherits (child, parent) {
  1085. child.prototype = Object.create(parent.prototype, {
  1086. constructor: {
  1087. value: child,
  1088. enumerable: false, configurable: true, writable: true
  1089. }
  1090. });
  1091. return child;
  1092. }
  1093. function SmalltalkGlobalsBrik (brikz, st) {
  1094. // jshint evil:true
  1095. var jsGlobals = new Function("return this")();
  1096. var globals = Object.create(jsGlobals);
  1097. globals.SmalltalkSettings = {};
  1098. this.globals = globals;
  1099. }
  1100. function RootBrik (brikz, st) {
  1101. /* Smalltalk foundational objects */
  1102. var coreFns = this.coreFns = {};
  1103. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1104. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1105. Detached roots (eg. wrapped JS classes like Number or Date)
  1106. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1107. function SmalltalkRoot () {
  1108. }
  1109. function SmalltalkProtoObject () {
  1110. }
  1111. function SmalltalkObject () {
  1112. }
  1113. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1114. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1115. this.Root = SmalltalkRoot;
  1116. this.Object = SmalltalkObject;
  1117. }
  1118. OrganizeBrik.deps = ["arraySet", "root"];
  1119. function OrganizeBrik (brikz, st) {
  1120. var SmalltalkObject = brikz.root.Object;
  1121. var coreFns = brikz.root.coreFns;
  1122. var addElement = brikz.arraySet.addElement;
  1123. var removeElement = brikz.arraySet.removeElement;
  1124. function SmalltalkOrganizer () {
  1125. }
  1126. function SmalltalkPackageOrganizer () {
  1127. this.elements = [];
  1128. }
  1129. function SmalltalkClassOrganizer () {
  1130. this.elements = [];
  1131. }
  1132. coreFns.Organizer = inherits(SmalltalkOrganizer, SmalltalkObject);
  1133. coreFns.PackageOrganizer = inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  1134. coreFns.ClassOrganizer = inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  1135. this.setupClassOrganization = function (behaviorBody) {
  1136. behaviorBody.organization = new SmalltalkClassOrganizer();
  1137. behaviorBody.organization.theClass = behaviorBody;
  1138. };
  1139. this.setupPackageOrganization = function (pkg) {
  1140. pkg.organization = new SmalltalkPackageOrganizer();
  1141. };
  1142. this.addOrganizationElement = function (owner, element) {
  1143. addElement(owner.organization.elements, element);
  1144. };
  1145. this.removeOrganizationElement = function (owner, element) {
  1146. removeElement(owner.organization.elements, element);
  1147. };
  1148. }
  1149. SelectorsBrik.deps = ["selectorConversion"];
  1150. function SelectorsBrik (brikz, st) {
  1151. var selectorSet = Object.create(null);
  1152. var selectors = this.selectors = [];
  1153. var selectorPairs = this.selectorPairs = [];
  1154. this.registerSelector = function (stSelector) {
  1155. if (selectorSet[stSelector]) return null;
  1156. var jsSelector = st.st2js(stSelector);
  1157. selectorSet[stSelector] = true;
  1158. selectors.push(stSelector);
  1159. var pair = {st: stSelector, js: jsSelector};
  1160. selectorPairs.push(pair);
  1161. return pair;
  1162. };
  1163. st.allSelectors = function () {
  1164. return selectors;
  1165. };
  1166. }
  1167. PackagesBrik.deps = ["organize", "root"];
  1168. function PackagesBrik (brikz, st) {
  1169. var setupPackageOrganization = brikz.organize.setupPackageOrganization;
  1170. var SmalltalkObject = brikz.root.Object;
  1171. var coreFns = brikz.root.coreFns;
  1172. function SmalltalkPackage () {
  1173. }
  1174. coreFns.Package = inherits(SmalltalkPackage, SmalltalkObject);
  1175. st.packages = {};
  1176. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  1177. function pkg (spec) {
  1178. var that = new SmalltalkPackage();
  1179. that.pkgName = spec.pkgName;
  1180. setupPackageOrganization(that);
  1181. that.properties = spec.properties || {};
  1182. return that;
  1183. }
  1184. /* Add a package to the system, creating a new one if needed.
  1185. If pkgName is null or empty we return nil.
  1186. If package already exists we still update the properties of it. */
  1187. st.addPackage = function (pkgName, properties) {
  1188. if (!pkgName) return null;
  1189. if (!st.packages[pkgName]) {
  1190. st.packages[pkgName] = pkg({
  1191. pkgName: pkgName,
  1192. properties: properties
  1193. });
  1194. } else {
  1195. if (properties) {
  1196. st.packages[pkgName].properties = properties;
  1197. }
  1198. }
  1199. return st.packages[pkgName];
  1200. };
  1201. }
  1202. BehaviorsBrik.deps = ["organize", "root", "smalltalkGlobals", "arraySet"];
  1203. function BehaviorsBrik (brikz, st) {
  1204. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1205. var removeOrganizationElement = brikz.organize.removeOrganizationElement;
  1206. var globals = brikz.smalltalkGlobals.globals;
  1207. var SmalltalkObject = brikz.root.Object;
  1208. var coreFns = brikz.root.coreFns;
  1209. var addElement = brikz.arraySet.addElement;
  1210. var removeElement = brikz.arraySet.removeElement;
  1211. function SmalltalkBehaviorBody () {
  1212. }
  1213. coreFns.BehaviorBody = inherits(SmalltalkBehaviorBody, SmalltalkObject);
  1214. this.BehaviorBody = SmalltalkBehaviorBody;
  1215. /* Smalltalk classes */
  1216. var classes = [];
  1217. this.buildBehaviorBody = function (pkgName, builder) {
  1218. var pkg = st.packages[pkgName];
  1219. if (!pkg) throw new Error("Missing package " + pkgName);
  1220. var behaviorBody = globals.hasOwnProperty(builder.className) && globals[builder.className];
  1221. if (behaviorBody) {
  1222. builder.updateExisting(behaviorBody, pkg);
  1223. } else {
  1224. behaviorBody = builder.make(pkg);
  1225. }
  1226. addBehaviorBody(behaviorBody);
  1227. return behaviorBody;
  1228. };
  1229. function addBehaviorBody (behaviorBody) {
  1230. globals[behaviorBody.className] = behaviorBody;
  1231. addElement(classes, behaviorBody);
  1232. addOrganizationElement(behaviorBody.pkg, behaviorBody);
  1233. behaviorBody.added();
  1234. }
  1235. function removeBehaviorBody (behaviorBody) {
  1236. behaviorBody.removed();
  1237. removeOrganizationElement(behaviorBody.pkg, behaviorBody);
  1238. removeElement(classes, behaviorBody);
  1239. delete globals[behaviorBody.className];
  1240. }
  1241. this.removeBehaviorBody = removeBehaviorBody;
  1242. /* Create an alias for an existing class */
  1243. st.alias = function (behaviorBody, alias) {
  1244. globals[alias] = behaviorBody;
  1245. };
  1246. /* Answer all registered Smalltalk classes */
  1247. //TODO: remove the function and make smalltalk.classes an array
  1248. st.classes = this.classes = function () {
  1249. return classes;
  1250. };
  1251. }
  1252. MethodsBrik.deps = ["composition", "selectors", "root", "selectorConversion"];
  1253. function MethodsBrik (brikz, st) {
  1254. var registerSelector = brikz.selectors.registerSelector;
  1255. var updateMethod = brikz.composition.updateMethod;
  1256. var SmalltalkObject = brikz.root.Object;
  1257. var coreFns = brikz.root.coreFns;
  1258. function SmalltalkMethod () {
  1259. }
  1260. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1261. /* Smalltalk method object. To add a method to a class,
  1262. use api.addMethod() */
  1263. st.method = function (spec) {
  1264. var that = new SmalltalkMethod();
  1265. var selector = spec.selector;
  1266. that.selector = selector;
  1267. that.jsSelector = st.st2js(selector);
  1268. that.args = spec.args || {};
  1269. that.protocol = spec.protocol;
  1270. that.source = spec.source;
  1271. that.messageSends = spec.messageSends || [];
  1272. that.referencedClasses = spec.referencedClasses || [];
  1273. that.fn = spec.fn;
  1274. return that;
  1275. };
  1276. /* Add/remove a method to/from a class */
  1277. st.addMethod = function (method, behaviorBody) {
  1278. if (method.methodClass != null) {
  1279. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.methodClass);
  1280. }
  1281. method.methodClass = behaviorBody;
  1282. registerNewSelectors(method);
  1283. behaviorBody.localMethods[method.selector] = method;
  1284. updateMethod(method.selector, behaviorBody);
  1285. };
  1286. function registerNewSelectors (method) {
  1287. var newSelectors = [];
  1288. function selectorInUse (stSelector) {
  1289. var pair = registerSelector(stSelector);
  1290. if (pair) {
  1291. newSelectors.push(pair);
  1292. }
  1293. }
  1294. selectorInUse(method.selector);
  1295. method.messageSends.forEach(selectorInUse);
  1296. if (st._selectorsAdded) st._selectorsAdded(newSelectors);
  1297. }
  1298. st.removeMethod = function (method, behaviorBody) {
  1299. if (behaviorBody.localMethods[method.selector] !== method) return;
  1300. delete behaviorBody.localMethods[method.selector];
  1301. updateMethod(method.selector, behaviorBody);
  1302. };
  1303. }
  1304. MethodCompositionBrik.deps = ["organize"];
  1305. function MethodCompositionBrik (brikz, st) {
  1306. var setupClassOrganization = brikz.organize.setupClassOrganization;
  1307. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1308. this.setupMethods = function (behaviorBody) {
  1309. setupClassOrganization(behaviorBody);
  1310. behaviorBody.traitComposition = [];
  1311. behaviorBody.localMethods = Object.create(null);
  1312. behaviorBody.methods = Object.create(null);
  1313. };
  1314. function addMethod (method, behaviorBody) {
  1315. behaviorBody.methods[method.selector] = method;
  1316. // During the bootstrap, #addCompiledMethod is not used.
  1317. // Therefore we populate the organizer here too
  1318. addOrganizationElement(behaviorBody, method.protocol);
  1319. behaviorBody.methodAdded(method);
  1320. }
  1321. function removeMethod (method, behaviorBody) {
  1322. delete behaviorBody.methods[method.selector];
  1323. behaviorBody.methodRemoved(method);
  1324. // Do *not* delete protocols from here.
  1325. // This is handled by #removeCompiledMethod
  1326. }
  1327. function aliased (selector, method) {
  1328. if (method.selector === selector) return method;
  1329. var result = st.method({
  1330. selector: selector,
  1331. args: method.args,
  1332. protocol: method.protocol,
  1333. source: '"Aliased as ' + selector + '"\n' + method.source,
  1334. messageSends: method.messageSends,
  1335. referencesClasses: method.referencedClasses,
  1336. fn: method.fn
  1337. });
  1338. result.methodClass = method.methodClass;
  1339. return result;
  1340. }
  1341. function deleteKeysFrom (keys, obj) {
  1342. keys.forEach(function (each) {
  1343. delete obj[each];
  1344. });
  1345. }
  1346. function fillTraitTransformation (traitTransformation, obj) {
  1347. // assert(Object.getOwnProperties(obj).length === 0)
  1348. var traitMethods = traitTransformation.trait.methods;
  1349. Object.keys(traitMethods).forEach(function (selector) {
  1350. obj[selector] = traitMethods[selector];
  1351. });
  1352. var traitAliases = traitTransformation.aliases;
  1353. if (traitAliases) {
  1354. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1355. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1356. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1357. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1358. });
  1359. }
  1360. var traitExclusions = traitTransformation.exclusions;
  1361. if (traitExclusions) {
  1362. deleteKeysFrom(traitExclusions, obj);
  1363. }
  1364. return obj;
  1365. }
  1366. function buildCompositionChain (traitComposition) {
  1367. return traitComposition.reduce(function (soFar, each) {
  1368. return fillTraitTransformation(each, Object.create(soFar));
  1369. }, null);
  1370. }
  1371. st.setTraitComposition = function (traitComposition, behaviorBody) {
  1372. var oldLocalMethods = behaviorBody.localMethods,
  1373. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1374. Object.keys(oldLocalMethods).forEach(function (selector) {
  1375. newLocalMethods[selector] = oldLocalMethods[selector];
  1376. });
  1377. behaviorBody.localMethods = newLocalMethods;
  1378. for (var selector in newLocalMethods) {
  1379. updateMethod(selector, behaviorBody);
  1380. }
  1381. for (var selector in oldLocalMethods) {
  1382. updateMethod(selector, behaviorBody);
  1383. }
  1384. behaviorBody.traitComposition.forEach(function (each) {
  1385. each.trait.removeUser(behaviorBody);
  1386. });
  1387. behaviorBody.traitComposition = traitComposition;
  1388. behaviorBody.traitComposition.forEach(function (each) {
  1389. each.trait.addUser(behaviorBody);
  1390. });
  1391. };
  1392. function updateMethod (selector, behaviorBody) {
  1393. var oldMethod = behaviorBody.methods[selector],
  1394. newMethod = behaviorBody.localMethods[selector];
  1395. if (oldMethod == null && newMethod == null) {
  1396. console.warn("Removal of nonexistent method " + behaviorBody + " >> " + selector);
  1397. return;
  1398. }
  1399. if (newMethod === oldMethod) return;
  1400. if (newMethod != null) addMethod(newMethod, behaviorBody);
  1401. else removeMethod(oldMethod, behaviorBody);
  1402. }
  1403. this.updateMethod = updateMethod;
  1404. function aliasesOfSelector (selector, traitAliases) {
  1405. if (!traitAliases) return [selector];
  1406. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  1407. return traitAliases[aliasSelector] === selector
  1408. });
  1409. if (!traitAliases[selector]) result.push(selector);
  1410. return result;
  1411. }
  1412. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  1413. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1414. changes.forEach(function (aliasSelector) {
  1415. obj[aliasSelector] = aliased(aliasSelector, method);
  1416. });
  1417. var traitExclusions = traitTransformation.exclusions;
  1418. if (traitExclusions) {
  1419. deleteKeysFrom(traitExclusions, obj);
  1420. }
  1421. return changes;
  1422. }
  1423. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  1424. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  1425. deleteKeysFrom(changes, obj);
  1426. return changes;
  1427. }
  1428. function traitMethodChanged (selector, method, trait, behaviorBody) {
  1429. var traitComposition = behaviorBody.traitComposition,
  1430. chain = behaviorBody.localMethods,
  1431. changes = [];
  1432. for (var i = traitComposition.length - 1; i >= 0; --i) {
  1433. chain = Object.getPrototypeOf(chain);
  1434. var traitTransformation = traitComposition[i];
  1435. if (traitTransformation.trait !== trait) continue;
  1436. changes.push.apply(changes, method ?
  1437. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  1438. applyTraitMethodDeletion(selector, traitTransformation, chain));
  1439. }
  1440. // assert(chain === null);
  1441. changes.forEach(function (each) {
  1442. updateMethod(each, behaviorBody);
  1443. });
  1444. }
  1445. this.traitMethodChanged = traitMethodChanged;
  1446. }
  1447. function ArraySetBrik (brikz, st) {
  1448. st.addElement = this.addElement = function (array, el) {
  1449. if (typeof el === 'undefined') {
  1450. return;
  1451. }
  1452. if (array.indexOf(el) === -1) {
  1453. array.push(el);
  1454. }
  1455. };
  1456. st.removeElement = this.removeElement = function (array, el) {
  1457. var i = array.indexOf(el);
  1458. if (i !== -1) {
  1459. array.splice(i, 1);
  1460. }
  1461. };
  1462. }
  1463. function SelectorConversionBrik (brikz, st) {
  1464. /* Convert a Smalltalk selector into a JS selector */
  1465. st.st2js = function (string) {
  1466. return '_' + string
  1467. .replace(/:/g, '_')
  1468. .replace(/[\&]/g, '_and')
  1469. .replace(/[\|]/g, '_or')
  1470. .replace(/[+]/g, '_plus')
  1471. .replace(/-/g, '_minus')
  1472. .replace(/[*]/g, '_star')
  1473. .replace(/[\/]/g, '_slash')
  1474. .replace(/[\\]/g, '_backslash')
  1475. .replace(/[\~]/g, '_tild')
  1476. .replace(/%/g, '_percent')
  1477. .replace(/>/g, '_gt')
  1478. .replace(/</g, '_lt')
  1479. .replace(/=/g, '_eq')
  1480. .replace(/,/g, '_comma')
  1481. .replace(/[@]/g, '_at');
  1482. };
  1483. /* Convert a string to a valid smalltalk selector.
  1484. if you modify the following functions, also change st2js
  1485. accordingly */
  1486. st.js2st = function (selector) {
  1487. if (selector.match(/^__/)) {
  1488. return binaryJsToSt(selector);
  1489. } else {
  1490. return keywordJsToSt(selector);
  1491. }
  1492. };
  1493. function keywordJsToSt (selector) {
  1494. return selector.replace(/^_/, '').replace(/_/g, ':');
  1495. }
  1496. function binaryJsToSt (selector) {
  1497. return selector
  1498. .replace(/^_/, '')
  1499. .replace(/_and/g, '&')
  1500. .replace(/_or/g, '|')
  1501. .replace(/_plus/g, '+')
  1502. .replace(/_minus/g, '-')
  1503. .replace(/_star/g, '*')
  1504. .replace(/_slash/g, '/')
  1505. .replace(/_backslash/g, '\\')
  1506. .replace(/_tild/g, '~')
  1507. .replace(/_percent/g, '%')
  1508. .replace(/_gt/g, '>')
  1509. .replace(/_lt/g, '<')
  1510. .replace(/_eq/g, '=')
  1511. .replace(/_comma/g, ',')
  1512. .replace(/_at/g, '@');
  1513. }
  1514. st.st2prop = function (stSelector) {
  1515. var colonPosition = stSelector.indexOf(':');
  1516. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1517. };
  1518. }
  1519. /* Making smalltalk that has basic building blocks */
  1520. function configureWithFundamentals (brikz) {
  1521. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1522. brikz.root = RootBrik;
  1523. brikz.arraySet = ArraySetBrik;
  1524. brikz.organize = OrganizeBrik;
  1525. brikz.selectorConversion = SelectorConversionBrik;
  1526. brikz.selectors = SelectorsBrik;
  1527. brikz.packages = PackagesBrik;
  1528. brikz.composition = MethodCompositionBrik;
  1529. brikz.behaviors = BehaviorsBrik;
  1530. brikz.methods = MethodsBrik;
  1531. brikz.rebuild();
  1532. }
  1533. return configureWithFundamentals;
  1534. });
  1535. /* ====================================================================
  1536. |
  1537. | Amber Smalltalk
  1538. | http://amber-lang.net
  1539. |
  1540. ======================================================================
  1541. ======================================================================
  1542. |
  1543. | Copyright (c) 2010-2014
  1544. | Nicolas Petton <petton.nicolas@gmail.com>
  1545. |
  1546. | Copyright (c) 2012-2016
  1547. | The Amber team https://lolg.it/org/amber/members
  1548. | Amber contributors (see /CONTRIBUTORS)
  1549. |
  1550. | Amber is released under the MIT license
  1551. |
  1552. | Permission is hereby granted, free of charge, to any person obtaining
  1553. | a copy of this software and associated documentation files (the
  1554. | 'Software'), to deal in the Software without restriction, including
  1555. | without limitation the rights to use, copy, modify, merge, publish,
  1556. | distribute, sublicense, and/or sell copies of the Software, and to
  1557. | permit persons to whom the Software is furnished to do so, subject to
  1558. | the following conditions:
  1559. |
  1560. | The above copyright notice and this permission notice shall be
  1561. | included in all copies or substantial portions of the Software.
  1562. |
  1563. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1564. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1565. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1566. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1567. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1568. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1569. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1570. |
  1571. ==================================================================== */
  1572. //jshint eqnull:true
  1573. define('amber/kernel-language',['./compatibility'], function () {
  1574. "use strict";
  1575. function inherits (child, parent) {
  1576. child.prototype = Object.create(parent.prototype, {
  1577. constructor: {
  1578. value: child,
  1579. enumerable: false, configurable: true, writable: true
  1580. }
  1581. });
  1582. return child;
  1583. }
  1584. function defineMethod (klass, name, method) {
  1585. Object.defineProperty(klass.prototype, name, {
  1586. value: method,
  1587. enumerable: false, configurable: true, writable: true
  1588. });
  1589. }
  1590. TraitsBrik.deps = ["behaviors", "composition", "arraySet", "root"];
  1591. function TraitsBrik (brikz, st) {
  1592. var coreFns = brikz.root.coreFns;
  1593. var SmalltalkBehaviorBody = brikz.behaviors.BehaviorBody;
  1594. var setupMethods = brikz.composition.setupMethods;
  1595. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1596. var buildBehaviorBody = brikz.behaviors.buildBehaviorBody;
  1597. var addElement = brikz.arraySet.addElement;
  1598. var removeElement = brikz.arraySet.removeElement;
  1599. function SmalltalkTrait () {
  1600. }
  1601. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkBehaviorBody);
  1602. SmalltalkTrait.prototype.trait = true;
  1603. defineMethod(SmalltalkTrait, "toString", function () {
  1604. return 'Smalltalk Trait ' + this.className;
  1605. });
  1606. defineMethod(SmalltalkTrait, "added", function () {
  1607. if (st._traitAdded) st._traitAdded(this);
  1608. });
  1609. defineMethod(SmalltalkTrait, "removed", function () {
  1610. if (st._traitRemoved) st._traitRemoved(this);
  1611. });
  1612. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1613. var self = this;
  1614. this.traitUsers.forEach(function (each) {
  1615. traitMethodChanged(method.selector, method, self, each);
  1616. });
  1617. if (st._traitMethodAdded) st._traitMethodAdded(method, this);
  1618. });
  1619. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1620. var self = this;
  1621. this.traitUsers.forEach(function (each) {
  1622. traitMethodChanged(method.selector, null, self, each);
  1623. });
  1624. if (st._traitMethodRemoved) st._traitMethodRemoved(method, this);
  1625. });
  1626. defineMethod(SmalltalkTrait, "addUser", function (behaviorBody) {
  1627. addElement(this.traitUsers, behaviorBody);
  1628. });
  1629. defineMethod(SmalltalkTrait, "removeUser", function (behaviorBody) {
  1630. removeElement(this.traitUsers, behaviorBody);
  1631. });
  1632. function traitBuilder (className) {
  1633. return {
  1634. className: className,
  1635. make: function (pkg) {
  1636. var that = new SmalltalkTrait();
  1637. that.className = className;
  1638. that.pkg = pkg;
  1639. that.traitUsers = [];
  1640. setupMethods(that);
  1641. return that;
  1642. },
  1643. updateExisting: function (trait, pkg) {
  1644. if (pkg) trait.pkg = pkg;
  1645. }
  1646. };
  1647. }
  1648. st.addTrait = function (className, pkgName) {
  1649. return buildBehaviorBody(pkgName, traitBuilder(className));
  1650. };
  1651. }
  1652. ClassesBrik.deps = ["root", "behaviors", "composition", "arraySet", "smalltalkGlobals"];
  1653. function ClassesBrik (brikz, st) {
  1654. var SmalltalkRoot = brikz.root.Root;
  1655. var coreFns = brikz.root.coreFns;
  1656. var globals = brikz.smalltalkGlobals.globals;
  1657. var SmalltalkBehaviorBody = brikz.behaviors.BehaviorBody;
  1658. var buildBehaviorBody = brikz.behaviors.buildBehaviorBody;
  1659. var setupMethods = brikz.composition.setupMethods;
  1660. var removeBehaviorBody = brikz.behaviors.removeBehaviorBody;
  1661. var addElement = brikz.arraySet.addElement;
  1662. var removeElement = brikz.arraySet.removeElement;
  1663. function SmalltalkBehavior () {
  1664. }
  1665. function SmalltalkClass () {
  1666. }
  1667. function SmalltalkMetaclass () {
  1668. }
  1669. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkBehaviorBody);
  1670. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  1671. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1672. // Fake root class of the system.
  1673. // Effective superclass of all classes created with `nil subclass: ...`.
  1674. var nilAsClass = this.nilAsClass = {fn: SmalltalkRoot, klass: {fn: SmalltalkClass}};
  1675. SmalltalkMetaclass.prototype.meta = true;
  1676. defineMethod(SmalltalkClass, "toString", function () {
  1677. return 'Smalltalk ' + this.className;
  1678. });
  1679. defineMethod(SmalltalkMetaclass, "toString", function () {
  1680. return 'Smalltalk Metaclass ' + this.instanceClass.className;
  1681. });
  1682. defineMethod(SmalltalkClass, "added", function () {
  1683. addSubclass(this);
  1684. if (st._classAdded) st._classAdded(this);
  1685. });
  1686. defineMethod(SmalltalkClass, "removed", function () {
  1687. if (st._classRemoved) st._classRemoved(this);
  1688. removeSubclass(this);
  1689. });
  1690. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  1691. if (st._methodAdded) st._methodAdded(method, this);
  1692. });
  1693. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  1694. if (st._methodRemoved) st._methodRemoved(method, this);
  1695. });
  1696. this.bootstrapHierarchy = function () {
  1697. var nilSubclasses = [globals.ProtoObject];
  1698. nilAsClass.klass = globals.Class;
  1699. nilSubclasses.forEach(function (each) {
  1700. each.klass.superclass = globals.Class;
  1701. addSubclass(each.klass);
  1702. });
  1703. };
  1704. /* Smalltalk class creation. A class is an instance of an automatically
  1705. created metaclass object. Newly created classes (not their metaclass)
  1706. should be added to the system, see smalltalk.addClass().
  1707. Superclass linking is *not* handled here, see api.initialize() */
  1708. function classBuilder (className, superclass, iVarNames, fn) {
  1709. var logicalSuperclass = superclass;
  1710. if (superclass == null || superclass.isNil) {
  1711. superclass = nilAsClass;
  1712. logicalSuperclass = null;
  1713. }
  1714. function klass (pkg) {
  1715. var that = metaclass().instanceClass;
  1716. that.superclass = logicalSuperclass;
  1717. that.fn = fn || inherits(function () {
  1718. }, superclass.fn);
  1719. that.iVarNames = iVarNames || [];
  1720. that.className = className;
  1721. that.pkg = pkg;
  1722. that.subclasses = [];
  1723. setupMethods(that);
  1724. return that;
  1725. }
  1726. function metaclass () {
  1727. var that = new SmalltalkMetaclass();
  1728. that.superclass = superclass.klass;
  1729. that.fn = inherits(function () {
  1730. }, that.superclass.fn);
  1731. that.iVarNames = [];
  1732. that.instanceClass = new that.fn();
  1733. wireKlass(that);
  1734. setupMethods(that);
  1735. return that;
  1736. }
  1737. return {
  1738. className: className,
  1739. make: klass,
  1740. updateExisting: function (klass, pkg) {
  1741. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  1742. if (iVarNames) klass.iVarNames = iVarNames;
  1743. if (pkg) klass.pkg = pkg;
  1744. } else throw new Error("Incompatible change of class: " + klass.className);
  1745. }
  1746. };
  1747. }
  1748. function wireKlass (klass) {
  1749. Object.defineProperty(klass.fn.prototype, "klass", {
  1750. value: klass,
  1751. enumerable: false, configurable: true, writable: true
  1752. });
  1753. }
  1754. this.wireKlass = wireKlass;
  1755. /* Add a class to the system, creating a new one if needed.
  1756. A Package is lazily created if one with given name does not exist. */
  1757. st.addClass = function (className, superclass, iVarNames, pkgName) {
  1758. // While subclassing nil is allowed, it might be an error, so
  1759. // warn about it.
  1760. if (typeof superclass == 'undefined' || superclass && superclass.isNil) {
  1761. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1762. }
  1763. return buildBehaviorBody(pkgName, classBuilder(className, superclass, iVarNames, coreFns[className]));
  1764. };
  1765. st.removeClass = removeBehaviorBody;
  1766. function addSubclass (klass) {
  1767. if (klass.superclass) {
  1768. addElement(klass.superclass.subclasses, klass);
  1769. }
  1770. }
  1771. function removeSubclass (klass) {
  1772. if (klass.superclass) {
  1773. removeElement(klass.superclass.subclasses, klass);
  1774. }
  1775. }
  1776. function metaSubclasses (metaclass) {
  1777. return metaclass.instanceClass.subclasses
  1778. .filter(function (each) {
  1779. return !each.meta;
  1780. })
  1781. .map(function (each) {
  1782. return each.klass;
  1783. });
  1784. }
  1785. st.metaSubclasses = metaSubclasses;
  1786. st.traverseClassTree = function (klass, fn) {
  1787. var queue = [klass], sentinel = {};
  1788. for (var i = 0; i < queue.length; ++i) {
  1789. var item = queue[i];
  1790. if (fn(item, sentinel) === sentinel) continue;
  1791. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1792. queue.push.apply(queue, subclasses);
  1793. }
  1794. };
  1795. }
  1796. NilBrik.deps = ["root"];
  1797. function NilBrik (brikz, st) {
  1798. var SmalltalkObject = brikz.root.Object;
  1799. var coreFns = brikz.root.coreFns;
  1800. function SmalltalkNil () {
  1801. }
  1802. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1803. this.nilAsReceiver = new SmalltalkNil();
  1804. // Adds an `isNil` property to the `nil` object. When sending
  1805. // nil objects from one environment to another, doing
  1806. // `anObject == nil` (in JavaScript) does not always answer
  1807. // true as the referenced nil object might come from the other
  1808. // environment.
  1809. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1810. value: true,
  1811. enumerable: false, configurable: false, writable: false
  1812. });
  1813. }
  1814. /* Defines asReceiver to be present at load time */
  1815. /* (logically it belongs more to PrimitiveBrik) */
  1816. AsReceiverBrik.deps = ["nil"];
  1817. function AsReceiverBrik (brikz, st) {
  1818. var nilAsReceiver = brikz.nil.nilAsReceiver;
  1819. /**
  1820. * This function is used all over the compiled amber code.
  1821. * It takes any value (JavaScript or Smalltalk)
  1822. * and returns a proper Amber Smalltalk receiver.
  1823. *
  1824. * null or undefined -> nilAsReceiver,
  1825. * object having Smalltalk signature -> unchanged,
  1826. * otherwise wrapped foreign (JS) object
  1827. */
  1828. this.asReceiver = function (o) {
  1829. if (o == null) return nilAsReceiver;
  1830. else if (o.klass != null) return o;
  1831. else return st.wrapJavaScript(o);
  1832. };
  1833. }
  1834. /* Making smalltalk that can load */
  1835. function configureWithHierarchy (brikz) {
  1836. brikz.traits = TraitsBrik;
  1837. brikz.classes = ClassesBrik;
  1838. brikz.nil = NilBrik;
  1839. brikz.asReceiver = AsReceiverBrik;
  1840. brikz.rebuild();
  1841. }
  1842. return configureWithHierarchy;
  1843. });
  1844. /* ====================================================================
  1845. |
  1846. | Amber Smalltalk
  1847. | http://amber-lang.net
  1848. |
  1849. ======================================================================
  1850. ======================================================================
  1851. |
  1852. | Copyright (c) 2010-2014
  1853. | Nicolas Petton <petton.nicolas@gmail.com>
  1854. |
  1855. | Copyright (c) 2012-2016
  1856. | The Amber team https://lolg.it/org/amber/members
  1857. | Amber contributors (see /CONTRIBUTORS)
  1858. |
  1859. | Amber is released under the MIT license
  1860. |
  1861. | Permission is hereby granted, free of charge, to any person obtaining
  1862. | a copy of this software and associated documentation files (the
  1863. | 'Software'), to deal in the Software without restriction, including
  1864. | without limitation the rights to use, copy, modify, merge, publish,
  1865. | distribute, sublicense, and/or sell copies of the Software, and to
  1866. | permit persons to whom the Software is furnished to do so, subject to
  1867. | the following conditions:
  1868. |
  1869. | The above copyright notice and this permission notice shall be
  1870. | included in all copies or substantial portions of the Software.
  1871. |
  1872. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1873. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1874. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1875. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1876. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1877. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1878. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1879. |
  1880. ==================================================================== */
  1881. //jshint eqnull:true
  1882. define('amber/boot',[
  1883. 'require', './brikz', './kernel-fundamentals', './kernel-language', './compatibility'
  1884. ], function (require, Brikz, configureWithFundamentals, configureWithHierarchy) {
  1885. "use strict";
  1886. require(['./kernel-runtime']); // preload
  1887. SmalltalkInitBrik.deps = ["classes"];
  1888. function SmalltalkInitBrik (brikz, st) {
  1889. var bootstrapHierarchy = brikz.classes.bootstrapHierarchy;
  1890. var initialized = false;
  1891. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  1892. require(['./kernel-runtime'], resolve, reject);
  1893. });
  1894. /* Smalltalk initialization. Called on page load */
  1895. st.initialize = function () {
  1896. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  1897. if (initialized) return;
  1898. bootstrapHierarchy();
  1899. configureWithRuntime(brikz);
  1900. initialized = true;
  1901. });
  1902. };
  1903. }
  1904. /* Adds AMD and requirejs related methods to the api */
  1905. function AMDBrik (brikz, st) {
  1906. st.amdRequire = require;
  1907. st.defaultTransportType = st.defaultTransportType || "amd";
  1908. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1909. }
  1910. var api = {};
  1911. var brikz = new Brikz(api);
  1912. configureWithFundamentals(brikz);
  1913. configureWithHierarchy(brikz);
  1914. brikz.stInit = SmalltalkInitBrik;
  1915. brikz.amd = AMDBrik;
  1916. brikz.rebuild();
  1917. return {
  1918. api: api,
  1919. nil/* TODO deprecate */: brikz.nil.nilAsReceiver,
  1920. nilAsReceiver: brikz.nil.nilAsReceiver,
  1921. dnu/* TODO deprecate */: brikz.classes.nilAsClass,
  1922. nilAsClass: brikz.classes.nilAsClass,
  1923. globals: brikz.smalltalkGlobals.globals,
  1924. asReceiver: brikz.asReceiver.asReceiver
  1925. };
  1926. });
  1927. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  1928. var globals = boot.globals,
  1929. exports = {},
  1930. api = boot.api,
  1931. nil = boot.nilAsReceiver;
  1932. // API
  1933. exports.popupHelios = function () {
  1934. require(['helios/index'], function (helios) {
  1935. helios.popup();
  1936. }, function (err) {
  1937. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1938. });
  1939. };
  1940. Object.defineProperty(exports, "api", {
  1941. value: api,
  1942. enumerable: true, configurable: true, writable: false
  1943. });
  1944. Object.defineProperty(exports, "globals", {
  1945. value: globals,
  1946. enumerable: true, configurable: true, writable: false
  1947. });
  1948. Object.defineProperty(exports, "nil", {
  1949. value: nil,
  1950. enumerable: true, configurable: true, writable: false
  1951. });
  1952. function mixinToSettings (source) {
  1953. var settings = globals.SmalltalkSettings;
  1954. Object.keys(source).forEach(function (key) {
  1955. settings[key] = source[key];
  1956. });
  1957. }
  1958. function settingsInLocalStorage () {
  1959. //jshint evil:true
  1960. var global = new Function('return this')(),
  1961. storage = 'localStorage' in global && global.localStorage;
  1962. if (storage) {
  1963. var fromStorage;
  1964. try {
  1965. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1966. } catch (ex) {
  1967. // pass
  1968. }
  1969. mixinToSettings(fromStorage || {});
  1970. if (typeof window !== "undefined") {
  1971. requirejs(['jquery'], function ($) {
  1972. $(window).on('beforeunload', function () {
  1973. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1974. });
  1975. });
  1976. }
  1977. }
  1978. }
  1979. exports.initialize = function (options) {
  1980. return Promise.resolve()
  1981. .then(function () {
  1982. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1983. })
  1984. .then(settingsInLocalStorage)
  1985. .then(function () {
  1986. return options || {};
  1987. })
  1988. .then(mixinToSettings)
  1989. .then(function () {
  1990. return api.initialize();
  1991. });
  1992. };
  1993. // Exports
  1994. return exports;
  1995. });
  1996. define('amber_core/Kernel-Objects',["amber/boot"], function($boot){"use strict";
  1997. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  1998. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  1999. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  2000. $core.addPackage("Kernel-Objects");
  2001. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2002. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2003. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2004. $globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.";
  2005. $core.addMethod(
  2006. $core.method({
  2007. selector: "=",
  2008. protocol: "comparing",
  2009. fn: function (anObject){
  2010. var self=this;
  2011. return $core.withContext(function($ctx1) {
  2012. return self.__eq_eq(anObject);
  2013. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2014. },
  2015. args: ["anObject"],
  2016. source: "= anObject\x0a\x09^ self == anObject",
  2017. referencedClasses: [],
  2018. messageSends: ["=="]
  2019. }),
  2020. $globals.ProtoObject);
  2021. $core.addMethod(
  2022. $core.method({
  2023. selector: "==",
  2024. protocol: "comparing",
  2025. fn: function (anObject){
  2026. var self=this;
  2027. return $core.withContext(function($ctx1) {
  2028. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  2029. return self;
  2030. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2031. },
  2032. args: ["anObject"],
  2033. source: "== anObject\x0a<inlineJS:\x0a\x09'return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)'>",
  2034. referencedClasses: [],
  2035. messageSends: []
  2036. }),
  2037. $globals.ProtoObject);
  2038. $core.addMethod(
  2039. $core.method({
  2040. selector: "asJSON",
  2041. protocol: "converting",
  2042. fn: function (){
  2043. var self=this;
  2044. return $core.withContext(function($ctx1) {
  2045. self._deprecatedAPI_("Use #asJavaScriptObject instead.");
  2046. return self._asJavaScriptObject();
  2047. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.ProtoObject)});
  2048. },
  2049. args: [],
  2050. source: "asJSON\x0a\x09self deprecatedAPI: 'Use #asJavaScriptObject instead.'.\x0a\x09^ self asJavaScriptObject",
  2051. referencedClasses: [],
  2052. messageSends: ["deprecatedAPI:", "asJavaScriptObject"]
  2053. }),
  2054. $globals.ProtoObject);
  2055. $core.addMethod(
  2056. $core.method({
  2057. selector: "asJavascript",
  2058. protocol: "converting",
  2059. fn: function (){
  2060. var self=this;
  2061. return $core.withContext(function($ctx1) {
  2062. self._deprecatedAPI_("Use #asJavaScriptSource instead.");
  2063. return self._asJavaScriptSource();
  2064. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.ProtoObject)});
  2065. },
  2066. args: [],
  2067. source: "asJavascript\x0a\x09self deprecatedAPI: 'Use #asJavaScriptSource instead.'.\x0a\x09^ self asJavaScriptSource",
  2068. referencedClasses: [],
  2069. messageSends: ["deprecatedAPI:", "asJavaScriptSource"]
  2070. }),
  2071. $globals.ProtoObject);
  2072. $core.addMethod(
  2073. $core.method({
  2074. selector: "asString",
  2075. protocol: "converting",
  2076. fn: function (){
  2077. var self=this;
  2078. return $core.withContext(function($ctx1) {
  2079. return self._printString();
  2080. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2081. },
  2082. args: [],
  2083. source: "asString\x0a\x09^ self printString",
  2084. referencedClasses: [],
  2085. messageSends: ["printString"]
  2086. }),
  2087. $globals.ProtoObject);
  2088. $core.addMethod(
  2089. $core.method({
  2090. selector: "class",
  2091. protocol: "accessing",
  2092. fn: function (){
  2093. var self=this;
  2094. return $core.withContext(function($ctx1) {
  2095. return self.klass;
  2096. return self;
  2097. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2098. },
  2099. args: [],
  2100. source: "class\x0a\x09<inlineJS: 'return self.klass'>",
  2101. referencedClasses: [],
  2102. messageSends: []
  2103. }),
  2104. $globals.ProtoObject);
  2105. $core.addMethod(
  2106. $core.method({
  2107. selector: "doesNotUnderstand:",
  2108. protocol: "error handling",
  2109. fn: function (aMessage){
  2110. var self=this;
  2111. return $core.withContext(function($ctx1) {
  2112. var $1;
  2113. $1=$recv($globals.MessageNotUnderstood)._new();
  2114. $recv($1)._receiver_(self);
  2115. $recv($1)._message_(aMessage);
  2116. $recv($1)._signal();
  2117. return self;
  2118. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2119. },
  2120. args: ["aMessage"],
  2121. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2122. referencedClasses: ["MessageNotUnderstood"],
  2123. messageSends: ["receiver:", "new", "message:", "signal"]
  2124. }),
  2125. $globals.ProtoObject);
  2126. $core.addMethod(
  2127. $core.method({
  2128. selector: "evaluate:on:",
  2129. protocol: "evaluating",
  2130. fn: function (aString,anEvaluator){
  2131. var self=this;
  2132. return $core.withContext(function($ctx1) {
  2133. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2134. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2135. },
  2136. args: ["aString", "anEvaluator"],
  2137. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2138. referencedClasses: [],
  2139. messageSends: ["evaluate:receiver:"]
  2140. }),
  2141. $globals.ProtoObject);
  2142. $core.addMethod(
  2143. $core.method({
  2144. selector: "identityHash",
  2145. protocol: "accessing",
  2146. fn: function (){
  2147. var self=this;
  2148. return $core.withContext(function($ctx1) {
  2149. var hash=self.identityHash;
  2150. if (hash) return hash;
  2151. hash=$core.nextId();
  2152. Object.defineProperty(self, 'identityHash', {value:hash});
  2153. return hash;
  2154. ;
  2155. return self;
  2156. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2157. },
  2158. args: [],
  2159. source: "identityHash\x0a\x09<inlineJS: '\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, ''identityHash'', {value:hash});\x0a\x09\x09return hash;\x0a\x09'>",
  2160. referencedClasses: [],
  2161. messageSends: []
  2162. }),
  2163. $globals.ProtoObject);
  2164. $core.addMethod(
  2165. $core.method({
  2166. selector: "ifNil:",
  2167. protocol: "testing",
  2168. fn: function (aBlock){
  2169. var self=this;
  2170. return self;
  2171. },
  2172. args: ["aBlock"],
  2173. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2174. referencedClasses: [],
  2175. messageSends: []
  2176. }),
  2177. $globals.ProtoObject);
  2178. $core.addMethod(
  2179. $core.method({
  2180. selector: "ifNil:ifNotNil:",
  2181. protocol: "testing",
  2182. fn: function (aBlock,anotherBlock){
  2183. var self=this;
  2184. return $core.withContext(function($ctx1) {
  2185. return $recv(anotherBlock)._value_(self);
  2186. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2187. },
  2188. args: ["aBlock", "anotherBlock"],
  2189. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2190. referencedClasses: [],
  2191. messageSends: ["value:"]
  2192. }),
  2193. $globals.ProtoObject);
  2194. $core.addMethod(
  2195. $core.method({
  2196. selector: "ifNotNil:",
  2197. protocol: "testing",
  2198. fn: function (aBlock){
  2199. var self=this;
  2200. return $core.withContext(function($ctx1) {
  2201. return $recv(aBlock)._value_(self);
  2202. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2203. },
  2204. args: ["aBlock"],
  2205. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2206. referencedClasses: [],
  2207. messageSends: ["value:"]
  2208. }),
  2209. $globals.ProtoObject);
  2210. $core.addMethod(
  2211. $core.method({
  2212. selector: "ifNotNil:ifNil:",
  2213. protocol: "testing",
  2214. fn: function (aBlock,anotherBlock){
  2215. var self=this;
  2216. return $core.withContext(function($ctx1) {
  2217. return $recv(aBlock)._value_(self);
  2218. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2219. },
  2220. args: ["aBlock", "anotherBlock"],
  2221. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2222. referencedClasses: [],
  2223. messageSends: ["value:"]
  2224. }),
  2225. $globals.ProtoObject);
  2226. $core.addMethod(
  2227. $core.method({
  2228. selector: "initialize",
  2229. protocol: "initialization",
  2230. fn: function (){
  2231. var self=this;
  2232. return self;
  2233. },
  2234. args: [],
  2235. source: "initialize",
  2236. referencedClasses: [],
  2237. messageSends: []
  2238. }),
  2239. $globals.ProtoObject);
  2240. $core.addMethod(
  2241. $core.method({
  2242. selector: "inspect",
  2243. protocol: "inspecting",
  2244. fn: function (){
  2245. var self=this;
  2246. return $core.withContext(function($ctx1) {
  2247. $recv($globals.Inspector)._inspect_(self);
  2248. return self;
  2249. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2250. },
  2251. args: [],
  2252. source: "inspect\x0a\x09Inspector inspect: self",
  2253. referencedClasses: ["Inspector"],
  2254. messageSends: ["inspect:"]
  2255. }),
  2256. $globals.ProtoObject);
  2257. $core.addMethod(
  2258. $core.method({
  2259. selector: "inspectOn:",
  2260. protocol: "inspecting",
  2261. fn: function (anInspector){
  2262. var self=this;
  2263. return self;
  2264. },
  2265. args: ["anInspector"],
  2266. source: "inspectOn: anInspector",
  2267. referencedClasses: [],
  2268. messageSends: []
  2269. }),
  2270. $globals.ProtoObject);
  2271. $core.addMethod(
  2272. $core.method({
  2273. selector: "instVarAt:",
  2274. protocol: "accessing",
  2275. fn: function (aString){
  2276. var self=this;
  2277. return $core.withContext(function($ctx1) {
  2278. return self['@'+aString];
  2279. return self;
  2280. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2281. },
  2282. args: ["aString"],
  2283. source: "instVarAt: aString\x0a\x09<inlineJS: 'return self[''@''+aString]'>",
  2284. referencedClasses: [],
  2285. messageSends: []
  2286. }),
  2287. $globals.ProtoObject);
  2288. $core.addMethod(
  2289. $core.method({
  2290. selector: "instVarAt:put:",
  2291. protocol: "accessing",
  2292. fn: function (aString,anObject){
  2293. var self=this;
  2294. return $core.withContext(function($ctx1) {
  2295. self['@' + aString] = anObject;
  2296. return self;
  2297. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2298. },
  2299. args: ["aString", "anObject"],
  2300. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: 'self[''@'' + aString] = anObject'>",
  2301. referencedClasses: [],
  2302. messageSends: []
  2303. }),
  2304. $globals.ProtoObject);
  2305. $core.addMethod(
  2306. $core.method({
  2307. selector: "isKindOf:",
  2308. protocol: "testing",
  2309. fn: function (aClass){
  2310. var self=this;
  2311. return $core.withContext(function($ctx1) {
  2312. var $1;
  2313. $1=self._isMemberOf_(aClass);
  2314. if($core.assert($1)){
  2315. return true;
  2316. } else {
  2317. return $recv(self._class())._inheritsFrom_(aClass);
  2318. }
  2319. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2320. },
  2321. args: ["aClass"],
  2322. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2323. referencedClasses: [],
  2324. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2325. }),
  2326. $globals.ProtoObject);
  2327. $core.addMethod(
  2328. $core.method({
  2329. selector: "isNil",
  2330. protocol: "testing",
  2331. fn: function (){
  2332. var self=this;
  2333. return false;
  2334. },
  2335. args: [],
  2336. source: "isNil\x0a\x09^ false",
  2337. referencedClasses: [],
  2338. messageSends: []
  2339. }),
  2340. $globals.ProtoObject);
  2341. $core.addMethod(
  2342. $core.method({
  2343. selector: "isSameInstanceAs:",
  2344. protocol: "comparing",
  2345. fn: function (anObject){
  2346. var self=this;
  2347. return $core.withContext(function($ctx1) {
  2348. var $1;
  2349. $1=self._identityHash();
  2350. $ctx1.sendIdx["identityHash"]=1;
  2351. return $recv($1).__eq($recv(anObject)._identityHash());
  2352. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  2353. },
  2354. args: ["anObject"],
  2355. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  2356. referencedClasses: [],
  2357. messageSends: ["=", "identityHash"]
  2358. }),
  2359. $globals.ProtoObject);
  2360. $core.addMethod(
  2361. $core.method({
  2362. selector: "notNil",
  2363. protocol: "testing",
  2364. fn: function (){
  2365. var self=this;
  2366. return $core.withContext(function($ctx1) {
  2367. return $recv(self._isNil())._not();
  2368. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2369. },
  2370. args: [],
  2371. source: "notNil\x0a\x09^ self isNil not",
  2372. referencedClasses: [],
  2373. messageSends: ["not", "isNil"]
  2374. }),
  2375. $globals.ProtoObject);
  2376. $core.addMethod(
  2377. $core.method({
  2378. selector: "perform:",
  2379. protocol: "message handling",
  2380. fn: function (aString){
  2381. var self=this;
  2382. return $core.withContext(function($ctx1) {
  2383. return self._perform_withArguments_(aString,[]);
  2384. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2385. },
  2386. args: ["aString"],
  2387. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2388. referencedClasses: [],
  2389. messageSends: ["perform:withArguments:"]
  2390. }),
  2391. $globals.ProtoObject);
  2392. $core.addMethod(
  2393. $core.method({
  2394. selector: "perform:withArguments:",
  2395. protocol: "message handling",
  2396. fn: function (aString,aCollection){
  2397. var self=this;
  2398. return $core.withContext(function($ctx1) {
  2399. return $core.send2(self, aString, aCollection);
  2400. return self;
  2401. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2402. },
  2403. args: ["aString", "aCollection"],
  2404. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2405. referencedClasses: [],
  2406. messageSends: []
  2407. }),
  2408. $globals.ProtoObject);
  2409. $core.addMethod(
  2410. $core.method({
  2411. selector: "printOn:",
  2412. protocol: "printing",
  2413. fn: function (aStream){
  2414. var self=this;
  2415. return $core.withContext(function($ctx1) {
  2416. var $5,$4,$3,$2,$1;
  2417. $5=self._class();
  2418. $ctx1.sendIdx["class"]=1;
  2419. $4=$recv($5)._name();
  2420. $ctx1.sendIdx["name"]=1;
  2421. $3=$recv($4)._first();
  2422. $2=$recv($3)._isVowel();
  2423. if($core.assert($2)){
  2424. $1="an ";
  2425. } else {
  2426. $1="a ";
  2427. }
  2428. $recv(aStream)._nextPutAll_($1);
  2429. $ctx1.sendIdx["nextPutAll:"]=1;
  2430. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  2431. return self;
  2432. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2433. },
  2434. args: ["aStream"],
  2435. source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  2436. referencedClasses: [],
  2437. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2438. }),
  2439. $globals.ProtoObject);
  2440. $core.addMethod(
  2441. $core.method({
  2442. selector: "printString",
  2443. protocol: "printing",
  2444. fn: function (){
  2445. var self=this;
  2446. return $core.withContext(function($ctx1) {
  2447. return $recv($globals.String)._streamContents_((function(str){
  2448. return $core.withContext(function($ctx2) {
  2449. return self._printOn_(str);
  2450. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2451. }));
  2452. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2453. },
  2454. args: [],
  2455. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2456. referencedClasses: ["String"],
  2457. messageSends: ["streamContents:", "printOn:"]
  2458. }),
  2459. $globals.ProtoObject);
  2460. $core.addMethod(
  2461. $core.method({
  2462. selector: "yourself",
  2463. protocol: "accessing",
  2464. fn: function (){
  2465. var self=this;
  2466. return self;
  2467. },
  2468. args: [],
  2469. source: "yourself\x0a\x09^ self",
  2470. referencedClasses: [],
  2471. messageSends: []
  2472. }),
  2473. $globals.ProtoObject);
  2474. $core.addMethod(
  2475. $core.method({
  2476. selector: "~=",
  2477. protocol: "comparing",
  2478. fn: function (anObject){
  2479. var self=this;
  2480. return $core.withContext(function($ctx1) {
  2481. var $1;
  2482. $1=$recv(self.__eq(anObject)).__eq(false);
  2483. $ctx1.sendIdx["="]=1;
  2484. return $1;
  2485. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  2486. },
  2487. args: ["anObject"],
  2488. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  2489. referencedClasses: [],
  2490. messageSends: ["="]
  2491. }),
  2492. $globals.ProtoObject);
  2493. $core.addMethod(
  2494. $core.method({
  2495. selector: "~~",
  2496. protocol: "comparing",
  2497. fn: function (anObject){
  2498. var self=this;
  2499. return $core.withContext(function($ctx1) {
  2500. return $recv(self.__eq_eq(anObject)).__eq(false);
  2501. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  2502. },
  2503. args: ["anObject"],
  2504. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  2505. referencedClasses: [],
  2506. messageSends: ["=", "=="]
  2507. }),
  2508. $globals.ProtoObject);
  2509. $core.addMethod(
  2510. $core.method({
  2511. selector: "initialize",
  2512. protocol: "initialization",
  2513. fn: function (){
  2514. var self=this;
  2515. return self;
  2516. },
  2517. args: [],
  2518. source: "initialize",
  2519. referencedClasses: [],
  2520. messageSends: []
  2521. }),
  2522. $globals.ProtoObject.klass);
  2523. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  2524. $globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example.";
  2525. $core.addMethod(
  2526. $core.method({
  2527. selector: "->",
  2528. protocol: "converting",
  2529. fn: function (anObject){
  2530. var self=this;
  2531. return $core.withContext(function($ctx1) {
  2532. return $recv($globals.Association)._key_value_(self,anObject);
  2533. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  2534. },
  2535. args: ["anObject"],
  2536. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  2537. referencedClasses: ["Association"],
  2538. messageSends: ["key:value:"]
  2539. }),
  2540. $globals.Object);
  2541. $core.addMethod(
  2542. $core.method({
  2543. selector: "asJSONString",
  2544. protocol: "converting",
  2545. fn: function (){
  2546. var self=this;
  2547. return $core.withContext(function($ctx1) {
  2548. return $recv($globals.JSON)._stringify_(self._asJavaScriptObject());
  2549. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  2550. },
  2551. args: [],
  2552. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  2553. referencedClasses: ["JSON"],
  2554. messageSends: ["stringify:", "asJavaScriptObject"]
  2555. }),
  2556. $globals.Object);
  2557. $core.addMethod(
  2558. $core.method({
  2559. selector: "asJavaScriptObject",
  2560. protocol: "converting",
  2561. fn: function (){
  2562. var self=this;
  2563. var variables;
  2564. return $core.withContext(function($ctx1) {
  2565. variables=$recv($globals.HashedCollection)._new();
  2566. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  2567. return $core.withContext(function($ctx2) {
  2568. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJavaScriptObject());
  2569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2570. }));
  2571. return variables;
  2572. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  2573. },
  2574. args: [],
  2575. source: "asJavaScriptObject\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJavaScriptObject ].\x0a\x09^ variables",
  2576. referencedClasses: ["HashedCollection"],
  2577. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  2578. }),
  2579. $globals.Object);
  2580. $core.addMethod(
  2581. $core.method({
  2582. selector: "asJavaScriptSource",
  2583. protocol: "converting",
  2584. fn: function (){
  2585. var self=this;
  2586. return $core.withContext(function($ctx1) {
  2587. return self._asString();
  2588. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  2589. },
  2590. args: [],
  2591. source: "asJavaScriptSource\x0a\x09^ self asString",
  2592. referencedClasses: [],
  2593. messageSends: ["asString"]
  2594. }),
  2595. $globals.Object);
  2596. $core.addMethod(
  2597. $core.method({
  2598. selector: "basicAt:",
  2599. protocol: "accessing",
  2600. fn: function (aString){
  2601. var self=this;
  2602. return $core.withContext(function($ctx1) {
  2603. return self[aString];
  2604. return self;
  2605. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  2606. },
  2607. args: ["aString"],
  2608. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  2609. referencedClasses: [],
  2610. messageSends: []
  2611. }),
  2612. $globals.Object);
  2613. $core.addMethod(
  2614. $core.method({
  2615. selector: "basicAt:put:",
  2616. protocol: "accessing",
  2617. fn: function (aString,anObject){
  2618. var self=this;
  2619. return $core.withContext(function($ctx1) {
  2620. return self[aString] = anObject;
  2621. return self;
  2622. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  2623. },
  2624. args: ["aString", "anObject"],
  2625. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  2626. referencedClasses: [],
  2627. messageSends: []
  2628. }),
  2629. $globals.Object);
  2630. $core.addMethod(
  2631. $core.method({
  2632. selector: "basicDelete:",
  2633. protocol: "accessing",
  2634. fn: function (aString){
  2635. var self=this;
  2636. return $core.withContext(function($ctx1) {
  2637. delete self[aString]; return aString;
  2638. return self;
  2639. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  2640. },
  2641. args: ["aString"],
  2642. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  2643. referencedClasses: [],
  2644. messageSends: []
  2645. }),
  2646. $globals.Object);
  2647. $core.addMethod(
  2648. $core.method({
  2649. selector: "basicPerform:",
  2650. protocol: "message handling",
  2651. fn: function (aString){
  2652. var self=this;
  2653. return $core.withContext(function($ctx1) {
  2654. return self._basicPerform_withArguments_(aString,[]);
  2655. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  2656. },
  2657. args: ["aString"],
  2658. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  2659. referencedClasses: [],
  2660. messageSends: ["basicPerform:withArguments:"]
  2661. }),
  2662. $globals.Object);
  2663. $core.addMethod(
  2664. $core.method({
  2665. selector: "basicPerform:withArguments:",
  2666. protocol: "message handling",
  2667. fn: function (aString,aCollection){
  2668. var self=this;
  2669. return $core.withContext(function($ctx1) {
  2670. return self[aString].apply(self, aCollection);;
  2671. return self;
  2672. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  2673. },
  2674. args: ["aString", "aCollection"],
  2675. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  2676. referencedClasses: [],
  2677. messageSends: []
  2678. }),
  2679. $globals.Object);
  2680. $core.addMethod(
  2681. $core.method({
  2682. selector: "browse",
  2683. protocol: "browsing",
  2684. fn: function (){
  2685. var self=this;
  2686. return $core.withContext(function($ctx1) {
  2687. $recv($globals.Finder)._findClass_(self._class());
  2688. return self;
  2689. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  2690. },
  2691. args: [],
  2692. source: "browse\x0a\x09Finder findClass: self class",
  2693. referencedClasses: ["Finder"],
  2694. messageSends: ["findClass:", "class"]
  2695. }),
  2696. $globals.Object);
  2697. $core.addMethod(
  2698. $core.method({
  2699. selector: "copy",
  2700. protocol: "copying",
  2701. fn: function (){
  2702. var self=this;
  2703. return $core.withContext(function($ctx1) {
  2704. return $recv(self._shallowCopy())._postCopy();
  2705. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  2706. },
  2707. args: [],
  2708. source: "copy\x0a\x09^ self shallowCopy postCopy",
  2709. referencedClasses: [],
  2710. messageSends: ["postCopy", "shallowCopy"]
  2711. }),
  2712. $globals.Object);
  2713. $core.addMethod(
  2714. $core.method({
  2715. selector: "deepCopy",
  2716. protocol: "copying",
  2717. fn: function (){
  2718. var self=this;
  2719. return $core.withContext(function($ctx1) {
  2720. var copy = self.klass._new();
  2721. Object.keys(self).forEach(function (i) {
  2722. if(/^@.+/.test(i)) {
  2723. copy[i] = self[i]._deepCopy();
  2724. }
  2725. });
  2726. return copy;
  2727. ;
  2728. return self;
  2729. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  2730. },
  2731. args: [],
  2732. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  2733. referencedClasses: [],
  2734. messageSends: []
  2735. }),
  2736. $globals.Object);
  2737. $core.addMethod(
  2738. $core.method({
  2739. selector: "deprecatedAPI",
  2740. protocol: "error handling",
  2741. fn: function (){
  2742. var self=this;
  2743. return $core.withContext(function($ctx1) {
  2744. var $1,$6,$5,$4,$8,$7,$3,$2;
  2745. $1=console;
  2746. $6=$core.getThisContext()._home();
  2747. $ctx1.sendIdx["home"]=1;
  2748. $5=$recv($6)._asString();
  2749. $ctx1.sendIdx["asString"]=1;
  2750. $4=$recv($5).__comma(" is deprecated! (in ");
  2751. $8=$recv($core.getThisContext()._home())._home();
  2752. $ctx1.sendIdx["home"]=2;
  2753. $7=$recv($8)._asString();
  2754. $3=$recv($4).__comma($7);
  2755. $ctx1.sendIdx[","]=2;
  2756. $2=$recv($3).__comma(")");
  2757. $ctx1.sendIdx[","]=1;
  2758. $recv($1)._warn_($2);
  2759. return self;
  2760. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  2761. },
  2762. args: [],
  2763. source: "deprecatedAPI\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.",
  2764. referencedClasses: [],
  2765. messageSends: ["warn:", ",", "asString", "home"]
  2766. }),
  2767. $globals.Object);
  2768. $core.addMethod(
  2769. $core.method({
  2770. selector: "deprecatedAPI:",
  2771. protocol: "error handling",
  2772. fn: function (aString){
  2773. var self=this;
  2774. return $core.withContext(function($ctx1) {
  2775. var $1,$6,$5,$4,$8,$7,$3,$2;
  2776. $1=console;
  2777. $6=$core.getThisContext()._home();
  2778. $ctx1.sendIdx["home"]=1;
  2779. $5=$recv($6)._asString();
  2780. $ctx1.sendIdx["asString"]=1;
  2781. $4=$recv($5).__comma(" is deprecated! (in ");
  2782. $8=$recv($core.getThisContext()._home())._home();
  2783. $ctx1.sendIdx["home"]=2;
  2784. $7=$recv($8)._asString();
  2785. $3=$recv($4).__comma($7);
  2786. $ctx1.sendIdx[","]=2;
  2787. $2=$recv($3).__comma(")");
  2788. $ctx1.sendIdx[","]=1;
  2789. $recv($1)._warn_($2);
  2790. $ctx1.sendIdx["warn:"]=1;
  2791. $recv(console)._warn_(aString);
  2792. return self;
  2793. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  2794. },
  2795. args: ["aString"],
  2796. source: "deprecatedAPI: aString\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.\x0a\x09console warn: aString",
  2797. referencedClasses: [],
  2798. messageSends: ["warn:", ",", "asString", "home"]
  2799. }),
  2800. $globals.Object);
  2801. $core.addMethod(
  2802. $core.method({
  2803. selector: "error:",
  2804. protocol: "error handling",
  2805. fn: function (aString){
  2806. var self=this;
  2807. return $core.withContext(function($ctx1) {
  2808. $recv($globals.Error)._signal_(aString);
  2809. return self;
  2810. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  2811. },
  2812. args: ["aString"],
  2813. source: "error: aString\x0a\x09Error signal: aString",
  2814. referencedClasses: ["Error"],
  2815. messageSends: ["signal:"]
  2816. }),
  2817. $globals.Object);
  2818. $core.addMethod(
  2819. $core.method({
  2820. selector: "halt",
  2821. protocol: "error handling",
  2822. fn: function (){
  2823. var self=this;
  2824. return $core.withContext(function($ctx1) {
  2825. $recv($globals.Halt)._signal();
  2826. return self;
  2827. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  2828. },
  2829. args: [],
  2830. source: "halt\x0a\x09Halt signal",
  2831. referencedClasses: ["Halt"],
  2832. messageSends: ["signal"]
  2833. }),
  2834. $globals.Object);
  2835. $core.addMethod(
  2836. $core.method({
  2837. selector: "in:",
  2838. protocol: "evaluating",
  2839. fn: function (aValuable){
  2840. var self=this;
  2841. return $core.withContext(function($ctx1) {
  2842. return $recv(aValuable)._value_(self);
  2843. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  2844. },
  2845. args: ["aValuable"],
  2846. source: "in: aValuable\x0a\x09^ aValuable value: self",
  2847. referencedClasses: [],
  2848. messageSends: ["value:"]
  2849. }),
  2850. $globals.Object);
  2851. $core.addMethod(
  2852. $core.method({
  2853. selector: "isBehavior",
  2854. protocol: "testing",
  2855. fn: function (){
  2856. var self=this;
  2857. return false;
  2858. },
  2859. args: [],
  2860. source: "isBehavior\x0a\x09^ false",
  2861. referencedClasses: [],
  2862. messageSends: []
  2863. }),
  2864. $globals.Object);
  2865. $core.addMethod(
  2866. $core.method({
  2867. selector: "isBoolean",
  2868. protocol: "testing",
  2869. fn: function (){
  2870. var self=this;
  2871. return false;
  2872. },
  2873. args: [],
  2874. source: "isBoolean\x0a\x09^ false",
  2875. referencedClasses: [],
  2876. messageSends: []
  2877. }),
  2878. $globals.Object);
  2879. $core.addMethod(
  2880. $core.method({
  2881. selector: "isClass",
  2882. protocol: "testing",
  2883. fn: function (){
  2884. var self=this;
  2885. return false;
  2886. },
  2887. args: [],
  2888. source: "isClass\x0a\x09^ false",
  2889. referencedClasses: [],
  2890. messageSends: []
  2891. }),
  2892. $globals.Object);
  2893. $core.addMethod(
  2894. $core.method({
  2895. selector: "isCompiledMethod",
  2896. protocol: "testing",
  2897. fn: function (){
  2898. var self=this;
  2899. return false;
  2900. },
  2901. args: [],
  2902. source: "isCompiledMethod\x0a\x09^ false",
  2903. referencedClasses: [],
  2904. messageSends: []
  2905. }),
  2906. $globals.Object);
  2907. $core.addMethod(
  2908. $core.method({
  2909. selector: "isImmutable",
  2910. protocol: "testing",
  2911. fn: function (){
  2912. var self=this;
  2913. return false;
  2914. },
  2915. args: [],
  2916. source: "isImmutable\x0a\x09^ false",
  2917. referencedClasses: [],
  2918. messageSends: []
  2919. }),
  2920. $globals.Object);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "isMemberOf:",
  2924. protocol: "testing",
  2925. fn: function (aClass){
  2926. var self=this;
  2927. return $core.withContext(function($ctx1) {
  2928. return $recv(self._class()).__eq(aClass);
  2929. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2930. },
  2931. args: ["aClass"],
  2932. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2933. referencedClasses: [],
  2934. messageSends: ["=", "class"]
  2935. }),
  2936. $globals.Object);
  2937. $core.addMethod(
  2938. $core.method({
  2939. selector: "isMetaclass",
  2940. protocol: "testing",
  2941. fn: function (){
  2942. var self=this;
  2943. return false;
  2944. },
  2945. args: [],
  2946. source: "isMetaclass\x0a\x09^ false",
  2947. referencedClasses: [],
  2948. messageSends: []
  2949. }),
  2950. $globals.Object);
  2951. $core.addMethod(
  2952. $core.method({
  2953. selector: "isNumber",
  2954. protocol: "testing",
  2955. fn: function (){
  2956. var self=this;
  2957. return false;
  2958. },
  2959. args: [],
  2960. source: "isNumber\x0a\x09^ false",
  2961. referencedClasses: [],
  2962. messageSends: []
  2963. }),
  2964. $globals.Object);
  2965. $core.addMethod(
  2966. $core.method({
  2967. selector: "isPackage",
  2968. protocol: "testing",
  2969. fn: function (){
  2970. var self=this;
  2971. return false;
  2972. },
  2973. args: [],
  2974. source: "isPackage\x0a\x09^ false",
  2975. referencedClasses: [],
  2976. messageSends: []
  2977. }),
  2978. $globals.Object);
  2979. $core.addMethod(
  2980. $core.method({
  2981. selector: "isParseFailure",
  2982. protocol: "testing",
  2983. fn: function (){
  2984. var self=this;
  2985. return false;
  2986. },
  2987. args: [],
  2988. source: "isParseFailure\x0a\x09^ false",
  2989. referencedClasses: [],
  2990. messageSends: []
  2991. }),
  2992. $globals.Object);
  2993. $core.addMethod(
  2994. $core.method({
  2995. selector: "isString",
  2996. protocol: "testing",
  2997. fn: function (){
  2998. var self=this;
  2999. return false;
  3000. },
  3001. args: [],
  3002. source: "isString\x0a\x09^ false",
  3003. referencedClasses: [],
  3004. messageSends: []
  3005. }),
  3006. $globals.Object);
  3007. $core.addMethod(
  3008. $core.method({
  3009. selector: "isSymbol",
  3010. protocol: "testing",
  3011. fn: function (){
  3012. var self=this;
  3013. return false;
  3014. },
  3015. args: [],
  3016. source: "isSymbol\x0a\x09^ false",
  3017. referencedClasses: [],
  3018. messageSends: []
  3019. }),
  3020. $globals.Object);
  3021. $core.addMethod(
  3022. $core.method({
  3023. selector: "postCopy",
  3024. protocol: "copying",
  3025. fn: function (){
  3026. var self=this;
  3027. return self;
  3028. },
  3029. args: [],
  3030. source: "postCopy",
  3031. referencedClasses: [],
  3032. messageSends: []
  3033. }),
  3034. $globals.Object);
  3035. $core.addMethod(
  3036. $core.method({
  3037. selector: "putOn:",
  3038. protocol: "streaming",
  3039. fn: function (aStream){
  3040. var self=this;
  3041. return $core.withContext(function($ctx1) {
  3042. $recv(aStream)._nextPut_(self);
  3043. return self;
  3044. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3045. },
  3046. args: ["aStream"],
  3047. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3048. referencedClasses: [],
  3049. messageSends: ["nextPut:"]
  3050. }),
  3051. $globals.Object);
  3052. $core.addMethod(
  3053. $core.method({
  3054. selector: "respondsTo:",
  3055. protocol: "testing",
  3056. fn: function (aSelector){
  3057. var self=this;
  3058. return $core.withContext(function($ctx1) {
  3059. return $recv(self._class())._canUnderstand_(aSelector);
  3060. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3061. },
  3062. args: ["aSelector"],
  3063. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3064. referencedClasses: [],
  3065. messageSends: ["canUnderstand:", "class"]
  3066. }),
  3067. $globals.Object);
  3068. $core.addMethod(
  3069. $core.method({
  3070. selector: "shallowCopy",
  3071. protocol: "copying",
  3072. fn: function (){
  3073. var self=this;
  3074. return $core.withContext(function($ctx1) {
  3075. var copy = self.klass._new();
  3076. Object.keys(self).forEach(function(i) {
  3077. if(/^@.+/.test(i)) {
  3078. copy[i] = self[i];
  3079. }
  3080. });
  3081. return copy;
  3082. ;
  3083. return self;
  3084. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3085. },
  3086. args: [],
  3087. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3088. referencedClasses: [],
  3089. messageSends: []
  3090. }),
  3091. $globals.Object);
  3092. $core.addMethod(
  3093. $core.method({
  3094. selector: "shouldNotImplement",
  3095. protocol: "error handling",
  3096. fn: function (){
  3097. var self=this;
  3098. return $core.withContext(function($ctx1) {
  3099. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  3100. return self;
  3101. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3102. },
  3103. args: [],
  3104. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3105. referencedClasses: [],
  3106. messageSends: ["error:", ",", "name", "class"]
  3107. }),
  3108. $globals.Object);
  3109. $core.addMethod(
  3110. $core.method({
  3111. selector: "size",
  3112. protocol: "accessing",
  3113. fn: function (){
  3114. var self=this;
  3115. return $core.withContext(function($ctx1) {
  3116. self._error_("Object not indexable");
  3117. return self;
  3118. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3119. },
  3120. args: [],
  3121. source: "size\x0a\x09self error: 'Object not indexable'",
  3122. referencedClasses: [],
  3123. messageSends: ["error:"]
  3124. }),
  3125. $globals.Object);
  3126. $core.addMethod(
  3127. $core.method({
  3128. selector: "subclassResponsibility",
  3129. protocol: "error handling",
  3130. fn: function (){
  3131. var self=this;
  3132. return $core.withContext(function($ctx1) {
  3133. self._error_("This method is a responsibility of a subclass");
  3134. return self;
  3135. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3136. },
  3137. args: [],
  3138. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3139. referencedClasses: [],
  3140. messageSends: ["error:"]
  3141. }),
  3142. $globals.Object);
  3143. $core.addMethod(
  3144. $core.method({
  3145. selector: "value",
  3146. protocol: "evaluating",
  3147. fn: function (){
  3148. var self=this;
  3149. return $core.withContext(function($ctx1) {
  3150. return self.valueOf();
  3151. return self;
  3152. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3153. },
  3154. args: [],
  3155. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3156. referencedClasses: [],
  3157. messageSends: []
  3158. }),
  3159. $globals.Object);
  3160. $core.addMethod(
  3161. $core.method({
  3162. selector: "accessorProtocolWith:",
  3163. protocol: "helios",
  3164. fn: function (aGenerator){
  3165. var self=this;
  3166. return $core.withContext(function($ctx1) {
  3167. $recv(aGenerator)._accessorProtocolForObject();
  3168. return self;
  3169. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3170. },
  3171. args: ["aGenerator"],
  3172. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3173. referencedClasses: [],
  3174. messageSends: ["accessorProtocolForObject"]
  3175. }),
  3176. $globals.Object.klass);
  3177. $core.addMethod(
  3178. $core.method({
  3179. selector: "accessorsSourceCodesWith:",
  3180. protocol: "helios",
  3181. fn: function (aGenerator){
  3182. var self=this;
  3183. return $core.withContext(function($ctx1) {
  3184. $recv(aGenerator)._accessorsForObject();
  3185. return self;
  3186. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3187. },
  3188. args: ["aGenerator"],
  3189. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3190. referencedClasses: [],
  3191. messageSends: ["accessorsForObject"]
  3192. }),
  3193. $globals.Object.klass);
  3194. $core.addMethod(
  3195. $core.method({
  3196. selector: "initialize",
  3197. protocol: "initialization",
  3198. fn: function (){
  3199. var self=this;
  3200. return self;
  3201. },
  3202. args: [],
  3203. source: "initialize\x0a\x09\x22no op\x22",
  3204. referencedClasses: [],
  3205. messageSends: []
  3206. }),
  3207. $globals.Object.klass);
  3208. $core.addMethod(
  3209. $core.method({
  3210. selector: "initializeProtocolWith:",
  3211. protocol: "helios",
  3212. fn: function (aGenerator){
  3213. var self=this;
  3214. return $core.withContext(function($ctx1) {
  3215. $recv(aGenerator)._initializeProtocolForObject();
  3216. return self;
  3217. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3218. },
  3219. args: ["aGenerator"],
  3220. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3221. referencedClasses: [],
  3222. messageSends: ["initializeProtocolForObject"]
  3223. }),
  3224. $globals.Object.klass);
  3225. $core.addMethod(
  3226. $core.method({
  3227. selector: "initializeSourceCodesWith:",
  3228. protocol: "helios",
  3229. fn: function (aGenerator){
  3230. var self=this;
  3231. return $core.withContext(function($ctx1) {
  3232. $recv(aGenerator)._initializeForObject();
  3233. return self;
  3234. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3235. },
  3236. args: ["aGenerator"],
  3237. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3238. referencedClasses: [],
  3239. messageSends: ["initializeForObject"]
  3240. }),
  3241. $globals.Object.klass);
  3242. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3243. $globals.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]";
  3244. $core.addMethod(
  3245. $core.method({
  3246. selector: "&",
  3247. protocol: "controlling",
  3248. fn: function (aBoolean){
  3249. var self=this;
  3250. return $core.withContext(function($ctx1) {
  3251. if(self == true) {
  3252. return aBoolean;
  3253. } else {
  3254. return false;
  3255. }
  3256. ;
  3257. return self;
  3258. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3259. },
  3260. args: ["aBoolean"],
  3261. source: "& aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09'>",
  3262. referencedClasses: [],
  3263. messageSends: []
  3264. }),
  3265. $globals.Boolean);
  3266. $core.addMethod(
  3267. $core.method({
  3268. selector: "==",
  3269. protocol: "comparing",
  3270. fn: function (aBoolean){
  3271. var self=this;
  3272. return $core.withContext(function($ctx1) {
  3273. if (typeof aBoolean === "boolean") return self.valueOf() === aBoolean;
  3274. else if (aBoolean != null && typeof aBoolean === "object") return self.valueOf() === aBoolean.valueOf();
  3275. else return false;;
  3276. return self;
  3277. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3278. },
  3279. args: ["aBoolean"],
  3280. source: "== aBoolean\x0a<inlineJS: '\x0a\x09if (typeof aBoolean === \x22boolean\x22) return self.valueOf() === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return self.valueOf() === aBoolean.valueOf();\x0a\x09else return false;\x0a'>",
  3281. referencedClasses: [],
  3282. messageSends: []
  3283. }),
  3284. $globals.Boolean);
  3285. $core.addMethod(
  3286. $core.method({
  3287. selector: "and:",
  3288. protocol: "controlling",
  3289. fn: function (aBlock){
  3290. var self=this;
  3291. return $core.withContext(function($ctx1) {
  3292. if($core.assert(self)){
  3293. return $recv(aBlock)._value();
  3294. } else {
  3295. return false;
  3296. }
  3297. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3298. },
  3299. args: ["aBlock"],
  3300. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3301. referencedClasses: [],
  3302. messageSends: ["ifTrue:ifFalse:", "value"]
  3303. }),
  3304. $globals.Boolean);
  3305. $core.addMethod(
  3306. $core.method({
  3307. selector: "asBit",
  3308. protocol: "converting",
  3309. fn: function (){
  3310. var self=this;
  3311. return $core.withContext(function($ctx1) {
  3312. if($core.assert(self)){
  3313. return (1);
  3314. } else {
  3315. return (0);
  3316. }
  3317. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3318. },
  3319. args: [],
  3320. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3321. referencedClasses: [],
  3322. messageSends: ["ifTrue:ifFalse:"]
  3323. }),
  3324. $globals.Boolean);
  3325. $core.addMethod(
  3326. $core.method({
  3327. selector: "asJavaScriptObject",
  3328. protocol: "converting",
  3329. fn: function (){
  3330. var self=this;
  3331. return self;
  3332. },
  3333. args: [],
  3334. source: "asJavaScriptObject\x0a\x09^ self",
  3335. referencedClasses: [],
  3336. messageSends: []
  3337. }),
  3338. $globals.Boolean);
  3339. $core.addMethod(
  3340. $core.method({
  3341. selector: "asString",
  3342. protocol: "converting",
  3343. fn: function (){
  3344. var self=this;
  3345. return $core.withContext(function($ctx1) {
  3346. return self.toString();
  3347. return self;
  3348. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3349. },
  3350. args: [],
  3351. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3352. referencedClasses: [],
  3353. messageSends: []
  3354. }),
  3355. $globals.Boolean);
  3356. $core.addMethod(
  3357. $core.method({
  3358. selector: "deepCopy",
  3359. protocol: "copying",
  3360. fn: function (){
  3361. var self=this;
  3362. return self;
  3363. },
  3364. args: [],
  3365. source: "deepCopy\x0a\x09^ self",
  3366. referencedClasses: [],
  3367. messageSends: []
  3368. }),
  3369. $globals.Boolean);
  3370. $core.addMethod(
  3371. $core.method({
  3372. selector: "ifFalse:",
  3373. protocol: "controlling",
  3374. fn: function (aBlock){
  3375. var self=this;
  3376. return $core.withContext(function($ctx1) {
  3377. return self._ifTrue_ifFalse_((function(){
  3378. }),aBlock);
  3379. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3380. },
  3381. args: ["aBlock"],
  3382. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3383. referencedClasses: [],
  3384. messageSends: ["ifTrue:ifFalse:"]
  3385. }),
  3386. $globals.Boolean);
  3387. $core.addMethod(
  3388. $core.method({
  3389. selector: "ifFalse:ifTrue:",
  3390. protocol: "controlling",
  3391. fn: function (aBlock,anotherBlock){
  3392. var self=this;
  3393. return $core.withContext(function($ctx1) {
  3394. return self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3395. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3396. },
  3397. args: ["aBlock", "anotherBlock"],
  3398. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3399. referencedClasses: [],
  3400. messageSends: ["ifTrue:ifFalse:"]
  3401. }),
  3402. $globals.Boolean);
  3403. $core.addMethod(
  3404. $core.method({
  3405. selector: "ifTrue:",
  3406. protocol: "controlling",
  3407. fn: function (aBlock){
  3408. var self=this;
  3409. return $core.withContext(function($ctx1) {
  3410. return self._ifTrue_ifFalse_(aBlock,(function(){
  3411. }));
  3412. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3413. },
  3414. args: ["aBlock"],
  3415. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3416. referencedClasses: [],
  3417. messageSends: ["ifTrue:ifFalse:"]
  3418. }),
  3419. $globals.Boolean);
  3420. $core.addMethod(
  3421. $core.method({
  3422. selector: "ifTrue:ifFalse:",
  3423. protocol: "controlling",
  3424. fn: function (aBlock,anotherBlock){
  3425. var self=this;
  3426. return $core.withContext(function($ctx1) {
  3427. if(self == true) {
  3428. return aBlock._value();
  3429. } else {
  3430. return anotherBlock._value();
  3431. }
  3432. ;
  3433. return self;
  3434. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3435. },
  3436. args: ["aBlock", "anotherBlock"],
  3437. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09'>",
  3438. referencedClasses: [],
  3439. messageSends: []
  3440. }),
  3441. $globals.Boolean);
  3442. $core.addMethod(
  3443. $core.method({
  3444. selector: "isBoolean",
  3445. protocol: "testing",
  3446. fn: function (){
  3447. var self=this;
  3448. return true;
  3449. },
  3450. args: [],
  3451. source: "isBoolean\x0a\x09^ true",
  3452. referencedClasses: [],
  3453. messageSends: []
  3454. }),
  3455. $globals.Boolean);
  3456. $core.addMethod(
  3457. $core.method({
  3458. selector: "isImmutable",
  3459. protocol: "testing",
  3460. fn: function (){
  3461. var self=this;
  3462. return true;
  3463. },
  3464. args: [],
  3465. source: "isImmutable\x0a\x09^ true",
  3466. referencedClasses: [],
  3467. messageSends: []
  3468. }),
  3469. $globals.Boolean);
  3470. $core.addMethod(
  3471. $core.method({
  3472. selector: "not",
  3473. protocol: "controlling",
  3474. fn: function (){
  3475. var self=this;
  3476. return $core.withContext(function($ctx1) {
  3477. return self.__eq(false);
  3478. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  3479. },
  3480. args: [],
  3481. source: "not\x0a\x09^ self = false",
  3482. referencedClasses: [],
  3483. messageSends: ["="]
  3484. }),
  3485. $globals.Boolean);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "or:",
  3489. protocol: "controlling",
  3490. fn: function (aBlock){
  3491. var self=this;
  3492. return $core.withContext(function($ctx1) {
  3493. if($core.assert(self)){
  3494. return true;
  3495. } else {
  3496. return $recv(aBlock)._value();
  3497. }
  3498. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  3499. },
  3500. args: ["aBlock"],
  3501. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  3502. referencedClasses: [],
  3503. messageSends: ["ifTrue:ifFalse:", "value"]
  3504. }),
  3505. $globals.Boolean);
  3506. $core.addMethod(
  3507. $core.method({
  3508. selector: "printOn:",
  3509. protocol: "printing",
  3510. fn: function (aStream){
  3511. var self=this;
  3512. return $core.withContext(function($ctx1) {
  3513. $recv(aStream)._nextPutAll_(self._asString());
  3514. return self;
  3515. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  3516. },
  3517. args: ["aStream"],
  3518. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3519. referencedClasses: [],
  3520. messageSends: ["nextPutAll:", "asString"]
  3521. }),
  3522. $globals.Boolean);
  3523. $core.addMethod(
  3524. $core.method({
  3525. selector: "shallowCopy",
  3526. protocol: "copying",
  3527. fn: function (){
  3528. var self=this;
  3529. return self;
  3530. },
  3531. args: [],
  3532. source: "shallowCopy\x0a\x09^ self",
  3533. referencedClasses: [],
  3534. messageSends: []
  3535. }),
  3536. $globals.Boolean);
  3537. $core.addMethod(
  3538. $core.method({
  3539. selector: "|",
  3540. protocol: "controlling",
  3541. fn: function (aBoolean){
  3542. var self=this;
  3543. return $core.withContext(function($ctx1) {
  3544. if(self == true) {
  3545. return true;
  3546. } else {
  3547. return aBoolean;
  3548. }
  3549. ;
  3550. return self;
  3551. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  3552. },
  3553. args: ["aBoolean"],
  3554. source: "| aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09'>",
  3555. referencedClasses: [],
  3556. messageSends: []
  3557. }),
  3558. $globals.Boolean);
  3559. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  3560. $globals.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).";
  3561. $core.addMethod(
  3562. $core.method({
  3563. selector: "+",
  3564. protocol: "arithmetic",
  3565. fn: function (aDate){
  3566. var self=this;
  3567. return $core.withContext(function($ctx1) {
  3568. return self + aDate;
  3569. return self;
  3570. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  3571. },
  3572. args: ["aDate"],
  3573. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  3574. referencedClasses: [],
  3575. messageSends: []
  3576. }),
  3577. $globals.Date);
  3578. $core.addMethod(
  3579. $core.method({
  3580. selector: "-",
  3581. protocol: "arithmetic",
  3582. fn: function (aDate){
  3583. var self=this;
  3584. return $core.withContext(function($ctx1) {
  3585. return self - aDate;
  3586. return self;
  3587. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  3588. },
  3589. args: ["aDate"],
  3590. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  3591. referencedClasses: [],
  3592. messageSends: []
  3593. }),
  3594. $globals.Date);
  3595. $core.addMethod(
  3596. $core.method({
  3597. selector: "<",
  3598. protocol: "comparing",
  3599. fn: function (aDate){
  3600. var self=this;
  3601. return $core.withContext(function($ctx1) {
  3602. return self < aDate;
  3603. return self;
  3604. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  3605. },
  3606. args: ["aDate"],
  3607. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  3608. referencedClasses: [],
  3609. messageSends: []
  3610. }),
  3611. $globals.Date);
  3612. $core.addMethod(
  3613. $core.method({
  3614. selector: "<=",
  3615. protocol: "comparing",
  3616. fn: function (aDate){
  3617. var self=this;
  3618. return $core.withContext(function($ctx1) {
  3619. return self <= aDate;
  3620. return self;
  3621. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  3622. },
  3623. args: ["aDate"],
  3624. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  3625. referencedClasses: [],
  3626. messageSends: []
  3627. }),
  3628. $globals.Date);
  3629. $core.addMethod(
  3630. $core.method({
  3631. selector: "=",
  3632. protocol: "comparing",
  3633. fn: function (aDate){
  3634. var self=this;
  3635. return $core.withContext(function($ctx1) {
  3636. var $2,$1,$3;
  3637. $2=$recv(aDate)._class();
  3638. $ctx1.sendIdx["class"]=1;
  3639. $1=$recv($2).__eq_eq(self._class());
  3640. $ctx1.sendIdx["=="]=1;
  3641. return $recv($1)._and_((function(){
  3642. return $core.withContext(function($ctx2) {
  3643. $3=self._asMilliseconds();
  3644. $ctx2.sendIdx["asMilliseconds"]=1;
  3645. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  3646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3647. }));
  3648. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  3649. },
  3650. args: ["aDate"],
  3651. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  3652. referencedClasses: [],
  3653. messageSends: ["and:", "==", "class", "asMilliseconds"]
  3654. }),
  3655. $globals.Date);
  3656. $core.addMethod(
  3657. $core.method({
  3658. selector: ">",
  3659. protocol: "comparing",
  3660. fn: function (aDate){
  3661. var self=this;
  3662. return $core.withContext(function($ctx1) {
  3663. return self > aDate;
  3664. return self;
  3665. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  3666. },
  3667. args: ["aDate"],
  3668. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  3669. referencedClasses: [],
  3670. messageSends: []
  3671. }),
  3672. $globals.Date);
  3673. $core.addMethod(
  3674. $core.method({
  3675. selector: ">=",
  3676. protocol: "comparing",
  3677. fn: function (aDate){
  3678. var self=this;
  3679. return $core.withContext(function($ctx1) {
  3680. return self >= aDate;
  3681. return self;
  3682. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  3683. },
  3684. args: ["aDate"],
  3685. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  3686. referencedClasses: [],
  3687. messageSends: []
  3688. }),
  3689. $globals.Date);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "asDateString",
  3693. protocol: "converting",
  3694. fn: function (){
  3695. var self=this;
  3696. return $core.withContext(function($ctx1) {
  3697. return self.toDateString();
  3698. return self;
  3699. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  3700. },
  3701. args: [],
  3702. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  3703. referencedClasses: [],
  3704. messageSends: []
  3705. }),
  3706. $globals.Date);
  3707. $core.addMethod(
  3708. $core.method({
  3709. selector: "asLocaleString",
  3710. protocol: "converting",
  3711. fn: function (){
  3712. var self=this;
  3713. return $core.withContext(function($ctx1) {
  3714. return self.toLocaleString();
  3715. return self;
  3716. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  3717. },
  3718. args: [],
  3719. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  3720. referencedClasses: [],
  3721. messageSends: []
  3722. }),
  3723. $globals.Date);
  3724. $core.addMethod(
  3725. $core.method({
  3726. selector: "asMilliseconds",
  3727. protocol: "converting",
  3728. fn: function (){
  3729. var self=this;
  3730. return $core.withContext(function($ctx1) {
  3731. return self._time();
  3732. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  3733. },
  3734. args: [],
  3735. source: "asMilliseconds\x0a\x09^ self time",
  3736. referencedClasses: [],
  3737. messageSends: ["time"]
  3738. }),
  3739. $globals.Date);
  3740. $core.addMethod(
  3741. $core.method({
  3742. selector: "asNumber",
  3743. protocol: "converting",
  3744. fn: function (){
  3745. var self=this;
  3746. return $core.withContext(function($ctx1) {
  3747. return self._asMilliseconds();
  3748. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  3749. },
  3750. args: [],
  3751. source: "asNumber\x0a\x09^ self asMilliseconds",
  3752. referencedClasses: [],
  3753. messageSends: ["asMilliseconds"]
  3754. }),
  3755. $globals.Date);
  3756. $core.addMethod(
  3757. $core.method({
  3758. selector: "asString",
  3759. protocol: "converting",
  3760. fn: function (){
  3761. var self=this;
  3762. return $core.withContext(function($ctx1) {
  3763. return self.toString();
  3764. return self;
  3765. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  3766. },
  3767. args: [],
  3768. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3769. referencedClasses: [],
  3770. messageSends: []
  3771. }),
  3772. $globals.Date);
  3773. $core.addMethod(
  3774. $core.method({
  3775. selector: "asTimeString",
  3776. protocol: "converting",
  3777. fn: function (){
  3778. var self=this;
  3779. return $core.withContext(function($ctx1) {
  3780. return self.toTimeString();
  3781. return self;
  3782. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  3783. },
  3784. args: [],
  3785. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  3786. referencedClasses: [],
  3787. messageSends: []
  3788. }),
  3789. $globals.Date);
  3790. $core.addMethod(
  3791. $core.method({
  3792. selector: "day",
  3793. protocol: "accessing",
  3794. fn: function (){
  3795. var self=this;
  3796. return $core.withContext(function($ctx1) {
  3797. return self._dayOfWeek();
  3798. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  3799. },
  3800. args: [],
  3801. source: "day\x0a\x09^ self dayOfWeek",
  3802. referencedClasses: [],
  3803. messageSends: ["dayOfWeek"]
  3804. }),
  3805. $globals.Date);
  3806. $core.addMethod(
  3807. $core.method({
  3808. selector: "day:",
  3809. protocol: "accessing",
  3810. fn: function (aNumber){
  3811. var self=this;
  3812. return $core.withContext(function($ctx1) {
  3813. self._dayOfWeek_(aNumber);
  3814. return self;
  3815. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  3816. },
  3817. args: ["aNumber"],
  3818. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  3819. referencedClasses: [],
  3820. messageSends: ["dayOfWeek:"]
  3821. }),
  3822. $globals.Date);
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "dayOfMonth",
  3826. protocol: "accessing",
  3827. fn: function (){
  3828. var self=this;
  3829. return $core.withContext(function($ctx1) {
  3830. return self.getDate();
  3831. return self;
  3832. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  3833. },
  3834. args: [],
  3835. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  3836. referencedClasses: [],
  3837. messageSends: []
  3838. }),
  3839. $globals.Date);
  3840. $core.addMethod(
  3841. $core.method({
  3842. selector: "dayOfMonth:",
  3843. protocol: "accessing",
  3844. fn: function (aNumber){
  3845. var self=this;
  3846. return $core.withContext(function($ctx1) {
  3847. self.setDate(aNumber);
  3848. return self;
  3849. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  3850. },
  3851. args: ["aNumber"],
  3852. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  3853. referencedClasses: [],
  3854. messageSends: []
  3855. }),
  3856. $globals.Date);
  3857. $core.addMethod(
  3858. $core.method({
  3859. selector: "dayOfWeek",
  3860. protocol: "accessing",
  3861. fn: function (){
  3862. var self=this;
  3863. return $core.withContext(function($ctx1) {
  3864. return self.getDay() + 1;
  3865. return self;
  3866. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  3867. },
  3868. args: [],
  3869. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  3870. referencedClasses: [],
  3871. messageSends: []
  3872. }),
  3873. $globals.Date);
  3874. $core.addMethod(
  3875. $core.method({
  3876. selector: "dayOfWeek:",
  3877. protocol: "accessing",
  3878. fn: function (aNumber){
  3879. var self=this;
  3880. return $core.withContext(function($ctx1) {
  3881. return self.setDay(aNumber - 1);
  3882. return self;
  3883. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  3884. },
  3885. args: ["aNumber"],
  3886. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  3887. referencedClasses: [],
  3888. messageSends: []
  3889. }),
  3890. $globals.Date);
  3891. $core.addMethod(
  3892. $core.method({
  3893. selector: "hours",
  3894. protocol: "accessing",
  3895. fn: function (){
  3896. var self=this;
  3897. return $core.withContext(function($ctx1) {
  3898. return self.getHours();
  3899. return self;
  3900. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3901. },
  3902. args: [],
  3903. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  3904. referencedClasses: [],
  3905. messageSends: []
  3906. }),
  3907. $globals.Date);
  3908. $core.addMethod(
  3909. $core.method({
  3910. selector: "hours:",
  3911. protocol: "accessing",
  3912. fn: function (aNumber){
  3913. var self=this;
  3914. return $core.withContext(function($ctx1) {
  3915. self.setHours(aNumber);
  3916. return self;
  3917. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3918. },
  3919. args: ["aNumber"],
  3920. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  3921. referencedClasses: [],
  3922. messageSends: []
  3923. }),
  3924. $globals.Date);
  3925. $core.addMethod(
  3926. $core.method({
  3927. selector: "milliseconds",
  3928. protocol: "accessing",
  3929. fn: function (){
  3930. var self=this;
  3931. return $core.withContext(function($ctx1) {
  3932. return self.getMilliseconds();
  3933. return self;
  3934. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3935. },
  3936. args: [],
  3937. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  3938. referencedClasses: [],
  3939. messageSends: []
  3940. }),
  3941. $globals.Date);
  3942. $core.addMethod(
  3943. $core.method({
  3944. selector: "milliseconds:",
  3945. protocol: "accessing",
  3946. fn: function (aNumber){
  3947. var self=this;
  3948. return $core.withContext(function($ctx1) {
  3949. self.setMilliseconds(aNumber);
  3950. return self;
  3951. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3952. },
  3953. args: ["aNumber"],
  3954. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  3955. referencedClasses: [],
  3956. messageSends: []
  3957. }),
  3958. $globals.Date);
  3959. $core.addMethod(
  3960. $core.method({
  3961. selector: "minutes",
  3962. protocol: "accessing",
  3963. fn: function (){
  3964. var self=this;
  3965. return $core.withContext(function($ctx1) {
  3966. return self.getMinutes();
  3967. return self;
  3968. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3969. },
  3970. args: [],
  3971. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  3972. referencedClasses: [],
  3973. messageSends: []
  3974. }),
  3975. $globals.Date);
  3976. $core.addMethod(
  3977. $core.method({
  3978. selector: "minutes:",
  3979. protocol: "accessing",
  3980. fn: function (aNumber){
  3981. var self=this;
  3982. return $core.withContext(function($ctx1) {
  3983. self.setMinutes(aNumber);
  3984. return self;
  3985. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3986. },
  3987. args: ["aNumber"],
  3988. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  3989. referencedClasses: [],
  3990. messageSends: []
  3991. }),
  3992. $globals.Date);
  3993. $core.addMethod(
  3994. $core.method({
  3995. selector: "month",
  3996. protocol: "accessing",
  3997. fn: function (){
  3998. var self=this;
  3999. return $core.withContext(function($ctx1) {
  4000. return self.getMonth() + 1;
  4001. return self;
  4002. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4003. },
  4004. args: [],
  4005. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4006. referencedClasses: [],
  4007. messageSends: []
  4008. }),
  4009. $globals.Date);
  4010. $core.addMethod(
  4011. $core.method({
  4012. selector: "month:",
  4013. protocol: "accessing",
  4014. fn: function (aNumber){
  4015. var self=this;
  4016. return $core.withContext(function($ctx1) {
  4017. self.setMonth(aNumber - 1);
  4018. return self;
  4019. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4020. },
  4021. args: ["aNumber"],
  4022. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4023. referencedClasses: [],
  4024. messageSends: []
  4025. }),
  4026. $globals.Date);
  4027. $core.addMethod(
  4028. $core.method({
  4029. selector: "printOn:",
  4030. protocol: "printing",
  4031. fn: function (aStream){
  4032. var self=this;
  4033. return $core.withContext(function($ctx1) {
  4034. $recv(aStream)._nextPutAll_(self._asString());
  4035. return self;
  4036. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4037. },
  4038. args: ["aStream"],
  4039. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4040. referencedClasses: [],
  4041. messageSends: ["nextPutAll:", "asString"]
  4042. }),
  4043. $globals.Date);
  4044. $core.addMethod(
  4045. $core.method({
  4046. selector: "seconds",
  4047. protocol: "accessing",
  4048. fn: function (){
  4049. var self=this;
  4050. return $core.withContext(function($ctx1) {
  4051. return self.getSeconds();
  4052. return self;
  4053. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4054. },
  4055. args: [],
  4056. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4057. referencedClasses: [],
  4058. messageSends: []
  4059. }),
  4060. $globals.Date);
  4061. $core.addMethod(
  4062. $core.method({
  4063. selector: "seconds:",
  4064. protocol: "accessing",
  4065. fn: function (aNumber){
  4066. var self=this;
  4067. return $core.withContext(function($ctx1) {
  4068. self.setSeconds(aNumber);
  4069. return self;
  4070. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4071. },
  4072. args: ["aNumber"],
  4073. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4074. referencedClasses: [],
  4075. messageSends: []
  4076. }),
  4077. $globals.Date);
  4078. $core.addMethod(
  4079. $core.method({
  4080. selector: "time",
  4081. protocol: "accessing",
  4082. fn: function (){
  4083. var self=this;
  4084. return $core.withContext(function($ctx1) {
  4085. return self.getTime();
  4086. return self;
  4087. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4088. },
  4089. args: [],
  4090. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4091. referencedClasses: [],
  4092. messageSends: []
  4093. }),
  4094. $globals.Date);
  4095. $core.addMethod(
  4096. $core.method({
  4097. selector: "time:",
  4098. protocol: "accessing",
  4099. fn: function (aNumber){
  4100. var self=this;
  4101. return $core.withContext(function($ctx1) {
  4102. self.setTime(aNumber);
  4103. return self;
  4104. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4105. },
  4106. args: ["aNumber"],
  4107. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4108. referencedClasses: [],
  4109. messageSends: []
  4110. }),
  4111. $globals.Date);
  4112. $core.addMethod(
  4113. $core.method({
  4114. selector: "year",
  4115. protocol: "accessing",
  4116. fn: function (){
  4117. var self=this;
  4118. return $core.withContext(function($ctx1) {
  4119. return self.getFullYear();
  4120. return self;
  4121. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4122. },
  4123. args: [],
  4124. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4125. referencedClasses: [],
  4126. messageSends: []
  4127. }),
  4128. $globals.Date);
  4129. $core.addMethod(
  4130. $core.method({
  4131. selector: "year:",
  4132. protocol: "accessing",
  4133. fn: function (aNumber){
  4134. var self=this;
  4135. return $core.withContext(function($ctx1) {
  4136. self.setFullYear(aNumber);
  4137. return self;
  4138. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4139. },
  4140. args: ["aNumber"],
  4141. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4142. referencedClasses: [],
  4143. messageSends: []
  4144. }),
  4145. $globals.Date);
  4146. $core.addMethod(
  4147. $core.method({
  4148. selector: "classTag",
  4149. protocol: "accessing",
  4150. fn: function (){
  4151. var self=this;
  4152. return "magnitude";
  4153. },
  4154. args: [],
  4155. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  4156. referencedClasses: [],
  4157. messageSends: []
  4158. }),
  4159. $globals.Date.klass);
  4160. $core.addMethod(
  4161. $core.method({
  4162. selector: "fromMilliseconds:",
  4163. protocol: "instance creation",
  4164. fn: function (aNumber){
  4165. var self=this;
  4166. return $core.withContext(function($ctx1) {
  4167. return self._new_(aNumber);
  4168. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  4169. },
  4170. args: ["aNumber"],
  4171. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4172. referencedClasses: [],
  4173. messageSends: ["new:"]
  4174. }),
  4175. $globals.Date.klass);
  4176. $core.addMethod(
  4177. $core.method({
  4178. selector: "fromSeconds:",
  4179. protocol: "instance creation",
  4180. fn: function (aNumber){
  4181. var self=this;
  4182. return $core.withContext(function($ctx1) {
  4183. return self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4184. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  4185. },
  4186. args: ["aNumber"],
  4187. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4188. referencedClasses: [],
  4189. messageSends: ["fromMilliseconds:", "*"]
  4190. }),
  4191. $globals.Date.klass);
  4192. $core.addMethod(
  4193. $core.method({
  4194. selector: "fromString:",
  4195. protocol: "instance creation",
  4196. fn: function (aString){
  4197. var self=this;
  4198. return $core.withContext(function($ctx1) {
  4199. return self._new_(aString);
  4200. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  4201. },
  4202. args: ["aString"],
  4203. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4204. referencedClasses: [],
  4205. messageSends: ["new:"]
  4206. }),
  4207. $globals.Date.klass);
  4208. $core.addMethod(
  4209. $core.method({
  4210. selector: "millisecondsToRun:",
  4211. protocol: "instance creation",
  4212. fn: function (aBlock){
  4213. var self=this;
  4214. var t;
  4215. return $core.withContext(function($ctx1) {
  4216. t=$recv($globals.Date)._now();
  4217. $ctx1.sendIdx["now"]=1;
  4218. $recv(aBlock)._value();
  4219. return $recv($recv($globals.Date)._now()).__minus(t);
  4220. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  4221. },
  4222. args: ["aBlock"],
  4223. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4224. referencedClasses: ["Date"],
  4225. messageSends: ["now", "value", "-"]
  4226. }),
  4227. $globals.Date.klass);
  4228. $core.addMethod(
  4229. $core.method({
  4230. selector: "new:",
  4231. protocol: "instance creation",
  4232. fn: function (anObject){
  4233. var self=this;
  4234. return $core.withContext(function($ctx1) {
  4235. return new Date(anObject);
  4236. return self;
  4237. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  4238. },
  4239. args: ["anObject"],
  4240. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4241. referencedClasses: [],
  4242. messageSends: []
  4243. }),
  4244. $globals.Date.klass);
  4245. $core.addMethod(
  4246. $core.method({
  4247. selector: "now",
  4248. protocol: "instance creation",
  4249. fn: function (){
  4250. var self=this;
  4251. return $core.withContext(function($ctx1) {
  4252. return self._today();
  4253. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  4254. },
  4255. args: [],
  4256. source: "now\x0a\x09^ self today",
  4257. referencedClasses: [],
  4258. messageSends: ["today"]
  4259. }),
  4260. $globals.Date.klass);
  4261. $core.addMethod(
  4262. $core.method({
  4263. selector: "today",
  4264. protocol: "instance creation",
  4265. fn: function (){
  4266. var self=this;
  4267. return $core.withContext(function($ctx1) {
  4268. return self._new();
  4269. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  4270. },
  4271. args: [],
  4272. source: "today\x0a\x09^ self new",
  4273. referencedClasses: [],
  4274. messageSends: ["new"]
  4275. }),
  4276. $globals.Date.klass);
  4277. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4278. $globals.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [ Transcript show: 'This will be printed 5 times'; cr ].\x0a\x09\x0a\x091 to: 5 do: [ :aNumber| Transcript show: aNumber asString; cr ].\x0a\x09\x0a\x091 to: 10 by: 2 do: [ :aNumber| Transcript show: aNumber asString; cr ].";
  4279. $core.addMethod(
  4280. $core.method({
  4281. selector: "&",
  4282. protocol: "converting",
  4283. fn: function (aNumber){
  4284. var self=this;
  4285. return $core.withContext(function($ctx1) {
  4286. return self & aNumber;
  4287. return self;
  4288. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4289. },
  4290. args: ["aNumber"],
  4291. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4292. referencedClasses: [],
  4293. messageSends: []
  4294. }),
  4295. $globals.Number);
  4296. $core.addMethod(
  4297. $core.method({
  4298. selector: "*",
  4299. protocol: "arithmetic",
  4300. fn: function (aNumber){
  4301. var self=this;
  4302. return $core.withContext(function($ctx1) {
  4303. return self * aNumber;
  4304. return self;
  4305. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4306. },
  4307. args: ["aNumber"],
  4308. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4309. referencedClasses: [],
  4310. messageSends: []
  4311. }),
  4312. $globals.Number);
  4313. $core.addMethod(
  4314. $core.method({
  4315. selector: "**",
  4316. protocol: "mathematical functions",
  4317. fn: function (exponent){
  4318. var self=this;
  4319. return $core.withContext(function($ctx1) {
  4320. return self._raisedTo_(exponent);
  4321. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4322. },
  4323. args: ["exponent"],
  4324. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4325. referencedClasses: [],
  4326. messageSends: ["raisedTo:"]
  4327. }),
  4328. $globals.Number);
  4329. $core.addMethod(
  4330. $core.method({
  4331. selector: "+",
  4332. protocol: "arithmetic",
  4333. fn: function (aNumber){
  4334. var self=this;
  4335. return $core.withContext(function($ctx1) {
  4336. return self + aNumber;
  4337. return self;
  4338. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4339. },
  4340. args: ["aNumber"],
  4341. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4342. referencedClasses: [],
  4343. messageSends: []
  4344. }),
  4345. $globals.Number);
  4346. $core.addMethod(
  4347. $core.method({
  4348. selector: "-",
  4349. protocol: "arithmetic",
  4350. fn: function (aNumber){
  4351. var self=this;
  4352. return $core.withContext(function($ctx1) {
  4353. return self - aNumber;
  4354. return self;
  4355. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4356. },
  4357. args: ["aNumber"],
  4358. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4359. referencedClasses: [],
  4360. messageSends: []
  4361. }),
  4362. $globals.Number);
  4363. $core.addMethod(
  4364. $core.method({
  4365. selector: "/",
  4366. protocol: "arithmetic",
  4367. fn: function (aNumber){
  4368. var self=this;
  4369. return $core.withContext(function($ctx1) {
  4370. return self / aNumber;
  4371. return self;
  4372. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4373. },
  4374. args: ["aNumber"],
  4375. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4376. referencedClasses: [],
  4377. messageSends: []
  4378. }),
  4379. $globals.Number);
  4380. $core.addMethod(
  4381. $core.method({
  4382. selector: "//",
  4383. protocol: "arithmetic",
  4384. fn: function (aNumber){
  4385. var self=this;
  4386. return $core.withContext(function($ctx1) {
  4387. return $recv(self.__slash(aNumber))._floor();
  4388. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4389. },
  4390. args: ["aNumber"],
  4391. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4392. referencedClasses: [],
  4393. messageSends: ["floor", "/"]
  4394. }),
  4395. $globals.Number);
  4396. $core.addMethod(
  4397. $core.method({
  4398. selector: "<",
  4399. protocol: "comparing",
  4400. fn: function (aNumber){
  4401. var self=this;
  4402. return $core.withContext(function($ctx1) {
  4403. return self < aNumber;
  4404. return self;
  4405. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4406. },
  4407. args: ["aNumber"],
  4408. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4409. referencedClasses: [],
  4410. messageSends: []
  4411. }),
  4412. $globals.Number);
  4413. $core.addMethod(
  4414. $core.method({
  4415. selector: "<=",
  4416. protocol: "comparing",
  4417. fn: function (aNumber){
  4418. var self=this;
  4419. return $core.withContext(function($ctx1) {
  4420. return self <= aNumber;
  4421. return self;
  4422. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4423. },
  4424. args: ["aNumber"],
  4425. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4426. referencedClasses: [],
  4427. messageSends: []
  4428. }),
  4429. $globals.Number);
  4430. $core.addMethod(
  4431. $core.method({
  4432. selector: "==",
  4433. protocol: "comparing",
  4434. fn: function (aNumber){
  4435. var self=this;
  4436. return $core.withContext(function($ctx1) {
  4437. if (typeof aNumber === "number") return Number(self) === aNumber;
  4438. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4439. else return false;;
  4440. return self;
  4441. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4442. },
  4443. args: ["aNumber"],
  4444. source: "== aNumber\x0a<inlineJS: '\x0a\x09if (typeof aNumber === \x22number\x22) return Number(self) === aNumber;\x0a\x09else if (aNumber != null && typeof aNumber === \x22object\x22) return Number(self) === aNumber.valueOf();\x0a\x09else return false;\x0a'>",
  4445. referencedClasses: [],
  4446. messageSends: []
  4447. }),
  4448. $globals.Number);
  4449. $core.addMethod(
  4450. $core.method({
  4451. selector: ">",
  4452. protocol: "comparing",
  4453. fn: function (aNumber){
  4454. var self=this;
  4455. return $core.withContext(function($ctx1) {
  4456. return self > aNumber;
  4457. return self;
  4458. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4459. },
  4460. args: ["aNumber"],
  4461. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  4462. referencedClasses: [],
  4463. messageSends: []
  4464. }),
  4465. $globals.Number);
  4466. $core.addMethod(
  4467. $core.method({
  4468. selector: ">=",
  4469. protocol: "comparing",
  4470. fn: function (aNumber){
  4471. var self=this;
  4472. return $core.withContext(function($ctx1) {
  4473. return self >= aNumber;
  4474. return self;
  4475. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  4476. },
  4477. args: ["aNumber"],
  4478. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  4479. referencedClasses: [],
  4480. messageSends: []
  4481. }),
  4482. $globals.Number);
  4483. $core.addMethod(
  4484. $core.method({
  4485. selector: "@",
  4486. protocol: "converting",
  4487. fn: function (aNumber){
  4488. var self=this;
  4489. return $core.withContext(function($ctx1) {
  4490. return $recv($globals.Point)._x_y_(self,aNumber);
  4491. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  4492. },
  4493. args: ["aNumber"],
  4494. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4495. referencedClasses: ["Point"],
  4496. messageSends: ["x:y:"]
  4497. }),
  4498. $globals.Number);
  4499. $core.addMethod(
  4500. $core.method({
  4501. selector: "\x5c\x5c",
  4502. protocol: "arithmetic",
  4503. fn: function (aNumber){
  4504. var self=this;
  4505. return $core.withContext(function($ctx1) {
  4506. return self % aNumber;
  4507. return self;
  4508. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  4509. },
  4510. args: ["aNumber"],
  4511. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  4512. referencedClasses: [],
  4513. messageSends: []
  4514. }),
  4515. $globals.Number);
  4516. $core.addMethod(
  4517. $core.method({
  4518. selector: "abs",
  4519. protocol: "arithmetic",
  4520. fn: function (){
  4521. var self=this;
  4522. return $core.withContext(function($ctx1) {
  4523. return Math.abs(self);;
  4524. return self;
  4525. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  4526. },
  4527. args: [],
  4528. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  4529. referencedClasses: [],
  4530. messageSends: []
  4531. }),
  4532. $globals.Number);
  4533. $core.addMethod(
  4534. $core.method({
  4535. selector: "arcCos",
  4536. protocol: "mathematical functions",
  4537. fn: function (){
  4538. var self=this;
  4539. return $core.withContext(function($ctx1) {
  4540. return Math.acos(self);;
  4541. return self;
  4542. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  4543. },
  4544. args: [],
  4545. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  4546. referencedClasses: [],
  4547. messageSends: []
  4548. }),
  4549. $globals.Number);
  4550. $core.addMethod(
  4551. $core.method({
  4552. selector: "arcSin",
  4553. protocol: "mathematical functions",
  4554. fn: function (){
  4555. var self=this;
  4556. return $core.withContext(function($ctx1) {
  4557. return Math.asin(self);;
  4558. return self;
  4559. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  4560. },
  4561. args: [],
  4562. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  4563. referencedClasses: [],
  4564. messageSends: []
  4565. }),
  4566. $globals.Number);
  4567. $core.addMethod(
  4568. $core.method({
  4569. selector: "arcTan",
  4570. protocol: "mathematical functions",
  4571. fn: function (){
  4572. var self=this;
  4573. return $core.withContext(function($ctx1) {
  4574. return Math.atan(self);;
  4575. return self;
  4576. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  4577. },
  4578. args: [],
  4579. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  4580. referencedClasses: [],
  4581. messageSends: []
  4582. }),
  4583. $globals.Number);
  4584. $core.addMethod(
  4585. $core.method({
  4586. selector: "asJavaScriptObject",
  4587. protocol: "converting",
  4588. fn: function (){
  4589. var self=this;
  4590. return self;
  4591. },
  4592. args: [],
  4593. source: "asJavaScriptObject\x0a\x09^ self",
  4594. referencedClasses: [],
  4595. messageSends: []
  4596. }),
  4597. $globals.Number);
  4598. $core.addMethod(
  4599. $core.method({
  4600. selector: "asJavaScriptSource",
  4601. protocol: "converting",
  4602. fn: function (){
  4603. var self=this;
  4604. return $core.withContext(function($ctx1) {
  4605. var $1;
  4606. $1=$recv("(".__comma(self._printString())).__comma(")");
  4607. $ctx1.sendIdx[","]=1;
  4608. return $1;
  4609. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  4610. },
  4611. args: [],
  4612. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  4613. referencedClasses: [],
  4614. messageSends: [",", "printString"]
  4615. }),
  4616. $globals.Number);
  4617. $core.addMethod(
  4618. $core.method({
  4619. selector: "asNumber",
  4620. protocol: "converting",
  4621. fn: function (){
  4622. var self=this;
  4623. return self;
  4624. },
  4625. args: [],
  4626. source: "asNumber\x0a\x09^ self",
  4627. referencedClasses: [],
  4628. messageSends: []
  4629. }),
  4630. $globals.Number);
  4631. $core.addMethod(
  4632. $core.method({
  4633. selector: "asPoint",
  4634. protocol: "converting",
  4635. fn: function (){
  4636. var self=this;
  4637. return $core.withContext(function($ctx1) {
  4638. return $recv($globals.Point)._x_y_(self,self);
  4639. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  4640. },
  4641. args: [],
  4642. source: "asPoint\x0a\x09^ Point x: self y: self",
  4643. referencedClasses: ["Point"],
  4644. messageSends: ["x:y:"]
  4645. }),
  4646. $globals.Number);
  4647. $core.addMethod(
  4648. $core.method({
  4649. selector: "asString",
  4650. protocol: "converting",
  4651. fn: function (){
  4652. var self=this;
  4653. return $core.withContext(function($ctx1) {
  4654. return String(self);
  4655. return self;
  4656. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  4657. },
  4658. args: [],
  4659. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  4660. referencedClasses: [],
  4661. messageSends: []
  4662. }),
  4663. $globals.Number);
  4664. $core.addMethod(
  4665. $core.method({
  4666. selector: "atRandom",
  4667. protocol: "converting",
  4668. fn: function (){
  4669. var self=this;
  4670. return $core.withContext(function($ctx1) {
  4671. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  4672. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  4673. },
  4674. args: [],
  4675. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4676. referencedClasses: ["Random"],
  4677. messageSends: ["+", "truncated", "*", "next", "new"]
  4678. }),
  4679. $globals.Number);
  4680. $core.addMethod(
  4681. $core.method({
  4682. selector: "ceiling",
  4683. protocol: "converting",
  4684. fn: function (){
  4685. var self=this;
  4686. return $core.withContext(function($ctx1) {
  4687. return Math.ceil(self);;
  4688. return self;
  4689. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  4690. },
  4691. args: [],
  4692. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  4693. referencedClasses: [],
  4694. messageSends: []
  4695. }),
  4696. $globals.Number);
  4697. $core.addMethod(
  4698. $core.method({
  4699. selector: "copy",
  4700. protocol: "copying",
  4701. fn: function (){
  4702. var self=this;
  4703. return self;
  4704. },
  4705. args: [],
  4706. source: "copy\x0a\x09^ self",
  4707. referencedClasses: [],
  4708. messageSends: []
  4709. }),
  4710. $globals.Number);
  4711. $core.addMethod(
  4712. $core.method({
  4713. selector: "cos",
  4714. protocol: "mathematical functions",
  4715. fn: function (){
  4716. var self=this;
  4717. return $core.withContext(function($ctx1) {
  4718. return Math.cos(self);;
  4719. return self;
  4720. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  4721. },
  4722. args: [],
  4723. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  4724. referencedClasses: [],
  4725. messageSends: []
  4726. }),
  4727. $globals.Number);
  4728. $core.addMethod(
  4729. $core.method({
  4730. selector: "deepCopy",
  4731. protocol: "copying",
  4732. fn: function (){
  4733. var self=this;
  4734. return $core.withContext(function($ctx1) {
  4735. return self._copy();
  4736. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  4737. },
  4738. args: [],
  4739. source: "deepCopy\x0a\x09^ self copy",
  4740. referencedClasses: [],
  4741. messageSends: ["copy"]
  4742. }),
  4743. $globals.Number);
  4744. $core.addMethod(
  4745. $core.method({
  4746. selector: "even",
  4747. protocol: "testing",
  4748. fn: function (){
  4749. var self=this;
  4750. return $core.withContext(function($ctx1) {
  4751. return (0).__eq(self.__backslash_backslash((2)));
  4752. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  4753. },
  4754. args: [],
  4755. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4756. referencedClasses: [],
  4757. messageSends: ["=", "\x5c\x5c"]
  4758. }),
  4759. $globals.Number);
  4760. $core.addMethod(
  4761. $core.method({
  4762. selector: "floor",
  4763. protocol: "converting",
  4764. fn: function (){
  4765. var self=this;
  4766. return $core.withContext(function($ctx1) {
  4767. return Math.floor(self);;
  4768. return self;
  4769. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  4770. },
  4771. args: [],
  4772. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  4773. referencedClasses: [],
  4774. messageSends: []
  4775. }),
  4776. $globals.Number);
  4777. $core.addMethod(
  4778. $core.method({
  4779. selector: "isImmutable",
  4780. protocol: "testing",
  4781. fn: function (){
  4782. var self=this;
  4783. return true;
  4784. },
  4785. args: [],
  4786. source: "isImmutable\x0a\x09^ true",
  4787. referencedClasses: [],
  4788. messageSends: []
  4789. }),
  4790. $globals.Number);
  4791. $core.addMethod(
  4792. $core.method({
  4793. selector: "isNumber",
  4794. protocol: "testing",
  4795. fn: function (){
  4796. var self=this;
  4797. return true;
  4798. },
  4799. args: [],
  4800. source: "isNumber\x0a\x09^ true",
  4801. referencedClasses: [],
  4802. messageSends: []
  4803. }),
  4804. $globals.Number);
  4805. $core.addMethod(
  4806. $core.method({
  4807. selector: "isZero",
  4808. protocol: "testing",
  4809. fn: function (){
  4810. var self=this;
  4811. return $core.withContext(function($ctx1) {
  4812. return self.__eq((0));
  4813. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  4814. },
  4815. args: [],
  4816. source: "isZero\x0a\x09^ self = 0",
  4817. referencedClasses: [],
  4818. messageSends: ["="]
  4819. }),
  4820. $globals.Number);
  4821. $core.addMethod(
  4822. $core.method({
  4823. selector: "ln",
  4824. protocol: "mathematical functions",
  4825. fn: function (){
  4826. var self=this;
  4827. return $core.withContext(function($ctx1) {
  4828. return Math.log(self);;
  4829. return self;
  4830. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  4831. },
  4832. args: [],
  4833. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  4834. referencedClasses: [],
  4835. messageSends: []
  4836. }),
  4837. $globals.Number);
  4838. $core.addMethod(
  4839. $core.method({
  4840. selector: "log",
  4841. protocol: "mathematical functions",
  4842. fn: function (){
  4843. var self=this;
  4844. return $core.withContext(function($ctx1) {
  4845. return Math.log(self) / Math.LN10;;
  4846. return self;
  4847. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  4848. },
  4849. args: [],
  4850. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  4851. referencedClasses: [],
  4852. messageSends: []
  4853. }),
  4854. $globals.Number);
  4855. $core.addMethod(
  4856. $core.method({
  4857. selector: "log:",
  4858. protocol: "mathematical functions",
  4859. fn: function (aNumber){
  4860. var self=this;
  4861. return $core.withContext(function($ctx1) {
  4862. return Math.log(self) / Math.log(aNumber);;
  4863. return self;
  4864. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4865. },
  4866. args: ["aNumber"],
  4867. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  4868. referencedClasses: [],
  4869. messageSends: []
  4870. }),
  4871. $globals.Number);
  4872. $core.addMethod(
  4873. $core.method({
  4874. selector: "max:",
  4875. protocol: "arithmetic",
  4876. fn: function (aNumber){
  4877. var self=this;
  4878. return $core.withContext(function($ctx1) {
  4879. return Math.max(self, aNumber);;
  4880. return self;
  4881. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4882. },
  4883. args: ["aNumber"],
  4884. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  4885. referencedClasses: [],
  4886. messageSends: []
  4887. }),
  4888. $globals.Number);
  4889. $core.addMethod(
  4890. $core.method({
  4891. selector: "min:",
  4892. protocol: "arithmetic",
  4893. fn: function (aNumber){
  4894. var self=this;
  4895. return $core.withContext(function($ctx1) {
  4896. return Math.min(self, aNumber);;
  4897. return self;
  4898. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4899. },
  4900. args: ["aNumber"],
  4901. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  4902. referencedClasses: [],
  4903. messageSends: []
  4904. }),
  4905. $globals.Number);
  4906. $core.addMethod(
  4907. $core.method({
  4908. selector: "negated",
  4909. protocol: "arithmetic",
  4910. fn: function (){
  4911. var self=this;
  4912. return $core.withContext(function($ctx1) {
  4913. return (0).__minus(self);
  4914. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4915. },
  4916. args: [],
  4917. source: "negated\x0a\x09^ 0 - self",
  4918. referencedClasses: [],
  4919. messageSends: ["-"]
  4920. }),
  4921. $globals.Number);
  4922. $core.addMethod(
  4923. $core.method({
  4924. selector: "negative",
  4925. protocol: "testing",
  4926. fn: function (){
  4927. var self=this;
  4928. return $core.withContext(function($ctx1) {
  4929. return self.__lt((0));
  4930. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4931. },
  4932. args: [],
  4933. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4934. referencedClasses: [],
  4935. messageSends: ["<"]
  4936. }),
  4937. $globals.Number);
  4938. $core.addMethod(
  4939. $core.method({
  4940. selector: "odd",
  4941. protocol: "testing",
  4942. fn: function (){
  4943. var self=this;
  4944. return $core.withContext(function($ctx1) {
  4945. return $recv(self._even())._not();
  4946. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4947. },
  4948. args: [],
  4949. source: "odd\x0a\x09^ self even not",
  4950. referencedClasses: [],
  4951. messageSends: ["not", "even"]
  4952. }),
  4953. $globals.Number);
  4954. $core.addMethod(
  4955. $core.method({
  4956. selector: "positive",
  4957. protocol: "testing",
  4958. fn: function (){
  4959. var self=this;
  4960. return $core.withContext(function($ctx1) {
  4961. return self.__gt_eq((0));
  4962. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4963. },
  4964. args: [],
  4965. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4966. referencedClasses: [],
  4967. messageSends: [">="]
  4968. }),
  4969. $globals.Number);
  4970. $core.addMethod(
  4971. $core.method({
  4972. selector: "printOn:",
  4973. protocol: "printing",
  4974. fn: function (aStream){
  4975. var self=this;
  4976. return $core.withContext(function($ctx1) {
  4977. $recv(aStream)._nextPutAll_(self._asString());
  4978. return self;
  4979. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4980. },
  4981. args: ["aStream"],
  4982. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4983. referencedClasses: [],
  4984. messageSends: ["nextPutAll:", "asString"]
  4985. }),
  4986. $globals.Number);
  4987. $core.addMethod(
  4988. $core.method({
  4989. selector: "printShowingDecimalPlaces:",
  4990. protocol: "printing",
  4991. fn: function (placesDesired){
  4992. var self=this;
  4993. return $core.withContext(function($ctx1) {
  4994. return self.toFixed(placesDesired);
  4995. return self;
  4996. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4997. },
  4998. args: ["placesDesired"],
  4999. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5000. referencedClasses: [],
  5001. messageSends: []
  5002. }),
  5003. $globals.Number);
  5004. $core.addMethod(
  5005. $core.method({
  5006. selector: "raisedTo:",
  5007. protocol: "mathematical functions",
  5008. fn: function (exponent){
  5009. var self=this;
  5010. return $core.withContext(function($ctx1) {
  5011. return Math.pow(self, exponent);;
  5012. return self;
  5013. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5014. },
  5015. args: ["exponent"],
  5016. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5017. referencedClasses: [],
  5018. messageSends: []
  5019. }),
  5020. $globals.Number);
  5021. $core.addMethod(
  5022. $core.method({
  5023. selector: "rounded",
  5024. protocol: "converting",
  5025. fn: function (){
  5026. var self=this;
  5027. return $core.withContext(function($ctx1) {
  5028. return Math.round(self);;
  5029. return self;
  5030. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5031. },
  5032. args: [],
  5033. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5034. referencedClasses: [],
  5035. messageSends: []
  5036. }),
  5037. $globals.Number);
  5038. $core.addMethod(
  5039. $core.method({
  5040. selector: "sign",
  5041. protocol: "mathematical functions",
  5042. fn: function (){
  5043. var self=this;
  5044. return $core.withContext(function($ctx1) {
  5045. var $1,$2;
  5046. $1=self._isZero();
  5047. if($core.assert($1)){
  5048. return (0);
  5049. }
  5050. $2=self._positive();
  5051. if($core.assert($2)){
  5052. return (1);
  5053. } else {
  5054. return (-1);
  5055. }
  5056. return self;
  5057. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5058. },
  5059. args: [],
  5060. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5061. referencedClasses: [],
  5062. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5063. }),
  5064. $globals.Number);
  5065. $core.addMethod(
  5066. $core.method({
  5067. selector: "sin",
  5068. protocol: "mathematical functions",
  5069. fn: function (){
  5070. var self=this;
  5071. return $core.withContext(function($ctx1) {
  5072. return Math.sin(self);;
  5073. return self;
  5074. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5075. },
  5076. args: [],
  5077. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5078. referencedClasses: [],
  5079. messageSends: []
  5080. }),
  5081. $globals.Number);
  5082. $core.addMethod(
  5083. $core.method({
  5084. selector: "sqrt",
  5085. protocol: "mathematical functions",
  5086. fn: function (){
  5087. var self=this;
  5088. return $core.withContext(function($ctx1) {
  5089. return Math.sqrt(self);
  5090. return self;
  5091. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5092. },
  5093. args: [],
  5094. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5095. referencedClasses: [],
  5096. messageSends: []
  5097. }),
  5098. $globals.Number);
  5099. $core.addMethod(
  5100. $core.method({
  5101. selector: "squared",
  5102. protocol: "mathematical functions",
  5103. fn: function (){
  5104. var self=this;
  5105. return $core.withContext(function($ctx1) {
  5106. return self.__star(self);
  5107. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5108. },
  5109. args: [],
  5110. source: "squared\x0a\x09^ self * self",
  5111. referencedClasses: [],
  5112. messageSends: ["*"]
  5113. }),
  5114. $globals.Number);
  5115. $core.addMethod(
  5116. $core.method({
  5117. selector: "tan",
  5118. protocol: "mathematical functions",
  5119. fn: function (){
  5120. var self=this;
  5121. return $core.withContext(function($ctx1) {
  5122. return Math.tan(self);;
  5123. return self;
  5124. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5125. },
  5126. args: [],
  5127. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5128. referencedClasses: [],
  5129. messageSends: []
  5130. }),
  5131. $globals.Number);
  5132. $core.addMethod(
  5133. $core.method({
  5134. selector: "timesRepeat:",
  5135. protocol: "enumerating",
  5136. fn: function (aBlock){
  5137. var self=this;
  5138. var count;
  5139. return $core.withContext(function($ctx1) {
  5140. count=(1);
  5141. $recv((function(){
  5142. return $core.withContext(function($ctx2) {
  5143. return $recv(count).__gt(self);
  5144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5145. }))._whileFalse_((function(){
  5146. return $core.withContext(function($ctx2) {
  5147. $recv(aBlock)._value();
  5148. count=$recv(count).__plus((1));
  5149. return count;
  5150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5151. }));
  5152. return self;
  5153. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5154. },
  5155. args: ["aBlock"],
  5156. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5157. referencedClasses: [],
  5158. messageSends: ["whileFalse:", ">", "value", "+"]
  5159. }),
  5160. $globals.Number);
  5161. $core.addMethod(
  5162. $core.method({
  5163. selector: "to:",
  5164. protocol: "converting",
  5165. fn: function (aNumber){
  5166. var self=this;
  5167. var array,first,last,count;
  5168. return $core.withContext(function($ctx1) {
  5169. first=self._truncated();
  5170. $ctx1.sendIdx["truncated"]=1;
  5171. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5172. $ctx1.sendIdx["+"]=1;
  5173. count=(1);
  5174. array=$recv($globals.Array)._new();
  5175. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5176. return $core.withContext(function($ctx2) {
  5177. $recv(array)._at_put_(count,first);
  5178. count=$recv(count).__plus((1));
  5179. $ctx2.sendIdx["+"]=2;
  5180. count;
  5181. first=$recv(first).__plus((1));
  5182. return first;
  5183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5184. }));
  5185. return array;
  5186. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5187. },
  5188. args: ["aNumber"],
  5189. source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1 ].\x0a\x09^ array",
  5190. referencedClasses: ["Array"],
  5191. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5192. }),
  5193. $globals.Number);
  5194. $core.addMethod(
  5195. $core.method({
  5196. selector: "to:by:",
  5197. protocol: "converting",
  5198. fn: function (stop,step){
  5199. var self=this;
  5200. var array,value,pos;
  5201. return $core.withContext(function($ctx1) {
  5202. var $1,$2;
  5203. value=self;
  5204. array=$recv($globals.Array)._new();
  5205. pos=(1);
  5206. $1=$recv(step).__eq((0));
  5207. if($core.assert($1)){
  5208. self._error_("step must be non-zero");
  5209. }
  5210. $2=$recv(step).__lt((0));
  5211. if($core.assert($2)){
  5212. $recv((function(){
  5213. return $core.withContext(function($ctx2) {
  5214. return $recv(value).__gt_eq(stop);
  5215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5216. }))._whileTrue_((function(){
  5217. return $core.withContext(function($ctx2) {
  5218. $recv(array)._at_put_(pos,value);
  5219. $ctx2.sendIdx["at:put:"]=1;
  5220. pos=$recv(pos).__plus((1));
  5221. $ctx2.sendIdx["+"]=1;
  5222. pos;
  5223. value=$recv(value).__plus(step);
  5224. $ctx2.sendIdx["+"]=2;
  5225. return value;
  5226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5227. }));
  5228. $ctx1.sendIdx["whileTrue:"]=1;
  5229. } else {
  5230. $recv((function(){
  5231. return $core.withContext(function($ctx2) {
  5232. return $recv(value).__lt_eq(stop);
  5233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5234. }))._whileTrue_((function(){
  5235. return $core.withContext(function($ctx2) {
  5236. $recv(array)._at_put_(pos,value);
  5237. pos=$recv(pos).__plus((1));
  5238. $ctx2.sendIdx["+"]=3;
  5239. pos;
  5240. value=$recv(value).__plus(step);
  5241. return value;
  5242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5243. }));
  5244. }
  5245. return array;
  5246. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5247. },
  5248. args: ["stop", "step"],
  5249. source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]].\x0a\x09^ array",
  5250. referencedClasses: ["Array"],
  5251. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5252. }),
  5253. $globals.Number);
  5254. $core.addMethod(
  5255. $core.method({
  5256. selector: "to:by:do:",
  5257. protocol: "enumerating",
  5258. fn: function (stop,step,aBlock){
  5259. var self=this;
  5260. var value;
  5261. return $core.withContext(function($ctx1) {
  5262. var $1,$2;
  5263. value=self;
  5264. $1=$recv(step).__eq((0));
  5265. if($core.assert($1)){
  5266. self._error_("step must be non-zero");
  5267. }
  5268. $2=$recv(step).__lt((0));
  5269. if($core.assert($2)){
  5270. $recv((function(){
  5271. return $core.withContext(function($ctx2) {
  5272. return $recv(value).__gt_eq(stop);
  5273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5274. }))._whileTrue_((function(){
  5275. return $core.withContext(function($ctx2) {
  5276. $recv(aBlock)._value_(value);
  5277. $ctx2.sendIdx["value:"]=1;
  5278. value=$recv(value).__plus(step);
  5279. $ctx2.sendIdx["+"]=1;
  5280. return value;
  5281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5282. }));
  5283. $ctx1.sendIdx["whileTrue:"]=1;
  5284. } else {
  5285. $recv((function(){
  5286. return $core.withContext(function($ctx2) {
  5287. return $recv(value).__lt_eq(stop);
  5288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5289. }))._whileTrue_((function(){
  5290. return $core.withContext(function($ctx2) {
  5291. $recv(aBlock)._value_(value);
  5292. value=$recv(value).__plus(step);
  5293. return value;
  5294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5295. }));
  5296. }
  5297. return self;
  5298. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  5299. },
  5300. args: ["stop", "step", "aBlock"],
  5301. source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]",
  5302. referencedClasses: [],
  5303. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  5304. }),
  5305. $globals.Number);
  5306. $core.addMethod(
  5307. $core.method({
  5308. selector: "to:do:",
  5309. protocol: "enumerating",
  5310. fn: function (stop,aBlock){
  5311. var self=this;
  5312. var nextValue;
  5313. return $core.withContext(function($ctx1) {
  5314. nextValue=self;
  5315. $recv((function(){
  5316. return $core.withContext(function($ctx2) {
  5317. return $recv(nextValue).__lt_eq(stop);
  5318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5319. }))._whileTrue_((function(){
  5320. return $core.withContext(function($ctx2) {
  5321. $recv(aBlock)._value_(nextValue);
  5322. nextValue=$recv(nextValue).__plus((1));
  5323. return nextValue;
  5324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5325. }));
  5326. return self;
  5327. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  5328. },
  5329. args: ["stop", "aBlock"],
  5330. source: "to: stop do: aBlock\x0a\x09\x22Evaluate aBlock for each number from self to aNumber.\x22\x0a\x09| nextValue |\x0a\x09nextValue := self.\x0a\x09[ nextValue <= stop ]\x0a\x09\x09whileTrue:\x0a\x09\x09\x09[ aBlock value: nextValue.\x0a\x09\x09\x09nextValue := nextValue + 1 ]",
  5331. referencedClasses: [],
  5332. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5333. }),
  5334. $globals.Number);
  5335. $core.addMethod(
  5336. $core.method({
  5337. selector: "truncated",
  5338. protocol: "converting",
  5339. fn: function (){
  5340. var self=this;
  5341. return $core.withContext(function($ctx1) {
  5342. if(self >= 0) {
  5343. return Math.floor(self);
  5344. } else {
  5345. return Math.floor(self * (-1)) * (-1);
  5346. };
  5347. ;
  5348. return self;
  5349. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5350. },
  5351. args: [],
  5352. source: "truncated\x0a\x09<inlineJS: '\x0a\x09\x09if(self >= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09'>",
  5353. referencedClasses: [],
  5354. messageSends: []
  5355. }),
  5356. $globals.Number);
  5357. $core.addMethod(
  5358. $core.method({
  5359. selector: "|",
  5360. protocol: "converting",
  5361. fn: function (aNumber){
  5362. var self=this;
  5363. return $core.withContext(function($ctx1) {
  5364. return self | aNumber;
  5365. return self;
  5366. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  5367. },
  5368. args: ["aNumber"],
  5369. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5370. referencedClasses: [],
  5371. messageSends: []
  5372. }),
  5373. $globals.Number);
  5374. $core.addMethod(
  5375. $core.method({
  5376. selector: "classTag",
  5377. protocol: "accessing",
  5378. fn: function (){
  5379. var self=this;
  5380. return "magnitude";
  5381. },
  5382. args: [],
  5383. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  5384. referencedClasses: [],
  5385. messageSends: []
  5386. }),
  5387. $globals.Number.klass);
  5388. $core.addMethod(
  5389. $core.method({
  5390. selector: "e",
  5391. protocol: "instance creation",
  5392. fn: function (){
  5393. var self=this;
  5394. return $core.withContext(function($ctx1) {
  5395. return Math.E;;
  5396. return self;
  5397. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  5398. },
  5399. args: [],
  5400. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  5401. referencedClasses: [],
  5402. messageSends: []
  5403. }),
  5404. $globals.Number.klass);
  5405. $core.addMethod(
  5406. $core.method({
  5407. selector: "pi",
  5408. protocol: "instance creation",
  5409. fn: function (){
  5410. var self=this;
  5411. return $core.withContext(function($ctx1) {
  5412. return Math.PI;
  5413. return self;
  5414. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  5415. },
  5416. args: [],
  5417. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  5418. referencedClasses: [],
  5419. messageSends: []
  5420. }),
  5421. $globals.Number.klass);
  5422. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  5423. $globals.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22";
  5424. $core.addMethod(
  5425. $core.method({
  5426. selector: "*",
  5427. protocol: "arithmetic",
  5428. fn: function (aPoint){
  5429. var self=this;
  5430. return $core.withContext(function($ctx1) {
  5431. var $2,$4,$3,$1,$6,$5;
  5432. $2=self._x();
  5433. $ctx1.sendIdx["x"]=1;
  5434. $4=$recv(aPoint)._asPoint();
  5435. $ctx1.sendIdx["asPoint"]=1;
  5436. $3=$recv($4)._x();
  5437. $1=$recv($2).__star($3);
  5438. $ctx1.sendIdx["*"]=1;
  5439. $6=self._y();
  5440. $ctx1.sendIdx["y"]=1;
  5441. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  5442. return $recv($globals.Point)._x_y_($1,$5);
  5443. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  5444. },
  5445. args: ["aPoint"],
  5446. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5447. referencedClasses: ["Point"],
  5448. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5449. }),
  5450. $globals.Point);
  5451. $core.addMethod(
  5452. $core.method({
  5453. selector: "+",
  5454. protocol: "arithmetic",
  5455. fn: function (aPoint){
  5456. var self=this;
  5457. return $core.withContext(function($ctx1) {
  5458. var $2,$4,$3,$1,$6,$5;
  5459. $2=self._x();
  5460. $ctx1.sendIdx["x"]=1;
  5461. $4=$recv(aPoint)._asPoint();
  5462. $ctx1.sendIdx["asPoint"]=1;
  5463. $3=$recv($4)._x();
  5464. $1=$recv($2).__plus($3);
  5465. $ctx1.sendIdx["+"]=1;
  5466. $6=self._y();
  5467. $ctx1.sendIdx["y"]=1;
  5468. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  5469. return $recv($globals.Point)._x_y_($1,$5);
  5470. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  5471. },
  5472. args: ["aPoint"],
  5473. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5474. referencedClasses: ["Point"],
  5475. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  5476. }),
  5477. $globals.Point);
  5478. $core.addMethod(
  5479. $core.method({
  5480. selector: "-",
  5481. protocol: "arithmetic",
  5482. fn: function (aPoint){
  5483. var self=this;
  5484. return $core.withContext(function($ctx1) {
  5485. var $2,$4,$3,$1,$6,$5;
  5486. $2=self._x();
  5487. $ctx1.sendIdx["x"]=1;
  5488. $4=$recv(aPoint)._asPoint();
  5489. $ctx1.sendIdx["asPoint"]=1;
  5490. $3=$recv($4)._x();
  5491. $1=$recv($2).__minus($3);
  5492. $ctx1.sendIdx["-"]=1;
  5493. $6=self._y();
  5494. $ctx1.sendIdx["y"]=1;
  5495. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  5496. return $recv($globals.Point)._x_y_($1,$5);
  5497. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  5498. },
  5499. args: ["aPoint"],
  5500. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5501. referencedClasses: ["Point"],
  5502. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  5503. }),
  5504. $globals.Point);
  5505. $core.addMethod(
  5506. $core.method({
  5507. selector: "/",
  5508. protocol: "arithmetic",
  5509. fn: function (aPoint){
  5510. var self=this;
  5511. return $core.withContext(function($ctx1) {
  5512. var $2,$4,$3,$1,$6,$5;
  5513. $2=self._x();
  5514. $ctx1.sendIdx["x"]=1;
  5515. $4=$recv(aPoint)._asPoint();
  5516. $ctx1.sendIdx["asPoint"]=1;
  5517. $3=$recv($4)._x();
  5518. $1=$recv($2).__slash($3);
  5519. $ctx1.sendIdx["/"]=1;
  5520. $6=self._y();
  5521. $ctx1.sendIdx["y"]=1;
  5522. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  5523. return $recv($globals.Point)._x_y_($1,$5);
  5524. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  5525. },
  5526. args: ["aPoint"],
  5527. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5528. referencedClasses: ["Point"],
  5529. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  5530. }),
  5531. $globals.Point);
  5532. $core.addMethod(
  5533. $core.method({
  5534. selector: "<",
  5535. protocol: "comparing",
  5536. fn: function (aPoint){
  5537. var self=this;
  5538. return $core.withContext(function($ctx1) {
  5539. var $2,$1,$3;
  5540. $2=self._x();
  5541. $ctx1.sendIdx["x"]=1;
  5542. $1=$recv($2).__lt($recv(aPoint)._x());
  5543. $ctx1.sendIdx["<"]=1;
  5544. return $recv($1)._and_((function(){
  5545. return $core.withContext(function($ctx2) {
  5546. $3=self._y();
  5547. $ctx2.sendIdx["y"]=1;
  5548. return $recv($3).__lt($recv(aPoint)._y());
  5549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5550. }));
  5551. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  5552. },
  5553. args: ["aPoint"],
  5554. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  5555. referencedClasses: [],
  5556. messageSends: ["and:", "<", "x", "y"]
  5557. }),
  5558. $globals.Point);
  5559. $core.addMethod(
  5560. $core.method({
  5561. selector: "<=",
  5562. protocol: "comparing",
  5563. fn: function (aPoint){
  5564. var self=this;
  5565. return $core.withContext(function($ctx1) {
  5566. var $2,$1,$3;
  5567. $2=self._x();
  5568. $ctx1.sendIdx["x"]=1;
  5569. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  5570. $ctx1.sendIdx["<="]=1;
  5571. return $recv($1)._and_((function(){
  5572. return $core.withContext(function($ctx2) {
  5573. $3=self._y();
  5574. $ctx2.sendIdx["y"]=1;
  5575. return $recv($3).__lt_eq($recv(aPoint)._y());
  5576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5577. }));
  5578. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  5579. },
  5580. args: ["aPoint"],
  5581. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  5582. referencedClasses: [],
  5583. messageSends: ["and:", "<=", "x", "y"]
  5584. }),
  5585. $globals.Point);
  5586. $core.addMethod(
  5587. $core.method({
  5588. selector: "=",
  5589. protocol: "comparing",
  5590. fn: function (aPoint){
  5591. var self=this;
  5592. return $core.withContext(function($ctx1) {
  5593. var $2,$1,$4,$3,$6,$5;
  5594. $2=$recv(aPoint)._class();
  5595. $ctx1.sendIdx["class"]=1;
  5596. $1=$recv($2).__eq(self._class());
  5597. $ctx1.sendIdx["="]=1;
  5598. return $recv($1)._and_((function(){
  5599. return $core.withContext(function($ctx2) {
  5600. $4=$recv(aPoint)._x();
  5601. $ctx2.sendIdx["x"]=1;
  5602. $3=$recv($4).__eq(self._x());
  5603. $ctx2.sendIdx["="]=2;
  5604. $6=$recv(aPoint)._y();
  5605. $ctx2.sendIdx["y"]=1;
  5606. $5=$recv($6).__eq(self._y());
  5607. return $recv($3).__and($5);
  5608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5609. }));
  5610. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  5611. },
  5612. args: ["aPoint"],
  5613. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  5614. referencedClasses: [],
  5615. messageSends: ["and:", "=", "class", "&", "x", "y"]
  5616. }),
  5617. $globals.Point);
  5618. $core.addMethod(
  5619. $core.method({
  5620. selector: ">",
  5621. protocol: "comparing",
  5622. fn: function (aPoint){
  5623. var self=this;
  5624. return $core.withContext(function($ctx1) {
  5625. var $2,$1,$3;
  5626. $2=self._x();
  5627. $ctx1.sendIdx["x"]=1;
  5628. $1=$recv($2).__gt($recv(aPoint)._x());
  5629. $ctx1.sendIdx[">"]=1;
  5630. return $recv($1)._and_((function(){
  5631. return $core.withContext(function($ctx2) {
  5632. $3=self._y();
  5633. $ctx2.sendIdx["y"]=1;
  5634. return $recv($3).__gt($recv(aPoint)._y());
  5635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5636. }));
  5637. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  5638. },
  5639. args: ["aPoint"],
  5640. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  5641. referencedClasses: [],
  5642. messageSends: ["and:", ">", "x", "y"]
  5643. }),
  5644. $globals.Point);
  5645. $core.addMethod(
  5646. $core.method({
  5647. selector: ">=",
  5648. protocol: "comparing",
  5649. fn: function (aPoint){
  5650. var self=this;
  5651. return $core.withContext(function($ctx1) {
  5652. var $2,$1,$3;
  5653. $2=self._x();
  5654. $ctx1.sendIdx["x"]=1;
  5655. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  5656. $ctx1.sendIdx[">="]=1;
  5657. return $recv($1)._and_((function(){
  5658. return $core.withContext(function($ctx2) {
  5659. $3=self._y();
  5660. $ctx2.sendIdx["y"]=1;
  5661. return $recv($3).__gt_eq($recv(aPoint)._y());
  5662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5663. }));
  5664. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  5665. },
  5666. args: ["aPoint"],
  5667. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  5668. referencedClasses: [],
  5669. messageSends: ["and:", ">=", "x", "y"]
  5670. }),
  5671. $globals.Point);
  5672. $core.addMethod(
  5673. $core.method({
  5674. selector: "asPoint",
  5675. protocol: "converting",
  5676. fn: function (){
  5677. var self=this;
  5678. return self;
  5679. },
  5680. args: [],
  5681. source: "asPoint\x0a\x09^ self",
  5682. referencedClasses: [],
  5683. messageSends: []
  5684. }),
  5685. $globals.Point);
  5686. $core.addMethod(
  5687. $core.method({
  5688. selector: "dist:",
  5689. protocol: "transforming",
  5690. fn: function (aPoint){
  5691. var self=this;
  5692. var dx,dy;
  5693. return $core.withContext(function($ctx1) {
  5694. var $2,$1;
  5695. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  5696. $ctx1.sendIdx["-"]=1;
  5697. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  5698. $2=$recv(dx).__star(dx);
  5699. $ctx1.sendIdx["*"]=1;
  5700. $1=$recv($2).__plus($recv(dy).__star(dy));
  5701. return $recv($1)._sqrt();
  5702. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  5703. },
  5704. args: ["aPoint"],
  5705. source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt",
  5706. referencedClasses: [],
  5707. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  5708. }),
  5709. $globals.Point);
  5710. $core.addMethod(
  5711. $core.method({
  5712. selector: "printOn:",
  5713. protocol: "printing",
  5714. fn: function (aStream){
  5715. var self=this;
  5716. return $core.withContext(function($ctx1) {
  5717. var $1;
  5718. $recv(self["@x"])._printOn_(aStream);
  5719. $ctx1.sendIdx["printOn:"]=1;
  5720. $recv(aStream)._nextPutAll_("@");
  5721. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  5722. return $core.withContext(function($ctx2) {
  5723. return $recv(self["@y"])._negative();
  5724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5725. }));
  5726. if($core.assert($1)){
  5727. $recv(aStream)._space();
  5728. }
  5729. $recv(self["@y"])._printOn_(aStream);
  5730. return self;
  5731. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  5732. },
  5733. args: ["aStream"],
  5734. source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [ y negative ]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream",
  5735. referencedClasses: [],
  5736. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  5737. }),
  5738. $globals.Point);
  5739. $core.addMethod(
  5740. $core.method({
  5741. selector: "translateBy:",
  5742. protocol: "transforming",
  5743. fn: function (delta){
  5744. var self=this;
  5745. return $core.withContext(function($ctx1) {
  5746. var $1;
  5747. $1=$recv($recv(delta)._x()).__plus(self["@x"]);
  5748. $ctx1.sendIdx["+"]=1;
  5749. return $recv($1).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  5750. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  5751. },
  5752. args: ["delta"],
  5753. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  5754. referencedClasses: [],
  5755. messageSends: ["@", "+", "x", "y"]
  5756. }),
  5757. $globals.Point);
  5758. $core.addMethod(
  5759. $core.method({
  5760. selector: "x",
  5761. protocol: "accessing",
  5762. fn: function (){
  5763. var self=this;
  5764. return self["@x"];
  5765. },
  5766. args: [],
  5767. source: "x\x0a\x09^ x",
  5768. referencedClasses: [],
  5769. messageSends: []
  5770. }),
  5771. $globals.Point);
  5772. $core.addMethod(
  5773. $core.method({
  5774. selector: "x:",
  5775. protocol: "accessing",
  5776. fn: function (aNumber){
  5777. var self=this;
  5778. self["@x"]=aNumber;
  5779. return self;
  5780. },
  5781. args: ["aNumber"],
  5782. source: "x: aNumber\x0a\x09x := aNumber",
  5783. referencedClasses: [],
  5784. messageSends: []
  5785. }),
  5786. $globals.Point);
  5787. $core.addMethod(
  5788. $core.method({
  5789. selector: "y",
  5790. protocol: "accessing",
  5791. fn: function (){
  5792. var self=this;
  5793. return self["@y"];
  5794. },
  5795. args: [],
  5796. source: "y\x0a\x09^ y",
  5797. referencedClasses: [],
  5798. messageSends: []
  5799. }),
  5800. $globals.Point);
  5801. $core.addMethod(
  5802. $core.method({
  5803. selector: "y:",
  5804. protocol: "accessing",
  5805. fn: function (aNumber){
  5806. var self=this;
  5807. self["@y"]=aNumber;
  5808. return self;
  5809. },
  5810. args: ["aNumber"],
  5811. source: "y: aNumber\x0a\x09y := aNumber",
  5812. referencedClasses: [],
  5813. messageSends: []
  5814. }),
  5815. $globals.Point);
  5816. $core.addMethod(
  5817. $core.method({
  5818. selector: "classTag",
  5819. protocol: "accessing",
  5820. fn: function (){
  5821. var self=this;
  5822. return "magnitude";
  5823. },
  5824. args: [],
  5825. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  5826. referencedClasses: [],
  5827. messageSends: []
  5828. }),
  5829. $globals.Point.klass);
  5830. $core.addMethod(
  5831. $core.method({
  5832. selector: "x:y:",
  5833. protocol: "instance creation",
  5834. fn: function (aNumber,anotherNumber){
  5835. var self=this;
  5836. return $core.withContext(function($ctx1) {
  5837. var $1;
  5838. $1=self._new();
  5839. $recv($1)._x_(aNumber);
  5840. $recv($1)._y_(anotherNumber);
  5841. return $recv($1)._yourself();
  5842. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5843. },
  5844. args: ["aNumber", "anotherNumber"],
  5845. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5846. referencedClasses: [],
  5847. messageSends: ["x:", "new", "y:", "yourself"]
  5848. }),
  5849. $globals.Point.klass);
  5850. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  5851. $globals.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.";
  5852. $core.addMethod(
  5853. $core.method({
  5854. selector: "next",
  5855. protocol: "accessing",
  5856. fn: function (){
  5857. var self=this;
  5858. return $core.withContext(function($ctx1) {
  5859. return Math.random();
  5860. return self;
  5861. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5862. },
  5863. args: [],
  5864. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  5865. referencedClasses: [],
  5866. messageSends: []
  5867. }),
  5868. $globals.Random);
  5869. $core.addMethod(
  5870. $core.method({
  5871. selector: "next:",
  5872. protocol: "accessing",
  5873. fn: function (anInteger){
  5874. var self=this;
  5875. return $core.withContext(function($ctx1) {
  5876. return $recv((1)._to_(anInteger))._collect_((function(each){
  5877. return $core.withContext(function($ctx2) {
  5878. return self._next();
  5879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5880. }));
  5881. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5882. },
  5883. args: ["anInteger"],
  5884. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5885. referencedClasses: [],
  5886. messageSends: ["collect:", "to:", "next"]
  5887. }),
  5888. $globals.Random);
  5889. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  5890. $globals.UndefinedObject.comment="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.";
  5891. $core.addMethod(
  5892. $core.method({
  5893. selector: "asJavaScriptObject",
  5894. protocol: "converting",
  5895. fn: function (){
  5896. var self=this;
  5897. return null;
  5898. },
  5899. args: [],
  5900. source: "asJavaScriptObject\x0a\x09^ null",
  5901. referencedClasses: [],
  5902. messageSends: []
  5903. }),
  5904. $globals.UndefinedObject);
  5905. $core.addMethod(
  5906. $core.method({
  5907. selector: "deepCopy",
  5908. protocol: "copying",
  5909. fn: function (){
  5910. var self=this;
  5911. return self;
  5912. },
  5913. args: [],
  5914. source: "deepCopy\x0a\x09^ self",
  5915. referencedClasses: [],
  5916. messageSends: []
  5917. }),
  5918. $globals.UndefinedObject);
  5919. $core.addMethod(
  5920. $core.method({
  5921. selector: "ifNil:",
  5922. protocol: "testing",
  5923. fn: function (aBlock){
  5924. var self=this;
  5925. return $core.withContext(function($ctx1) {
  5926. return self._ifNil_ifNotNil_(aBlock,(function(){
  5927. }));
  5928. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5929. },
  5930. args: ["aBlock"],
  5931. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5932. referencedClasses: [],
  5933. messageSends: ["ifNil:ifNotNil:"]
  5934. }),
  5935. $globals.UndefinedObject);
  5936. $core.addMethod(
  5937. $core.method({
  5938. selector: "ifNil:ifNotNil:",
  5939. protocol: "testing",
  5940. fn: function (aBlock,anotherBlock){
  5941. var self=this;
  5942. return $core.withContext(function($ctx1) {
  5943. return $recv(aBlock)._value();
  5944. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5945. },
  5946. args: ["aBlock", "anotherBlock"],
  5947. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5948. referencedClasses: [],
  5949. messageSends: ["value"]
  5950. }),
  5951. $globals.UndefinedObject);
  5952. $core.addMethod(
  5953. $core.method({
  5954. selector: "ifNotNil:",
  5955. protocol: "testing",
  5956. fn: function (aBlock){
  5957. var self=this;
  5958. return self;
  5959. },
  5960. args: ["aBlock"],
  5961. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5962. referencedClasses: [],
  5963. messageSends: []
  5964. }),
  5965. $globals.UndefinedObject);
  5966. $core.addMethod(
  5967. $core.method({
  5968. selector: "ifNotNil:ifNil:",
  5969. protocol: "testing",
  5970. fn: function (aBlock,anotherBlock){
  5971. var self=this;
  5972. return $core.withContext(function($ctx1) {
  5973. return $recv(anotherBlock)._value();
  5974. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5975. },
  5976. args: ["aBlock", "anotherBlock"],
  5977. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5978. referencedClasses: [],
  5979. messageSends: ["value"]
  5980. }),
  5981. $globals.UndefinedObject);
  5982. $core.addMethod(
  5983. $core.method({
  5984. selector: "isImmutable",
  5985. protocol: "testing",
  5986. fn: function (){
  5987. var self=this;
  5988. return true;
  5989. },
  5990. args: [],
  5991. source: "isImmutable\x0a\x09^ true",
  5992. referencedClasses: [],
  5993. messageSends: []
  5994. }),
  5995. $globals.UndefinedObject);
  5996. $core.addMethod(
  5997. $core.method({
  5998. selector: "isNil",
  5999. protocol: "testing",
  6000. fn: function (){
  6001. var self=this;
  6002. return true;
  6003. },
  6004. args: [],
  6005. source: "isNil\x0a\x09^ true",
  6006. referencedClasses: [],
  6007. messageSends: []
  6008. }),
  6009. $globals.UndefinedObject);
  6010. $core.addMethod(
  6011. $core.method({
  6012. selector: "notNil",
  6013. protocol: "testing",
  6014. fn: function (){
  6015. var self=this;
  6016. return false;
  6017. },
  6018. args: [],
  6019. source: "notNil\x0a\x09^ false",
  6020. referencedClasses: [],
  6021. messageSends: []
  6022. }),
  6023. $globals.UndefinedObject);
  6024. $core.addMethod(
  6025. $core.method({
  6026. selector: "printOn:",
  6027. protocol: "printing",
  6028. fn: function (aStream){
  6029. var self=this;
  6030. return $core.withContext(function($ctx1) {
  6031. $recv(aStream)._nextPutAll_("nil");
  6032. return self;
  6033. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  6034. },
  6035. args: ["aStream"],
  6036. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  6037. referencedClasses: [],
  6038. messageSends: ["nextPutAll:"]
  6039. }),
  6040. $globals.UndefinedObject);
  6041. $core.addMethod(
  6042. $core.method({
  6043. selector: "shallowCopy",
  6044. protocol: "copying",
  6045. fn: function (){
  6046. var self=this;
  6047. return self;
  6048. },
  6049. args: [],
  6050. source: "shallowCopy\x0a\x09^ self",
  6051. referencedClasses: [],
  6052. messageSends: []
  6053. }),
  6054. $globals.UndefinedObject);
  6055. $core.addMethod(
  6056. $core.method({
  6057. selector: "new",
  6058. protocol: "instance creation",
  6059. fn: function (){
  6060. var self=this;
  6061. return $core.withContext(function($ctx1) {
  6062. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  6063. return self;
  6064. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  6065. },
  6066. args: [],
  6067. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  6068. referencedClasses: [],
  6069. messageSends: ["error:"]
  6070. }),
  6071. $globals.UndefinedObject.klass);
  6072. });
  6073. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  6074. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  6075. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  6076. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  6077. $core.addPackage("Kernel-Collections");
  6078. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  6079. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6080. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  6081. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  6082. $core.addMethod(
  6083. $core.method({
  6084. selector: "=",
  6085. protocol: "comparing",
  6086. fn: function (anAssociation){
  6087. var self=this;
  6088. return $core.withContext(function($ctx1) {
  6089. var $3,$2,$5,$4,$6,$1;
  6090. $3=self._class();
  6091. $ctx1.sendIdx["class"]=1;
  6092. $2=$recv($3).__eq($recv(anAssociation)._class());
  6093. $ctx1.sendIdx["="]=1;
  6094. $1=$recv($2)._and_((function(){
  6095. return $core.withContext(function($ctx2) {
  6096. $5=self._key();
  6097. $ctx2.sendIdx["key"]=1;
  6098. $4=$recv($5).__eq($recv(anAssociation)._key());
  6099. $ctx2.sendIdx["="]=2;
  6100. return $recv($4)._and_((function(){
  6101. return $core.withContext(function($ctx3) {
  6102. $6=self._value();
  6103. $ctx3.sendIdx["value"]=1;
  6104. return $recv($6).__eq($recv(anAssociation)._value());
  6105. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6106. }));
  6107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6108. }));
  6109. $ctx1.sendIdx["and:"]=1;
  6110. return $1;
  6111. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  6112. },
  6113. args: ["anAssociation"],
  6114. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  6115. referencedClasses: [],
  6116. messageSends: ["and:", "=", "class", "key", "value"]
  6117. }),
  6118. $globals.Association);
  6119. $core.addMethod(
  6120. $core.method({
  6121. selector: "key",
  6122. protocol: "accessing",
  6123. fn: function (){
  6124. var self=this;
  6125. return self["@key"];
  6126. },
  6127. args: [],
  6128. source: "key\x0a\x09^ key",
  6129. referencedClasses: [],
  6130. messageSends: []
  6131. }),
  6132. $globals.Association);
  6133. $core.addMethod(
  6134. $core.method({
  6135. selector: "key:",
  6136. protocol: "accessing",
  6137. fn: function (aKey){
  6138. var self=this;
  6139. self["@key"]=aKey;
  6140. return self;
  6141. },
  6142. args: ["aKey"],
  6143. source: "key: aKey\x0a\x09key := aKey",
  6144. referencedClasses: [],
  6145. messageSends: []
  6146. }),
  6147. $globals.Association);
  6148. $core.addMethod(
  6149. $core.method({
  6150. selector: "printOn:",
  6151. protocol: "printing",
  6152. fn: function (aStream){
  6153. var self=this;
  6154. return $core.withContext(function($ctx1) {
  6155. $recv(self._key())._printOn_(aStream);
  6156. $ctx1.sendIdx["printOn:"]=1;
  6157. $recv(aStream)._nextPutAll_(" -> ");
  6158. $recv(self._value())._printOn_(aStream);
  6159. return self;
  6160. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  6161. },
  6162. args: ["aStream"],
  6163. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  6164. referencedClasses: [],
  6165. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  6166. }),
  6167. $globals.Association);
  6168. $core.addMethod(
  6169. $core.method({
  6170. selector: "value",
  6171. protocol: "accessing",
  6172. fn: function (){
  6173. var self=this;
  6174. return self["@value"];
  6175. },
  6176. args: [],
  6177. source: "value\x0a\x09^ value",
  6178. referencedClasses: [],
  6179. messageSends: []
  6180. }),
  6181. $globals.Association);
  6182. $core.addMethod(
  6183. $core.method({
  6184. selector: "value:",
  6185. protocol: "accessing",
  6186. fn: function (aValue){
  6187. var self=this;
  6188. self["@value"]=aValue;
  6189. return self;
  6190. },
  6191. args: ["aValue"],
  6192. source: "value: aValue\x0a\x09value := aValue",
  6193. referencedClasses: [],
  6194. messageSends: []
  6195. }),
  6196. $globals.Association);
  6197. $core.addMethod(
  6198. $core.method({
  6199. selector: "key:value:",
  6200. protocol: "instance creation",
  6201. fn: function (aKey,aValue){
  6202. var self=this;
  6203. return $core.withContext(function($ctx1) {
  6204. var $1;
  6205. $1=self._new();
  6206. $recv($1)._key_(aKey);
  6207. $recv($1)._value_(aValue);
  6208. return $recv($1)._yourself();
  6209. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  6210. },
  6211. args: ["aKey", "aValue"],
  6212. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  6213. referencedClasses: [],
  6214. messageSends: ["key:", "new", "value:", "yourself"]
  6215. }),
  6216. $globals.Association.klass);
  6217. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  6218. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  6219. $core.addMethod(
  6220. $core.method({
  6221. selector: "bucketOfElement:",
  6222. protocol: "accessing",
  6223. fn: function (anObject){
  6224. var self=this;
  6225. return $core.withContext(function($ctx1) {
  6226. var hash = self['@hashBlock'](anObject);
  6227. if (!hash) return null;
  6228. var buckets = self['@buckets'],
  6229. bucket = buckets[hash];
  6230. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  6231. return bucket;
  6232. ;
  6233. return self;
  6234. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  6235. },
  6236. args: ["anObject"],
  6237. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = self[''@hashBlock''](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = self[''@buckets''],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  6238. referencedClasses: [],
  6239. messageSends: []
  6240. }),
  6241. $globals.BucketStore);
  6242. $core.addMethod(
  6243. $core.method({
  6244. selector: "do:",
  6245. protocol: "enumerating",
  6246. fn: function (aBlock){
  6247. var self=this;
  6248. return $core.withContext(function($ctx1) {
  6249. var buckets = self['@buckets'];
  6250. var keys = Object.keys(buckets);
  6251. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  6252. ;
  6253. return self;
  6254. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  6255. },
  6256. args: ["aBlock"],
  6257. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = self[''@buckets''];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  6258. referencedClasses: [],
  6259. messageSends: []
  6260. }),
  6261. $globals.BucketStore);
  6262. $core.addMethod(
  6263. $core.method({
  6264. selector: "hashBlock:",
  6265. protocol: "accessing",
  6266. fn: function (aBlock){
  6267. var self=this;
  6268. self["@hashBlock"]=aBlock;
  6269. return self;
  6270. },
  6271. args: ["aBlock"],
  6272. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  6273. referencedClasses: [],
  6274. messageSends: []
  6275. }),
  6276. $globals.BucketStore);
  6277. $core.addMethod(
  6278. $core.method({
  6279. selector: "initialize",
  6280. protocol: "initialization",
  6281. fn: function (){
  6282. var self=this;
  6283. return $core.withContext(function($ctx1) {
  6284. (
  6285. $ctx1.supercall = true,
  6286. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  6287. $ctx1.supercall = false;
  6288. self._removeAll();
  6289. return self;
  6290. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  6291. },
  6292. args: [],
  6293. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  6294. referencedClasses: [],
  6295. messageSends: ["initialize", "removeAll"]
  6296. }),
  6297. $globals.BucketStore);
  6298. $core.addMethod(
  6299. $core.method({
  6300. selector: "newBucket",
  6301. protocol: "private",
  6302. fn: function (){
  6303. var self=this;
  6304. return $core.withContext(function($ctx1) {
  6305. self._subclassResponsibility();
  6306. return self;
  6307. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  6308. },
  6309. args: [],
  6310. source: "newBucket\x0a\x09self subclassResponsibility",
  6311. referencedClasses: [],
  6312. messageSends: ["subclassResponsibility"]
  6313. }),
  6314. $globals.BucketStore);
  6315. $core.addMethod(
  6316. $core.method({
  6317. selector: "removeAll",
  6318. protocol: "adding/removing",
  6319. fn: function (){
  6320. var self=this;
  6321. return $core.withContext(function($ctx1) {
  6322. self['@buckets'] = Object.create(null);;
  6323. return self;
  6324. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  6325. },
  6326. args: [],
  6327. source: "removeAll\x0a\x09<inlineJS: 'self[''@buckets''] = Object.create(null);'>",
  6328. referencedClasses: [],
  6329. messageSends: []
  6330. }),
  6331. $globals.BucketStore);
  6332. $core.addMethod(
  6333. $core.method({
  6334. selector: "hashBlock:",
  6335. protocol: "instance creation",
  6336. fn: function (aBlock){
  6337. var self=this;
  6338. return $core.withContext(function($ctx1) {
  6339. var $1;
  6340. $1=self._new();
  6341. $recv($1)._hashBlock_(aBlock);
  6342. return $recv($1)._yourself();
  6343. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  6344. },
  6345. args: ["aBlock"],
  6346. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  6347. referencedClasses: [],
  6348. messageSends: ["hashBlock:", "new", "yourself"]
  6349. }),
  6350. $globals.BucketStore.klass);
  6351. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  6352. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  6353. $core.addMethod(
  6354. $core.method({
  6355. selector: "newBucket",
  6356. protocol: "private",
  6357. fn: function (){
  6358. var self=this;
  6359. return [];
  6360. },
  6361. args: [],
  6362. source: "newBucket\x0a\x09^ #()",
  6363. referencedClasses: [],
  6364. messageSends: []
  6365. }),
  6366. $globals.ArrayBucketStore);
  6367. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  6368. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  6369. $core.addMethod(
  6370. $core.method({
  6371. selector: ",",
  6372. protocol: "copying",
  6373. fn: function (aCollection){
  6374. var self=this;
  6375. return $core.withContext(function($ctx1) {
  6376. var $1;
  6377. $1=self._copy();
  6378. $recv($1)._addAll_(aCollection);
  6379. return $recv($1)._yourself();
  6380. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  6381. },
  6382. args: ["aCollection"],
  6383. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  6384. referencedClasses: [],
  6385. messageSends: ["addAll:", "copy", "yourself"]
  6386. }),
  6387. $globals.Collection);
  6388. $core.addMethod(
  6389. $core.method({
  6390. selector: "add:",
  6391. protocol: "adding/removing",
  6392. fn: function (anObject){
  6393. var self=this;
  6394. return $core.withContext(function($ctx1) {
  6395. self._subclassResponsibility();
  6396. return self;
  6397. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  6398. },
  6399. args: ["anObject"],
  6400. source: "add: anObject\x0a\x09self subclassResponsibility",
  6401. referencedClasses: [],
  6402. messageSends: ["subclassResponsibility"]
  6403. }),
  6404. $globals.Collection);
  6405. $core.addMethod(
  6406. $core.method({
  6407. selector: "addAll:",
  6408. protocol: "adding/removing",
  6409. fn: function (aCollection){
  6410. var self=this;
  6411. return $core.withContext(function($ctx1) {
  6412. $recv(aCollection)._do_((function(each){
  6413. return $core.withContext(function($ctx2) {
  6414. return self._add_(each);
  6415. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6416. }));
  6417. return aCollection;
  6418. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  6419. },
  6420. args: ["aCollection"],
  6421. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  6422. referencedClasses: [],
  6423. messageSends: ["do:", "add:"]
  6424. }),
  6425. $globals.Collection);
  6426. $core.addMethod(
  6427. $core.method({
  6428. selector: "allSatisfy:",
  6429. protocol: "enumerating",
  6430. fn: function (aBlock){
  6431. var self=this;
  6432. return $core.withContext(function($ctx1) {
  6433. var $1;
  6434. var $early={};
  6435. try {
  6436. self._do_((function(each){
  6437. return $core.withContext(function($ctx2) {
  6438. $1=$recv(aBlock)._value_(each);
  6439. if(!$core.assert($1)){
  6440. throw $early=[false];
  6441. }
  6442. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6443. }));
  6444. return true;
  6445. }
  6446. catch(e) {if(e===$early)return e[0]; throw e}
  6447. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  6448. },
  6449. args: ["aBlock"],
  6450. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  6451. referencedClasses: [],
  6452. messageSends: ["do:", "ifFalse:", "value:"]
  6453. }),
  6454. $globals.Collection);
  6455. $core.addMethod(
  6456. $core.method({
  6457. selector: "anyOne",
  6458. protocol: "accessing",
  6459. fn: function (){
  6460. var self=this;
  6461. return $core.withContext(function($ctx1) {
  6462. var $early={};
  6463. try {
  6464. self._ifEmpty_((function(){
  6465. return $core.withContext(function($ctx2) {
  6466. return self._error_("Collection is empty");
  6467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6468. }));
  6469. self._do_((function(each){
  6470. throw $early=[each];
  6471. }));
  6472. return self;
  6473. }
  6474. catch(e) {if(e===$early)return e[0]; throw e}
  6475. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  6476. },
  6477. args: [],
  6478. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  6479. referencedClasses: [],
  6480. messageSends: ["ifEmpty:", "error:", "do:"]
  6481. }),
  6482. $globals.Collection);
  6483. $core.addMethod(
  6484. $core.method({
  6485. selector: "anySatisfy:",
  6486. protocol: "enumerating",
  6487. fn: function (aBlock){
  6488. var self=this;
  6489. return $core.withContext(function($ctx1) {
  6490. var $1;
  6491. var $early={};
  6492. try {
  6493. self._do_((function(each){
  6494. return $core.withContext(function($ctx2) {
  6495. $1=$recv(aBlock)._value_(each);
  6496. if($core.assert($1)){
  6497. throw $early=[true];
  6498. }
  6499. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6500. }));
  6501. return false;
  6502. }
  6503. catch(e) {if(e===$early)return e[0]; throw e}
  6504. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  6505. },
  6506. args: ["aBlock"],
  6507. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  6508. referencedClasses: [],
  6509. messageSends: ["do:", "ifTrue:", "value:"]
  6510. }),
  6511. $globals.Collection);
  6512. $core.addMethod(
  6513. $core.method({
  6514. selector: "asArray",
  6515. protocol: "converting",
  6516. fn: function (){
  6517. var self=this;
  6518. return $core.withContext(function($ctx1) {
  6519. return $recv($globals.Array)._withAll_(self);
  6520. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  6521. },
  6522. args: [],
  6523. source: "asArray\x0a\x09^ Array withAll: self",
  6524. referencedClasses: ["Array"],
  6525. messageSends: ["withAll:"]
  6526. }),
  6527. $globals.Collection);
  6528. $core.addMethod(
  6529. $core.method({
  6530. selector: "asJavaScriptObject",
  6531. protocol: "converting",
  6532. fn: function (){
  6533. var self=this;
  6534. return $core.withContext(function($ctx1) {
  6535. return $recv(self._asArray())._collect_((function(each){
  6536. return $core.withContext(function($ctx2) {
  6537. return $recv(each)._asJavaScriptObject();
  6538. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6539. }));
  6540. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  6541. },
  6542. args: [],
  6543. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  6544. referencedClasses: [],
  6545. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  6546. }),
  6547. $globals.Collection);
  6548. $core.addMethod(
  6549. $core.method({
  6550. selector: "asOrderedCollection",
  6551. protocol: "converting",
  6552. fn: function (){
  6553. var self=this;
  6554. return $core.withContext(function($ctx1) {
  6555. return self._asArray();
  6556. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  6557. },
  6558. args: [],
  6559. source: "asOrderedCollection\x0a\x09^ self asArray",
  6560. referencedClasses: [],
  6561. messageSends: ["asArray"]
  6562. }),
  6563. $globals.Collection);
  6564. $core.addMethod(
  6565. $core.method({
  6566. selector: "asSet",
  6567. protocol: "converting",
  6568. fn: function (){
  6569. var self=this;
  6570. return $core.withContext(function($ctx1) {
  6571. return $recv($globals.Set)._withAll_(self);
  6572. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  6573. },
  6574. args: [],
  6575. source: "asSet\x0a\x09^ Set withAll: self",
  6576. referencedClasses: ["Set"],
  6577. messageSends: ["withAll:"]
  6578. }),
  6579. $globals.Collection);
  6580. $core.addMethod(
  6581. $core.method({
  6582. selector: "collect:",
  6583. protocol: "enumerating",
  6584. fn: function (aBlock){
  6585. var self=this;
  6586. var stream;
  6587. return $core.withContext(function($ctx1) {
  6588. stream=$recv($recv(self._class())._new())._writeStream();
  6589. self._do_((function(each){
  6590. return $core.withContext(function($ctx2) {
  6591. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  6592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6593. }));
  6594. return $recv(stream)._contents();
  6595. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  6596. },
  6597. args: ["aBlock"],
  6598. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  6599. referencedClasses: [],
  6600. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  6601. }),
  6602. $globals.Collection);
  6603. $core.addMethod(
  6604. $core.method({
  6605. selector: "copyWith:",
  6606. protocol: "copying",
  6607. fn: function (anObject){
  6608. var self=this;
  6609. return $core.withContext(function($ctx1) {
  6610. var $1;
  6611. $1=self._copy();
  6612. $recv($1)._add_(anObject);
  6613. return $recv($1)._yourself();
  6614. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  6615. },
  6616. args: ["anObject"],
  6617. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  6618. referencedClasses: [],
  6619. messageSends: ["add:", "copy", "yourself"]
  6620. }),
  6621. $globals.Collection);
  6622. $core.addMethod(
  6623. $core.method({
  6624. selector: "copyWithAll:",
  6625. protocol: "copying",
  6626. fn: function (aCollection){
  6627. var self=this;
  6628. return $core.withContext(function($ctx1) {
  6629. var $1;
  6630. $1=self._copy();
  6631. $recv($1)._addAll_(aCollection);
  6632. return $recv($1)._yourself();
  6633. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  6634. },
  6635. args: ["aCollection"],
  6636. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  6637. referencedClasses: [],
  6638. messageSends: ["addAll:", "copy", "yourself"]
  6639. }),
  6640. $globals.Collection);
  6641. $core.addMethod(
  6642. $core.method({
  6643. selector: "copyWithout:",
  6644. protocol: "copying",
  6645. fn: function (anObject){
  6646. var self=this;
  6647. return $core.withContext(function($ctx1) {
  6648. return self._reject_((function(each){
  6649. return $core.withContext(function($ctx2) {
  6650. return $recv(each).__eq(anObject);
  6651. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6652. }));
  6653. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  6654. },
  6655. args: ["anObject"],
  6656. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  6657. referencedClasses: [],
  6658. messageSends: ["reject:", "="]
  6659. }),
  6660. $globals.Collection);
  6661. $core.addMethod(
  6662. $core.method({
  6663. selector: "copyWithoutAll:",
  6664. protocol: "copying",
  6665. fn: function (aCollection){
  6666. var self=this;
  6667. return $core.withContext(function($ctx1) {
  6668. return self._reject_((function(each){
  6669. return $core.withContext(function($ctx2) {
  6670. return $recv(aCollection)._includes_(each);
  6671. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6672. }));
  6673. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  6674. },
  6675. args: ["aCollection"],
  6676. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  6677. referencedClasses: [],
  6678. messageSends: ["reject:", "includes:"]
  6679. }),
  6680. $globals.Collection);
  6681. $core.addMethod(
  6682. $core.method({
  6683. selector: "deepCopy",
  6684. protocol: "copying",
  6685. fn: function (){
  6686. var self=this;
  6687. return $core.withContext(function($ctx1) {
  6688. return self._collect_((function(each){
  6689. return $core.withContext(function($ctx2) {
  6690. return $recv(each)._deepCopy();
  6691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6692. }));
  6693. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  6694. },
  6695. args: [],
  6696. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  6697. referencedClasses: [],
  6698. messageSends: ["collect:", "deepCopy"]
  6699. }),
  6700. $globals.Collection);
  6701. $core.addMethod(
  6702. $core.method({
  6703. selector: "detect:",
  6704. protocol: "enumerating",
  6705. fn: function (aBlock){
  6706. var self=this;
  6707. return $core.withContext(function($ctx1) {
  6708. return self._detect_ifNone_(aBlock,(function(){
  6709. return $core.withContext(function($ctx2) {
  6710. return self._errorNotFound();
  6711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6712. }));
  6713. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  6714. },
  6715. args: ["aBlock"],
  6716. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  6717. referencedClasses: [],
  6718. messageSends: ["detect:ifNone:", "errorNotFound"]
  6719. }),
  6720. $globals.Collection);
  6721. $core.addMethod(
  6722. $core.method({
  6723. selector: "detect:ifNone:",
  6724. protocol: "enumerating",
  6725. fn: function (aBlock,anotherBlock){
  6726. var self=this;
  6727. return $core.withContext(function($ctx1) {
  6728. self._subclassResponsibility();
  6729. return self;
  6730. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  6731. },
  6732. args: ["aBlock", "anotherBlock"],
  6733. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  6734. referencedClasses: [],
  6735. messageSends: ["subclassResponsibility"]
  6736. }),
  6737. $globals.Collection);
  6738. $core.addMethod(
  6739. $core.method({
  6740. selector: "do:",
  6741. protocol: "enumerating",
  6742. fn: function (aBlock){
  6743. var self=this;
  6744. return $core.withContext(function($ctx1) {
  6745. self._subclassResponsibility();
  6746. return self;
  6747. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  6748. },
  6749. args: ["aBlock"],
  6750. source: "do: aBlock\x0a\x09self subclassResponsibility",
  6751. referencedClasses: [],
  6752. messageSends: ["subclassResponsibility"]
  6753. }),
  6754. $globals.Collection);
  6755. $core.addMethod(
  6756. $core.method({
  6757. selector: "do:separatedBy:",
  6758. protocol: "enumerating",
  6759. fn: function (aBlock,anotherBlock){
  6760. var self=this;
  6761. var actionBeforeElement;
  6762. return $core.withContext(function($ctx1) {
  6763. actionBeforeElement=(function(){
  6764. actionBeforeElement=anotherBlock;
  6765. return actionBeforeElement;
  6766. });
  6767. self._do_((function(each){
  6768. return $core.withContext(function($ctx2) {
  6769. $recv(actionBeforeElement)._value();
  6770. return $recv(aBlock)._value_(each);
  6771. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  6772. }));
  6773. return self;
  6774. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  6775. },
  6776. args: ["aBlock", "anotherBlock"],
  6777. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]",
  6778. referencedClasses: [],
  6779. messageSends: ["do:", "value", "value:"]
  6780. }),
  6781. $globals.Collection);
  6782. $core.addMethod(
  6783. $core.method({
  6784. selector: "errorNotFound",
  6785. protocol: "error handling",
  6786. fn: function (){
  6787. var self=this;
  6788. return $core.withContext(function($ctx1) {
  6789. self._error_("Object is not in the collection");
  6790. return self;
  6791. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  6792. },
  6793. args: [],
  6794. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  6795. referencedClasses: [],
  6796. messageSends: ["error:"]
  6797. }),
  6798. $globals.Collection);
  6799. $core.addMethod(
  6800. $core.method({
  6801. selector: "ifEmpty:",
  6802. protocol: "testing",
  6803. fn: function (aBlock){
  6804. var self=this;
  6805. return $core.withContext(function($ctx1) {
  6806. var $1;
  6807. $1=self._isEmpty();
  6808. if($core.assert($1)){
  6809. return $recv(aBlock)._value();
  6810. } else {
  6811. return self;
  6812. }
  6813. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  6814. },
  6815. args: ["aBlock"],
  6816. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  6817. referencedClasses: [],
  6818. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  6819. }),
  6820. $globals.Collection);
  6821. $core.addMethod(
  6822. $core.method({
  6823. selector: "ifEmpty:ifNotEmpty:",
  6824. protocol: "testing",
  6825. fn: function (aBlock,anotherBlock){
  6826. var self=this;
  6827. return $core.withContext(function($ctx1) {
  6828. var $1;
  6829. $1=self._isEmpty();
  6830. if($core.assert($1)){
  6831. return $recv(aBlock)._value();
  6832. } else {
  6833. return $recv(anotherBlock)._value_(self);
  6834. }
  6835. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  6836. },
  6837. args: ["aBlock", "anotherBlock"],
  6838. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  6839. referencedClasses: [],
  6840. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  6841. }),
  6842. $globals.Collection);
  6843. $core.addMethod(
  6844. $core.method({
  6845. selector: "ifNotEmpty:",
  6846. protocol: "testing",
  6847. fn: function (aBlock){
  6848. var self=this;
  6849. return $core.withContext(function($ctx1) {
  6850. var $1;
  6851. $1=self._notEmpty();
  6852. if($core.assert($1)){
  6853. return $recv(aBlock)._value_(self);
  6854. } else {
  6855. return self;
  6856. }
  6857. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  6858. },
  6859. args: ["aBlock"],
  6860. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  6861. referencedClasses: [],
  6862. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  6863. }),
  6864. $globals.Collection);
  6865. $core.addMethod(
  6866. $core.method({
  6867. selector: "ifNotEmpty:ifEmpty:",
  6868. protocol: "testing",
  6869. fn: function (aBlock,anotherBlock){
  6870. var self=this;
  6871. return $core.withContext(function($ctx1) {
  6872. var $1;
  6873. $1=self._notEmpty();
  6874. if($core.assert($1)){
  6875. return $recv(aBlock)._value_(self);
  6876. } else {
  6877. return $recv(anotherBlock)._value();
  6878. }
  6879. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  6880. },
  6881. args: ["aBlock", "anotherBlock"],
  6882. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  6883. referencedClasses: [],
  6884. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  6885. }),
  6886. $globals.Collection);
  6887. $core.addMethod(
  6888. $core.method({
  6889. selector: "includes:",
  6890. protocol: "testing",
  6891. fn: function (anObject){
  6892. var self=this;
  6893. return $core.withContext(function($ctx1) {
  6894. return self._anySatisfy_((function(each){
  6895. return $core.withContext(function($ctx2) {
  6896. return $recv(each).__eq(anObject);
  6897. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6898. }));
  6899. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  6900. },
  6901. args: ["anObject"],
  6902. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  6903. referencedClasses: [],
  6904. messageSends: ["anySatisfy:", "="]
  6905. }),
  6906. $globals.Collection);
  6907. $core.addMethod(
  6908. $core.method({
  6909. selector: "inject:into:",
  6910. protocol: "enumerating",
  6911. fn: function (anObject,aBlock){
  6912. var self=this;
  6913. var result;
  6914. return $core.withContext(function($ctx1) {
  6915. result=anObject;
  6916. self._do_((function(each){
  6917. return $core.withContext(function($ctx2) {
  6918. result=$recv(aBlock)._value_value_(result,each);
  6919. return result;
  6920. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6921. }));
  6922. return result;
  6923. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  6924. },
  6925. args: ["anObject", "aBlock"],
  6926. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result",
  6927. referencedClasses: [],
  6928. messageSends: ["do:", "value:value:"]
  6929. }),
  6930. $globals.Collection);
  6931. $core.addMethod(
  6932. $core.method({
  6933. selector: "intersection:",
  6934. protocol: "enumerating",
  6935. fn: function (aCollection){
  6936. var self=this;
  6937. var set,outputSet;
  6938. return $core.withContext(function($ctx1) {
  6939. var $2,$1;
  6940. set=self._asSet();
  6941. outputSet=$recv($globals.Set)._new();
  6942. $recv(aCollection)._do_((function(each){
  6943. return $core.withContext(function($ctx2) {
  6944. $2=$recv(set)._includes_(each);
  6945. $ctx2.sendIdx["includes:"]=1;
  6946. $1=$recv($2)._and_((function(){
  6947. return $core.withContext(function($ctx3) {
  6948. return $recv($recv(outputSet)._includes_(each))._not();
  6949. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6950. }));
  6951. if($core.assert($1)){
  6952. return $recv(outputSet)._add_(each);
  6953. }
  6954. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6955. }));
  6956. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  6957. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  6958. },
  6959. args: ["aCollection"],
  6960. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [ (outputSet includes: each) not ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each ]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  6961. referencedClasses: ["Set"],
  6962. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  6963. }),
  6964. $globals.Collection);
  6965. $core.addMethod(
  6966. $core.method({
  6967. selector: "isEmpty",
  6968. protocol: "testing",
  6969. fn: function (){
  6970. var self=this;
  6971. return $core.withContext(function($ctx1) {
  6972. return $recv(self._size()).__eq((0));
  6973. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  6974. },
  6975. args: [],
  6976. source: "isEmpty\x0a\x09^ self size = 0",
  6977. referencedClasses: [],
  6978. messageSends: ["=", "size"]
  6979. }),
  6980. $globals.Collection);
  6981. $core.addMethod(
  6982. $core.method({
  6983. selector: "noneSatisfy:",
  6984. protocol: "enumerating",
  6985. fn: function (aBlock){
  6986. var self=this;
  6987. return $core.withContext(function($ctx1) {
  6988. var $1;
  6989. var $early={};
  6990. try {
  6991. self._do_((function(item){
  6992. return $core.withContext(function($ctx2) {
  6993. $1=$recv(aBlock)._value_(item);
  6994. if($core.assert($1)){
  6995. throw $early=[false];
  6996. }
  6997. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  6998. }));
  6999. return true;
  7000. }
  7001. catch(e) {if(e===$early)return e[0]; throw e}
  7002. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7003. },
  7004. args: ["aBlock"],
  7005. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  7006. referencedClasses: [],
  7007. messageSends: ["do:", "ifTrue:", "value:"]
  7008. }),
  7009. $globals.Collection);
  7010. $core.addMethod(
  7011. $core.method({
  7012. selector: "notEmpty",
  7013. protocol: "testing",
  7014. fn: function (){
  7015. var self=this;
  7016. return $core.withContext(function($ctx1) {
  7017. return $recv(self._isEmpty())._not();
  7018. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  7019. },
  7020. args: [],
  7021. source: "notEmpty\x0a\x09^ self isEmpty not",
  7022. referencedClasses: [],
  7023. messageSends: ["not", "isEmpty"]
  7024. }),
  7025. $globals.Collection);
  7026. $core.addMethod(
  7027. $core.method({
  7028. selector: "occurrencesOf:",
  7029. protocol: "accessing",
  7030. fn: function (anObject){
  7031. var self=this;
  7032. var tally;
  7033. return $core.withContext(function($ctx1) {
  7034. var $1;
  7035. tally=(0);
  7036. self._do_((function(each){
  7037. return $core.withContext(function($ctx2) {
  7038. $1=$recv(anObject).__eq(each);
  7039. if($core.assert($1)){
  7040. tally=$recv(tally).__plus((1));
  7041. return tally;
  7042. }
  7043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7044. }));
  7045. return tally;
  7046. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  7047. },
  7048. args: ["anObject"],
  7049. source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].\x0a\x09^ tally",
  7050. referencedClasses: [],
  7051. messageSends: ["do:", "ifTrue:", "=", "+"]
  7052. }),
  7053. $globals.Collection);
  7054. $core.addMethod(
  7055. $core.method({
  7056. selector: "putOn:",
  7057. protocol: "streaming",
  7058. fn: function (aStream){
  7059. var self=this;
  7060. return $core.withContext(function($ctx1) {
  7061. self._do_((function(each){
  7062. return $core.withContext(function($ctx2) {
  7063. return $recv(each)._putOn_(aStream);
  7064. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7065. }));
  7066. return self;
  7067. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  7068. },
  7069. args: ["aStream"],
  7070. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  7071. referencedClasses: [],
  7072. messageSends: ["do:", "putOn:"]
  7073. }),
  7074. $globals.Collection);
  7075. $core.addMethod(
  7076. $core.method({
  7077. selector: "reject:",
  7078. protocol: "enumerating",
  7079. fn: function (aBlock){
  7080. var self=this;
  7081. return $core.withContext(function($ctx1) {
  7082. return self._select_((function(each){
  7083. return $core.withContext(function($ctx2) {
  7084. return $recv($recv(aBlock)._value_(each)).__eq(false);
  7085. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7086. }));
  7087. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  7088. },
  7089. args: ["aBlock"],
  7090. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  7091. referencedClasses: [],
  7092. messageSends: ["select:", "=", "value:"]
  7093. }),
  7094. $globals.Collection);
  7095. $core.addMethod(
  7096. $core.method({
  7097. selector: "remove:",
  7098. protocol: "adding/removing",
  7099. fn: function (anObject){
  7100. var self=this;
  7101. return $core.withContext(function($ctx1) {
  7102. return self._remove_ifAbsent_(anObject,(function(){
  7103. return $core.withContext(function($ctx2) {
  7104. return self._errorNotFound();
  7105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7106. }));
  7107. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  7108. },
  7109. args: ["anObject"],
  7110. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  7111. referencedClasses: [],
  7112. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  7113. }),
  7114. $globals.Collection);
  7115. $core.addMethod(
  7116. $core.method({
  7117. selector: "remove:ifAbsent:",
  7118. protocol: "adding/removing",
  7119. fn: function (anObject,aBlock){
  7120. var self=this;
  7121. return $core.withContext(function($ctx1) {
  7122. self._subclassResponsibility();
  7123. return self;
  7124. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  7125. },
  7126. args: ["anObject", "aBlock"],
  7127. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  7128. referencedClasses: [],
  7129. messageSends: ["subclassResponsibility"]
  7130. }),
  7131. $globals.Collection);
  7132. $core.addMethod(
  7133. $core.method({
  7134. selector: "removeAll",
  7135. protocol: "adding/removing",
  7136. fn: function (){
  7137. var self=this;
  7138. return $core.withContext(function($ctx1) {
  7139. self._subclassResponsibility();
  7140. return self;
  7141. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  7142. },
  7143. args: [],
  7144. source: "removeAll\x0a\x09self subclassResponsibility",
  7145. referencedClasses: [],
  7146. messageSends: ["subclassResponsibility"]
  7147. }),
  7148. $globals.Collection);
  7149. $core.addMethod(
  7150. $core.method({
  7151. selector: "select:",
  7152. protocol: "enumerating",
  7153. fn: function (aBlock){
  7154. var self=this;
  7155. var stream;
  7156. return $core.withContext(function($ctx1) {
  7157. var $1;
  7158. stream=$recv($recv(self._class())._new())._writeStream();
  7159. self._do_((function(each){
  7160. return $core.withContext(function($ctx2) {
  7161. $1=$recv(aBlock)._value_(each);
  7162. if($core.assert($1)){
  7163. return $recv(stream)._nextPut_(each);
  7164. }
  7165. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7166. }));
  7167. return $recv(stream)._contents();
  7168. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7169. },
  7170. args: ["aBlock"],
  7171. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents",
  7172. referencedClasses: [],
  7173. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  7174. }),
  7175. $globals.Collection);
  7176. $core.addMethod(
  7177. $core.method({
  7178. selector: "select:thenCollect:",
  7179. protocol: "enumerating",
  7180. fn: function (selectBlock,collectBlock){
  7181. var self=this;
  7182. var stream;
  7183. return $core.withContext(function($ctx1) {
  7184. var $1;
  7185. stream=$recv($recv(self._class())._new())._writeStream();
  7186. self._do_((function(each){
  7187. return $core.withContext(function($ctx2) {
  7188. $1=$recv(selectBlock)._value_(each);
  7189. $ctx2.sendIdx["value:"]=1;
  7190. if($core.assert($1)){
  7191. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  7192. }
  7193. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7194. }));
  7195. return $recv(stream)._contents();
  7196. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  7197. },
  7198. args: ["selectBlock", "collectBlock"],
  7199. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  7200. referencedClasses: [],
  7201. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  7202. }),
  7203. $globals.Collection);
  7204. $core.addMethod(
  7205. $core.method({
  7206. selector: "shallowCopy",
  7207. protocol: "copying",
  7208. fn: function (){
  7209. var self=this;
  7210. return $core.withContext(function($ctx1) {
  7211. return self._collect_((function(each){
  7212. return each;
  7213. }));
  7214. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  7215. },
  7216. args: [],
  7217. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  7218. referencedClasses: [],
  7219. messageSends: ["collect:"]
  7220. }),
  7221. $globals.Collection);
  7222. $core.addMethod(
  7223. $core.method({
  7224. selector: "single",
  7225. protocol: "accessing",
  7226. fn: function (){
  7227. var self=this;
  7228. return $core.withContext(function($ctx1) {
  7229. var $1;
  7230. self._ifEmpty_((function(){
  7231. return $core.withContext(function($ctx2) {
  7232. return self._error_("Collection is empty");
  7233. $ctx2.sendIdx["error:"]=1;
  7234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7235. }));
  7236. $1=$recv(self._size()).__gt((1));
  7237. if($core.assert($1)){
  7238. self._error_("Collection holds more than one element");
  7239. }
  7240. return self._anyOne();
  7241. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  7242. },
  7243. args: [],
  7244. source: "single\x0a\x09\x22Answer a single element.\x0a\x09Raise an error if collection holds less or more than one element.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self size > 1 ifTrue: [ self error: 'Collection holds more than one element' ].\x0a\x09^ self anyOne",
  7245. referencedClasses: [],
  7246. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  7247. }),
  7248. $globals.Collection);
  7249. $core.addMethod(
  7250. $core.method({
  7251. selector: "size",
  7252. protocol: "accessing",
  7253. fn: function (){
  7254. var self=this;
  7255. return $core.withContext(function($ctx1) {
  7256. self._subclassResponsibility();
  7257. return self;
  7258. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  7259. },
  7260. args: [],
  7261. source: "size\x0a\x09self subclassResponsibility",
  7262. referencedClasses: [],
  7263. messageSends: ["subclassResponsibility"]
  7264. }),
  7265. $globals.Collection);
  7266. $core.addMethod(
  7267. $core.method({
  7268. selector: "classTag",
  7269. protocol: "accessing",
  7270. fn: function (){
  7271. var self=this;
  7272. return "collection";
  7273. },
  7274. args: [],
  7275. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'collection'",
  7276. referencedClasses: [],
  7277. messageSends: []
  7278. }),
  7279. $globals.Collection.klass);
  7280. $core.addMethod(
  7281. $core.method({
  7282. selector: "new:",
  7283. protocol: "instance creation",
  7284. fn: function (anInteger){
  7285. var self=this;
  7286. return $core.withContext(function($ctx1) {
  7287. return self._new();
  7288. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  7289. },
  7290. args: ["anInteger"],
  7291. source: "new: anInteger\x0a\x09^ self new",
  7292. referencedClasses: [],
  7293. messageSends: ["new"]
  7294. }),
  7295. $globals.Collection.klass);
  7296. $core.addMethod(
  7297. $core.method({
  7298. selector: "with:",
  7299. protocol: "instance creation",
  7300. fn: function (anObject){
  7301. var self=this;
  7302. return $core.withContext(function($ctx1) {
  7303. var $1;
  7304. $1=self._new();
  7305. $recv($1)._add_(anObject);
  7306. return $recv($1)._yourself();
  7307. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  7308. },
  7309. args: ["anObject"],
  7310. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  7311. referencedClasses: [],
  7312. messageSends: ["add:", "new", "yourself"]
  7313. }),
  7314. $globals.Collection.klass);
  7315. $core.addMethod(
  7316. $core.method({
  7317. selector: "with:with:",
  7318. protocol: "instance creation",
  7319. fn: function (anObject,anotherObject){
  7320. var self=this;
  7321. return $core.withContext(function($ctx1) {
  7322. var $1;
  7323. $1=self._new();
  7324. $recv($1)._add_(anObject);
  7325. $ctx1.sendIdx["add:"]=1;
  7326. $recv($1)._add_(anotherObject);
  7327. return $recv($1)._yourself();
  7328. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  7329. },
  7330. args: ["anObject", "anotherObject"],
  7331. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  7332. referencedClasses: [],
  7333. messageSends: ["add:", "new", "yourself"]
  7334. }),
  7335. $globals.Collection.klass);
  7336. $core.addMethod(
  7337. $core.method({
  7338. selector: "with:with:with:",
  7339. protocol: "instance creation",
  7340. fn: function (firstObject,secondObject,thirdObject){
  7341. var self=this;
  7342. return $core.withContext(function($ctx1) {
  7343. var $1;
  7344. $1=self._new();
  7345. $recv($1)._add_(firstObject);
  7346. $ctx1.sendIdx["add:"]=1;
  7347. $recv($1)._add_(secondObject);
  7348. $ctx1.sendIdx["add:"]=2;
  7349. $recv($1)._add_(thirdObject);
  7350. return $recv($1)._yourself();
  7351. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  7352. },
  7353. args: ["firstObject", "secondObject", "thirdObject"],
  7354. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  7355. referencedClasses: [],
  7356. messageSends: ["add:", "new", "yourself"]
  7357. }),
  7358. $globals.Collection.klass);
  7359. $core.addMethod(
  7360. $core.method({
  7361. selector: "withAll:",
  7362. protocol: "instance creation",
  7363. fn: function (aCollection){
  7364. var self=this;
  7365. return $core.withContext(function($ctx1) {
  7366. var $1;
  7367. $1=self._new();
  7368. $recv($1)._addAll_(aCollection);
  7369. return $recv($1)._yourself();
  7370. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  7371. },
  7372. args: ["aCollection"],
  7373. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7374. referencedClasses: [],
  7375. messageSends: ["addAll:", "new", "yourself"]
  7376. }),
  7377. $globals.Collection.klass);
  7378. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  7379. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  7380. $core.addMethod(
  7381. $core.method({
  7382. selector: "at:",
  7383. protocol: "accessing",
  7384. fn: function (anIndex){
  7385. var self=this;
  7386. return $core.withContext(function($ctx1) {
  7387. return self._at_ifAbsent_(anIndex,(function(){
  7388. return $core.withContext(function($ctx2) {
  7389. return self._errorNotFound();
  7390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7391. }));
  7392. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  7393. },
  7394. args: ["anIndex"],
  7395. source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
  7396. referencedClasses: [],
  7397. messageSends: ["at:ifAbsent:", "errorNotFound"]
  7398. }),
  7399. $globals.IndexableCollection);
  7400. $core.addMethod(
  7401. $core.method({
  7402. selector: "at:ifAbsent:",
  7403. protocol: "accessing",
  7404. fn: function (anIndex,aBlock){
  7405. var self=this;
  7406. return $core.withContext(function($ctx1) {
  7407. self._subclassResponsibility();
  7408. return self;
  7409. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  7410. },
  7411. args: ["anIndex", "aBlock"],
  7412. source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  7413. referencedClasses: [],
  7414. messageSends: ["subclassResponsibility"]
  7415. }),
  7416. $globals.IndexableCollection);
  7417. $core.addMethod(
  7418. $core.method({
  7419. selector: "at:ifAbsentPut:",
  7420. protocol: "accessing",
  7421. fn: function (aKey,aBlock){
  7422. var self=this;
  7423. return $core.withContext(function($ctx1) {
  7424. return self._at_ifAbsent_(aKey,(function(){
  7425. return $core.withContext(function($ctx2) {
  7426. return self._at_put_(aKey,$recv(aBlock)._value());
  7427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7428. }));
  7429. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  7430. },
  7431. args: ["aKey", "aBlock"],
  7432. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  7433. referencedClasses: [],
  7434. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  7435. }),
  7436. $globals.IndexableCollection);
  7437. $core.addMethod(
  7438. $core.method({
  7439. selector: "at:ifPresent:",
  7440. protocol: "accessing",
  7441. fn: function (anIndex,aBlock){
  7442. var self=this;
  7443. return $core.withContext(function($ctx1) {
  7444. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  7445. return nil;
  7446. }));
  7447. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  7448. },
  7449. args: ["anIndex", "aBlock"],
  7450. source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
  7451. referencedClasses: [],
  7452. messageSends: ["at:ifPresent:ifAbsent:"]
  7453. }),
  7454. $globals.IndexableCollection);
  7455. $core.addMethod(
  7456. $core.method({
  7457. selector: "at:ifPresent:ifAbsent:",
  7458. protocol: "accessing",
  7459. fn: function (anIndex,aBlock,anotherBlock){
  7460. var self=this;
  7461. return $core.withContext(function($ctx1) {
  7462. self._subclassResponsibility();
  7463. return self;
  7464. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  7465. },
  7466. args: ["anIndex", "aBlock", "anotherBlock"],
  7467. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  7468. referencedClasses: [],
  7469. messageSends: ["subclassResponsibility"]
  7470. }),
  7471. $globals.IndexableCollection);
  7472. $core.addMethod(
  7473. $core.method({
  7474. selector: "at:put:",
  7475. protocol: "accessing",
  7476. fn: function (anIndex,anObject){
  7477. var self=this;
  7478. return $core.withContext(function($ctx1) {
  7479. self._subclassResponsibility();
  7480. return self;
  7481. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  7482. },
  7483. args: ["anIndex", "anObject"],
  7484. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  7485. referencedClasses: [],
  7486. messageSends: ["subclassResponsibility"]
  7487. }),
  7488. $globals.IndexableCollection);
  7489. $core.addMethod(
  7490. $core.method({
  7491. selector: "indexOf:",
  7492. protocol: "accessing",
  7493. fn: function (anObject){
  7494. var self=this;
  7495. return $core.withContext(function($ctx1) {
  7496. return self._indexOf_ifAbsent_(anObject,(function(){
  7497. return $core.withContext(function($ctx2) {
  7498. return self._errorNotFound();
  7499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7500. }));
  7501. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  7502. },
  7503. args: ["anObject"],
  7504. source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]",
  7505. referencedClasses: [],
  7506. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  7507. }),
  7508. $globals.IndexableCollection);
  7509. $core.addMethod(
  7510. $core.method({
  7511. selector: "indexOf:ifAbsent:",
  7512. protocol: "accessing",
  7513. fn: function (anObject,aBlock){
  7514. var self=this;
  7515. return $core.withContext(function($ctx1) {
  7516. self._subclassResponsibility();
  7517. return self;
  7518. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  7519. },
  7520. args: ["anObject", "aBlock"],
  7521. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  7522. referencedClasses: [],
  7523. messageSends: ["subclassResponsibility"]
  7524. }),
  7525. $globals.IndexableCollection);
  7526. $core.addMethod(
  7527. $core.method({
  7528. selector: "with:do:",
  7529. protocol: "enumerating",
  7530. fn: function (anotherCollection,aBlock){
  7531. var self=this;
  7532. return $core.withContext(function($ctx1) {
  7533. self._withIndexDo_((function(each,index){
  7534. return $core.withContext(function($ctx2) {
  7535. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  7536. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  7537. }));
  7538. return self;
  7539. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  7540. },
  7541. args: ["anotherCollection", "aBlock"],
  7542. source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
  7543. referencedClasses: [],
  7544. messageSends: ["withIndexDo:", "value:value:", "at:"]
  7545. }),
  7546. $globals.IndexableCollection);
  7547. $core.addMethod(
  7548. $core.method({
  7549. selector: "withIndexDo:",
  7550. protocol: "enumerating",
  7551. fn: function (aBlock){
  7552. var self=this;
  7553. return $core.withContext(function($ctx1) {
  7554. self._subclassResponsibility();
  7555. return self;
  7556. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  7557. },
  7558. args: ["aBlock"],
  7559. source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility",
  7560. referencedClasses: [],
  7561. messageSends: ["subclassResponsibility"]
  7562. }),
  7563. $globals.IndexableCollection);
  7564. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  7565. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  7566. $core.addMethod(
  7567. $core.method({
  7568. selector: "=",
  7569. protocol: "comparing",
  7570. fn: function (anAssocitativeCollection){
  7571. var self=this;
  7572. return $core.withContext(function($ctx1) {
  7573. var $2,$1,$4,$3,$5;
  7574. $2=self._class();
  7575. $ctx1.sendIdx["class"]=1;
  7576. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  7577. $ctx1.sendIdx["="]=1;
  7578. if(!$core.assert($1)){
  7579. return false;
  7580. }
  7581. $4=self._size();
  7582. $ctx1.sendIdx["size"]=1;
  7583. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  7584. $ctx1.sendIdx["="]=2;
  7585. if(!$core.assert($3)){
  7586. return false;
  7587. }
  7588. $5=self._associations();
  7589. $ctx1.sendIdx["associations"]=1;
  7590. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  7591. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  7592. },
  7593. args: ["anAssocitativeCollection"],
  7594. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  7595. referencedClasses: [],
  7596. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  7597. }),
  7598. $globals.AssociativeCollection);
  7599. $core.addMethod(
  7600. $core.method({
  7601. selector: "add:",
  7602. protocol: "adding/removing",
  7603. fn: function (anAssociation){
  7604. var self=this;
  7605. return $core.withContext(function($ctx1) {
  7606. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  7607. return self;
  7608. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  7609. },
  7610. args: ["anAssociation"],
  7611. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  7612. referencedClasses: [],
  7613. messageSends: ["at:put:", "key", "value"]
  7614. }),
  7615. $globals.AssociativeCollection);
  7616. $core.addMethod(
  7617. $core.method({
  7618. selector: "addAll:",
  7619. protocol: "adding/removing",
  7620. fn: function (anAssociativeCollection){
  7621. var self=this;
  7622. return $core.withContext(function($ctx1) {
  7623. (
  7624. $ctx1.supercall = true,
  7625. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  7626. $ctx1.supercall = false;
  7627. return anAssociativeCollection;
  7628. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  7629. },
  7630. args: ["anAssociativeCollection"],
  7631. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  7632. referencedClasses: [],
  7633. messageSends: ["addAll:", "associations"]
  7634. }),
  7635. $globals.AssociativeCollection);
  7636. $core.addMethod(
  7637. $core.method({
  7638. selector: "asDictionary",
  7639. protocol: "converting",
  7640. fn: function (){
  7641. var self=this;
  7642. return $core.withContext(function($ctx1) {
  7643. return $recv($globals.Dictionary)._from_(self._associations());
  7644. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  7645. },
  7646. args: [],
  7647. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  7648. referencedClasses: ["Dictionary"],
  7649. messageSends: ["from:", "associations"]
  7650. }),
  7651. $globals.AssociativeCollection);
  7652. $core.addMethod(
  7653. $core.method({
  7654. selector: "asHashedCollection",
  7655. protocol: "converting",
  7656. fn: function (){
  7657. var self=this;
  7658. return $core.withContext(function($ctx1) {
  7659. return $recv($globals.HashedCollection)._from_(self._associations());
  7660. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  7661. },
  7662. args: [],
  7663. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  7664. referencedClasses: ["HashedCollection"],
  7665. messageSends: ["from:", "associations"]
  7666. }),
  7667. $globals.AssociativeCollection);
  7668. $core.addMethod(
  7669. $core.method({
  7670. selector: "asJavaScriptObject",
  7671. protocol: "converting",
  7672. fn: function (){
  7673. var self=this;
  7674. var hash;
  7675. return $core.withContext(function($ctx1) {
  7676. hash=$recv($globals.HashedCollection)._new();
  7677. self._keysAndValuesDo_((function(key,value){
  7678. return $core.withContext(function($ctx2) {
  7679. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  7680. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7681. }));
  7682. return hash;
  7683. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  7684. },
  7685. args: [],
  7686. source: "asJavaScriptObject\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJavaScriptObject ].\x0a\x09^ hash",
  7687. referencedClasses: ["HashedCollection"],
  7688. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  7689. }),
  7690. $globals.AssociativeCollection);
  7691. $core.addMethod(
  7692. $core.method({
  7693. selector: "associations",
  7694. protocol: "accessing",
  7695. fn: function (){
  7696. var self=this;
  7697. var associations;
  7698. return $core.withContext(function($ctx1) {
  7699. associations=[];
  7700. self._associationsDo_((function(each){
  7701. return $core.withContext(function($ctx2) {
  7702. return $recv(associations)._add_(each);
  7703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7704. }));
  7705. return associations;
  7706. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  7707. },
  7708. args: [],
  7709. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  7710. referencedClasses: [],
  7711. messageSends: ["associationsDo:", "add:"]
  7712. }),
  7713. $globals.AssociativeCollection);
  7714. $core.addMethod(
  7715. $core.method({
  7716. selector: "associationsDo:",
  7717. protocol: "enumerating",
  7718. fn: function (aBlock){
  7719. var self=this;
  7720. return $core.withContext(function($ctx1) {
  7721. self._keysAndValuesDo_((function(key,value){
  7722. return $core.withContext(function($ctx2) {
  7723. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  7724. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7725. }));
  7726. return self;
  7727. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  7728. },
  7729. args: ["aBlock"],
  7730. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  7731. referencedClasses: ["Association"],
  7732. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  7733. }),
  7734. $globals.AssociativeCollection);
  7735. $core.addMethod(
  7736. $core.method({
  7737. selector: "at:ifPresent:ifAbsent:",
  7738. protocol: "accessing",
  7739. fn: function (aKey,aBlock,anotherBlock){
  7740. var self=this;
  7741. return $core.withContext(function($ctx1) {
  7742. var $1;
  7743. $1=self._includesKey_(aKey);
  7744. if($core.assert($1)){
  7745. return $recv(aBlock)._value_(self._at_(aKey));
  7746. } else {
  7747. return $recv(anotherBlock)._value();
  7748. }
  7749. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  7750. },
  7751. args: ["aKey", "aBlock", "anotherBlock"],
  7752. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  7753. referencedClasses: [],
  7754. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  7755. }),
  7756. $globals.AssociativeCollection);
  7757. $core.addMethod(
  7758. $core.method({
  7759. selector: "collect:",
  7760. protocol: "enumerating",
  7761. fn: function (aBlock){
  7762. var self=this;
  7763. var newDict;
  7764. return $core.withContext(function($ctx1) {
  7765. newDict=$recv(self._class())._new();
  7766. self._keysAndValuesDo_((function(key,value){
  7767. return $core.withContext(function($ctx2) {
  7768. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  7769. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7770. }));
  7771. return newDict;
  7772. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  7773. },
  7774. args: ["aBlock"],
  7775. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict",
  7776. referencedClasses: [],
  7777. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  7778. }),
  7779. $globals.AssociativeCollection);
  7780. $core.addMethod(
  7781. $core.method({
  7782. selector: "deepCopy",
  7783. protocol: "copying",
  7784. fn: function (){
  7785. var self=this;
  7786. var copy;
  7787. return $core.withContext(function($ctx1) {
  7788. copy=$recv(self._class())._new();
  7789. self._keysAndValuesDo_((function(key,value){
  7790. return $core.withContext(function($ctx2) {
  7791. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  7792. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  7793. }));
  7794. return copy;
  7795. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  7796. },
  7797. args: [],
  7798. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy",
  7799. referencedClasses: [],
  7800. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  7801. }),
  7802. $globals.AssociativeCollection);
  7803. $core.addMethod(
  7804. $core.method({
  7805. selector: "detect:ifNone:",
  7806. protocol: "enumerating",
  7807. fn: function (aBlock,anotherBlock){
  7808. var self=this;
  7809. return $core.withContext(function($ctx1) {
  7810. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  7811. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  7812. },
  7813. args: ["aBlock", "anotherBlock"],
  7814. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  7815. referencedClasses: [],
  7816. messageSends: ["detect:ifNone:", "values"]
  7817. }),
  7818. $globals.AssociativeCollection);
  7819. $core.addMethod(
  7820. $core.method({
  7821. selector: "do:",
  7822. protocol: "enumerating",
  7823. fn: function (aBlock){
  7824. var self=this;
  7825. return $core.withContext(function($ctx1) {
  7826. self._valuesDo_(aBlock);
  7827. return self;
  7828. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  7829. },
  7830. args: ["aBlock"],
  7831. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  7832. referencedClasses: [],
  7833. messageSends: ["valuesDo:"]
  7834. }),
  7835. $globals.AssociativeCollection);
  7836. $core.addMethod(
  7837. $core.method({
  7838. selector: "includes:",
  7839. protocol: "enumerating",
  7840. fn: function (anObject){
  7841. var self=this;
  7842. return $core.withContext(function($ctx1) {
  7843. return $recv(self._values())._includes_(anObject);
  7844. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  7845. },
  7846. args: ["anObject"],
  7847. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  7848. referencedClasses: [],
  7849. messageSends: ["includes:", "values"]
  7850. }),
  7851. $globals.AssociativeCollection);
  7852. $core.addMethod(
  7853. $core.method({
  7854. selector: "includesKey:",
  7855. protocol: "testing",
  7856. fn: function (aKey){
  7857. var self=this;
  7858. return $core.withContext(function($ctx1) {
  7859. self._subclassResponsibility();
  7860. return self;
  7861. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  7862. },
  7863. args: ["aKey"],
  7864. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  7865. referencedClasses: [],
  7866. messageSends: ["subclassResponsibility"]
  7867. }),
  7868. $globals.AssociativeCollection);
  7869. $core.addMethod(
  7870. $core.method({
  7871. selector: "indexOf:ifAbsent:",
  7872. protocol: "accessing",
  7873. fn: function (anObject,aBlock){
  7874. var self=this;
  7875. return $core.withContext(function($ctx1) {
  7876. return $recv(self._keys())._detect_ifNone_((function(each){
  7877. return $core.withContext(function($ctx2) {
  7878. return $recv(self._at_(each)).__eq(anObject);
  7879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7880. }),aBlock);
  7881. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  7882. },
  7883. args: ["anObject", "aBlock"],
  7884. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  7885. referencedClasses: [],
  7886. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  7887. }),
  7888. $globals.AssociativeCollection);
  7889. $core.addMethod(
  7890. $core.method({
  7891. selector: "keyAtValue:",
  7892. protocol: "accessing",
  7893. fn: function (anObject){
  7894. var self=this;
  7895. return $core.withContext(function($ctx1) {
  7896. return self._keyAtValue_ifAbsent_(anObject,(function(){
  7897. return $core.withContext(function($ctx2) {
  7898. return self._errorNotFound();
  7899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7900. }));
  7901. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  7902. },
  7903. args: ["anObject"],
  7904. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  7905. referencedClasses: [],
  7906. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  7907. }),
  7908. $globals.AssociativeCollection);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "keyAtValue:ifAbsent:",
  7912. protocol: "accessing",
  7913. fn: function (anObject,aBlock){
  7914. var self=this;
  7915. return $core.withContext(function($ctx1) {
  7916. return self._indexOf_ifAbsent_(anObject,aBlock);
  7917. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  7918. },
  7919. args: ["anObject", "aBlock"],
  7920. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  7921. referencedClasses: [],
  7922. messageSends: ["indexOf:ifAbsent:"]
  7923. }),
  7924. $globals.AssociativeCollection);
  7925. $core.addMethod(
  7926. $core.method({
  7927. selector: "keys",
  7928. protocol: "accessing",
  7929. fn: function (){
  7930. var self=this;
  7931. return $core.withContext(function($ctx1) {
  7932. self._subclassResponsibility();
  7933. return self;
  7934. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  7935. },
  7936. args: [],
  7937. source: "keys\x0a\x09self subclassResponsibility",
  7938. referencedClasses: [],
  7939. messageSends: ["subclassResponsibility"]
  7940. }),
  7941. $globals.AssociativeCollection);
  7942. $core.addMethod(
  7943. $core.method({
  7944. selector: "keysAndValuesDo:",
  7945. protocol: "enumerating",
  7946. fn: function (aBlock){
  7947. var self=this;
  7948. return $core.withContext(function($ctx1) {
  7949. self._keysDo_((function(each){
  7950. return $core.withContext(function($ctx2) {
  7951. return $recv(aBlock)._value_value_(each,self._at_(each));
  7952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7953. }));
  7954. return self;
  7955. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  7956. },
  7957. args: ["aBlock"],
  7958. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  7959. referencedClasses: [],
  7960. messageSends: ["keysDo:", "value:value:", "at:"]
  7961. }),
  7962. $globals.AssociativeCollection);
  7963. $core.addMethod(
  7964. $core.method({
  7965. selector: "keysDo:",
  7966. protocol: "enumerating",
  7967. fn: function (aBlock){
  7968. var self=this;
  7969. return $core.withContext(function($ctx1) {
  7970. self._subclassResponsibility();
  7971. return self;
  7972. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  7973. },
  7974. args: ["aBlock"],
  7975. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  7976. referencedClasses: [],
  7977. messageSends: ["subclassResponsibility"]
  7978. }),
  7979. $globals.AssociativeCollection);
  7980. $core.addMethod(
  7981. $core.method({
  7982. selector: "printOn:",
  7983. protocol: "printing",
  7984. fn: function (aStream){
  7985. var self=this;
  7986. return $core.withContext(function($ctx1) {
  7987. (
  7988. $ctx1.supercall = true,
  7989. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  7990. $ctx1.supercall = false;
  7991. $ctx1.sendIdx["printOn:"]=1;
  7992. $recv(aStream)._nextPutAll_(" (");
  7993. $ctx1.sendIdx["nextPutAll:"]=1;
  7994. $recv(self._associations())._do_separatedBy_((function(each){
  7995. return $core.withContext(function($ctx2) {
  7996. return $recv(each)._printOn_(aStream);
  7997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7998. }),(function(){
  7999. return $core.withContext(function($ctx2) {
  8000. return $recv(aStream)._nextPutAll_(" , ");
  8001. $ctx2.sendIdx["nextPutAll:"]=2;
  8002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8003. }));
  8004. $recv(aStream)._nextPutAll_(")");
  8005. return self;
  8006. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  8007. },
  8008. args: ["aStream"],
  8009. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  8010. referencedClasses: [],
  8011. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  8012. }),
  8013. $globals.AssociativeCollection);
  8014. $core.addMethod(
  8015. $core.method({
  8016. selector: "remove:ifAbsent:",
  8017. protocol: "adding/removing",
  8018. fn: function (aKey,aBlock){
  8019. var self=this;
  8020. return $core.withContext(function($ctx1) {
  8021. return self._removeKey_ifAbsent_(aKey,aBlock);
  8022. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  8023. },
  8024. args: ["aKey", "aBlock"],
  8025. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  8026. referencedClasses: [],
  8027. messageSends: ["removeKey:ifAbsent:"]
  8028. }),
  8029. $globals.AssociativeCollection);
  8030. $core.addMethod(
  8031. $core.method({
  8032. selector: "removeAll",
  8033. protocol: "adding/removing",
  8034. fn: function (){
  8035. var self=this;
  8036. return $core.withContext(function($ctx1) {
  8037. return $recv(self._keys())._do_((function(each){
  8038. return $core.withContext(function($ctx2) {
  8039. return self._removeKey_(each);
  8040. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8041. }));
  8042. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  8043. },
  8044. args: [],
  8045. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  8046. referencedClasses: [],
  8047. messageSends: ["do:", "keys", "removeKey:"]
  8048. }),
  8049. $globals.AssociativeCollection);
  8050. $core.addMethod(
  8051. $core.method({
  8052. selector: "removeKey:",
  8053. protocol: "adding/removing",
  8054. fn: function (aKey){
  8055. var self=this;
  8056. return $core.withContext(function($ctx1) {
  8057. return self._remove_(aKey);
  8058. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8059. },
  8060. args: ["aKey"],
  8061. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  8062. referencedClasses: [],
  8063. messageSends: ["remove:"]
  8064. }),
  8065. $globals.AssociativeCollection);
  8066. $core.addMethod(
  8067. $core.method({
  8068. selector: "removeKey:ifAbsent:",
  8069. protocol: "adding/removing",
  8070. fn: function (aKey,aBlock){
  8071. var self=this;
  8072. return $core.withContext(function($ctx1) {
  8073. self._subclassResponsibility();
  8074. return self;
  8075. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  8076. },
  8077. args: ["aKey", "aBlock"],
  8078. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8079. referencedClasses: [],
  8080. messageSends: ["subclassResponsibility"]
  8081. }),
  8082. $globals.AssociativeCollection);
  8083. $core.addMethod(
  8084. $core.method({
  8085. selector: "select:",
  8086. protocol: "enumerating",
  8087. fn: function (aBlock){
  8088. var self=this;
  8089. var newDict;
  8090. return $core.withContext(function($ctx1) {
  8091. var $1;
  8092. newDict=$recv(self._class())._new();
  8093. self._keysAndValuesDo_((function(key,value){
  8094. return $core.withContext(function($ctx2) {
  8095. $1=$recv(aBlock)._value_(value);
  8096. if($core.assert($1)){
  8097. return $recv(newDict)._at_put_(key,value);
  8098. }
  8099. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8100. }));
  8101. return newDict;
  8102. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8103. },
  8104. args: ["aBlock"],
  8105. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict",
  8106. referencedClasses: [],
  8107. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  8108. }),
  8109. $globals.AssociativeCollection);
  8110. $core.addMethod(
  8111. $core.method({
  8112. selector: "select:thenCollect:",
  8113. protocol: "enumerating",
  8114. fn: function (selectBlock,collectBlock){
  8115. var self=this;
  8116. var newDict;
  8117. return $core.withContext(function($ctx1) {
  8118. var $1;
  8119. newDict=$recv(self._class())._new();
  8120. self._keysAndValuesDo_((function(key,value){
  8121. return $core.withContext(function($ctx2) {
  8122. $1=$recv(selectBlock)._value_(value);
  8123. $ctx2.sendIdx["value:"]=1;
  8124. if($core.assert($1)){
  8125. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  8126. }
  8127. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8128. }));
  8129. return newDict;
  8130. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  8131. },
  8132. args: ["selectBlock", "collectBlock"],
  8133. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(selectBlock value: value) ifTrue: [ newDict at: key put: (collectBlock value: value) ]].\x0a\x09^ newDict",
  8134. referencedClasses: [],
  8135. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  8136. }),
  8137. $globals.AssociativeCollection);
  8138. $core.addMethod(
  8139. $core.method({
  8140. selector: "shallowCopy",
  8141. protocol: "copying",
  8142. fn: function (){
  8143. var self=this;
  8144. var copy;
  8145. return $core.withContext(function($ctx1) {
  8146. copy=$recv(self._class())._new();
  8147. self._keysAndValuesDo_((function(key,value){
  8148. return $core.withContext(function($ctx2) {
  8149. return $recv(copy)._at_put_(key,value);
  8150. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8151. }));
  8152. return copy;
  8153. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  8154. },
  8155. args: [],
  8156. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy",
  8157. referencedClasses: [],
  8158. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  8159. }),
  8160. $globals.AssociativeCollection);
  8161. $core.addMethod(
  8162. $core.method({
  8163. selector: "size",
  8164. protocol: "accessing",
  8165. fn: function (){
  8166. var self=this;
  8167. return $core.withContext(function($ctx1) {
  8168. return $recv(self._keys())._size();
  8169. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  8170. },
  8171. args: [],
  8172. source: "size\x0a\x09^ self keys size",
  8173. referencedClasses: [],
  8174. messageSends: ["size", "keys"]
  8175. }),
  8176. $globals.AssociativeCollection);
  8177. $core.addMethod(
  8178. $core.method({
  8179. selector: "values",
  8180. protocol: "accessing",
  8181. fn: function (){
  8182. var self=this;
  8183. return $core.withContext(function($ctx1) {
  8184. self._subclassResponsibility();
  8185. return self;
  8186. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  8187. },
  8188. args: [],
  8189. source: "values\x0a\x09self subclassResponsibility",
  8190. referencedClasses: [],
  8191. messageSends: ["subclassResponsibility"]
  8192. }),
  8193. $globals.AssociativeCollection);
  8194. $core.addMethod(
  8195. $core.method({
  8196. selector: "valuesDo:",
  8197. protocol: "enumerating",
  8198. fn: function (aBlock){
  8199. var self=this;
  8200. return $core.withContext(function($ctx1) {
  8201. self._subclassResponsibility();
  8202. return self;
  8203. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8204. },
  8205. args: ["aBlock"],
  8206. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  8207. referencedClasses: [],
  8208. messageSends: ["subclassResponsibility"]
  8209. }),
  8210. $globals.AssociativeCollection);
  8211. $core.addMethod(
  8212. $core.method({
  8213. selector: "withIndexDo:",
  8214. protocol: "enumerating",
  8215. fn: function (aBlock){
  8216. var self=this;
  8217. return $core.withContext(function($ctx1) {
  8218. self._keysAndValuesDo_((function(key,value){
  8219. return $core.withContext(function($ctx2) {
  8220. return $recv(aBlock)._value_value_(value,key);
  8221. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8222. }));
  8223. return self;
  8224. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8225. },
  8226. args: ["aBlock"],
  8227. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  8228. referencedClasses: [],
  8229. messageSends: ["keysAndValuesDo:", "value:value:"]
  8230. }),
  8231. $globals.AssociativeCollection);
  8232. $core.addMethod(
  8233. $core.method({
  8234. selector: "from:",
  8235. protocol: "instance creation",
  8236. fn: function (aCollection){
  8237. var self=this;
  8238. var newCollection;
  8239. return $core.withContext(function($ctx1) {
  8240. newCollection=self._new();
  8241. $recv(aCollection)._do_((function(each){
  8242. return $core.withContext(function($ctx2) {
  8243. return $recv(newCollection)._add_(each);
  8244. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8245. }));
  8246. return newCollection;
  8247. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  8248. },
  8249. args: ["aCollection"],
  8250. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  8251. referencedClasses: [],
  8252. messageSends: ["new", "do:", "add:"]
  8253. }),
  8254. $globals.AssociativeCollection.klass);
  8255. $core.addMethod(
  8256. $core.method({
  8257. selector: "fromPairs:",
  8258. protocol: "instance creation",
  8259. fn: function (aCollection){
  8260. var self=this;
  8261. return $core.withContext(function($ctx1) {
  8262. return self._from_(aCollection);
  8263. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  8264. },
  8265. args: ["aCollection"],
  8266. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  8267. referencedClasses: [],
  8268. messageSends: ["from:"]
  8269. }),
  8270. $globals.AssociativeCollection.klass);
  8271. $core.addMethod(
  8272. $core.method({
  8273. selector: "newFromPairs:",
  8274. protocol: "instance creation",
  8275. fn: function (aCollection){
  8276. var self=this;
  8277. var newCollection;
  8278. return $core.withContext(function($ctx1) {
  8279. var $2,$1,$3,$4;
  8280. $2=$recv(aCollection)._size();
  8281. $ctx1.sendIdx["size"]=1;
  8282. $1=$recv($2)._even();
  8283. if(!$core.assert($1)){
  8284. self._error_("#newFromPairs only accepts arrays of an even length");
  8285. }
  8286. newCollection=self._new();
  8287. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  8288. return $core.withContext(function($ctx2) {
  8289. $3=newCollection;
  8290. $4=$recv(aCollection)._at_(each);
  8291. $ctx2.sendIdx["at:"]=1;
  8292. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  8293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  8294. }));
  8295. return newCollection;
  8296. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  8297. },
  8298. args: ["aCollection"],
  8299. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  8300. referencedClasses: [],
  8301. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  8302. }),
  8303. $globals.AssociativeCollection.klass);
  8304. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  8305. $globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  8306. $core.addMethod(
  8307. $core.method({
  8308. selector: "at:ifAbsent:",
  8309. protocol: "accessing",
  8310. fn: function (aKey,aBlock){
  8311. var self=this;
  8312. return $core.withContext(function($ctx1) {
  8313. var index = self._positionOfKey_(aKey);
  8314. return index >=0 ? self['@values'][index] : aBlock._value();
  8315. ;
  8316. return self;
  8317. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  8318. },
  8319. args: ["aKey", "aBlock"],
  8320. source: "at: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? self[''@values''][index] : aBlock._value();\x0a\x09'>",
  8321. referencedClasses: [],
  8322. messageSends: []
  8323. }),
  8324. $globals.Dictionary);
  8325. $core.addMethod(
  8326. $core.method({
  8327. selector: "at:put:",
  8328. protocol: "accessing",
  8329. fn: function (aKey,aValue){
  8330. var self=this;
  8331. return $core.withContext(function($ctx1) {
  8332. var index = self._positionOfKey_(aKey);
  8333. if(index === -1) {
  8334. var keys = self['@keys'];
  8335. index = keys.length;
  8336. keys.push(aKey);
  8337. }
  8338. return self['@values'][index] = aValue;
  8339. ;
  8340. return self;
  8341. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  8342. },
  8343. args: ["aKey", "aValue"],
  8344. source: "at: aKey put: aValue\x0a\x09<inlineJS: '\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = self[''@keys''];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return self[''@values''][index] = aValue;\x0a\x09'>",
  8345. referencedClasses: [],
  8346. messageSends: []
  8347. }),
  8348. $globals.Dictionary);
  8349. $core.addMethod(
  8350. $core.method({
  8351. selector: "includesKey:",
  8352. protocol: "testing",
  8353. fn: function (aKey){
  8354. var self=this;
  8355. return $core.withContext(function($ctx1) {
  8356. return self._positionOfKey_(aKey) >= 0;;
  8357. return self;
  8358. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  8359. },
  8360. args: ["aKey"],
  8361. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self._positionOfKey_(aKey) >= 0;'>",
  8362. referencedClasses: [],
  8363. messageSends: []
  8364. }),
  8365. $globals.Dictionary);
  8366. $core.addMethod(
  8367. $core.method({
  8368. selector: "indexOf:ifAbsent:",
  8369. protocol: "accessing",
  8370. fn: function (anObject,aBlock){
  8371. var self=this;
  8372. var index;
  8373. return $core.withContext(function($ctx1) {
  8374. var $1;
  8375. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  8376. return (0);
  8377. }));
  8378. $1=$recv(index).__eq((0));
  8379. if($core.assert($1)){
  8380. return $recv(aBlock)._value();
  8381. } else {
  8382. return $recv(self["@keys"])._at_(index);
  8383. }
  8384. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  8385. },
  8386. args: ["anObject", "aBlock"],
  8387. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  8388. referencedClasses: [],
  8389. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  8390. }),
  8391. $globals.Dictionary);
  8392. $core.addMethod(
  8393. $core.method({
  8394. selector: "initialize",
  8395. protocol: "initialization",
  8396. fn: function (){
  8397. var self=this;
  8398. return $core.withContext(function($ctx1) {
  8399. (
  8400. $ctx1.supercall = true,
  8401. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  8402. $ctx1.supercall = false;
  8403. self["@keys"]=[];
  8404. self["@values"]=[];
  8405. return self;
  8406. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  8407. },
  8408. args: [],
  8409. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  8410. referencedClasses: [],
  8411. messageSends: ["initialize"]
  8412. }),
  8413. $globals.Dictionary);
  8414. $core.addMethod(
  8415. $core.method({
  8416. selector: "keys",
  8417. protocol: "accessing",
  8418. fn: function (){
  8419. var self=this;
  8420. return $core.withContext(function($ctx1) {
  8421. return $recv(self["@keys"])._copy();
  8422. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  8423. },
  8424. args: [],
  8425. source: "keys\x0a\x09^ keys copy",
  8426. referencedClasses: [],
  8427. messageSends: ["copy"]
  8428. }),
  8429. $globals.Dictionary);
  8430. $core.addMethod(
  8431. $core.method({
  8432. selector: "keysAndValuesDo:",
  8433. protocol: "enumerating",
  8434. fn: function (aBlock){
  8435. var self=this;
  8436. return $core.withContext(function($ctx1) {
  8437. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  8438. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  8439. },
  8440. args: ["aBlock"],
  8441. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  8442. referencedClasses: [],
  8443. messageSends: ["with:do:"]
  8444. }),
  8445. $globals.Dictionary);
  8446. $core.addMethod(
  8447. $core.method({
  8448. selector: "keysDo:",
  8449. protocol: "enumerating",
  8450. fn: function (aBlock){
  8451. var self=this;
  8452. return $core.withContext(function($ctx1) {
  8453. return $recv(self["@keys"])._do_(aBlock);
  8454. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  8455. },
  8456. args: ["aBlock"],
  8457. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  8458. referencedClasses: [],
  8459. messageSends: ["do:"]
  8460. }),
  8461. $globals.Dictionary);
  8462. $core.addMethod(
  8463. $core.method({
  8464. selector: "positionOfKey:",
  8465. protocol: "private",
  8466. fn: function (anObject){
  8467. var self=this;
  8468. return $core.withContext(function($ctx1) {
  8469. var keys = self['@keys'];
  8470. for(var i=0;i<keys.length;i++){
  8471. if(keys[i].__eq(anObject)) { return i;}
  8472. }
  8473. return -1;
  8474. ;
  8475. return self;
  8476. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  8477. },
  8478. args: ["anObject"],
  8479. source: "positionOfKey: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var keys = self[''@keys''];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09'>",
  8480. referencedClasses: [],
  8481. messageSends: []
  8482. }),
  8483. $globals.Dictionary);
  8484. $core.addMethod(
  8485. $core.method({
  8486. selector: "removeAll",
  8487. protocol: "adding/removing",
  8488. fn: function (){
  8489. var self=this;
  8490. return $core.withContext(function($ctx1) {
  8491. $recv(self["@keys"])._removeAll();
  8492. $ctx1.sendIdx["removeAll"]=1;
  8493. $recv(self["@values"])._removeAll();
  8494. return self;
  8495. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  8496. },
  8497. args: [],
  8498. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  8499. referencedClasses: [],
  8500. messageSends: ["removeAll"]
  8501. }),
  8502. $globals.Dictionary);
  8503. $core.addMethod(
  8504. $core.method({
  8505. selector: "removeKey:ifAbsent:",
  8506. protocol: "adding/removing",
  8507. fn: function (aKey,aBlock){
  8508. var self=this;
  8509. return $core.withContext(function($ctx1) {
  8510. var index = self._positionOfKey_(aKey);
  8511. if(index === -1) {
  8512. return aBlock._value()
  8513. } else {
  8514. var keys = self['@keys'], values = self['@values'];
  8515. var value = values[index], l = keys.length;
  8516. keys[index] = keys[l-1];
  8517. keys.pop();
  8518. values[index] = values[l-1];
  8519. values.pop();
  8520. return value;
  8521. }
  8522. ;
  8523. return self;
  8524. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  8525. },
  8526. args: ["aKey", "aBlock"],
  8527. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = self[''@keys''], values = self[''@values''];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09'>",
  8528. referencedClasses: [],
  8529. messageSends: []
  8530. }),
  8531. $globals.Dictionary);
  8532. $core.addMethod(
  8533. $core.method({
  8534. selector: "values",
  8535. protocol: "accessing",
  8536. fn: function (){
  8537. var self=this;
  8538. return self["@values"];
  8539. },
  8540. args: [],
  8541. source: "values\x0a\x09^ values",
  8542. referencedClasses: [],
  8543. messageSends: []
  8544. }),
  8545. $globals.Dictionary);
  8546. $core.addMethod(
  8547. $core.method({
  8548. selector: "valuesDo:",
  8549. protocol: "enumerating",
  8550. fn: function (aBlock){
  8551. var self=this;
  8552. return $core.withContext(function($ctx1) {
  8553. return $recv(self["@values"])._do_(aBlock);
  8554. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  8555. },
  8556. args: ["aBlock"],
  8557. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  8558. referencedClasses: [],
  8559. messageSends: ["do:"]
  8560. }),
  8561. $globals.Dictionary);
  8562. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  8563. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  8564. $core.addMethod(
  8565. $core.method({
  8566. selector: "at:ifAbsent:",
  8567. protocol: "accessing",
  8568. fn: function (aKey,aBlock){
  8569. var self=this;
  8570. return $core.withContext(function($ctx1) {
  8571. var $1;
  8572. $1=self._includesKey_(aKey);
  8573. if($core.assert($1)){
  8574. return self._basicAt_(aKey);
  8575. } else {
  8576. return $recv(aBlock)._value();
  8577. }
  8578. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  8579. },
  8580. args: ["aKey", "aBlock"],
  8581. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  8582. referencedClasses: [],
  8583. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  8584. }),
  8585. $globals.HashedCollection);
  8586. $core.addMethod(
  8587. $core.method({
  8588. selector: "at:put:",
  8589. protocol: "accessing",
  8590. fn: function (aKey,aValue){
  8591. var self=this;
  8592. return $core.withContext(function($ctx1) {
  8593. return self._basicAt_put_(aKey,aValue);
  8594. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  8595. },
  8596. args: ["aKey", "aValue"],
  8597. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  8598. referencedClasses: [],
  8599. messageSends: ["basicAt:put:"]
  8600. }),
  8601. $globals.HashedCollection);
  8602. $core.addMethod(
  8603. $core.method({
  8604. selector: "includesKey:",
  8605. protocol: "testing",
  8606. fn: function (aKey){
  8607. var self=this;
  8608. return $core.withContext(function($ctx1) {
  8609. return self.hasOwnProperty(aKey);
  8610. return self;
  8611. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  8612. },
  8613. args: ["aKey"],
  8614. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  8615. referencedClasses: [],
  8616. messageSends: []
  8617. }),
  8618. $globals.HashedCollection);
  8619. $core.addMethod(
  8620. $core.method({
  8621. selector: "keys",
  8622. protocol: "accessing",
  8623. fn: function (){
  8624. var self=this;
  8625. return $core.withContext(function($ctx1) {
  8626. return Object.keys(self);
  8627. return self;
  8628. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  8629. },
  8630. args: [],
  8631. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  8632. referencedClasses: [],
  8633. messageSends: []
  8634. }),
  8635. $globals.HashedCollection);
  8636. $core.addMethod(
  8637. $core.method({
  8638. selector: "keysDo:",
  8639. protocol: "enumerating",
  8640. fn: function (aBlock){
  8641. var self=this;
  8642. return $core.withContext(function($ctx1) {
  8643. $recv(self._keys())._do_(aBlock);
  8644. return self;
  8645. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  8646. },
  8647. args: ["aBlock"],
  8648. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  8649. referencedClasses: [],
  8650. messageSends: ["do:", "keys"]
  8651. }),
  8652. $globals.HashedCollection);
  8653. $core.addMethod(
  8654. $core.method({
  8655. selector: "removeKey:ifAbsent:",
  8656. protocol: "adding/removing",
  8657. fn: function (aKey,aBlock){
  8658. var self=this;
  8659. return $core.withContext(function($ctx1) {
  8660. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  8661. return $core.withContext(function($ctx2) {
  8662. self._basicDelete_(aKey);
  8663. return removed;
  8664. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  8665. }),(function(){
  8666. return $core.withContext(function($ctx2) {
  8667. return $recv(aBlock)._value();
  8668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8669. }));
  8670. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  8671. },
  8672. args: ["aKey", "aBlock"],
  8673. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
  8674. referencedClasses: [],
  8675. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  8676. }),
  8677. $globals.HashedCollection);
  8678. $core.addMethod(
  8679. $core.method({
  8680. selector: "values",
  8681. protocol: "accessing",
  8682. fn: function (){
  8683. var self=this;
  8684. return $core.withContext(function($ctx1) {
  8685. return self._keys().map(function(key){
  8686. return self._at_(key);
  8687. });
  8688. ;
  8689. return self;
  8690. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  8691. },
  8692. args: [],
  8693. source: "values\x0a\x09<inlineJS: '\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09'>",
  8694. referencedClasses: [],
  8695. messageSends: []
  8696. }),
  8697. $globals.HashedCollection);
  8698. $core.addMethod(
  8699. $core.method({
  8700. selector: "valuesDo:",
  8701. protocol: "enumerating",
  8702. fn: function (aBlock){
  8703. var self=this;
  8704. return $core.withContext(function($ctx1) {
  8705. $recv(self._values())._do_(aBlock);
  8706. return self;
  8707. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  8708. },
  8709. args: ["aBlock"],
  8710. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  8711. referencedClasses: [],
  8712. messageSends: ["do:", "values"]
  8713. }),
  8714. $globals.HashedCollection);
  8715. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  8716. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  8717. $core.addMethod(
  8718. $core.method({
  8719. selector: "=",
  8720. protocol: "comparing",
  8721. fn: function (aCollection){
  8722. var self=this;
  8723. return $core.withContext(function($ctx1) {
  8724. var $3,$2,$4,$1,$5;
  8725. var $early={};
  8726. try {
  8727. $3=self._class();
  8728. $ctx1.sendIdx["class"]=1;
  8729. $2=$recv($3).__eq($recv(aCollection)._class());
  8730. $ctx1.sendIdx["="]=1;
  8731. $1=$recv($2)._and_((function(){
  8732. return $core.withContext(function($ctx2) {
  8733. $4=self._size();
  8734. $ctx2.sendIdx["size"]=1;
  8735. return $recv($4).__eq($recv(aCollection)._size());
  8736. $ctx2.sendIdx["="]=2;
  8737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8738. }));
  8739. if(!$core.assert($1)){
  8740. return false;
  8741. }
  8742. self._withIndexDo_((function(each,i){
  8743. return $core.withContext(function($ctx2) {
  8744. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  8745. if(!$core.assert($5)){
  8746. throw $early=[false];
  8747. }
  8748. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  8749. }));
  8750. return true;
  8751. }
  8752. catch(e) {if(e===$early)return e[0]; throw e}
  8753. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  8754. },
  8755. args: ["aCollection"],
  8756. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size ]) ifFalse: [ ^ false ].\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [ ^ false ]].\x0a\x09^ true",
  8757. referencedClasses: [],
  8758. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  8759. }),
  8760. $globals.SequenceableCollection);
  8761. $core.addMethod(
  8762. $core.method({
  8763. selector: "addLast:",
  8764. protocol: "adding/removing",
  8765. fn: function (anObject){
  8766. var self=this;
  8767. return $core.withContext(function($ctx1) {
  8768. self._add_(anObject);
  8769. return self;
  8770. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  8771. },
  8772. args: ["anObject"],
  8773. source: "addLast: anObject\x0a\x09self add: anObject",
  8774. referencedClasses: [],
  8775. messageSends: ["add:"]
  8776. }),
  8777. $globals.SequenceableCollection);
  8778. $core.addMethod(
  8779. $core.method({
  8780. selector: "allButFirst",
  8781. protocol: "accessing",
  8782. fn: function (){
  8783. var self=this;
  8784. return $core.withContext(function($ctx1) {
  8785. return self._copyFrom_to_((2),self._size());
  8786. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  8787. },
  8788. args: [],
  8789. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  8790. referencedClasses: [],
  8791. messageSends: ["copyFrom:to:", "size"]
  8792. }),
  8793. $globals.SequenceableCollection);
  8794. $core.addMethod(
  8795. $core.method({
  8796. selector: "allButLast",
  8797. protocol: "accessing",
  8798. fn: function (){
  8799. var self=this;
  8800. return $core.withContext(function($ctx1) {
  8801. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  8802. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  8803. },
  8804. args: [],
  8805. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  8806. referencedClasses: [],
  8807. messageSends: ["copyFrom:to:", "-", "size"]
  8808. }),
  8809. $globals.SequenceableCollection);
  8810. $core.addMethod(
  8811. $core.method({
  8812. selector: "anyOne",
  8813. protocol: "accessing",
  8814. fn: function (){
  8815. var self=this;
  8816. return $core.withContext(function($ctx1) {
  8817. return self._at_((1));
  8818. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  8819. },
  8820. args: [],
  8821. source: "anyOne\x0a\x09^ self at: 1",
  8822. referencedClasses: [],
  8823. messageSends: ["at:"]
  8824. }),
  8825. $globals.SequenceableCollection);
  8826. $core.addMethod(
  8827. $core.method({
  8828. selector: "atRandom",
  8829. protocol: "accessing",
  8830. fn: function (){
  8831. var self=this;
  8832. return $core.withContext(function($ctx1) {
  8833. return self._at_($recv(self._size())._atRandom());
  8834. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  8835. },
  8836. args: [],
  8837. source: "atRandom\x0a\x09^ self at: self size atRandom",
  8838. referencedClasses: [],
  8839. messageSends: ["at:", "atRandom", "size"]
  8840. }),
  8841. $globals.SequenceableCollection);
  8842. $core.addMethod(
  8843. $core.method({
  8844. selector: "beginsWith:",
  8845. protocol: "testing",
  8846. fn: function (prefix){
  8847. var self=this;
  8848. return $core.withContext(function($ctx1) {
  8849. var $2,$3,$1;
  8850. $2=self._size();
  8851. $ctx1.sendIdx["size"]=1;
  8852. $3=$recv(prefix)._size();
  8853. $ctx1.sendIdx["size"]=2;
  8854. $1=$recv($2).__lt($3);
  8855. if($core.assert($1)){
  8856. return false;
  8857. }
  8858. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  8859. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  8860. },
  8861. args: ["prefix"],
  8862. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  8863. referencedClasses: [],
  8864. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  8865. }),
  8866. $globals.SequenceableCollection);
  8867. $core.addMethod(
  8868. $core.method({
  8869. selector: "copyFrom:to:",
  8870. protocol: "copying",
  8871. fn: function (anIndex,anotherIndex){
  8872. var self=this;
  8873. return $core.withContext(function($ctx1) {
  8874. self._subclassResponsibility();
  8875. return self;
  8876. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  8877. },
  8878. args: ["anIndex", "anotherIndex"],
  8879. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  8880. referencedClasses: [],
  8881. messageSends: ["subclassResponsibility"]
  8882. }),
  8883. $globals.SequenceableCollection);
  8884. $core.addMethod(
  8885. $core.method({
  8886. selector: "detect:ifNone:",
  8887. protocol: "enumerating",
  8888. fn: function (aBlock,anotherBlock){
  8889. var self=this;
  8890. return $core.withContext(function($ctx1) {
  8891. self = self._numericallyIndexable();
  8892. for(var i = 0; i < self.length; i++)
  8893. if(aBlock._value_(self[i]))
  8894. return self[i];
  8895. return anotherBlock._value();
  8896. ;
  8897. return self;
  8898. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  8899. },
  8900. args: ["aBlock", "anotherBlock"],
  8901. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  8902. referencedClasses: [],
  8903. messageSends: []
  8904. }),
  8905. $globals.SequenceableCollection);
  8906. $core.addMethod(
  8907. $core.method({
  8908. selector: "do:",
  8909. protocol: "enumerating",
  8910. fn: function (aBlock){
  8911. var self=this;
  8912. return $core.withContext(function($ctx1) {
  8913. self = self._numericallyIndexable();
  8914. for(var i=0; i < self.length; i++) {
  8915. aBlock._value_(self[i]);
  8916. }
  8917. ;
  8918. return self;
  8919. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  8920. },
  8921. args: ["aBlock"],
  8922. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  8923. referencedClasses: [],
  8924. messageSends: []
  8925. }),
  8926. $globals.SequenceableCollection);
  8927. $core.addMethod(
  8928. $core.method({
  8929. selector: "endsWith:",
  8930. protocol: "testing",
  8931. fn: function (suffix){
  8932. var self=this;
  8933. return $core.withContext(function($ctx1) {
  8934. var $2,$3,$1;
  8935. $2=self._size();
  8936. $ctx1.sendIdx["size"]=1;
  8937. $3=$recv(suffix)._size();
  8938. $ctx1.sendIdx["size"]=2;
  8939. $1=$recv($2).__lt($3);
  8940. if($core.assert($1)){
  8941. return false;
  8942. }
  8943. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  8944. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  8945. },
  8946. args: ["suffix"],
  8947. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  8948. referencedClasses: [],
  8949. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  8950. }),
  8951. $globals.SequenceableCollection);
  8952. $core.addMethod(
  8953. $core.method({
  8954. selector: "first",
  8955. protocol: "accessing",
  8956. fn: function (){
  8957. var self=this;
  8958. return $core.withContext(function($ctx1) {
  8959. return self._at_((1));
  8960. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  8961. },
  8962. args: [],
  8963. source: "first\x0a\x09^ self at: 1",
  8964. referencedClasses: [],
  8965. messageSends: ["at:"]
  8966. }),
  8967. $globals.SequenceableCollection);
  8968. $core.addMethod(
  8969. $core.method({
  8970. selector: "first:",
  8971. protocol: "accessing",
  8972. fn: function (aNumber){
  8973. var self=this;
  8974. return $core.withContext(function($ctx1) {
  8975. var $1;
  8976. $1=$recv(self._size()).__lt(aNumber);
  8977. if($core.assert($1)){
  8978. self._error_("Invalid number of elements");
  8979. }
  8980. return self._copyFrom_to_((1),aNumber);
  8981. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  8982. },
  8983. args: ["aNumber"],
  8984. source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber",
  8985. referencedClasses: [],
  8986. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  8987. }),
  8988. $globals.SequenceableCollection);
  8989. $core.addMethod(
  8990. $core.method({
  8991. selector: "fourth",
  8992. protocol: "accessing",
  8993. fn: function (){
  8994. var self=this;
  8995. return $core.withContext(function($ctx1) {
  8996. return self._at_((4));
  8997. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  8998. },
  8999. args: [],
  9000. source: "fourth\x0a\x09^ self at: 4",
  9001. referencedClasses: [],
  9002. messageSends: ["at:"]
  9003. }),
  9004. $globals.SequenceableCollection);
  9005. $core.addMethod(
  9006. $core.method({
  9007. selector: "includes:",
  9008. protocol: "testing",
  9009. fn: function (anObject){
  9010. var self=this;
  9011. return $core.withContext(function($ctx1) {
  9012. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  9013. return nil;
  9014. })))._notNil();
  9015. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  9016. },
  9017. args: ["anObject"],
  9018. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  9019. referencedClasses: [],
  9020. messageSends: ["notNil", "indexOf:ifAbsent:"]
  9021. }),
  9022. $globals.SequenceableCollection);
  9023. $core.addMethod(
  9024. $core.method({
  9025. selector: "indexOf:ifAbsent:",
  9026. protocol: "accessing",
  9027. fn: function (anObject,aBlock){
  9028. var self=this;
  9029. return $core.withContext(function($ctx1) {
  9030. self = self._numericallyIndexable();
  9031. for(var i=0; i < self.length; i++) {
  9032. if($recv(self[i]).__eq(anObject)) {return i+1}
  9033. };
  9034. return aBlock._value();
  9035. ;
  9036. return self;
  9037. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  9038. },
  9039. args: ["anObject", "aBlock"],
  9040. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  9041. referencedClasses: [],
  9042. messageSends: []
  9043. }),
  9044. $globals.SequenceableCollection);
  9045. $core.addMethod(
  9046. $core.method({
  9047. selector: "indexOf:startingAt:",
  9048. protocol: "accessing",
  9049. fn: function (anObject,start){
  9050. var self=this;
  9051. return $core.withContext(function($ctx1) {
  9052. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  9053. return (0);
  9054. }));
  9055. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  9056. },
  9057. args: ["anObject", "start"],
  9058. source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement,\x0a\x09answer 0.\x22\x0a\x09^ self indexOf: anObject startingAt: start ifAbsent: [ 0 ]",
  9059. referencedClasses: [],
  9060. messageSends: ["indexOf:startingAt:ifAbsent:"]
  9061. }),
  9062. $globals.SequenceableCollection);
  9063. $core.addMethod(
  9064. $core.method({
  9065. selector: "indexOf:startingAt:ifAbsent:",
  9066. protocol: "accessing",
  9067. fn: function (anObject,start,aBlock){
  9068. var self=this;
  9069. return $core.withContext(function($ctx1) {
  9070. self = self._numericallyIndexable();
  9071. for(var i=start - 1; i < self.length; i++){
  9072. if($recv(self[i]).__eq(anObject)) {return i+1}
  9073. }
  9074. return aBlock._value();
  9075. ;
  9076. return self;
  9077. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  9078. },
  9079. args: ["anObject", "start", "aBlock"],
  9080. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  9081. referencedClasses: [],
  9082. messageSends: []
  9083. }),
  9084. $globals.SequenceableCollection);
  9085. $core.addMethod(
  9086. $core.method({
  9087. selector: "last",
  9088. protocol: "accessing",
  9089. fn: function (){
  9090. var self=this;
  9091. return $core.withContext(function($ctx1) {
  9092. return self._at_(self._size());
  9093. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  9094. },
  9095. args: [],
  9096. source: "last\x0a\x09^ self at: self size",
  9097. referencedClasses: [],
  9098. messageSends: ["at:", "size"]
  9099. }),
  9100. $globals.SequenceableCollection);
  9101. $core.addMethod(
  9102. $core.method({
  9103. selector: "last:",
  9104. protocol: "accessing",
  9105. fn: function (aNumber){
  9106. var self=this;
  9107. return $core.withContext(function($ctx1) {
  9108. var $2,$1,$5,$4,$3;
  9109. $2=self._size();
  9110. $ctx1.sendIdx["size"]=1;
  9111. $1=$recv($2).__lt(aNumber);
  9112. if($core.assert($1)){
  9113. self._error_("Invalid number of elements");
  9114. }
  9115. $5=self._size();
  9116. $ctx1.sendIdx["size"]=2;
  9117. $4=$recv($5).__minus(aNumber);
  9118. $3=$recv($4).__plus((1));
  9119. return self._copyFrom_to_($3,self._size());
  9120. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  9121. },
  9122. args: ["aNumber"],
  9123. source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size",
  9124. referencedClasses: [],
  9125. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  9126. }),
  9127. $globals.SequenceableCollection);
  9128. $core.addMethod(
  9129. $core.method({
  9130. selector: "newStream",
  9131. protocol: "streaming",
  9132. fn: function (){
  9133. var self=this;
  9134. return $core.withContext(function($ctx1) {
  9135. return $recv(self._streamClass())._on_(self);
  9136. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  9137. },
  9138. args: [],
  9139. source: "newStream\x0a\x09^ self streamClass on: self",
  9140. referencedClasses: [],
  9141. messageSends: ["on:", "streamClass"]
  9142. }),
  9143. $globals.SequenceableCollection);
  9144. $core.addMethod(
  9145. $core.method({
  9146. selector: "numericallyIndexable",
  9147. protocol: "private",
  9148. fn: function (){
  9149. var self=this;
  9150. return $core.withContext(function($ctx1) {
  9151. self._subclassResponsibility();
  9152. return self;
  9153. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  9154. },
  9155. args: [],
  9156. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  9157. referencedClasses: [],
  9158. messageSends: ["subclassResponsibility"]
  9159. }),
  9160. $globals.SequenceableCollection);
  9161. $core.addMethod(
  9162. $core.method({
  9163. selector: "readStream",
  9164. protocol: "streaming",
  9165. fn: function (){
  9166. var self=this;
  9167. return $core.withContext(function($ctx1) {
  9168. return self._stream();
  9169. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  9170. },
  9171. args: [],
  9172. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  9173. referencedClasses: [],
  9174. messageSends: ["stream"]
  9175. }),
  9176. $globals.SequenceableCollection);
  9177. $core.addMethod(
  9178. $core.method({
  9179. selector: "removeLast",
  9180. protocol: "adding/removing",
  9181. fn: function (){
  9182. var self=this;
  9183. return $core.withContext(function($ctx1) {
  9184. return self._remove_(self._last());
  9185. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  9186. },
  9187. args: [],
  9188. source: "removeLast\x0a\x09^ self remove: self last",
  9189. referencedClasses: [],
  9190. messageSends: ["remove:", "last"]
  9191. }),
  9192. $globals.SequenceableCollection);
  9193. $core.addMethod(
  9194. $core.method({
  9195. selector: "reverseDo:",
  9196. protocol: "enumerating",
  9197. fn: function (aBlock){
  9198. var self=this;
  9199. return $core.withContext(function($ctx1) {
  9200. $recv(self._reversed())._do_(aBlock);
  9201. return self;
  9202. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  9203. },
  9204. args: ["aBlock"],
  9205. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  9206. referencedClasses: [],
  9207. messageSends: ["do:", "reversed"]
  9208. }),
  9209. $globals.SequenceableCollection);
  9210. $core.addMethod(
  9211. $core.method({
  9212. selector: "reversed",
  9213. protocol: "converting",
  9214. fn: function (){
  9215. var self=this;
  9216. return $core.withContext(function($ctx1) {
  9217. self._subclassResponsibility();
  9218. return self;
  9219. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  9220. },
  9221. args: [],
  9222. source: "reversed\x0a\x09self subclassResponsibility",
  9223. referencedClasses: [],
  9224. messageSends: ["subclassResponsibility"]
  9225. }),
  9226. $globals.SequenceableCollection);
  9227. $core.addMethod(
  9228. $core.method({
  9229. selector: "second",
  9230. protocol: "accessing",
  9231. fn: function (){
  9232. var self=this;
  9233. return $core.withContext(function($ctx1) {
  9234. return self._at_((2));
  9235. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  9236. },
  9237. args: [],
  9238. source: "second\x0a\x09^ self at: 2",
  9239. referencedClasses: [],
  9240. messageSends: ["at:"]
  9241. }),
  9242. $globals.SequenceableCollection);
  9243. $core.addMethod(
  9244. $core.method({
  9245. selector: "single",
  9246. protocol: "accessing",
  9247. fn: function (){
  9248. var self=this;
  9249. return $core.withContext(function($ctx1) {
  9250. if (self.length == 0) throw new Error("Collection is empty");
  9251. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9252. return self[0];;
  9253. return self;
  9254. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  9255. },
  9256. args: [],
  9257. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];\x0a'>",
  9258. referencedClasses: [],
  9259. messageSends: []
  9260. }),
  9261. $globals.SequenceableCollection);
  9262. $core.addMethod(
  9263. $core.method({
  9264. selector: "stream",
  9265. protocol: "streaming",
  9266. fn: function (){
  9267. var self=this;
  9268. return $core.withContext(function($ctx1) {
  9269. return self._newStream();
  9270. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  9271. },
  9272. args: [],
  9273. source: "stream\x0a\x09^ self newStream",
  9274. referencedClasses: [],
  9275. messageSends: ["newStream"]
  9276. }),
  9277. $globals.SequenceableCollection);
  9278. $core.addMethod(
  9279. $core.method({
  9280. selector: "streamClass",
  9281. protocol: "streaming",
  9282. fn: function (){
  9283. var self=this;
  9284. return $core.withContext(function($ctx1) {
  9285. return $recv(self._class())._streamClass();
  9286. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  9287. },
  9288. args: [],
  9289. source: "streamClass\x0a\x09^ self class streamClass",
  9290. referencedClasses: [],
  9291. messageSends: ["streamClass", "class"]
  9292. }),
  9293. $globals.SequenceableCollection);
  9294. $core.addMethod(
  9295. $core.method({
  9296. selector: "third",
  9297. protocol: "accessing",
  9298. fn: function (){
  9299. var self=this;
  9300. return $core.withContext(function($ctx1) {
  9301. return self._at_((3));
  9302. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  9303. },
  9304. args: [],
  9305. source: "third\x0a\x09^ self at: 3",
  9306. referencedClasses: [],
  9307. messageSends: ["at:"]
  9308. }),
  9309. $globals.SequenceableCollection);
  9310. $core.addMethod(
  9311. $core.method({
  9312. selector: "with:do:",
  9313. protocol: "enumerating",
  9314. fn: function (anotherCollection,aBlock){
  9315. var self=this;
  9316. return $core.withContext(function($ctx1) {
  9317. self = self._numericallyIndexable();
  9318. anotherCollection = anotherCollection._numericallyIndexable();
  9319. for(var i=0; i<self.length; i++) {
  9320. aBlock._value_value_(self[i], anotherCollection[i]);
  9321. }
  9322. ;
  9323. return self;
  9324. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  9325. },
  9326. args: ["anotherCollection", "aBlock"],
  9327. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  9328. referencedClasses: [],
  9329. messageSends: []
  9330. }),
  9331. $globals.SequenceableCollection);
  9332. $core.addMethod(
  9333. $core.method({
  9334. selector: "withIndexDo:",
  9335. protocol: "enumerating",
  9336. fn: function (aBlock){
  9337. var self=this;
  9338. return $core.withContext(function($ctx1) {
  9339. self = self._numericallyIndexable();
  9340. for(var i=0; i < self.length; i++) {
  9341. aBlock._value_value_(self[i], i+1);
  9342. }
  9343. ;
  9344. return self;
  9345. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  9346. },
  9347. args: ["aBlock"],
  9348. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  9349. referencedClasses: [],
  9350. messageSends: []
  9351. }),
  9352. $globals.SequenceableCollection);
  9353. $core.addMethod(
  9354. $core.method({
  9355. selector: "writeStream",
  9356. protocol: "streaming",
  9357. fn: function (){
  9358. var self=this;
  9359. return $core.withContext(function($ctx1) {
  9360. return self._stream();
  9361. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  9362. },
  9363. args: [],
  9364. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  9365. referencedClasses: [],
  9366. messageSends: ["stream"]
  9367. }),
  9368. $globals.SequenceableCollection);
  9369. $core.addMethod(
  9370. $core.method({
  9371. selector: "streamClass",
  9372. protocol: "accessing",
  9373. fn: function (){
  9374. var self=this;
  9375. return $globals.Stream;
  9376. },
  9377. args: [],
  9378. source: "streamClass\x0a\x09\x09^ Stream",
  9379. referencedClasses: ["Stream"],
  9380. messageSends: []
  9381. }),
  9382. $globals.SequenceableCollection.klass);
  9383. $core.addMethod(
  9384. $core.method({
  9385. selector: "streamContents:",
  9386. protocol: "streaming",
  9387. fn: function (aBlock){
  9388. var self=this;
  9389. var stream;
  9390. return $core.withContext(function($ctx1) {
  9391. stream=$recv(self._streamClass())._on_(self._new());
  9392. $recv(aBlock)._value_(stream);
  9393. return $recv(stream)._contents();
  9394. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  9395. },
  9396. args: ["aBlock"],
  9397. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  9398. referencedClasses: [],
  9399. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  9400. }),
  9401. $globals.SequenceableCollection.klass);
  9402. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  9403. $globals.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`.";
  9404. $core.addMethod(
  9405. $core.method({
  9406. selector: "add:",
  9407. protocol: "adding/removing",
  9408. fn: function (anObject){
  9409. var self=this;
  9410. return $core.withContext(function($ctx1) {
  9411. self.push(anObject); return anObject;;
  9412. return self;
  9413. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  9414. },
  9415. args: ["anObject"],
  9416. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  9417. referencedClasses: [],
  9418. messageSends: []
  9419. }),
  9420. $globals.Array);
  9421. $core.addMethod(
  9422. $core.method({
  9423. selector: "addAll:",
  9424. protocol: "adding/removing",
  9425. fn: function (aCollection){
  9426. var self=this;
  9427. return $core.withContext(function($ctx1) {
  9428. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  9429. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  9430. return aCollection;;
  9431. return self;
  9432. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  9433. },
  9434. args: ["aCollection"],
  9435. source: "addAll: aCollection\x0a<inlineJS: '\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);\x0a\x09return aCollection;\x0a'>",
  9436. referencedClasses: [],
  9437. messageSends: []
  9438. }),
  9439. $globals.Array);
  9440. $core.addMethod(
  9441. $core.method({
  9442. selector: "addFirst:",
  9443. protocol: "adding/removing",
  9444. fn: function (anObject){
  9445. var self=this;
  9446. return $core.withContext(function($ctx1) {
  9447. self.unshift(anObject); return anObject;;
  9448. return self;
  9449. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  9450. },
  9451. args: ["anObject"],
  9452. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  9453. referencedClasses: [],
  9454. messageSends: []
  9455. }),
  9456. $globals.Array);
  9457. $core.addMethod(
  9458. $core.method({
  9459. selector: "asJavaScriptSource",
  9460. protocol: "converting",
  9461. fn: function (){
  9462. var self=this;
  9463. return $core.withContext(function($ctx1) {
  9464. var $1;
  9465. $1=$recv("[".__comma($recv(self._collect_((function(each){
  9466. return $core.withContext(function($ctx2) {
  9467. return $recv(each)._asJavaScriptSource();
  9468. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9469. })))._join_(", "))).__comma("]");
  9470. $ctx1.sendIdx[","]=1;
  9471. return $1;
  9472. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  9473. },
  9474. args: [],
  9475. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  9476. referencedClasses: [],
  9477. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  9478. }),
  9479. $globals.Array);
  9480. $core.addMethod(
  9481. $core.method({
  9482. selector: "at:ifAbsent:",
  9483. protocol: "accessing",
  9484. fn: function (anIndex,aBlock){
  9485. var self=this;
  9486. return $core.withContext(function($ctx1) {
  9487. return anIndex >= 1 && anIndex <= self.length
  9488. ? self[anIndex - 1]
  9489. : aBlock._value()
  9490. ;
  9491. return self;
  9492. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  9493. },
  9494. args: ["anIndex", "aBlock"],
  9495. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09'>",
  9496. referencedClasses: [],
  9497. messageSends: []
  9498. }),
  9499. $globals.Array);
  9500. $core.addMethod(
  9501. $core.method({
  9502. selector: "at:ifPresent:ifAbsent:",
  9503. protocol: "accessing",
  9504. fn: function (anIndex,aBlock,anotherBlock){
  9505. var self=this;
  9506. return $core.withContext(function($ctx1) {
  9507. return anIndex >= 1 && anIndex <= self.length
  9508. ? aBlock._value_(self[anIndex - 1])
  9509. : anotherBlock._value()
  9510. ;
  9511. return self;
  9512. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  9513. },
  9514. args: ["anIndex", "aBlock", "anotherBlock"],
  9515. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09'>",
  9516. referencedClasses: [],
  9517. messageSends: []
  9518. }),
  9519. $globals.Array);
  9520. $core.addMethod(
  9521. $core.method({
  9522. selector: "at:put:",
  9523. protocol: "accessing",
  9524. fn: function (anIndex,anObject){
  9525. var self=this;
  9526. return $core.withContext(function($ctx1) {
  9527. return self[anIndex - 1] = anObject;
  9528. return self;
  9529. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  9530. },
  9531. args: ["anIndex", "anObject"],
  9532. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  9533. referencedClasses: [],
  9534. messageSends: []
  9535. }),
  9536. $globals.Array);
  9537. $core.addMethod(
  9538. $core.method({
  9539. selector: "collect:",
  9540. protocol: "enumerating",
  9541. fn: function (aBlock){
  9542. var self=this;
  9543. return $core.withContext(function($ctx1) {
  9544. return self.map(function(each) {return aBlock._value_(each)});
  9545. return self;
  9546. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  9547. },
  9548. args: ["aBlock"],
  9549. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  9550. referencedClasses: [],
  9551. messageSends: []
  9552. }),
  9553. $globals.Array);
  9554. $core.addMethod(
  9555. $core.method({
  9556. selector: "copyFrom:to:",
  9557. protocol: "copying",
  9558. fn: function (anIndex,anotherIndex){
  9559. var self=this;
  9560. return $core.withContext(function($ctx1) {
  9561. if (anIndex >= 1 && anotherIndex <= self.length) {
  9562. return self.slice(anIndex - 1, anotherIndex);
  9563. } else {
  9564. self._at_(anIndex);
  9565. self._at_(self.length + 1);
  9566. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  9567. };
  9568. return self;
  9569. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  9570. },
  9571. args: ["anIndex", "anotherIndex"],
  9572. source: "copyFrom: anIndex to: anotherIndex\x0a<inlineJS: '\x0a\x09if (anIndex >= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}\x0a'>",
  9573. referencedClasses: [],
  9574. messageSends: []
  9575. }),
  9576. $globals.Array);
  9577. $core.addMethod(
  9578. $core.method({
  9579. selector: "join:",
  9580. protocol: "enumerating",
  9581. fn: function (aString){
  9582. var self=this;
  9583. return $core.withContext(function($ctx1) {
  9584. return self.join(aString);
  9585. return self;
  9586. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  9587. },
  9588. args: ["aString"],
  9589. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  9590. referencedClasses: [],
  9591. messageSends: []
  9592. }),
  9593. $globals.Array);
  9594. $core.addMethod(
  9595. $core.method({
  9596. selector: "numericallyIndexable",
  9597. protocol: "private",
  9598. fn: function (){
  9599. var self=this;
  9600. return self;
  9601. },
  9602. args: [],
  9603. source: "numericallyIndexable\x0a\x09^ self",
  9604. referencedClasses: [],
  9605. messageSends: []
  9606. }),
  9607. $globals.Array);
  9608. $core.addMethod(
  9609. $core.method({
  9610. selector: "printOn:",
  9611. protocol: "printing",
  9612. fn: function (aStream){
  9613. var self=this;
  9614. return $core.withContext(function($ctx1) {
  9615. (
  9616. $ctx1.supercall = true,
  9617. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9618. $ctx1.supercall = false;
  9619. $ctx1.sendIdx["printOn:"]=1;
  9620. $recv(aStream)._nextPutAll_(" (");
  9621. $ctx1.sendIdx["nextPutAll:"]=1;
  9622. self._do_separatedBy_((function(each){
  9623. return $core.withContext(function($ctx2) {
  9624. return $recv(each)._printOn_(aStream);
  9625. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9626. }),(function(){
  9627. return $core.withContext(function($ctx2) {
  9628. return $recv(aStream)._nextPutAll_(" ");
  9629. $ctx2.sendIdx["nextPutAll:"]=2;
  9630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9631. }));
  9632. $recv(aStream)._nextPutAll_(")");
  9633. return self;
  9634. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  9635. },
  9636. args: ["aStream"],
  9637. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  9638. referencedClasses: [],
  9639. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  9640. }),
  9641. $globals.Array);
  9642. $core.addMethod(
  9643. $core.method({
  9644. selector: "remove:ifAbsent:",
  9645. protocol: "adding/removing",
  9646. fn: function (anObject,aBlock){
  9647. var self=this;
  9648. var index;
  9649. return $core.withContext(function($ctx1) {
  9650. var $1;
  9651. index=self._indexOf_ifAbsent_(anObject,(function(){
  9652. return (0);
  9653. }));
  9654. $1=$recv(index).__eq((0));
  9655. if($core.assert($1)){
  9656. return $recv(aBlock)._value();
  9657. } else {
  9658. self._removeIndex_(index);
  9659. return anObject;
  9660. }
  9661. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  9662. },
  9663. args: ["anObject", "aBlock"],
  9664. source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]",
  9665. referencedClasses: [],
  9666. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  9667. }),
  9668. $globals.Array);
  9669. $core.addMethod(
  9670. $core.method({
  9671. selector: "removeAll",
  9672. protocol: "adding/removing",
  9673. fn: function (){
  9674. var self=this;
  9675. return $core.withContext(function($ctx1) {
  9676. self.length = 0;
  9677. return self;
  9678. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  9679. },
  9680. args: [],
  9681. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  9682. referencedClasses: [],
  9683. messageSends: []
  9684. }),
  9685. $globals.Array);
  9686. $core.addMethod(
  9687. $core.method({
  9688. selector: "removeFrom:to:",
  9689. protocol: "adding/removing",
  9690. fn: function (aNumber,anotherNumber){
  9691. var self=this;
  9692. return $core.withContext(function($ctx1) {
  9693. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  9694. return self;
  9695. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  9696. },
  9697. args: ["aNumber", "anotherNumber"],
  9698. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  9699. referencedClasses: [],
  9700. messageSends: []
  9701. }),
  9702. $globals.Array);
  9703. $core.addMethod(
  9704. $core.method({
  9705. selector: "removeIndex:",
  9706. protocol: "adding/removing",
  9707. fn: function (anInteger){
  9708. var self=this;
  9709. return $core.withContext(function($ctx1) {
  9710. self.splice(anInteger - 1, 1);
  9711. return self;
  9712. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  9713. },
  9714. args: ["anInteger"],
  9715. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  9716. referencedClasses: [],
  9717. messageSends: []
  9718. }),
  9719. $globals.Array);
  9720. $core.addMethod(
  9721. $core.method({
  9722. selector: "removeLast",
  9723. protocol: "adding/removing",
  9724. fn: function (){
  9725. var self=this;
  9726. return $core.withContext(function($ctx1) {
  9727. return self.pop();;
  9728. return self;
  9729. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  9730. },
  9731. args: [],
  9732. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  9733. referencedClasses: [],
  9734. messageSends: []
  9735. }),
  9736. $globals.Array);
  9737. $core.addMethod(
  9738. $core.method({
  9739. selector: "reversed",
  9740. protocol: "converting",
  9741. fn: function (){
  9742. var self=this;
  9743. return $core.withContext(function($ctx1) {
  9744. return self.slice().reverse();
  9745. return self;
  9746. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  9747. },
  9748. args: [],
  9749. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  9750. referencedClasses: [],
  9751. messageSends: []
  9752. }),
  9753. $globals.Array);
  9754. $core.addMethod(
  9755. $core.method({
  9756. selector: "select:",
  9757. protocol: "enumerating",
  9758. fn: function (aBlock){
  9759. var self=this;
  9760. return $core.withContext(function($ctx1) {
  9761. return self.filter(function(each) {return aBlock._value_(each)});
  9762. return self;
  9763. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  9764. },
  9765. args: ["aBlock"],
  9766. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  9767. referencedClasses: [],
  9768. messageSends: []
  9769. }),
  9770. $globals.Array);
  9771. $core.addMethod(
  9772. $core.method({
  9773. selector: "shallowCopy",
  9774. protocol: "copying",
  9775. fn: function (){
  9776. var self=this;
  9777. return $core.withContext(function($ctx1) {
  9778. return self.slice();
  9779. return self;
  9780. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  9781. },
  9782. args: [],
  9783. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  9784. referencedClasses: [],
  9785. messageSends: []
  9786. }),
  9787. $globals.Array);
  9788. $core.addMethod(
  9789. $core.method({
  9790. selector: "size",
  9791. protocol: "accessing",
  9792. fn: function (){
  9793. var self=this;
  9794. return $core.withContext(function($ctx1) {
  9795. return self.length;
  9796. return self;
  9797. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  9798. },
  9799. args: [],
  9800. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9801. referencedClasses: [],
  9802. messageSends: []
  9803. }),
  9804. $globals.Array);
  9805. $core.addMethod(
  9806. $core.method({
  9807. selector: "sort",
  9808. protocol: "enumerating",
  9809. fn: function (){
  9810. var self=this;
  9811. return $core.withContext(function($ctx1) {
  9812. return self._sort_((function(a,b){
  9813. return $core.withContext(function($ctx2) {
  9814. return $recv(a).__lt(b);
  9815. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  9816. }));
  9817. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  9818. },
  9819. args: [],
  9820. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  9821. referencedClasses: [],
  9822. messageSends: ["sort:", "<"]
  9823. }),
  9824. $globals.Array);
  9825. $core.addMethod(
  9826. $core.method({
  9827. selector: "sort:",
  9828. protocol: "enumerating",
  9829. fn: function (aBlock){
  9830. var self=this;
  9831. return $core.withContext(function($ctx1) {
  9832. return self.sort(function(a, b) {
  9833. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  9834. })
  9835. ;
  9836. return self;
  9837. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  9838. },
  9839. args: ["aBlock"],
  9840. source: "sort: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09'>",
  9841. referencedClasses: [],
  9842. messageSends: []
  9843. }),
  9844. $globals.Array);
  9845. $core.addMethod(
  9846. $core.method({
  9847. selector: "sorted",
  9848. protocol: "enumerating",
  9849. fn: function (){
  9850. var self=this;
  9851. return $core.withContext(function($ctx1) {
  9852. return $recv(self._copy())._sort();
  9853. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  9854. },
  9855. args: [],
  9856. source: "sorted\x0a\x09^ self copy sort",
  9857. referencedClasses: [],
  9858. messageSends: ["sort", "copy"]
  9859. }),
  9860. $globals.Array);
  9861. $core.addMethod(
  9862. $core.method({
  9863. selector: "sorted:",
  9864. protocol: "enumerating",
  9865. fn: function (aBlock){
  9866. var self=this;
  9867. return $core.withContext(function($ctx1) {
  9868. return $recv(self._copy())._sort_(aBlock);
  9869. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  9870. },
  9871. args: ["aBlock"],
  9872. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  9873. referencedClasses: [],
  9874. messageSends: ["sort:", "copy"]
  9875. }),
  9876. $globals.Array);
  9877. $core.addMethod(
  9878. $core.method({
  9879. selector: "new:",
  9880. protocol: "instance creation",
  9881. fn: function (anInteger){
  9882. var self=this;
  9883. return $core.withContext(function($ctx1) {
  9884. return new Array(anInteger);
  9885. return self;
  9886. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  9887. },
  9888. args: ["anInteger"],
  9889. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  9890. referencedClasses: [],
  9891. messageSends: []
  9892. }),
  9893. $globals.Array.klass);
  9894. $core.addMethod(
  9895. $core.method({
  9896. selector: "with:",
  9897. protocol: "instance creation",
  9898. fn: function (anObject){
  9899. var self=this;
  9900. return $core.withContext(function($ctx1) {
  9901. var $1;
  9902. $1=self._new_((1));
  9903. $recv($1)._at_put_((1),anObject);
  9904. return $recv($1)._yourself();
  9905. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  9906. },
  9907. args: ["anObject"],
  9908. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  9909. referencedClasses: [],
  9910. messageSends: ["at:put:", "new:", "yourself"]
  9911. }),
  9912. $globals.Array.klass);
  9913. $core.addMethod(
  9914. $core.method({
  9915. selector: "with:with:",
  9916. protocol: "instance creation",
  9917. fn: function (anObject,anObject2){
  9918. var self=this;
  9919. return $core.withContext(function($ctx1) {
  9920. var $1;
  9921. $1=self._new_((2));
  9922. $recv($1)._at_put_((1),anObject);
  9923. $ctx1.sendIdx["at:put:"]=1;
  9924. $recv($1)._at_put_((2),anObject2);
  9925. return $recv($1)._yourself();
  9926. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  9927. },
  9928. args: ["anObject", "anObject2"],
  9929. source: "with: anObject with: anObject2\x0a\x09\x09^ (self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  9930. referencedClasses: [],
  9931. messageSends: ["at:put:", "new:", "yourself"]
  9932. }),
  9933. $globals.Array.klass);
  9934. $core.addMethod(
  9935. $core.method({
  9936. selector: "with:with:with:",
  9937. protocol: "instance creation",
  9938. fn: function (anObject,anObject2,anObject3){
  9939. var self=this;
  9940. return $core.withContext(function($ctx1) {
  9941. var $1;
  9942. $1=self._new_((3));
  9943. $recv($1)._at_put_((1),anObject);
  9944. $ctx1.sendIdx["at:put:"]=1;
  9945. $recv($1)._at_put_((2),anObject2);
  9946. $ctx1.sendIdx["at:put:"]=2;
  9947. $recv($1)._at_put_((3),anObject3);
  9948. return $recv($1)._yourself();
  9949. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  9950. },
  9951. args: ["anObject", "anObject2", "anObject3"],
  9952. source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^ (self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
  9953. referencedClasses: [],
  9954. messageSends: ["at:put:", "new:", "yourself"]
  9955. }),
  9956. $globals.Array.klass);
  9957. $core.addMethod(
  9958. $core.method({
  9959. selector: "withAll:",
  9960. protocol: "instance creation",
  9961. fn: function (aCollection){
  9962. var self=this;
  9963. var instance,index;
  9964. return $core.withContext(function($ctx1) {
  9965. index=(1);
  9966. instance=self._new_($recv(aCollection)._size());
  9967. $recv(aCollection)._do_((function(each){
  9968. return $core.withContext(function($ctx2) {
  9969. $recv(instance)._at_put_(index,each);
  9970. index=$recv(index).__plus((1));
  9971. return index;
  9972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9973. }));
  9974. return instance;
  9975. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  9976. },
  9977. args: ["aCollection"],
  9978. source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [ :each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1 ].\x0a\x09^ instance",
  9979. referencedClasses: [],
  9980. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  9981. }),
  9982. $globals.Array.klass);
  9983. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  9984. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  9985. $core.addMethod(
  9986. $core.method({
  9987. selector: ",",
  9988. protocol: "copying",
  9989. fn: function (aString){
  9990. var self=this;
  9991. return $core.withContext(function($ctx1) {
  9992. var $1;
  9993. $1=self._asString();
  9994. $ctx1.sendIdx["asString"]=1;
  9995. return $recv($1).__comma($recv(aString)._asString());
  9996. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  9997. },
  9998. args: ["aString"],
  9999. source: ", aString\x0a\x09^ self asString, aString asString",
  10000. referencedClasses: [],
  10001. messageSends: [",", "asString"]
  10002. }),
  10003. $globals.CharacterArray);
  10004. $core.addMethod(
  10005. $core.method({
  10006. selector: "add:",
  10007. protocol: "adding/removing",
  10008. fn: function (anObject){
  10009. var self=this;
  10010. return $core.withContext(function($ctx1) {
  10011. self._errorReadOnly();
  10012. return self;
  10013. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  10014. },
  10015. args: ["anObject"],
  10016. source: "add: anObject\x0a\x09self errorReadOnly",
  10017. referencedClasses: [],
  10018. messageSends: ["errorReadOnly"]
  10019. }),
  10020. $globals.CharacterArray);
  10021. $core.addMethod(
  10022. $core.method({
  10023. selector: "asLowercase",
  10024. protocol: "converting",
  10025. fn: function (){
  10026. var self=this;
  10027. return $core.withContext(function($ctx1) {
  10028. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  10029. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  10030. },
  10031. args: [],
  10032. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  10033. referencedClasses: [],
  10034. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  10035. }),
  10036. $globals.CharacterArray);
  10037. $core.addMethod(
  10038. $core.method({
  10039. selector: "asNumber",
  10040. protocol: "converting",
  10041. fn: function (){
  10042. var self=this;
  10043. return $core.withContext(function($ctx1) {
  10044. return $recv(self._asString())._asNumber();
  10045. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  10046. },
  10047. args: [],
  10048. source: "asNumber\x0a\x09^ self asString asNumber",
  10049. referencedClasses: [],
  10050. messageSends: ["asNumber", "asString"]
  10051. }),
  10052. $globals.CharacterArray);
  10053. $core.addMethod(
  10054. $core.method({
  10055. selector: "asString",
  10056. protocol: "converting",
  10057. fn: function (){
  10058. var self=this;
  10059. return $core.withContext(function($ctx1) {
  10060. return self._subclassResponsibility();
  10061. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  10062. },
  10063. args: [],
  10064. source: "asString\x0a\x09^ self subclassResponsibility",
  10065. referencedClasses: [],
  10066. messageSends: ["subclassResponsibility"]
  10067. }),
  10068. $globals.CharacterArray);
  10069. $core.addMethod(
  10070. $core.method({
  10071. selector: "asSymbol",
  10072. protocol: "converting",
  10073. fn: function (){
  10074. var self=this;
  10075. return $core.withContext(function($ctx1) {
  10076. return self._asString();
  10077. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  10078. },
  10079. args: [],
  10080. source: "asSymbol\x0a\x09^ self asString",
  10081. referencedClasses: [],
  10082. messageSends: ["asString"]
  10083. }),
  10084. $globals.CharacterArray);
  10085. $core.addMethod(
  10086. $core.method({
  10087. selector: "asSymbolPrintOn:",
  10088. protocol: "printing",
  10089. fn: function (aStream){
  10090. var self=this;
  10091. return $core.withContext(function($ctx1) {
  10092. var $1;
  10093. $recv(aStream)._nextPutAll_("#");
  10094. $1=$recv(self._asString())._isSelector();
  10095. if($core.assert($1)){
  10096. $recv(aStream)._nextPut_(self);
  10097. } else {
  10098. self._printOn_(aStream);
  10099. }
  10100. return self;
  10101. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  10102. },
  10103. args: ["aStream"],
  10104. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  10105. referencedClasses: [],
  10106. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  10107. }),
  10108. $globals.CharacterArray);
  10109. $core.addMethod(
  10110. $core.method({
  10111. selector: "asUppercase",
  10112. protocol: "converting",
  10113. fn: function (){
  10114. var self=this;
  10115. return $core.withContext(function($ctx1) {
  10116. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  10117. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  10118. },
  10119. args: [],
  10120. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  10121. referencedClasses: [],
  10122. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  10123. }),
  10124. $globals.CharacterArray);
  10125. $core.addMethod(
  10126. $core.method({
  10127. selector: "at:put:",
  10128. protocol: "accessing",
  10129. fn: function (anIndex,anObject){
  10130. var self=this;
  10131. return $core.withContext(function($ctx1) {
  10132. self._errorReadOnly();
  10133. return self;
  10134. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  10135. },
  10136. args: ["anIndex", "anObject"],
  10137. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  10138. referencedClasses: [],
  10139. messageSends: ["errorReadOnly"]
  10140. }),
  10141. $globals.CharacterArray);
  10142. $core.addMethod(
  10143. $core.method({
  10144. selector: "errorReadOnly",
  10145. protocol: "error handling",
  10146. fn: function (){
  10147. var self=this;
  10148. return $core.withContext(function($ctx1) {
  10149. self._error_("Object is read-only");
  10150. return self;
  10151. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  10152. },
  10153. args: [],
  10154. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  10155. referencedClasses: [],
  10156. messageSends: ["error:"]
  10157. }),
  10158. $globals.CharacterArray);
  10159. $core.addMethod(
  10160. $core.method({
  10161. selector: "printOn:",
  10162. protocol: "printing",
  10163. fn: function (aStream){
  10164. var self=this;
  10165. return $core.withContext(function($ctx1) {
  10166. $recv(self._asString())._printOn_(aStream);
  10167. return self;
  10168. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  10169. },
  10170. args: ["aStream"],
  10171. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  10172. referencedClasses: [],
  10173. messageSends: ["printOn:", "asString"]
  10174. }),
  10175. $globals.CharacterArray);
  10176. $core.addMethod(
  10177. $core.method({
  10178. selector: "putOn:",
  10179. protocol: "streaming",
  10180. fn: function (aStream){
  10181. var self=this;
  10182. return $core.withContext(function($ctx1) {
  10183. $recv(aStream)._nextPutString_(self);
  10184. return self;
  10185. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  10186. },
  10187. args: ["aStream"],
  10188. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  10189. referencedClasses: [],
  10190. messageSends: ["nextPutString:"]
  10191. }),
  10192. $globals.CharacterArray);
  10193. $core.addMethod(
  10194. $core.method({
  10195. selector: "remove:",
  10196. protocol: "adding/removing",
  10197. fn: function (anObject){
  10198. var self=this;
  10199. return $core.withContext(function($ctx1) {
  10200. self._errorReadOnly();
  10201. return self;
  10202. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  10203. },
  10204. args: ["anObject"],
  10205. source: "remove: anObject\x0a\x09self errorReadOnly",
  10206. referencedClasses: [],
  10207. messageSends: ["errorReadOnly"]
  10208. }),
  10209. $globals.CharacterArray);
  10210. $core.addMethod(
  10211. $core.method({
  10212. selector: "symbolPrintString",
  10213. protocol: "printing",
  10214. fn: function (){
  10215. var self=this;
  10216. return $core.withContext(function($ctx1) {
  10217. return $recv($globals.String)._streamContents_((function(str){
  10218. return $core.withContext(function($ctx2) {
  10219. return self._asSymbolPrintOn_(str);
  10220. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  10221. }));
  10222. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  10223. },
  10224. args: [],
  10225. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  10226. referencedClasses: ["String"],
  10227. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  10228. }),
  10229. $globals.CharacterArray);
  10230. $core.addMethod(
  10231. $core.method({
  10232. selector: "fromString:",
  10233. protocol: "instance creation",
  10234. fn: function (aString){
  10235. var self=this;
  10236. return $core.withContext(function($ctx1) {
  10237. self._subclassResponsibility();
  10238. return self;
  10239. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  10240. },
  10241. args: ["aString"],
  10242. source: "fromString: aString\x0a\x09self subclassResponsibility",
  10243. referencedClasses: [],
  10244. messageSends: ["subclassResponsibility"]
  10245. }),
  10246. $globals.CharacterArray.klass);
  10247. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  10248. $globals.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`";
  10249. $core.addMethod(
  10250. $core.method({
  10251. selector: ",",
  10252. protocol: "copying",
  10253. fn: function (aString){
  10254. var self=this;
  10255. return $core.withContext(function($ctx1) {
  10256. return String(self) + aString;
  10257. return self;
  10258. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  10259. },
  10260. args: ["aString"],
  10261. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  10262. referencedClasses: [],
  10263. messageSends: []
  10264. }),
  10265. $globals.String);
  10266. $core.addMethod(
  10267. $core.method({
  10268. selector: "<",
  10269. protocol: "comparing",
  10270. fn: function (aString){
  10271. var self=this;
  10272. return $core.withContext(function($ctx1) {
  10273. return String(self) < aString._asString();
  10274. return self;
  10275. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  10276. },
  10277. args: ["aString"],
  10278. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  10279. referencedClasses: [],
  10280. messageSends: []
  10281. }),
  10282. $globals.String);
  10283. $core.addMethod(
  10284. $core.method({
  10285. selector: "<=",
  10286. protocol: "comparing",
  10287. fn: function (aString){
  10288. var self=this;
  10289. return $core.withContext(function($ctx1) {
  10290. return String(self) <= aString._asString();
  10291. return self;
  10292. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  10293. },
  10294. args: ["aString"],
  10295. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  10296. referencedClasses: [],
  10297. messageSends: []
  10298. }),
  10299. $globals.String);
  10300. $core.addMethod(
  10301. $core.method({
  10302. selector: "=",
  10303. protocol: "comparing",
  10304. fn: function (aString){
  10305. var self=this;
  10306. return $core.withContext(function($ctx1) {
  10307. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  10308. return self;
  10309. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  10310. },
  10311. args: ["aString"],
  10312. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  10313. referencedClasses: [],
  10314. messageSends: []
  10315. }),
  10316. $globals.String);
  10317. $core.addMethod(
  10318. $core.method({
  10319. selector: "==",
  10320. protocol: "comparing",
  10321. fn: function (aString){
  10322. var self=this;
  10323. return $core.withContext(function($ctx1) {
  10324. if (typeof aString === "string") return String(self) === aString;
  10325. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  10326. else return false;;
  10327. return self;
  10328. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  10329. },
  10330. args: ["aString"],
  10331. source: "== aString\x0a<inlineJS: '\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;\x0a'>",
  10332. referencedClasses: [],
  10333. messageSends: []
  10334. }),
  10335. $globals.String);
  10336. $core.addMethod(
  10337. $core.method({
  10338. selector: ">",
  10339. protocol: "comparing",
  10340. fn: function (aString){
  10341. var self=this;
  10342. return $core.withContext(function($ctx1) {
  10343. return String(self) > aString._asString();
  10344. return self;
  10345. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  10346. },
  10347. args: ["aString"],
  10348. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  10349. referencedClasses: [],
  10350. messageSends: []
  10351. }),
  10352. $globals.String);
  10353. $core.addMethod(
  10354. $core.method({
  10355. selector: ">=",
  10356. protocol: "comparing",
  10357. fn: function (aString){
  10358. var self=this;
  10359. return $core.withContext(function($ctx1) {
  10360. return String(self) >= aString._asString();
  10361. return self;
  10362. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  10363. },
  10364. args: ["aString"],
  10365. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  10366. referencedClasses: [],
  10367. messageSends: []
  10368. }),
  10369. $globals.String);
  10370. $core.addMethod(
  10371. $core.method({
  10372. selector: "asJavaScriptMethodName",
  10373. protocol: "converting",
  10374. fn: function (){
  10375. var self=this;
  10376. return $core.withContext(function($ctx1) {
  10377. return $core.st2js(self);
  10378. return self;
  10379. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  10380. },
  10381. args: [],
  10382. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  10383. referencedClasses: [],
  10384. messageSends: []
  10385. }),
  10386. $globals.String);
  10387. $core.addMethod(
  10388. $core.method({
  10389. selector: "asJavaScriptObject",
  10390. protocol: "converting",
  10391. fn: function (){
  10392. var self=this;
  10393. return self;
  10394. },
  10395. args: [],
  10396. source: "asJavaScriptObject\x0a\x09^ self",
  10397. referencedClasses: [],
  10398. messageSends: []
  10399. }),
  10400. $globals.String);
  10401. $core.addMethod(
  10402. $core.method({
  10403. selector: "asJavaScriptSource",
  10404. protocol: "converting",
  10405. fn: function (){
  10406. var self=this;
  10407. return $core.withContext(function($ctx1) {
  10408. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  10409. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  10410. else
  10411. return "\"" + self + "\"";
  10412. ;
  10413. return self;
  10414. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  10415. },
  10416. args: [],
  10417. source: "asJavaScriptSource\x0a\x09<inlineJS: '\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09'>",
  10418. referencedClasses: [],
  10419. messageSends: []
  10420. }),
  10421. $globals.String);
  10422. $core.addMethod(
  10423. $core.method({
  10424. selector: "asLowercase",
  10425. protocol: "converting",
  10426. fn: function (){
  10427. var self=this;
  10428. return $core.withContext(function($ctx1) {
  10429. return self.toLowerCase();
  10430. return self;
  10431. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  10432. },
  10433. args: [],
  10434. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  10435. referencedClasses: [],
  10436. messageSends: []
  10437. }),
  10438. $globals.String);
  10439. $core.addMethod(
  10440. $core.method({
  10441. selector: "asMutator",
  10442. protocol: "converting",
  10443. fn: function (){
  10444. var self=this;
  10445. return $core.withContext(function($ctx1) {
  10446. var $1;
  10447. $1=$recv(self._last()).__eq(":");
  10448. if(!$core.assert($1)){
  10449. return self.__comma(":");
  10450. }
  10451. return self;
  10452. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  10453. },
  10454. args: [],
  10455. source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self",
  10456. referencedClasses: [],
  10457. messageSends: ["ifFalse:", "=", "last", ","]
  10458. }),
  10459. $globals.String);
  10460. $core.addMethod(
  10461. $core.method({
  10462. selector: "asNumber",
  10463. protocol: "converting",
  10464. fn: function (){
  10465. var self=this;
  10466. return $core.withContext(function($ctx1) {
  10467. return Number(self);
  10468. return self;
  10469. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  10470. },
  10471. args: [],
  10472. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  10473. referencedClasses: [],
  10474. messageSends: []
  10475. }),
  10476. $globals.String);
  10477. $core.addMethod(
  10478. $core.method({
  10479. selector: "asRegexp",
  10480. protocol: "converting",
  10481. fn: function (){
  10482. var self=this;
  10483. return $core.withContext(function($ctx1) {
  10484. return $recv($globals.RegularExpression)._fromString_(self);
  10485. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  10486. },
  10487. args: [],
  10488. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  10489. referencedClasses: ["RegularExpression"],
  10490. messageSends: ["fromString:"]
  10491. }),
  10492. $globals.String);
  10493. $core.addMethod(
  10494. $core.method({
  10495. selector: "asString",
  10496. protocol: "converting",
  10497. fn: function (){
  10498. var self=this;
  10499. return self;
  10500. },
  10501. args: [],
  10502. source: "asString\x0a\x09^ self",
  10503. referencedClasses: [],
  10504. messageSends: []
  10505. }),
  10506. $globals.String);
  10507. $core.addMethod(
  10508. $core.method({
  10509. selector: "asSymbol",
  10510. protocol: "converting",
  10511. fn: function (){
  10512. var self=this;
  10513. return self;
  10514. },
  10515. args: [],
  10516. source: "asSymbol\x0a\x09^ self",
  10517. referencedClasses: [],
  10518. messageSends: []
  10519. }),
  10520. $globals.String);
  10521. $core.addMethod(
  10522. $core.method({
  10523. selector: "asUppercase",
  10524. protocol: "converting",
  10525. fn: function (){
  10526. var self=this;
  10527. return $core.withContext(function($ctx1) {
  10528. return self.toUpperCase();
  10529. return self;
  10530. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  10531. },
  10532. args: [],
  10533. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  10534. referencedClasses: [],
  10535. messageSends: []
  10536. }),
  10537. $globals.String);
  10538. $core.addMethod(
  10539. $core.method({
  10540. selector: "asciiValue",
  10541. protocol: "accessing",
  10542. fn: function (){
  10543. var self=this;
  10544. return $core.withContext(function($ctx1) {
  10545. return self.charCodeAt(0);;
  10546. return self;
  10547. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  10548. },
  10549. args: [],
  10550. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  10551. referencedClasses: [],
  10552. messageSends: []
  10553. }),
  10554. $globals.String);
  10555. $core.addMethod(
  10556. $core.method({
  10557. selector: "at:ifAbsent:",
  10558. protocol: "accessing",
  10559. fn: function (anIndex,aBlock){
  10560. var self=this;
  10561. return $core.withContext(function($ctx1) {
  10562. return String(self)[anIndex - 1] || aBlock._value();
  10563. return self;
  10564. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  10565. },
  10566. args: ["anIndex", "aBlock"],
  10567. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  10568. referencedClasses: [],
  10569. messageSends: []
  10570. }),
  10571. $globals.String);
  10572. $core.addMethod(
  10573. $core.method({
  10574. selector: "at:ifPresent:ifAbsent:",
  10575. protocol: "accessing",
  10576. fn: function (anIndex,aBlock,anotherBlock){
  10577. var self=this;
  10578. return $core.withContext(function($ctx1) {
  10579. var result = String(self)[anIndex - 1];
  10580. return result ? aBlock._value_(result) : anotherBlock._value();
  10581. ;
  10582. return self;
  10583. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  10584. },
  10585. args: ["anIndex", "aBlock", "anotherBlock"],
  10586. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09'>",
  10587. referencedClasses: [],
  10588. messageSends: []
  10589. }),
  10590. $globals.String);
  10591. $core.addMethod(
  10592. $core.method({
  10593. selector: "capitalized",
  10594. protocol: "converting",
  10595. fn: function (){
  10596. var self=this;
  10597. return $core.withContext(function($ctx1) {
  10598. return self._ifNotEmpty_((function(){
  10599. return $core.withContext(function($ctx2) {
  10600. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  10601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10602. }));
  10603. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  10604. },
  10605. args: [],
  10606. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  10607. referencedClasses: [],
  10608. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  10609. }),
  10610. $globals.String);
  10611. $core.addMethod(
  10612. $core.method({
  10613. selector: "charCodeAt:",
  10614. protocol: "accessing",
  10615. fn: function (anInteger){
  10616. var self=this;
  10617. return $core.withContext(function($ctx1) {
  10618. return self.charCodeAt(anInteger - 1);
  10619. return self;
  10620. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  10621. },
  10622. args: ["anInteger"],
  10623. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  10624. referencedClasses: [],
  10625. messageSends: []
  10626. }),
  10627. $globals.String);
  10628. $core.addMethod(
  10629. $core.method({
  10630. selector: "copyFrom:to:",
  10631. protocol: "copying",
  10632. fn: function (anIndex,anotherIndex){
  10633. var self=this;
  10634. return $core.withContext(function($ctx1) {
  10635. return self.substring(anIndex - 1, anotherIndex);
  10636. return self;
  10637. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  10638. },
  10639. args: ["anIndex", "anotherIndex"],
  10640. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  10641. referencedClasses: [],
  10642. messageSends: []
  10643. }),
  10644. $globals.String);
  10645. $core.addMethod(
  10646. $core.method({
  10647. selector: "crlfSanitized",
  10648. protocol: "converting",
  10649. fn: function (){
  10650. var self=this;
  10651. return $core.withContext(function($ctx1) {
  10652. return $recv(self._lines())._join_($recv($globals.String)._lf());
  10653. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  10654. },
  10655. args: [],
  10656. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  10657. referencedClasses: ["String"],
  10658. messageSends: ["join:", "lines", "lf"]
  10659. }),
  10660. $globals.String);
  10661. $core.addMethod(
  10662. $core.method({
  10663. selector: "deepCopy",
  10664. protocol: "copying",
  10665. fn: function (){
  10666. var self=this;
  10667. return $core.withContext(function($ctx1) {
  10668. return self._shallowCopy();
  10669. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  10670. },
  10671. args: [],
  10672. source: "deepCopy\x0a\x09^ self shallowCopy",
  10673. referencedClasses: [],
  10674. messageSends: ["shallowCopy"]
  10675. }),
  10676. $globals.String);
  10677. $core.addMethod(
  10678. $core.method({
  10679. selector: "escaped",
  10680. protocol: "converting",
  10681. fn: function (){
  10682. var self=this;
  10683. return $core.withContext(function($ctx1) {
  10684. return escape(self);
  10685. return self;
  10686. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  10687. },
  10688. args: [],
  10689. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  10690. referencedClasses: [],
  10691. messageSends: []
  10692. }),
  10693. $globals.String);
  10694. $core.addMethod(
  10695. $core.method({
  10696. selector: "includesSubString:",
  10697. protocol: "testing",
  10698. fn: function (subString){
  10699. var self=this;
  10700. return $core.withContext(function($ctx1) {
  10701. return self.indexOf(subString) != -1;
  10702. return self;
  10703. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  10704. },
  10705. args: ["subString"],
  10706. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  10707. referencedClasses: [],
  10708. messageSends: []
  10709. }),
  10710. $globals.String);
  10711. $core.addMethod(
  10712. $core.method({
  10713. selector: "isCapitalized",
  10714. protocol: "testing",
  10715. fn: function (){
  10716. var self=this;
  10717. return $core.withContext(function($ctx1) {
  10718. var $2,$1;
  10719. $2=self._first();
  10720. $ctx1.sendIdx["first"]=1;
  10721. $1=$recv($2)._asUppercase();
  10722. return $recv($1).__eq_eq(self._first());
  10723. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  10724. },
  10725. args: [],
  10726. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  10727. referencedClasses: [],
  10728. messageSends: ["==", "asUppercase", "first"]
  10729. }),
  10730. $globals.String);
  10731. $core.addMethod(
  10732. $core.method({
  10733. selector: "isImmutable",
  10734. protocol: "testing",
  10735. fn: function (){
  10736. var self=this;
  10737. return true;
  10738. },
  10739. args: [],
  10740. source: "isImmutable\x0a\x09^ true",
  10741. referencedClasses: [],
  10742. messageSends: []
  10743. }),
  10744. $globals.String);
  10745. $core.addMethod(
  10746. $core.method({
  10747. selector: "isSelector",
  10748. protocol: "testing",
  10749. fn: function (){
  10750. var self=this;
  10751. return $core.withContext(function($ctx1) {
  10752. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  10753. return self;
  10754. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  10755. },
  10756. args: [],
  10757. source: "isSelector\x0a<inlineJS:\x0a\x09'return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)'\x0a>",
  10758. referencedClasses: [],
  10759. messageSends: []
  10760. }),
  10761. $globals.String);
  10762. $core.addMethod(
  10763. $core.method({
  10764. selector: "isString",
  10765. protocol: "testing",
  10766. fn: function (){
  10767. var self=this;
  10768. return true;
  10769. },
  10770. args: [],
  10771. source: "isString\x0a\x09^ true",
  10772. referencedClasses: [],
  10773. messageSends: []
  10774. }),
  10775. $globals.String);
  10776. $core.addMethod(
  10777. $core.method({
  10778. selector: "isVowel",
  10779. protocol: "testing",
  10780. fn: function (){
  10781. var self=this;
  10782. return $core.withContext(function($ctx1) {
  10783. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  10784. return $core.withContext(function($ctx2) {
  10785. return "aeiou"._includes_(self._asLowercase());
  10786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10787. }));
  10788. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  10789. },
  10790. args: [],
  10791. source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]",
  10792. referencedClasses: [],
  10793. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  10794. }),
  10795. $globals.String);
  10796. $core.addMethod(
  10797. $core.method({
  10798. selector: "join:",
  10799. protocol: "split join",
  10800. fn: function (aCollection){
  10801. var self=this;
  10802. return $core.withContext(function($ctx1) {
  10803. return $recv($globals.String)._streamContents_((function(stream){
  10804. return $core.withContext(function($ctx2) {
  10805. return $recv(aCollection)._do_separatedBy_((function(each){
  10806. return $core.withContext(function($ctx3) {
  10807. return $recv(stream)._nextPutAll_($recv(each)._asString());
  10808. $ctx3.sendIdx["nextPutAll:"]=1;
  10809. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  10810. }),(function(){
  10811. return $core.withContext(function($ctx3) {
  10812. return $recv(stream)._nextPutAll_(self);
  10813. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  10814. }));
  10815. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  10816. }));
  10817. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  10818. },
  10819. args: ["aCollection"],
  10820. source: "join: aCollection\x0a\x09^ String\x0a\x09\x09streamContents: [ :stream | aCollection\x0a\x09\x09\x09\x09do: [ :each | stream nextPutAll: each asString ]\x0a\x09\x09\x09\x09separatedBy: [ stream nextPutAll: self ]]",
  10821. referencedClasses: ["String"],
  10822. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  10823. }),
  10824. $globals.String);
  10825. $core.addMethod(
  10826. $core.method({
  10827. selector: "lineIndicesDo:",
  10828. protocol: "split join",
  10829. fn: function (aBlock){
  10830. var self=this;
  10831. var cr,lf,start,sz,nextLF,nextCR;
  10832. return $core.withContext(function($ctx1) {
  10833. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  10834. var $early={};
  10835. try {
  10836. start=(1);
  10837. sz=self._size();
  10838. cr=$recv($globals.String)._cr();
  10839. nextCR=self._indexOf_startingAt_(cr,(1));
  10840. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  10841. lf=$recv($globals.String)._lf();
  10842. nextLF=self._indexOf_startingAt_(lf,(1));
  10843. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  10844. $recv((function(){
  10845. return $core.withContext(function($ctx2) {
  10846. return $recv(start).__lt_eq(sz);
  10847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10848. }))._whileTrue_((function(){
  10849. return $core.withContext(function($ctx2) {
  10850. $2=$recv(nextLF).__eq((0));
  10851. $ctx2.sendIdx["="]=1;
  10852. $1=$recv($2)._and_((function(){
  10853. return $core.withContext(function($ctx3) {
  10854. return $recv(nextCR).__eq((0));
  10855. $ctx3.sendIdx["="]=2;
  10856. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  10857. }));
  10858. $ctx2.sendIdx["and:"]=1;
  10859. if($core.assert($1)){
  10860. $recv(aBlock)._value_value_value_(start,sz,sz);
  10861. $ctx2.sendIdx["value:value:value:"]=1;
  10862. throw $early=[self];
  10863. }
  10864. $4=$recv(nextCR).__eq((0));
  10865. $ctx2.sendIdx["="]=3;
  10866. $3=$recv($4)._or_((function(){
  10867. return $core.withContext(function($ctx3) {
  10868. $5=(0).__lt(nextLF);
  10869. $ctx3.sendIdx["<"]=1;
  10870. return $recv($5)._and_((function(){
  10871. return $core.withContext(function($ctx4) {
  10872. return $recv(nextLF).__lt(nextCR);
  10873. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  10874. }));
  10875. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  10876. }));
  10877. if($core.assert($3)){
  10878. $6=start;
  10879. $7=$recv(nextLF).__minus((1));
  10880. $ctx2.sendIdx["-"]=1;
  10881. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  10882. $ctx2.sendIdx["value:value:value:"]=2;
  10883. start=(1).__plus(nextLF);
  10884. $ctx2.sendIdx["+"]=1;
  10885. start;
  10886. nextLF=self._indexOf_startingAt_(lf,start);
  10887. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  10888. return nextLF;
  10889. } else {
  10890. $9=(1).__plus(nextCR);
  10891. $ctx2.sendIdx["+"]=2;
  10892. $8=$recv($9).__eq(nextLF);
  10893. if($core.assert($8)){
  10894. $10=start;
  10895. $11=$recv(nextCR).__minus((1));
  10896. $ctx2.sendIdx["-"]=2;
  10897. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  10898. $ctx2.sendIdx["value:value:value:"]=3;
  10899. start=(1).__plus(nextLF);
  10900. $ctx2.sendIdx["+"]=3;
  10901. start;
  10902. nextCR=self._indexOf_startingAt_(cr,start);
  10903. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  10904. nextCR;
  10905. nextLF=self._indexOf_startingAt_(lf,start);
  10906. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  10907. return nextLF;
  10908. } else {
  10909. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  10910. start=(1).__plus(nextCR);
  10911. start;
  10912. nextCR=self._indexOf_startingAt_(cr,start);
  10913. return nextCR;
  10914. }
  10915. }
  10916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10917. }));
  10918. return self;
  10919. }
  10920. catch(e) {if(e===$early)return e[0]; throw e}
  10921. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  10922. },
  10923. args: ["aBlock"],
  10924. source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [ \x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^ self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ] ]]",
  10925. referencedClasses: ["String"],
  10926. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  10927. }),
  10928. $globals.String);
  10929. $core.addMethod(
  10930. $core.method({
  10931. selector: "lineNumber:",
  10932. protocol: "split join",
  10933. fn: function (anIndex){
  10934. var self=this;
  10935. var lineCount;
  10936. return $core.withContext(function($ctx1) {
  10937. var $2,$1;
  10938. var $early={};
  10939. try {
  10940. lineCount=(0);
  10941. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  10942. return $core.withContext(function($ctx2) {
  10943. lineCount=$recv(lineCount).__plus((1));
  10944. $2=lineCount;
  10945. $1=$recv($2).__eq(anIndex);
  10946. if($core.assert($1)){
  10947. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  10948. }
  10949. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  10950. }));
  10951. return nil;
  10952. }
  10953. catch(e) {if(e===$early)return e[0]; throw e}
  10954. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  10955. },
  10956. args: ["anIndex"],
  10957. source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [ ^ self copyFrom: start to: endWithoutDelimiters ]].\x0a\x09^ nil",
  10958. referencedClasses: [],
  10959. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  10960. }),
  10961. $globals.String);
  10962. $core.addMethod(
  10963. $core.method({
  10964. selector: "lines",
  10965. protocol: "split join",
  10966. fn: function (){
  10967. var self=this;
  10968. return $core.withContext(function($ctx1) {
  10969. var result = self.split(/\r\n|\r|\n/);
  10970. if (!result[result.length-1]) result.pop();
  10971. return result;;
  10972. return self;
  10973. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  10974. },
  10975. args: [],
  10976. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<inlineJS: '\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a'>",
  10977. referencedClasses: [],
  10978. messageSends: []
  10979. }),
  10980. $globals.String);
  10981. $core.addMethod(
  10982. $core.method({
  10983. selector: "linesDo:",
  10984. protocol: "split join",
  10985. fn: function (aBlock){
  10986. var self=this;
  10987. return $core.withContext(function($ctx1) {
  10988. $recv(self._lines())._do_(aBlock);
  10989. return self;
  10990. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  10991. },
  10992. args: ["aBlock"],
  10993. source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lines do: aBlock",
  10994. referencedClasses: [],
  10995. messageSends: ["do:", "lines"]
  10996. }),
  10997. $globals.String);
  10998. $core.addMethod(
  10999. $core.method({
  11000. selector: "match:",
  11001. protocol: "regular expressions",
  11002. fn: function (aRegexp){
  11003. var self=this;
  11004. return $core.withContext(function($ctx1) {
  11005. return self.search(aRegexp) != -1;
  11006. return self;
  11007. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  11008. },
  11009. args: ["aRegexp"],
  11010. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  11011. referencedClasses: [],
  11012. messageSends: []
  11013. }),
  11014. $globals.String);
  11015. $core.addMethod(
  11016. $core.method({
  11017. selector: "matchesOf:",
  11018. protocol: "regular expressions",
  11019. fn: function (aRegularExpression){
  11020. var self=this;
  11021. return $core.withContext(function($ctx1) {
  11022. return self.match(aRegularExpression);
  11023. return self;
  11024. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  11025. },
  11026. args: ["aRegularExpression"],
  11027. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  11028. referencedClasses: [],
  11029. messageSends: []
  11030. }),
  11031. $globals.String);
  11032. $core.addMethod(
  11033. $core.method({
  11034. selector: "numericallyIndexable",
  11035. protocol: "private",
  11036. fn: function (){
  11037. var self=this;
  11038. return $core.withContext(function($ctx1) {
  11039. return String(self);
  11040. return self;
  11041. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  11042. },
  11043. args: [],
  11044. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  11045. referencedClasses: [],
  11046. messageSends: []
  11047. }),
  11048. $globals.String);
  11049. $core.addMethod(
  11050. $core.method({
  11051. selector: "printNl",
  11052. protocol: "printing",
  11053. fn: function (){
  11054. var self=this;
  11055. return $core.withContext(function($ctx1) {
  11056. console.log(self);
  11057. return self;
  11058. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  11059. },
  11060. args: [],
  11061. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  11062. referencedClasses: [],
  11063. messageSends: []
  11064. }),
  11065. $globals.String);
  11066. $core.addMethod(
  11067. $core.method({
  11068. selector: "printOn:",
  11069. protocol: "printing",
  11070. fn: function (aStream){
  11071. var self=this;
  11072. return $core.withContext(function($ctx1) {
  11073. $recv(aStream)._nextPutAll_("'");
  11074. $ctx1.sendIdx["nextPutAll:"]=1;
  11075. $recv(aStream)._nextPutAll_(self._replace_with_("'","''"));
  11076. $ctx1.sendIdx["nextPutAll:"]=2;
  11077. $recv(aStream)._nextPutAll_("'");
  11078. return self;
  11079. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  11080. },
  11081. args: ["aStream"],
  11082. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  11083. referencedClasses: [],
  11084. messageSends: ["nextPutAll:", "replace:with:"]
  11085. }),
  11086. $globals.String);
  11087. $core.addMethod(
  11088. $core.method({
  11089. selector: "replace:with:",
  11090. protocol: "regular expressions",
  11091. fn: function (aString,anotherString){
  11092. var self=this;
  11093. return $core.withContext(function($ctx1) {
  11094. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  11095. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  11096. },
  11097. args: ["aString", "anotherString"],
  11098. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  11099. referencedClasses: ["RegularExpression"],
  11100. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  11101. }),
  11102. $globals.String);
  11103. $core.addMethod(
  11104. $core.method({
  11105. selector: "replaceRegexp:with:",
  11106. protocol: "regular expressions",
  11107. fn: function (aRegexp,aString){
  11108. var self=this;
  11109. return $core.withContext(function($ctx1) {
  11110. return self.replace(aRegexp, aString);
  11111. return self;
  11112. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  11113. },
  11114. args: ["aRegexp", "aString"],
  11115. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  11116. referencedClasses: [],
  11117. messageSends: []
  11118. }),
  11119. $globals.String);
  11120. $core.addMethod(
  11121. $core.method({
  11122. selector: "reversed",
  11123. protocol: "converting",
  11124. fn: function (){
  11125. var self=this;
  11126. return $core.withContext(function($ctx1) {
  11127. return self.split("").reverse().join("");
  11128. return self;
  11129. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  11130. },
  11131. args: [],
  11132. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  11133. referencedClasses: [],
  11134. messageSends: []
  11135. }),
  11136. $globals.String);
  11137. $core.addMethod(
  11138. $core.method({
  11139. selector: "shallowCopy",
  11140. protocol: "copying",
  11141. fn: function (){
  11142. var self=this;
  11143. return self;
  11144. },
  11145. args: [],
  11146. source: "shallowCopy\x0a\x09^ self",
  11147. referencedClasses: [],
  11148. messageSends: []
  11149. }),
  11150. $globals.String);
  11151. $core.addMethod(
  11152. $core.method({
  11153. selector: "size",
  11154. protocol: "accessing",
  11155. fn: function (){
  11156. var self=this;
  11157. return $core.withContext(function($ctx1) {
  11158. return self.length;
  11159. return self;
  11160. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  11161. },
  11162. args: [],
  11163. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  11164. referencedClasses: [],
  11165. messageSends: []
  11166. }),
  11167. $globals.String);
  11168. $core.addMethod(
  11169. $core.method({
  11170. selector: "subStrings:",
  11171. protocol: "split join",
  11172. fn: function (aString){
  11173. var self=this;
  11174. return $core.withContext(function($ctx1) {
  11175. return self._tokenize_(aString);
  11176. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  11177. },
  11178. args: ["aString"],
  11179. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  11180. referencedClasses: [],
  11181. messageSends: ["tokenize:"]
  11182. }),
  11183. $globals.String);
  11184. $core.addMethod(
  11185. $core.method({
  11186. selector: "tokenize:",
  11187. protocol: "split join",
  11188. fn: function (aString){
  11189. var self=this;
  11190. return $core.withContext(function($ctx1) {
  11191. return self.split(aString);
  11192. return self;
  11193. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  11194. },
  11195. args: ["aString"],
  11196. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  11197. referencedClasses: [],
  11198. messageSends: []
  11199. }),
  11200. $globals.String);
  11201. $core.addMethod(
  11202. $core.method({
  11203. selector: "trimBoth",
  11204. protocol: "regular expressions",
  11205. fn: function (){
  11206. var self=this;
  11207. return $core.withContext(function($ctx1) {
  11208. return self._trimBoth_("\x5cs");
  11209. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  11210. },
  11211. args: [],
  11212. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  11213. referencedClasses: [],
  11214. messageSends: ["trimBoth:"]
  11215. }),
  11216. $globals.String);
  11217. $core.addMethod(
  11218. $core.method({
  11219. selector: "trimBoth:",
  11220. protocol: "regular expressions",
  11221. fn: function (separators){
  11222. var self=this;
  11223. return $core.withContext(function($ctx1) {
  11224. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  11225. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  11226. },
  11227. args: ["separators"],
  11228. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  11229. referencedClasses: [],
  11230. messageSends: ["trimRight:", "trimLeft:"]
  11231. }),
  11232. $globals.String);
  11233. $core.addMethod(
  11234. $core.method({
  11235. selector: "trimLeft",
  11236. protocol: "regular expressions",
  11237. fn: function (){
  11238. var self=this;
  11239. return $core.withContext(function($ctx1) {
  11240. return self._trimLeft_("\x5cs");
  11241. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  11242. },
  11243. args: [],
  11244. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  11245. referencedClasses: [],
  11246. messageSends: ["trimLeft:"]
  11247. }),
  11248. $globals.String);
  11249. $core.addMethod(
  11250. $core.method({
  11251. selector: "trimLeft:",
  11252. protocol: "regular expressions",
  11253. fn: function (separators){
  11254. var self=this;
  11255. return $core.withContext(function($ctx1) {
  11256. var $2,$1;
  11257. $2=$recv("^[".__comma(separators)).__comma("]+");
  11258. $ctx1.sendIdx[","]=1;
  11259. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11260. return self._replaceRegexp_with_($1,"");
  11261. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  11262. },
  11263. args: ["separators"],
  11264. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  11265. referencedClasses: ["RegularExpression"],
  11266. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11267. }),
  11268. $globals.String);
  11269. $core.addMethod(
  11270. $core.method({
  11271. selector: "trimRight",
  11272. protocol: "regular expressions",
  11273. fn: function (){
  11274. var self=this;
  11275. return $core.withContext(function($ctx1) {
  11276. return self._trimRight_("\x5cs");
  11277. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  11278. },
  11279. args: [],
  11280. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  11281. referencedClasses: [],
  11282. messageSends: ["trimRight:"]
  11283. }),
  11284. $globals.String);
  11285. $core.addMethod(
  11286. $core.method({
  11287. selector: "trimRight:",
  11288. protocol: "regular expressions",
  11289. fn: function (separators){
  11290. var self=this;
  11291. return $core.withContext(function($ctx1) {
  11292. var $2,$1;
  11293. $2=$recv("[".__comma(separators)).__comma("]+$");
  11294. $ctx1.sendIdx[","]=1;
  11295. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  11296. return self._replaceRegexp_with_($1,"");
  11297. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  11298. },
  11299. args: ["separators"],
  11300. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  11301. referencedClasses: ["RegularExpression"],
  11302. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  11303. }),
  11304. $globals.String);
  11305. $core.addMethod(
  11306. $core.method({
  11307. selector: "unescaped",
  11308. protocol: "converting",
  11309. fn: function (){
  11310. var self=this;
  11311. return $core.withContext(function($ctx1) {
  11312. return unescape(self);
  11313. return self;
  11314. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  11315. },
  11316. args: [],
  11317. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  11318. referencedClasses: [],
  11319. messageSends: []
  11320. }),
  11321. $globals.String);
  11322. $core.addMethod(
  11323. $core.method({
  11324. selector: "uriComponentDecoded",
  11325. protocol: "converting",
  11326. fn: function (){
  11327. var self=this;
  11328. return $core.withContext(function($ctx1) {
  11329. return decodeURIComponent(self);
  11330. return self;
  11331. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  11332. },
  11333. args: [],
  11334. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  11335. referencedClasses: [],
  11336. messageSends: []
  11337. }),
  11338. $globals.String);
  11339. $core.addMethod(
  11340. $core.method({
  11341. selector: "uriComponentEncoded",
  11342. protocol: "converting",
  11343. fn: function (){
  11344. var self=this;
  11345. return $core.withContext(function($ctx1) {
  11346. return encodeURIComponent(self);
  11347. return self;
  11348. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  11349. },
  11350. args: [],
  11351. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  11352. referencedClasses: [],
  11353. messageSends: []
  11354. }),
  11355. $globals.String);
  11356. $core.addMethod(
  11357. $core.method({
  11358. selector: "uriDecoded",
  11359. protocol: "converting",
  11360. fn: function (){
  11361. var self=this;
  11362. return $core.withContext(function($ctx1) {
  11363. return decodeURI(self);
  11364. return self;
  11365. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  11366. },
  11367. args: [],
  11368. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  11369. referencedClasses: [],
  11370. messageSends: []
  11371. }),
  11372. $globals.String);
  11373. $core.addMethod(
  11374. $core.method({
  11375. selector: "uriEncoded",
  11376. protocol: "converting",
  11377. fn: function (){
  11378. var self=this;
  11379. return $core.withContext(function($ctx1) {
  11380. return encodeURI(self);
  11381. return self;
  11382. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  11383. },
  11384. args: [],
  11385. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  11386. referencedClasses: [],
  11387. messageSends: []
  11388. }),
  11389. $globals.String);
  11390. $core.addMethod(
  11391. $core.method({
  11392. selector: "value:",
  11393. protocol: "evaluating",
  11394. fn: function (anObject){
  11395. var self=this;
  11396. return $core.withContext(function($ctx1) {
  11397. return $recv(anObject)._perform_(self);
  11398. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  11399. },
  11400. args: ["anObject"],
  11401. source: "value: anObject \x0a\x09^ anObject perform: self",
  11402. referencedClasses: [],
  11403. messageSends: ["perform:"]
  11404. }),
  11405. $globals.String);
  11406. $core.addMethod(
  11407. $core.method({
  11408. selector: "cr",
  11409. protocol: "accessing",
  11410. fn: function (){
  11411. var self=this;
  11412. return $core.withContext(function($ctx1) {
  11413. return "\r";
  11414. return self;
  11415. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  11416. },
  11417. args: [],
  11418. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  11419. referencedClasses: [],
  11420. messageSends: []
  11421. }),
  11422. $globals.String.klass);
  11423. $core.addMethod(
  11424. $core.method({
  11425. selector: "crlf",
  11426. protocol: "accessing",
  11427. fn: function (){
  11428. var self=this;
  11429. return $core.withContext(function($ctx1) {
  11430. return "\r\n";
  11431. return self;
  11432. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  11433. },
  11434. args: [],
  11435. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  11436. referencedClasses: [],
  11437. messageSends: []
  11438. }),
  11439. $globals.String.klass);
  11440. $core.addMethod(
  11441. $core.method({
  11442. selector: "esc",
  11443. protocol: "accessing",
  11444. fn: function (){
  11445. var self=this;
  11446. return $core.withContext(function($ctx1) {
  11447. return self._fromCharCode_((27));
  11448. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  11449. },
  11450. args: [],
  11451. source: "esc\x0a\x09^ self fromCharCode: 27",
  11452. referencedClasses: [],
  11453. messageSends: ["fromCharCode:"]
  11454. }),
  11455. $globals.String.klass);
  11456. $core.addMethod(
  11457. $core.method({
  11458. selector: "fromCharCode:",
  11459. protocol: "instance creation",
  11460. fn: function (anInteger){
  11461. var self=this;
  11462. return $core.withContext(function($ctx1) {
  11463. return String.fromCharCode(anInteger);
  11464. return self;
  11465. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  11466. },
  11467. args: ["anInteger"],
  11468. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  11469. referencedClasses: [],
  11470. messageSends: []
  11471. }),
  11472. $globals.String.klass);
  11473. $core.addMethod(
  11474. $core.method({
  11475. selector: "fromString:",
  11476. protocol: "instance creation",
  11477. fn: function (aString){
  11478. var self=this;
  11479. return $core.withContext(function($ctx1) {
  11480. return String(aString);
  11481. return self;
  11482. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  11483. },
  11484. args: ["aString"],
  11485. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  11486. referencedClasses: [],
  11487. messageSends: []
  11488. }),
  11489. $globals.String.klass);
  11490. $core.addMethod(
  11491. $core.method({
  11492. selector: "lf",
  11493. protocol: "accessing",
  11494. fn: function (){
  11495. var self=this;
  11496. return $core.withContext(function($ctx1) {
  11497. return "\n";
  11498. return self;
  11499. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  11500. },
  11501. args: [],
  11502. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  11503. referencedClasses: [],
  11504. messageSends: []
  11505. }),
  11506. $globals.String.klass);
  11507. $core.addMethod(
  11508. $core.method({
  11509. selector: "random",
  11510. protocol: "random",
  11511. fn: function (){
  11512. var self=this;
  11513. return $core.withContext(function($ctx1) {
  11514. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  11515. return self;
  11516. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  11517. },
  11518. args: [],
  11519. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  11520. referencedClasses: [],
  11521. messageSends: []
  11522. }),
  11523. $globals.String.klass);
  11524. $core.addMethod(
  11525. $core.method({
  11526. selector: "randomNotIn:",
  11527. protocol: "random",
  11528. fn: function (aString){
  11529. var self=this;
  11530. var result;
  11531. return $core.withContext(function($ctx1) {
  11532. $recv((function(){
  11533. return $core.withContext(function($ctx2) {
  11534. result=self._random();
  11535. result;
  11536. return $recv(aString)._includesSubString_(result);
  11537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11538. }))._whileTrue();
  11539. return result;
  11540. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  11541. },
  11542. args: ["aString"],
  11543. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  11544. referencedClasses: [],
  11545. messageSends: ["whileTrue", "random", "includesSubString:"]
  11546. }),
  11547. $globals.String.klass);
  11548. $core.addMethod(
  11549. $core.method({
  11550. selector: "space",
  11551. protocol: "accessing",
  11552. fn: function (){
  11553. var self=this;
  11554. return $core.withContext(function($ctx1) {
  11555. return " ";
  11556. return self;
  11557. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  11558. },
  11559. args: [],
  11560. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  11561. referencedClasses: [],
  11562. messageSends: []
  11563. }),
  11564. $globals.String.klass);
  11565. $core.addMethod(
  11566. $core.method({
  11567. selector: "streamClass",
  11568. protocol: "accessing",
  11569. fn: function (){
  11570. var self=this;
  11571. return $globals.StringStream;
  11572. },
  11573. args: [],
  11574. source: "streamClass\x0a\x09\x09^ StringStream",
  11575. referencedClasses: ["StringStream"],
  11576. messageSends: []
  11577. }),
  11578. $globals.String.klass);
  11579. $core.addMethod(
  11580. $core.method({
  11581. selector: "tab",
  11582. protocol: "accessing",
  11583. fn: function (){
  11584. var self=this;
  11585. return $core.withContext(function($ctx1) {
  11586. return "\t";
  11587. return self;
  11588. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  11589. },
  11590. args: [],
  11591. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  11592. referencedClasses: [],
  11593. messageSends: []
  11594. }),
  11595. $globals.String.klass);
  11596. $core.addMethod(
  11597. $core.method({
  11598. selector: "value:",
  11599. protocol: "instance creation",
  11600. fn: function (aUTFCharCode){
  11601. var self=this;
  11602. return $core.withContext(function($ctx1) {
  11603. return String.fromCharCode(aUTFCharCode);;
  11604. return self;
  11605. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  11606. },
  11607. args: ["aUTFCharCode"],
  11608. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  11609. referencedClasses: [],
  11610. messageSends: []
  11611. }),
  11612. $globals.String.klass);
  11613. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  11614. $globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`.";
  11615. $core.addMethod(
  11616. $core.method({
  11617. selector: "=",
  11618. protocol: "comparing",
  11619. fn: function (aCollection){
  11620. var self=this;
  11621. return $core.withContext(function($ctx1) {
  11622. var $2,$1,$4,$3,$5;
  11623. var $early={};
  11624. try {
  11625. $2=self._class();
  11626. $ctx1.sendIdx["class"]=1;
  11627. $1=$recv($2).__eq($recv(aCollection)._class());
  11628. $ctx1.sendIdx["="]=1;
  11629. if(!$core.assert($1)){
  11630. return false;
  11631. }
  11632. $4=self._size();
  11633. $ctx1.sendIdx["size"]=1;
  11634. $3=$recv($4).__eq($recv(aCollection)._size());
  11635. if(!$core.assert($3)){
  11636. return false;
  11637. }
  11638. self._do_((function(each){
  11639. return $core.withContext(function($ctx2) {
  11640. $5=$recv(aCollection)._includes_(each);
  11641. if(!$core.assert($5)){
  11642. throw $early=[false];
  11643. }
  11644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  11645. }));
  11646. return true;
  11647. }
  11648. catch(e) {if(e===$early)return e[0]; throw e}
  11649. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  11650. },
  11651. args: ["aCollection"],
  11652. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  11653. referencedClasses: [],
  11654. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  11655. }),
  11656. $globals.Set);
  11657. $core.addMethod(
  11658. $core.method({
  11659. selector: "add:",
  11660. protocol: "adding/removing",
  11661. fn: function (anObject){
  11662. var self=this;
  11663. var bucket;
  11664. return $core.withContext(function($ctx1) {
  11665. var $1,$receiver;
  11666. bucket=self._bucketsOfElement_(anObject);
  11667. $1=$recv(bucket)._second();
  11668. if(($receiver = $1) == null || $receiver.isNil){
  11669. var object,slowBucket;
  11670. object=$recv(bucket)._first();
  11671. $ctx1.sendIdx["first"]=1;
  11672. object;
  11673. slowBucket=$recv(bucket)._third();
  11674. slowBucket;
  11675. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  11676. return $core.withContext(function($ctx2) {
  11677. $recv(slowBucket)._add_(object);
  11678. self["@size"]=$recv(self["@size"]).__plus((1));
  11679. return self["@size"];
  11680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11681. }));
  11682. return object;
  11683. } else {
  11684. var primitiveBucket;
  11685. primitiveBucket=$receiver;
  11686. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  11687. }
  11688. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  11689. },
  11690. args: ["anObject"],
  11691. source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]",
  11692. referencedClasses: [],
  11693. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  11694. }),
  11695. $globals.Set);
  11696. $core.addMethod(
  11697. $core.method({
  11698. selector: "add:in:",
  11699. protocol: "private",
  11700. fn: function (anObject,anotherObject){
  11701. var self=this;
  11702. return $core.withContext(function($ctx1) {
  11703. if (anObject in anotherObject.store) { return false; }
  11704. self['@size']++;
  11705. anotherObject.store[anObject] = true;
  11706. return anObject;
  11707. ;
  11708. return self;
  11709. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  11710. },
  11711. args: ["anObject", "anotherObject"],
  11712. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  11713. referencedClasses: [],
  11714. messageSends: []
  11715. }),
  11716. $globals.Set);
  11717. $core.addMethod(
  11718. $core.method({
  11719. selector: "bucketsOfElement:",
  11720. protocol: "private",
  11721. fn: function (anObject){
  11722. var self=this;
  11723. return $core.withContext(function($ctx1) {
  11724. // include nil to well-known objects under "boolean" fastBucket
  11725. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  11726. var prim = anObject.valueOf();
  11727. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  11728. var bucket = null;
  11729. self['@slowBucketStores'].some(function (store) {
  11730. return bucket = store._bucketOfElement_(anObject);
  11731. });
  11732. return [ anObject, null, bucket || self['@defaultBucket'] ];
  11733. }
  11734. return [ prim, self['@fastBuckets'][typeof prim] ];
  11735. ;
  11736. return self;
  11737. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  11738. },
  11739. args: ["anObject"],
  11740. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.isNil) return [ null, self[''@fastBuckets''].boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !self[''@fastBuckets''][typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09self[''@slowBucketStores''].some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || self[''@defaultBucket''] ];\x0a\x09\x09}\x0a\x09\x09return [ prim, self[''@fastBuckets''][typeof prim] ];\x0a\x09'>",
  11741. referencedClasses: [],
  11742. messageSends: []
  11743. }),
  11744. $globals.Set);
  11745. $core.addMethod(
  11746. $core.method({
  11747. selector: "classNameOf:",
  11748. protocol: "private",
  11749. fn: function (anObject){
  11750. var self=this;
  11751. return $core.withContext(function($ctx1) {
  11752. return anObject.klass != null && anObject.klass.className;
  11753. return self;
  11754. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  11755. },
  11756. args: ["anObject"],
  11757. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.klass != null && anObject.klass.className'>",
  11758. referencedClasses: [],
  11759. messageSends: []
  11760. }),
  11761. $globals.Set);
  11762. $core.addMethod(
  11763. $core.method({
  11764. selector: "collect:",
  11765. protocol: "enumerating",
  11766. fn: function (aBlock){
  11767. var self=this;
  11768. var collection;
  11769. return $core.withContext(function($ctx1) {
  11770. collection=$recv(self._class())._new();
  11771. self._do_((function(each){
  11772. return $core.withContext(function($ctx2) {
  11773. return $recv(collection)._add_($recv(aBlock)._value_(each));
  11774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11775. }));
  11776. return collection;
  11777. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  11778. },
  11779. args: ["aBlock"],
  11780. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  11781. referencedClasses: [],
  11782. messageSends: ["new", "class", "do:", "add:", "value:"]
  11783. }),
  11784. $globals.Set);
  11785. $core.addMethod(
  11786. $core.method({
  11787. selector: "detect:ifNone:",
  11788. protocol: "enumerating",
  11789. fn: function (aBlock,anotherBlock){
  11790. var self=this;
  11791. return $core.withContext(function($ctx1) {
  11792. var $1;
  11793. var $early={};
  11794. try {
  11795. self._do_((function(each){
  11796. return $core.withContext(function($ctx2) {
  11797. $1=$recv(aBlock)._value_(each);
  11798. if($core.assert($1)){
  11799. throw $early=[each];
  11800. }
  11801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11802. }));
  11803. return $recv(anotherBlock)._value();
  11804. }
  11805. catch(e) {if(e===$early)return e[0]; throw e}
  11806. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  11807. },
  11808. args: ["aBlock", "anotherBlock"],
  11809. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  11810. referencedClasses: [],
  11811. messageSends: ["do:", "ifTrue:", "value:", "value"]
  11812. }),
  11813. $globals.Set);
  11814. $core.addMethod(
  11815. $core.method({
  11816. selector: "do:",
  11817. protocol: "enumerating",
  11818. fn: function (aBlock){
  11819. var self=this;
  11820. return $core.withContext(function($ctx1) {
  11821. var el, keys, i;
  11822. el = self['@fastBuckets'];
  11823. keys = Object.keys(el);
  11824. for (i = 0; i < keys.length; ++i) {
  11825. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  11826. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  11827. else { store._do_(aBlock); }
  11828. }
  11829. el = self['@slowBucketStores'];
  11830. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  11831. self['@defaultBucket']._do_(aBlock);
  11832. ;
  11833. return self;
  11834. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  11835. },
  11836. args: ["aBlock"],
  11837. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = self[''@fastBuckets''];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = self[''@slowBucketStores''];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09self[''@defaultBucket'']._do_(aBlock);\x0a\x09'>",
  11838. referencedClasses: [],
  11839. messageSends: []
  11840. }),
  11841. $globals.Set);
  11842. $core.addMethod(
  11843. $core.method({
  11844. selector: "includes:",
  11845. protocol: "testing",
  11846. fn: function (anObject){
  11847. var self=this;
  11848. var bucket;
  11849. return $core.withContext(function($ctx1) {
  11850. var $1,$2,$3,$receiver;
  11851. bucket=self._bucketsOfElement_(anObject);
  11852. $1=$recv(bucket)._second();
  11853. if(($receiver = $1) == null || $receiver.isNil){
  11854. $2=$recv(bucket)._third();
  11855. $3=$recv(bucket)._first();
  11856. $ctx1.sendIdx["first"]=1;
  11857. return $recv($2)._includes_($3);
  11858. } else {
  11859. var primitiveBucket;
  11860. primitiveBucket=$receiver;
  11861. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  11862. }
  11863. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  11864. },
  11865. args: ["anObject"],
  11866. source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]",
  11867. referencedClasses: [],
  11868. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  11869. }),
  11870. $globals.Set);
  11871. $core.addMethod(
  11872. $core.method({
  11873. selector: "includes:in:",
  11874. protocol: "private",
  11875. fn: function (anObject,anotherObject){
  11876. var self=this;
  11877. return $core.withContext(function($ctx1) {
  11878. return anObject in anotherObject.store;
  11879. return self;
  11880. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  11881. },
  11882. args: ["anObject", "anotherObject"],
  11883. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  11884. referencedClasses: [],
  11885. messageSends: []
  11886. }),
  11887. $globals.Set);
  11888. $core.addMethod(
  11889. $core.method({
  11890. selector: "initialize",
  11891. protocol: "initialization",
  11892. fn: function (){
  11893. var self=this;
  11894. return $core.withContext(function($ctx1) {
  11895. (
  11896. $ctx1.supercall = true,
  11897. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  11898. $ctx1.supercall = false;
  11899. self["@defaultBucket"]=[];
  11900. self._initializeSlowBucketStores();
  11901. self._removeAll();
  11902. return self;
  11903. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  11904. },
  11905. args: [],
  11906. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  11907. referencedClasses: [],
  11908. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  11909. }),
  11910. $globals.Set);
  11911. $core.addMethod(
  11912. $core.method({
  11913. selector: "initializeSlowBucketStores",
  11914. protocol: "initialization",
  11915. fn: function (){
  11916. var self=this;
  11917. return $core.withContext(function($ctx1) {
  11918. var $1;
  11919. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  11920. return $core.withContext(function($ctx2) {
  11921. return self._classNameOf_(x);
  11922. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  11923. }));
  11924. $ctx1.sendIdx["hashBlock:"]=1;
  11925. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  11926. return $core.withContext(function($ctx2) {
  11927. return self._jsConstructorNameOf_(x);
  11928. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  11929. }))];
  11930. return self;
  11931. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  11932. },
  11933. args: [],
  11934. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  11935. referencedClasses: ["ArrayBucketStore"],
  11936. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  11937. }),
  11938. $globals.Set);
  11939. $core.addMethod(
  11940. $core.method({
  11941. selector: "jsConstructorNameOf:",
  11942. protocol: "private",
  11943. fn: function (anObject){
  11944. var self=this;
  11945. return $core.withContext(function($ctx1) {
  11946. return anObject.constructor && anObject.constructor.name;
  11947. return self;
  11948. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  11949. },
  11950. args: ["anObject"],
  11951. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  11952. referencedClasses: [],
  11953. messageSends: []
  11954. }),
  11955. $globals.Set);
  11956. $core.addMethod(
  11957. $core.method({
  11958. selector: "printOn:",
  11959. protocol: "printing",
  11960. fn: function (aStream){
  11961. var self=this;
  11962. return $core.withContext(function($ctx1) {
  11963. (
  11964. $ctx1.supercall = true,
  11965. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  11966. $ctx1.supercall = false;
  11967. $ctx1.sendIdx["printOn:"]=1;
  11968. $recv(aStream)._nextPutAll_(" (");
  11969. $ctx1.sendIdx["nextPutAll:"]=1;
  11970. self._do_separatedBy_((function(each){
  11971. return $core.withContext(function($ctx2) {
  11972. return $recv(each)._printOn_(aStream);
  11973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11974. }),(function(){
  11975. return $core.withContext(function($ctx2) {
  11976. return $recv(aStream)._nextPutAll_(" ");
  11977. $ctx2.sendIdx["nextPutAll:"]=2;
  11978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  11979. }));
  11980. $recv(aStream)._nextPutAll_(")");
  11981. return self;
  11982. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  11983. },
  11984. args: ["aStream"],
  11985. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  11986. referencedClasses: [],
  11987. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  11988. }),
  11989. $globals.Set);
  11990. $core.addMethod(
  11991. $core.method({
  11992. selector: "remove:ifAbsent:",
  11993. protocol: "adding/removing",
  11994. fn: function (anObject,aBlock){
  11995. var self=this;
  11996. var bucket;
  11997. return $core.withContext(function($ctx1) {
  11998. var $1,$2,$3,$receiver;
  11999. var $early={};
  12000. try {
  12001. bucket=self._bucketsOfElement_(anObject);
  12002. $1=$recv(bucket)._second();
  12003. if(($receiver = $1) == null || $receiver.isNil){
  12004. $2=$recv(bucket)._third();
  12005. $3=$recv(bucket)._first();
  12006. $ctx1.sendIdx["first"]=1;
  12007. $recv($2)._remove_ifAbsent_($3,(function(){
  12008. return $core.withContext(function($ctx2) {
  12009. throw $early=[$recv(aBlock)._value()];
  12010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12011. }));
  12012. self["@size"]=$recv(self["@size"]).__minus((1));
  12013. return self["@size"];
  12014. } else {
  12015. var primitiveBucket;
  12016. primitiveBucket=$receiver;
  12017. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  12018. }
  12019. }
  12020. catch(e) {if(e===$early)return e[0]; throw e}
  12021. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  12022. },
  12023. args: ["anObject", "aBlock"],
  12024. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
  12025. referencedClasses: [],
  12026. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  12027. }),
  12028. $globals.Set);
  12029. $core.addMethod(
  12030. $core.method({
  12031. selector: "remove:in:",
  12032. protocol: "private",
  12033. fn: function (anObject,anotherObject){
  12034. var self=this;
  12035. return $core.withContext(function($ctx1) {
  12036. if (delete anotherObject.store[anObject]) self['@size']--;
  12037. return self;
  12038. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12039. },
  12040. args: ["anObject", "anotherObject"],
  12041. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (delete anotherObject.store[anObject]) self[''@size'']--'>",
  12042. referencedClasses: [],
  12043. messageSends: []
  12044. }),
  12045. $globals.Set);
  12046. $core.addMethod(
  12047. $core.method({
  12048. selector: "removeAll",
  12049. protocol: "adding/removing",
  12050. fn: function (){
  12051. var self=this;
  12052. return $core.withContext(function($ctx1) {
  12053. self['@fastBuckets'] = {
  12054. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  12055. "number": { store: Object.create(null), fn: Number },
  12056. "string": { store: Object.create(null) }
  12057. };
  12058. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  12059. self['@defaultBucket']._removeAll();
  12060. self['@size'] = 0;
  12061. ;
  12062. return self;
  12063. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  12064. },
  12065. args: [],
  12066. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09self[''@fastBuckets''] = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09self[''@slowBucketStores''].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self[''@defaultBucket'']._removeAll();\x0a\x09\x09self[''@size''] = 0;\x0a\x09'>",
  12067. referencedClasses: [],
  12068. messageSends: []
  12069. }),
  12070. $globals.Set);
  12071. $core.addMethod(
  12072. $core.method({
  12073. selector: "select:",
  12074. protocol: "enumerating",
  12075. fn: function (aBlock){
  12076. var self=this;
  12077. var collection;
  12078. return $core.withContext(function($ctx1) {
  12079. var $1;
  12080. collection=$recv(self._class())._new();
  12081. self._do_((function(each){
  12082. return $core.withContext(function($ctx2) {
  12083. $1=$recv(aBlock)._value_(each);
  12084. if($core.assert($1)){
  12085. return $recv(collection)._add_(each);
  12086. }
  12087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12088. }));
  12089. return collection;
  12090. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12091. },
  12092. args: ["aBlock"],
  12093. source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each ] ].\x0a\x09^ collection",
  12094. referencedClasses: [],
  12095. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12096. }),
  12097. $globals.Set);
  12098. $core.addMethod(
  12099. $core.method({
  12100. selector: "select:thenCollect:",
  12101. protocol: "enumerating",
  12102. fn: function (selectBlock,collectBlock){
  12103. var self=this;
  12104. var collection;
  12105. return $core.withContext(function($ctx1) {
  12106. var $1;
  12107. collection=$recv(self._class())._new();
  12108. self._do_((function(each){
  12109. return $core.withContext(function($ctx2) {
  12110. $1=$recv(selectBlock)._value_(each);
  12111. $ctx2.sendIdx["value:"]=1;
  12112. if($core.assert($1)){
  12113. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  12114. }
  12115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12116. }));
  12117. return collection;
  12118. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  12119. },
  12120. args: ["selectBlock", "collectBlock"],
  12121. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: (collectBlock value: each) ] ].\x0a\x09^ collection",
  12122. referencedClasses: [],
  12123. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  12124. }),
  12125. $globals.Set);
  12126. $core.addMethod(
  12127. $core.method({
  12128. selector: "size",
  12129. protocol: "accessing",
  12130. fn: function (){
  12131. var self=this;
  12132. return self["@size"];
  12133. },
  12134. args: [],
  12135. source: "size\x0a\x09^ size",
  12136. referencedClasses: [],
  12137. messageSends: []
  12138. }),
  12139. $globals.Set);
  12140. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  12141. $globals.ProtoStream.comment="I am the abstract base for different accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams modifying the contents.";
  12142. $core.addMethod(
  12143. $core.method({
  12144. selector: "<<",
  12145. protocol: "writing",
  12146. fn: function (anObject){
  12147. var self=this;
  12148. return $core.withContext(function($ctx1) {
  12149. self._write_(anObject);
  12150. return self;
  12151. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  12152. },
  12153. args: ["anObject"],
  12154. source: "<< anObject\x0a\x09self write: anObject",
  12155. referencedClasses: [],
  12156. messageSends: ["write:"]
  12157. }),
  12158. $globals.ProtoStream);
  12159. $core.addMethod(
  12160. $core.method({
  12161. selector: "atEnd",
  12162. protocol: "testing",
  12163. fn: function (){
  12164. var self=this;
  12165. return $core.withContext(function($ctx1) {
  12166. self._subclassResponsibility();
  12167. return self;
  12168. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  12169. },
  12170. args: [],
  12171. source: "atEnd\x0a\x09self subclassResponsibility",
  12172. referencedClasses: [],
  12173. messageSends: ["subclassResponsibility"]
  12174. }),
  12175. $globals.ProtoStream);
  12176. $core.addMethod(
  12177. $core.method({
  12178. selector: "atStart",
  12179. protocol: "testing",
  12180. fn: function (){
  12181. var self=this;
  12182. return $core.withContext(function($ctx1) {
  12183. self._subclassResponsibility();
  12184. return self;
  12185. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  12186. },
  12187. args: [],
  12188. source: "atStart\x0a\x09self subclassResponsibility",
  12189. referencedClasses: [],
  12190. messageSends: ["subclassResponsibility"]
  12191. }),
  12192. $globals.ProtoStream);
  12193. $core.addMethod(
  12194. $core.method({
  12195. selector: "contents",
  12196. protocol: "accessing",
  12197. fn: function (){
  12198. var self=this;
  12199. return $core.withContext(function($ctx1) {
  12200. self._subclassResponsibility();
  12201. return self;
  12202. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  12203. },
  12204. args: [],
  12205. source: "contents\x0a\x09self subclassResponsibility",
  12206. referencedClasses: [],
  12207. messageSends: ["subclassResponsibility"]
  12208. }),
  12209. $globals.ProtoStream);
  12210. $core.addMethod(
  12211. $core.method({
  12212. selector: "do:",
  12213. protocol: "enumerating",
  12214. fn: function (aBlock){
  12215. var self=this;
  12216. return $core.withContext(function($ctx1) {
  12217. $recv((function(){
  12218. return $core.withContext(function($ctx2) {
  12219. return self._atEnd();
  12220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12221. }))._whileFalse_((function(){
  12222. return $core.withContext(function($ctx2) {
  12223. return $recv(aBlock)._value_(self._next());
  12224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12225. }));
  12226. return self;
  12227. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  12228. },
  12229. args: ["aBlock"],
  12230. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  12231. referencedClasses: [],
  12232. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  12233. }),
  12234. $globals.ProtoStream);
  12235. $core.addMethod(
  12236. $core.method({
  12237. selector: "isEmpty",
  12238. protocol: "testing",
  12239. fn: function (){
  12240. var self=this;
  12241. return $core.withContext(function($ctx1) {
  12242. return $recv(self._atStart())._and_((function(){
  12243. return $core.withContext(function($ctx2) {
  12244. return self._atEnd();
  12245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12246. }));
  12247. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  12248. },
  12249. args: [],
  12250. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  12251. referencedClasses: [],
  12252. messageSends: ["and:", "atStart", "atEnd"]
  12253. }),
  12254. $globals.ProtoStream);
  12255. $core.addMethod(
  12256. $core.method({
  12257. selector: "next",
  12258. protocol: "reading",
  12259. fn: function (){
  12260. var self=this;
  12261. return $core.withContext(function($ctx1) {
  12262. var $1;
  12263. $1=self._atEnd();
  12264. if($core.assert($1)){
  12265. return nil;
  12266. } else {
  12267. return self._subclassResponsibility();
  12268. }
  12269. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  12270. },
  12271. args: [],
  12272. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12273. referencedClasses: [],
  12274. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12275. }),
  12276. $globals.ProtoStream);
  12277. $core.addMethod(
  12278. $core.method({
  12279. selector: "nextPut:",
  12280. protocol: "writing",
  12281. fn: function (anObject){
  12282. var self=this;
  12283. return $core.withContext(function($ctx1) {
  12284. self._subclassResponsibility();
  12285. return self;
  12286. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  12287. },
  12288. args: ["anObject"],
  12289. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  12290. referencedClasses: [],
  12291. messageSends: ["subclassResponsibility"]
  12292. }),
  12293. $globals.ProtoStream);
  12294. $core.addMethod(
  12295. $core.method({
  12296. selector: "nextPutAll:",
  12297. protocol: "writing",
  12298. fn: function (aCollection){
  12299. var self=this;
  12300. return $core.withContext(function($ctx1) {
  12301. $recv(aCollection)._do_((function(each){
  12302. return $core.withContext(function($ctx2) {
  12303. return self._nextPut_(each);
  12304. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12305. }));
  12306. return self;
  12307. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  12308. },
  12309. args: ["aCollection"],
  12310. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  12311. referencedClasses: [],
  12312. messageSends: ["do:", "nextPut:"]
  12313. }),
  12314. $globals.ProtoStream);
  12315. $core.addMethod(
  12316. $core.method({
  12317. selector: "nextPutString:",
  12318. protocol: "writing",
  12319. fn: function (aString){
  12320. var self=this;
  12321. return $core.withContext(function($ctx1) {
  12322. self._nextPut_(aString);
  12323. return self;
  12324. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  12325. },
  12326. args: ["aString"],
  12327. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  12328. referencedClasses: [],
  12329. messageSends: ["nextPut:"]
  12330. }),
  12331. $globals.ProtoStream);
  12332. $core.addMethod(
  12333. $core.method({
  12334. selector: "peek",
  12335. protocol: "reading",
  12336. fn: function (){
  12337. var self=this;
  12338. return $core.withContext(function($ctx1) {
  12339. var $1;
  12340. $1=self._atEnd();
  12341. if($core.assert($1)){
  12342. return nil;
  12343. } else {
  12344. return self._subclassResponsibility();
  12345. }
  12346. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  12347. },
  12348. args: [],
  12349. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  12350. referencedClasses: [],
  12351. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  12352. }),
  12353. $globals.ProtoStream);
  12354. $core.addMethod(
  12355. $core.method({
  12356. selector: "reset",
  12357. protocol: "actions",
  12358. fn: function (){
  12359. var self=this;
  12360. return $core.withContext(function($ctx1) {
  12361. self._subclassResponsibility();
  12362. return self;
  12363. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  12364. },
  12365. args: [],
  12366. source: "reset\x0a\x09self subclassResponsibility",
  12367. referencedClasses: [],
  12368. messageSends: ["subclassResponsibility"]
  12369. }),
  12370. $globals.ProtoStream);
  12371. $core.addMethod(
  12372. $core.method({
  12373. selector: "resetContents",
  12374. protocol: "actions",
  12375. fn: function (){
  12376. var self=this;
  12377. return $core.withContext(function($ctx1) {
  12378. self._subclassResponsibility();
  12379. return self;
  12380. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  12381. },
  12382. args: [],
  12383. source: "resetContents\x0a\x09self subclassResponsibility",
  12384. referencedClasses: [],
  12385. messageSends: ["subclassResponsibility"]
  12386. }),
  12387. $globals.ProtoStream);
  12388. $core.addMethod(
  12389. $core.method({
  12390. selector: "setToEnd",
  12391. protocol: "positioning",
  12392. fn: function (){
  12393. var self=this;
  12394. return $core.withContext(function($ctx1) {
  12395. self._subclassResponsibility();
  12396. return self;
  12397. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  12398. },
  12399. args: [],
  12400. source: "setToEnd\x0a\x09self subclassResponsibility",
  12401. referencedClasses: [],
  12402. messageSends: ["subclassResponsibility"]
  12403. }),
  12404. $globals.ProtoStream);
  12405. $core.addMethod(
  12406. $core.method({
  12407. selector: "setToStart",
  12408. protocol: "positioning",
  12409. fn: function (){
  12410. var self=this;
  12411. return $core.withContext(function($ctx1) {
  12412. self._reset();
  12413. return self;
  12414. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  12415. },
  12416. args: [],
  12417. source: "setToStart\x0a\x09self reset",
  12418. referencedClasses: [],
  12419. messageSends: ["reset"]
  12420. }),
  12421. $globals.ProtoStream);
  12422. $core.addMethod(
  12423. $core.method({
  12424. selector: "write:",
  12425. protocol: "writing",
  12426. fn: function (anObject){
  12427. var self=this;
  12428. return $core.withContext(function($ctx1) {
  12429. $recv(anObject)._putOn_(self);
  12430. return self;
  12431. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  12432. },
  12433. args: ["anObject"],
  12434. source: "write: anObject\x0a\x09anObject putOn: self",
  12435. referencedClasses: [],
  12436. messageSends: ["putOn:"]
  12437. }),
  12438. $globals.ProtoStream);
  12439. $core.addMethod(
  12440. $core.method({
  12441. selector: "on:",
  12442. protocol: "instance creation",
  12443. fn: function (aCollection){
  12444. var self=this;
  12445. return $core.withContext(function($ctx1) {
  12446. var $1;
  12447. $1=self._new();
  12448. $recv($1)._setCollection_(aCollection);
  12449. $recv($1)._setStreamSize_($recv(aCollection)._size());
  12450. return $recv($1)._yourself();
  12451. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  12452. },
  12453. args: ["aCollection"],
  12454. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  12455. referencedClasses: [],
  12456. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  12457. }),
  12458. $globals.ProtoStream.klass);
  12459. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  12460. $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.";
  12461. $core.addMethod(
  12462. $core.method({
  12463. selector: "atEnd",
  12464. protocol: "testing",
  12465. fn: function (){
  12466. var self=this;
  12467. return $core.withContext(function($ctx1) {
  12468. return $recv(self._position()).__eq(self._size());
  12469. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  12470. },
  12471. args: [],
  12472. source: "atEnd\x0a\x09^ self position = self size",
  12473. referencedClasses: [],
  12474. messageSends: ["=", "position", "size"]
  12475. }),
  12476. $globals.Stream);
  12477. $core.addMethod(
  12478. $core.method({
  12479. selector: "atStart",
  12480. protocol: "testing",
  12481. fn: function (){
  12482. var self=this;
  12483. return $core.withContext(function($ctx1) {
  12484. return $recv(self._position()).__eq((0));
  12485. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  12486. },
  12487. args: [],
  12488. source: "atStart\x0a\x09^ self position = 0",
  12489. referencedClasses: [],
  12490. messageSends: ["=", "position"]
  12491. }),
  12492. $globals.Stream);
  12493. $core.addMethod(
  12494. $core.method({
  12495. selector: "close",
  12496. protocol: "actions",
  12497. fn: function (){
  12498. var self=this;
  12499. return self;
  12500. },
  12501. args: [],
  12502. source: "close",
  12503. referencedClasses: [],
  12504. messageSends: []
  12505. }),
  12506. $globals.Stream);
  12507. $core.addMethod(
  12508. $core.method({
  12509. selector: "collection",
  12510. protocol: "accessing",
  12511. fn: function (){
  12512. var self=this;
  12513. return self["@collection"];
  12514. },
  12515. args: [],
  12516. source: "collection\x0a\x09^ collection",
  12517. referencedClasses: [],
  12518. messageSends: []
  12519. }),
  12520. $globals.Stream);
  12521. $core.addMethod(
  12522. $core.method({
  12523. selector: "contents",
  12524. protocol: "accessing",
  12525. fn: function (){
  12526. var self=this;
  12527. return $core.withContext(function($ctx1) {
  12528. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  12529. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  12530. },
  12531. args: [],
  12532. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  12533. referencedClasses: [],
  12534. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  12535. }),
  12536. $globals.Stream);
  12537. $core.addMethod(
  12538. $core.method({
  12539. selector: "flush",
  12540. protocol: "actions",
  12541. fn: function (){
  12542. var self=this;
  12543. return self;
  12544. },
  12545. args: [],
  12546. source: "flush",
  12547. referencedClasses: [],
  12548. messageSends: []
  12549. }),
  12550. $globals.Stream);
  12551. $core.addMethod(
  12552. $core.method({
  12553. selector: "isEmpty",
  12554. protocol: "testing",
  12555. fn: function (){
  12556. var self=this;
  12557. return $core.withContext(function($ctx1) {
  12558. return $recv(self._size()).__eq((0));
  12559. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  12560. },
  12561. args: [],
  12562. source: "isEmpty\x0a\x09^ self size = 0",
  12563. referencedClasses: [],
  12564. messageSends: ["=", "size"]
  12565. }),
  12566. $globals.Stream);
  12567. $core.addMethod(
  12568. $core.method({
  12569. selector: "next",
  12570. protocol: "reading",
  12571. fn: function (){
  12572. var self=this;
  12573. return $core.withContext(function($ctx1) {
  12574. var $1,$3,$2;
  12575. $1=self._atEnd();
  12576. if($core.assert($1)){
  12577. return nil;
  12578. } else {
  12579. $3=self._position();
  12580. $ctx1.sendIdx["position"]=1;
  12581. $2=$recv($3).__plus((1));
  12582. self._position_($2);
  12583. return $recv(self["@collection"])._at_(self._position());
  12584. }
  12585. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  12586. },
  12587. args: [],
  12588. 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 ]",
  12589. referencedClasses: [],
  12590. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  12591. }),
  12592. $globals.Stream);
  12593. $core.addMethod(
  12594. $core.method({
  12595. selector: "next:",
  12596. protocol: "reading",
  12597. fn: function (anInteger){
  12598. var self=this;
  12599. var tempCollection;
  12600. return $core.withContext(function($ctx1) {
  12601. var $1;
  12602. tempCollection=$recv($recv(self._collection())._class())._new();
  12603. $recv(anInteger)._timesRepeat_((function(){
  12604. return $core.withContext(function($ctx2) {
  12605. $1=self._atEnd();
  12606. if(!$core.assert($1)){
  12607. return $recv(tempCollection)._add_(self._next());
  12608. }
  12609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12610. }));
  12611. return tempCollection;
  12612. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  12613. },
  12614. args: ["anInteger"],
  12615. 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",
  12616. referencedClasses: [],
  12617. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  12618. }),
  12619. $globals.Stream);
  12620. $core.addMethod(
  12621. $core.method({
  12622. selector: "nextPut:",
  12623. protocol: "writing",
  12624. fn: function (anObject){
  12625. var self=this;
  12626. return $core.withContext(function($ctx1) {
  12627. var $2,$1,$3,$4;
  12628. $2=self._position();
  12629. $ctx1.sendIdx["position"]=1;
  12630. $1=$recv($2).__plus((1));
  12631. self._position_($1);
  12632. $3=self._collection();
  12633. $4=self._position();
  12634. $ctx1.sendIdx["position"]=2;
  12635. $recv($3)._at_put_($4,anObject);
  12636. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  12637. return self;
  12638. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  12639. },
  12640. args: ["anObject"],
  12641. 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)",
  12642. referencedClasses: [],
  12643. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  12644. }),
  12645. $globals.Stream);
  12646. $core.addMethod(
  12647. $core.method({
  12648. selector: "peek",
  12649. protocol: "reading",
  12650. fn: function (){
  12651. var self=this;
  12652. return $core.withContext(function($ctx1) {
  12653. var $1;
  12654. $1=self._atEnd();
  12655. if(!$core.assert($1)){
  12656. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  12657. }
  12658. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  12659. },
  12660. args: [],
  12661. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  12662. referencedClasses: [],
  12663. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  12664. }),
  12665. $globals.Stream);
  12666. $core.addMethod(
  12667. $core.method({
  12668. selector: "position",
  12669. protocol: "accessing",
  12670. fn: function (){
  12671. var self=this;
  12672. return $core.withContext(function($ctx1) {
  12673. var $1,$receiver;
  12674. $1=self["@position"];
  12675. if(($receiver = $1) == null || $receiver.isNil){
  12676. self["@position"]=(0);
  12677. return self["@position"];
  12678. } else {
  12679. return $1;
  12680. }
  12681. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  12682. },
  12683. args: [],
  12684. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  12685. referencedClasses: [],
  12686. messageSends: ["ifNil:"]
  12687. }),
  12688. $globals.Stream);
  12689. $core.addMethod(
  12690. $core.method({
  12691. selector: "position:",
  12692. protocol: "accessing",
  12693. fn: function (anInteger){
  12694. var self=this;
  12695. self["@position"]=anInteger;
  12696. return self;
  12697. },
  12698. args: ["anInteger"],
  12699. source: "position: anInteger\x0a\x09position := anInteger",
  12700. referencedClasses: [],
  12701. messageSends: []
  12702. }),
  12703. $globals.Stream);
  12704. $core.addMethod(
  12705. $core.method({
  12706. selector: "reset",
  12707. protocol: "actions",
  12708. fn: function (){
  12709. var self=this;
  12710. return $core.withContext(function($ctx1) {
  12711. self._position_((0));
  12712. return self;
  12713. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  12714. },
  12715. args: [],
  12716. source: "reset\x0a\x09self position: 0",
  12717. referencedClasses: [],
  12718. messageSends: ["position:"]
  12719. }),
  12720. $globals.Stream);
  12721. $core.addMethod(
  12722. $core.method({
  12723. selector: "resetContents",
  12724. protocol: "actions",
  12725. fn: function (){
  12726. var self=this;
  12727. return $core.withContext(function($ctx1) {
  12728. self._reset();
  12729. self._setStreamSize_((0));
  12730. return self;
  12731. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  12732. },
  12733. args: [],
  12734. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  12735. referencedClasses: [],
  12736. messageSends: ["reset", "setStreamSize:"]
  12737. }),
  12738. $globals.Stream);
  12739. $core.addMethod(
  12740. $core.method({
  12741. selector: "setCollection:",
  12742. protocol: "accessing",
  12743. fn: function (aCollection){
  12744. var self=this;
  12745. self["@collection"]=aCollection;
  12746. return self;
  12747. },
  12748. args: ["aCollection"],
  12749. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  12750. referencedClasses: [],
  12751. messageSends: []
  12752. }),
  12753. $globals.Stream);
  12754. $core.addMethod(
  12755. $core.method({
  12756. selector: "setStreamSize:",
  12757. protocol: "accessing",
  12758. fn: function (anInteger){
  12759. var self=this;
  12760. self["@streamSize"]=anInteger;
  12761. return self;
  12762. },
  12763. args: ["anInteger"],
  12764. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  12765. referencedClasses: [],
  12766. messageSends: []
  12767. }),
  12768. $globals.Stream);
  12769. $core.addMethod(
  12770. $core.method({
  12771. selector: "setToEnd",
  12772. protocol: "positioning",
  12773. fn: function (){
  12774. var self=this;
  12775. return $core.withContext(function($ctx1) {
  12776. self._position_(self._size());
  12777. return self;
  12778. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  12779. },
  12780. args: [],
  12781. source: "setToEnd\x0a\x09self position: self size",
  12782. referencedClasses: [],
  12783. messageSends: ["position:", "size"]
  12784. }),
  12785. $globals.Stream);
  12786. $core.addMethod(
  12787. $core.method({
  12788. selector: "size",
  12789. protocol: "accessing",
  12790. fn: function (){
  12791. var self=this;
  12792. return $core.withContext(function($ctx1) {
  12793. return self._streamSize();
  12794. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  12795. },
  12796. args: [],
  12797. source: "size\x0a\x09^ self streamSize",
  12798. referencedClasses: [],
  12799. messageSends: ["streamSize"]
  12800. }),
  12801. $globals.Stream);
  12802. $core.addMethod(
  12803. $core.method({
  12804. selector: "skip:",
  12805. protocol: "positioning",
  12806. fn: function (anInteger){
  12807. var self=this;
  12808. return $core.withContext(function($ctx1) {
  12809. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  12810. return self;
  12811. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  12812. },
  12813. args: ["anInteger"],
  12814. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  12815. referencedClasses: [],
  12816. messageSends: ["position:", "min:max:", "+", "position", "size"]
  12817. }),
  12818. $globals.Stream);
  12819. $core.addMethod(
  12820. $core.method({
  12821. selector: "streamSize",
  12822. protocol: "accessing",
  12823. fn: function (){
  12824. var self=this;
  12825. return self["@streamSize"];
  12826. },
  12827. args: [],
  12828. source: "streamSize\x0a\x09^ streamSize",
  12829. referencedClasses: [],
  12830. messageSends: []
  12831. }),
  12832. $globals.Stream);
  12833. $core.addMethod(
  12834. $core.method({
  12835. selector: "on:",
  12836. protocol: "instance creation",
  12837. fn: function (aCollection){
  12838. var self=this;
  12839. return $core.withContext(function($ctx1) {
  12840. var $1;
  12841. $1=self._new();
  12842. $recv($1)._setCollection_(aCollection);
  12843. $recv($1)._setStreamSize_($recv(aCollection)._size());
  12844. return $recv($1)._yourself();
  12845. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  12846. },
  12847. args: ["aCollection"],
  12848. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  12849. referencedClasses: [],
  12850. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  12851. }),
  12852. $globals.Stream.klass);
  12853. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  12854. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  12855. $core.addMethod(
  12856. $core.method({
  12857. selector: "cr",
  12858. protocol: "writing",
  12859. fn: function (){
  12860. var self=this;
  12861. return $core.withContext(function($ctx1) {
  12862. return self._nextPutAll_($recv($globals.String)._cr());
  12863. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  12864. },
  12865. args: [],
  12866. source: "cr\x0a\x09^ self nextPutAll: String cr",
  12867. referencedClasses: ["String"],
  12868. messageSends: ["nextPutAll:", "cr"]
  12869. }),
  12870. $globals.StringStream);
  12871. $core.addMethod(
  12872. $core.method({
  12873. selector: "crlf",
  12874. protocol: "writing",
  12875. fn: function (){
  12876. var self=this;
  12877. return $core.withContext(function($ctx1) {
  12878. return self._nextPutAll_($recv($globals.String)._crlf());
  12879. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  12880. },
  12881. args: [],
  12882. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  12883. referencedClasses: ["String"],
  12884. messageSends: ["nextPutAll:", "crlf"]
  12885. }),
  12886. $globals.StringStream);
  12887. $core.addMethod(
  12888. $core.method({
  12889. selector: "lf",
  12890. protocol: "writing",
  12891. fn: function (){
  12892. var self=this;
  12893. return $core.withContext(function($ctx1) {
  12894. return self._nextPutAll_($recv($globals.String)._lf());
  12895. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  12896. },
  12897. args: [],
  12898. source: "lf\x0a\x09^ self nextPutAll: String lf",
  12899. referencedClasses: ["String"],
  12900. messageSends: ["nextPutAll:", "lf"]
  12901. }),
  12902. $globals.StringStream);
  12903. $core.addMethod(
  12904. $core.method({
  12905. selector: "next:",
  12906. protocol: "reading",
  12907. fn: function (anInteger){
  12908. var self=this;
  12909. var tempCollection;
  12910. return $core.withContext(function($ctx1) {
  12911. var $1;
  12912. tempCollection=$recv($recv(self._collection())._class())._new();
  12913. $recv(anInteger)._timesRepeat_((function(){
  12914. return $core.withContext(function($ctx2) {
  12915. $1=self._atEnd();
  12916. if(!$core.assert($1)){
  12917. tempCollection=$recv(tempCollection).__comma(self._next());
  12918. return tempCollection;
  12919. }
  12920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12921. }));
  12922. return tempCollection;
  12923. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  12924. },
  12925. args: ["anInteger"],
  12926. 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",
  12927. referencedClasses: [],
  12928. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  12929. }),
  12930. $globals.StringStream);
  12931. $core.addMethod(
  12932. $core.method({
  12933. selector: "nextPut:",
  12934. protocol: "writing",
  12935. fn: function (aString){
  12936. var self=this;
  12937. return $core.withContext(function($ctx1) {
  12938. self._nextPutAll_(aString);
  12939. return self;
  12940. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  12941. },
  12942. args: ["aString"],
  12943. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  12944. referencedClasses: [],
  12945. messageSends: ["nextPutAll:"]
  12946. }),
  12947. $globals.StringStream);
  12948. $core.addMethod(
  12949. $core.method({
  12950. selector: "nextPutAll:",
  12951. protocol: "writing",
  12952. fn: function (aString){
  12953. var self=this;
  12954. var pre,post;
  12955. return $core.withContext(function($ctx1) {
  12956. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  12957. $1=self._atEnd();
  12958. if($core.assert($1)){
  12959. $3=self._collection();
  12960. $ctx1.sendIdx["collection"]=1;
  12961. $2=$recv($3).__comma(aString);
  12962. $ctx1.sendIdx[","]=1;
  12963. self._setCollection_($2);
  12964. $ctx1.sendIdx["setCollection:"]=1;
  12965. } else {
  12966. $4=self._collection();
  12967. $ctx1.sendIdx["collection"]=2;
  12968. $5=self._position();
  12969. $ctx1.sendIdx["position"]=1;
  12970. pre=$recv($4)._copyFrom_to_((1),$5);
  12971. $ctx1.sendIdx["copyFrom:to:"]=1;
  12972. pre;
  12973. $6=self._collection();
  12974. $ctx1.sendIdx["collection"]=3;
  12975. $9=self._position();
  12976. $ctx1.sendIdx["position"]=2;
  12977. $8=$recv($9).__plus((1));
  12978. $ctx1.sendIdx["+"]=2;
  12979. $10=$recv(aString)._size();
  12980. $ctx1.sendIdx["size"]=1;
  12981. $7=$recv($8).__plus($10);
  12982. $ctx1.sendIdx["+"]=1;
  12983. $11=$recv(self._collection())._size();
  12984. $ctx1.sendIdx["size"]=2;
  12985. post=$recv($6)._copyFrom_to_($7,$11);
  12986. post;
  12987. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  12988. $ctx1.sendIdx[","]=2;
  12989. self._setCollection_($12);
  12990. }
  12991. $14=self._position();
  12992. $ctx1.sendIdx["position"]=3;
  12993. $13=$recv($14).__plus($recv(aString)._size());
  12994. self._position_($13);
  12995. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  12996. return self;
  12997. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  12998. },
  12999. args: ["aString"],
  13000. 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)",
  13001. referencedClasses: [],
  13002. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  13003. }),
  13004. $globals.StringStream);
  13005. $core.addMethod(
  13006. $core.method({
  13007. selector: "nextPutString:",
  13008. protocol: "writing",
  13009. fn: function (aString){
  13010. var self=this;
  13011. return $core.withContext(function($ctx1) {
  13012. self._nextPutAll_(aString);
  13013. return self;
  13014. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  13015. },
  13016. args: ["aString"],
  13017. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  13018. referencedClasses: [],
  13019. messageSends: ["nextPutAll:"]
  13020. }),
  13021. $globals.StringStream);
  13022. $core.addMethod(
  13023. $core.method({
  13024. selector: "print:",
  13025. protocol: "writing",
  13026. fn: function (anObject){
  13027. var self=this;
  13028. return $core.withContext(function($ctx1) {
  13029. $recv(anObject)._printOn_(self);
  13030. return self;
  13031. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  13032. },
  13033. args: ["anObject"],
  13034. source: "print: anObject\x0a\x09anObject printOn: self",
  13035. referencedClasses: [],
  13036. messageSends: ["printOn:"]
  13037. }),
  13038. $globals.StringStream);
  13039. $core.addMethod(
  13040. $core.method({
  13041. selector: "printSymbol:",
  13042. protocol: "writing",
  13043. fn: function (anObject){
  13044. var self=this;
  13045. return $core.withContext(function($ctx1) {
  13046. $recv(anObject)._asSymbolPrintOn_(self);
  13047. return self;
  13048. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  13049. },
  13050. args: ["anObject"],
  13051. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  13052. referencedClasses: [],
  13053. messageSends: ["asSymbolPrintOn:"]
  13054. }),
  13055. $globals.StringStream);
  13056. $core.addMethod(
  13057. $core.method({
  13058. selector: "space",
  13059. protocol: "writing",
  13060. fn: function (){
  13061. var self=this;
  13062. return $core.withContext(function($ctx1) {
  13063. self._nextPut_(" ");
  13064. return self;
  13065. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  13066. },
  13067. args: [],
  13068. source: "space\x0a\x09self nextPut: ' '",
  13069. referencedClasses: [],
  13070. messageSends: ["nextPut:"]
  13071. }),
  13072. $globals.StringStream);
  13073. $core.addMethod(
  13074. $core.method({
  13075. selector: "tab",
  13076. protocol: "writing",
  13077. fn: function (){
  13078. var self=this;
  13079. return $core.withContext(function($ctx1) {
  13080. return self._nextPutAll_($recv($globals.String)._tab());
  13081. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  13082. },
  13083. args: [],
  13084. source: "tab\x0a\x09^ self nextPutAll: String tab",
  13085. referencedClasses: ["String"],
  13086. messageSends: ["nextPutAll:", "tab"]
  13087. }),
  13088. $globals.StringStream);
  13089. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  13090. $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.";
  13091. $core.addMethod(
  13092. $core.method({
  13093. selector: "initialize",
  13094. protocol: "initialization",
  13095. fn: function (){
  13096. var self=this;
  13097. return $core.withContext(function($ctx1) {
  13098. (
  13099. $ctx1.supercall = true,
  13100. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  13101. $ctx1.supercall = false;
  13102. self["@read"]=$recv($globals.OrderedCollection)._new();
  13103. $ctx1.sendIdx["new"]=1;
  13104. self["@write"]=$recv($globals.OrderedCollection)._new();
  13105. self["@readIndex"]=(1);
  13106. return self;
  13107. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  13108. },
  13109. args: [],
  13110. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  13111. referencedClasses: ["OrderedCollection"],
  13112. messageSends: ["initialize", "new"]
  13113. }),
  13114. $globals.Queue);
  13115. $core.addMethod(
  13116. $core.method({
  13117. selector: "next",
  13118. protocol: "accessing",
  13119. fn: function (){
  13120. var self=this;
  13121. return $core.withContext(function($ctx1) {
  13122. return self._nextIfAbsent_((function(){
  13123. return $core.withContext(function($ctx2) {
  13124. return self._error_("Cannot read from empty Queue.");
  13125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13126. }));
  13127. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  13128. },
  13129. args: [],
  13130. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  13131. referencedClasses: [],
  13132. messageSends: ["nextIfAbsent:", "error:"]
  13133. }),
  13134. $globals.Queue);
  13135. $core.addMethod(
  13136. $core.method({
  13137. selector: "nextIfAbsent:",
  13138. protocol: "accessing",
  13139. fn: function (aBlock){
  13140. var self=this;
  13141. var result;
  13142. return $core.withContext(function($ctx1) {
  13143. var $1;
  13144. var $early={};
  13145. try {
  13146. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  13147. return $core.withContext(function($ctx2) {
  13148. $recv(self["@write"])._ifEmpty_((function(){
  13149. return $core.withContext(function($ctx3) {
  13150. $1=$recv(self["@readIndex"]).__gt((1));
  13151. if($core.assert($1)){
  13152. self["@read"]=[];
  13153. self["@read"];
  13154. self["@readIndex"]=(1);
  13155. self["@readIndex"];
  13156. }
  13157. throw $early=[$recv(aBlock)._value()];
  13158. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13159. }));
  13160. self["@read"]=self["@write"];
  13161. self["@read"];
  13162. self["@readIndex"]=(1);
  13163. self["@readIndex"];
  13164. self["@write"]=$recv($globals.OrderedCollection)._new();
  13165. self["@write"];
  13166. return $recv(self["@read"])._first();
  13167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13168. }));
  13169. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  13170. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  13171. return result;
  13172. }
  13173. catch(e) {if(e===$early)return e[0]; throw e}
  13174. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  13175. },
  13176. args: ["aBlock"],
  13177. 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",
  13178. referencedClasses: ["OrderedCollection"],
  13179. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  13180. }),
  13181. $globals.Queue);
  13182. $core.addMethod(
  13183. $core.method({
  13184. selector: "nextPut:",
  13185. protocol: "accessing",
  13186. fn: function (anObject){
  13187. var self=this;
  13188. return $core.withContext(function($ctx1) {
  13189. $recv(self["@write"])._add_(anObject);
  13190. return self;
  13191. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  13192. },
  13193. args: ["anObject"],
  13194. source: "nextPut: anObject\x0a\x09write add: anObject",
  13195. referencedClasses: [],
  13196. messageSends: ["add:"]
  13197. }),
  13198. $globals.Queue);
  13199. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  13200. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  13201. $core.addMethod(
  13202. $core.method({
  13203. selector: "compile:",
  13204. protocol: "evaluating",
  13205. fn: function (aString){
  13206. var self=this;
  13207. return $core.withContext(function($ctx1) {
  13208. return self.compile(aString);
  13209. return self;
  13210. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  13211. },
  13212. args: ["aString"],
  13213. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  13214. referencedClasses: [],
  13215. messageSends: []
  13216. }),
  13217. $globals.RegularExpression);
  13218. $core.addMethod(
  13219. $core.method({
  13220. selector: "exec:",
  13221. protocol: "evaluating",
  13222. fn: function (aString){
  13223. var self=this;
  13224. return $core.withContext(function($ctx1) {
  13225. return self.exec(aString) || nil;
  13226. return self;
  13227. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  13228. },
  13229. args: ["aString"],
  13230. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  13231. referencedClasses: [],
  13232. messageSends: []
  13233. }),
  13234. $globals.RegularExpression);
  13235. $core.addMethod(
  13236. $core.method({
  13237. selector: "test:",
  13238. protocol: "evaluating",
  13239. fn: function (aString){
  13240. var self=this;
  13241. return $core.withContext(function($ctx1) {
  13242. return self.test(aString);
  13243. return self;
  13244. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  13245. },
  13246. args: ["aString"],
  13247. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  13248. referencedClasses: [],
  13249. messageSends: []
  13250. }),
  13251. $globals.RegularExpression);
  13252. $core.addMethod(
  13253. $core.method({
  13254. selector: "fromString:",
  13255. protocol: "instance creation",
  13256. fn: function (aString){
  13257. var self=this;
  13258. return $core.withContext(function($ctx1) {
  13259. return self._fromString_flag_(aString,"");
  13260. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  13261. },
  13262. args: ["aString"],
  13263. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  13264. referencedClasses: [],
  13265. messageSends: ["fromString:flag:"]
  13266. }),
  13267. $globals.RegularExpression.klass);
  13268. $core.addMethod(
  13269. $core.method({
  13270. selector: "fromString:flag:",
  13271. protocol: "instance creation",
  13272. fn: function (aString,anotherString){
  13273. var self=this;
  13274. return $core.withContext(function($ctx1) {
  13275. return new RegExp(aString, anotherString);
  13276. return self;
  13277. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  13278. },
  13279. args: ["aString", "anotherString"],
  13280. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  13281. referencedClasses: [],
  13282. messageSends: []
  13283. }),
  13284. $globals.RegularExpression.klass);
  13285. });
  13286. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects"], function($boot){"use strict";
  13287. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  13288. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  13289. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  13290. $core.addPackage("Kernel-Classes");
  13291. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  13292. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  13293. $core.addClass("BehaviorBody", $globals.Object, [], "Kernel-Classes");
  13294. $globals.BehaviorBody.comment="I am the superclass of all behaviors.\x0a\x0aMy instances hold the method dictionary.\x0a\x0aI also provides methods for compiling methods and examining the method dictionary.";
  13295. $core.addMethod(
  13296. $core.method({
  13297. selector: ">>",
  13298. protocol: "accessing",
  13299. fn: function (aString){
  13300. var self=this;
  13301. return $core.withContext(function($ctx1) {
  13302. return self._methodAt_(aString);
  13303. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.BehaviorBody)});
  13304. },
  13305. args: ["aString"],
  13306. source: ">> aString\x0a\x09^ self methodAt: aString",
  13307. referencedClasses: [],
  13308. messageSends: ["methodAt:"]
  13309. }),
  13310. $globals.BehaviorBody);
  13311. $core.addMethod(
  13312. $core.method({
  13313. selector: "addCompiledMethod:",
  13314. protocol: "compiling",
  13315. fn: function (aMethod){
  13316. var self=this;
  13317. var oldMethod,announcement;
  13318. return $core.withContext(function($ctx1) {
  13319. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  13320. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  13321. return nil;
  13322. }));
  13323. $2=self._protocols();
  13324. $3=$recv(aMethod)._protocol();
  13325. $ctx1.sendIdx["protocol"]=1;
  13326. $1=$recv($2)._includes_($3);
  13327. if(!$core.assert($1)){
  13328. $4=self._organization();
  13329. $5=$recv(aMethod)._protocol();
  13330. $ctx1.sendIdx["protocol"]=2;
  13331. $recv($4)._addElement_($5);
  13332. }
  13333. self._basicAddCompiledMethod_(aMethod);
  13334. $6=oldMethod;
  13335. if(($receiver = $6) == null || $receiver.isNil){
  13336. $6;
  13337. } else {
  13338. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  13339. }
  13340. $7=oldMethod;
  13341. if(($receiver = $7) == null || $receiver.isNil){
  13342. $8=$recv($globals.MethodAdded)._new();
  13343. $ctx1.sendIdx["new"]=1;
  13344. $recv($8)._method_(aMethod);
  13345. $ctx1.sendIdx["method:"]=1;
  13346. $9=$recv($8)._yourself();
  13347. $ctx1.sendIdx["yourself"]=1;
  13348. announcement=$9;
  13349. } else {
  13350. $10=$recv($globals.MethodModified)._new();
  13351. $recv($10)._oldMethod_(oldMethod);
  13352. $recv($10)._method_(aMethod);
  13353. announcement=$recv($10)._yourself();
  13354. }
  13355. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  13356. return self;
  13357. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.BehaviorBody)});
  13358. },
  13359. args: ["aMethod"],
  13360. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  13361. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  13362. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  13363. }),
  13364. $globals.BehaviorBody);
  13365. $core.addMethod(
  13366. $core.method({
  13367. selector: "allInstanceVariableNames",
  13368. protocol: "accessing",
  13369. fn: function (){
  13370. var self=this;
  13371. return [];
  13372. },
  13373. args: [],
  13374. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  13375. referencedClasses: [],
  13376. messageSends: []
  13377. }),
  13378. $globals.BehaviorBody);
  13379. $core.addMethod(
  13380. $core.method({
  13381. selector: "allSubclassesDo:",
  13382. protocol: "enumerating",
  13383. fn: function (aBlock){
  13384. var self=this;
  13385. return self;
  13386. },
  13387. args: ["aBlock"],
  13388. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  13389. referencedClasses: [],
  13390. messageSends: []
  13391. }),
  13392. $globals.BehaviorBody);
  13393. $core.addMethod(
  13394. $core.method({
  13395. selector: "basicAddCompiledMethod:",
  13396. protocol: "private",
  13397. fn: function (aMethod){
  13398. var self=this;
  13399. return $core.withContext(function($ctx1) {
  13400. $core.addMethod(aMethod, self);
  13401. return self;
  13402. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.BehaviorBody)});
  13403. },
  13404. args: ["aMethod"],
  13405. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  13406. referencedClasses: [],
  13407. messageSends: []
  13408. }),
  13409. $globals.BehaviorBody);
  13410. $core.addMethod(
  13411. $core.method({
  13412. selector: "basicRemoveCompiledMethod:",
  13413. protocol: "private",
  13414. fn: function (aMethod){
  13415. var self=this;
  13416. return $core.withContext(function($ctx1) {
  13417. $core.removeMethod(aMethod,self);
  13418. return self;
  13419. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.BehaviorBody)});
  13420. },
  13421. args: ["aMethod"],
  13422. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  13423. referencedClasses: [],
  13424. messageSends: []
  13425. }),
  13426. $globals.BehaviorBody);
  13427. $core.addMethod(
  13428. $core.method({
  13429. selector: "comment",
  13430. protocol: "accessing",
  13431. fn: function (){
  13432. var self=this;
  13433. return $core.withContext(function($ctx1) {
  13434. var $1,$receiver;
  13435. $1=self._basicAt_("comment");
  13436. if(($receiver = $1) == null || $receiver.isNil){
  13437. return "";
  13438. } else {
  13439. return $1;
  13440. }
  13441. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.BehaviorBody)});
  13442. },
  13443. args: [],
  13444. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  13445. referencedClasses: [],
  13446. messageSends: ["ifNil:", "basicAt:"]
  13447. }),
  13448. $globals.BehaviorBody);
  13449. $core.addMethod(
  13450. $core.method({
  13451. selector: "comment:",
  13452. protocol: "accessing",
  13453. fn: function (aString){
  13454. var self=this;
  13455. return $core.withContext(function($ctx1) {
  13456. var $1,$3,$2;
  13457. self._basicAt_put_("comment",aString);
  13458. $1=$recv($globals.SystemAnnouncer)._current();
  13459. $3=$recv($globals.ClassCommentChanged)._new();
  13460. $recv($3)._theClass_(self);
  13461. $2=$recv($3)._yourself();
  13462. $recv($1)._announce_($2);
  13463. return self;
  13464. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.BehaviorBody)});
  13465. },
  13466. args: ["aString"],
  13467. 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)",
  13468. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  13469. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  13470. }),
  13471. $globals.BehaviorBody);
  13472. $core.addMethod(
  13473. $core.method({
  13474. selector: "compile:protocol:",
  13475. protocol: "compiling",
  13476. fn: function (aString,anotherString){
  13477. var self=this;
  13478. return $core.withContext(function($ctx1) {
  13479. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  13480. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.BehaviorBody)});
  13481. },
  13482. args: ["aString", "anotherString"],
  13483. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  13484. referencedClasses: ["Compiler"],
  13485. messageSends: ["install:forClass:protocol:", "new"]
  13486. }),
  13487. $globals.BehaviorBody);
  13488. $core.addMethod(
  13489. $core.method({
  13490. selector: "definition",
  13491. protocol: "accessing",
  13492. fn: function (){
  13493. var self=this;
  13494. return $core.withContext(function($ctx1) {
  13495. self._subclassResponsibility();
  13496. return self;
  13497. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.BehaviorBody)});
  13498. },
  13499. args: [],
  13500. source: "definition\x0a\x09self subclassResponsibility",
  13501. referencedClasses: [],
  13502. messageSends: ["subclassResponsibility"]
  13503. }),
  13504. $globals.BehaviorBody);
  13505. $core.addMethod(
  13506. $core.method({
  13507. selector: "includesSelector:",
  13508. protocol: "testing",
  13509. fn: function (aString){
  13510. var self=this;
  13511. return $core.withContext(function($ctx1) {
  13512. return $recv(self._methodDictionary())._includesKey_(aString);
  13513. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.BehaviorBody)});
  13514. },
  13515. args: ["aString"],
  13516. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  13517. referencedClasses: [],
  13518. messageSends: ["includesKey:", "methodDictionary"]
  13519. }),
  13520. $globals.BehaviorBody);
  13521. $core.addMethod(
  13522. $core.method({
  13523. selector: "methodAt:",
  13524. protocol: "accessing",
  13525. fn: function (aString){
  13526. var self=this;
  13527. return $core.withContext(function($ctx1) {
  13528. return $recv(self._methodDictionary())._at_(aString);
  13529. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.BehaviorBody)});
  13530. },
  13531. args: ["aString"],
  13532. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  13533. referencedClasses: [],
  13534. messageSends: ["at:", "methodDictionary"]
  13535. }),
  13536. $globals.BehaviorBody);
  13537. $core.addMethod(
  13538. $core.method({
  13539. selector: "methodDictionary",
  13540. protocol: "accessing",
  13541. fn: function (){
  13542. var self=this;
  13543. return $core.withContext(function($ctx1) {
  13544. var dict = $globals.HashedCollection._new();
  13545. var methods = self.methods;
  13546. Object.keys(methods).forEach(function(i) {
  13547. if(methods[i].selector) {
  13548. dict._at_put_(methods[i].selector, methods[i]);
  13549. }
  13550. });
  13551. return dict;
  13552. return self;
  13553. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.BehaviorBody)});
  13554. },
  13555. args: [],
  13556. 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'>",
  13557. referencedClasses: [],
  13558. messageSends: []
  13559. }),
  13560. $globals.BehaviorBody);
  13561. $core.addMethod(
  13562. $core.method({
  13563. selector: "methodTemplate",
  13564. protocol: "accessing",
  13565. fn: function (){
  13566. var self=this;
  13567. return $core.withContext(function($ctx1) {
  13568. return $recv($globals.String)._streamContents_((function(stream){
  13569. return $core.withContext(function($ctx2) {
  13570. $recv(stream)._write_("messageSelectorAndArgumentNames");
  13571. $ctx2.sendIdx["write:"]=1;
  13572. $recv(stream)._lf();
  13573. $ctx2.sendIdx["lf"]=1;
  13574. $recv(stream)._tab();
  13575. $ctx2.sendIdx["tab"]=1;
  13576. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  13577. $ctx2.sendIdx["write:"]=2;
  13578. $recv(stream)._lf();
  13579. $ctx2.sendIdx["lf"]=2;
  13580. $recv(stream)._lf();
  13581. $ctx2.sendIdx["lf"]=3;
  13582. $recv(stream)._tab();
  13583. $ctx2.sendIdx["tab"]=2;
  13584. $recv(stream)._write_("| temporary variable names |");
  13585. $ctx2.sendIdx["write:"]=3;
  13586. $recv(stream)._lf();
  13587. $recv(stream)._tab();
  13588. return $recv(stream)._write_("statements");
  13589. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  13590. }));
  13591. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.BehaviorBody)});
  13592. },
  13593. args: [],
  13594. 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' ]",
  13595. referencedClasses: ["String"],
  13596. messageSends: ["streamContents:", "write:", "lf", "tab"]
  13597. }),
  13598. $globals.BehaviorBody);
  13599. $core.addMethod(
  13600. $core.method({
  13601. selector: "methods",
  13602. protocol: "accessing",
  13603. fn: function (){
  13604. var self=this;
  13605. return $core.withContext(function($ctx1) {
  13606. return $recv(self._methodDictionary())._values();
  13607. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.BehaviorBody)});
  13608. },
  13609. args: [],
  13610. source: "methods\x0a\x09^ self methodDictionary values",
  13611. referencedClasses: [],
  13612. messageSends: ["values", "methodDictionary"]
  13613. }),
  13614. $globals.BehaviorBody);
  13615. $core.addMethod(
  13616. $core.method({
  13617. selector: "methodsInProtocol:",
  13618. protocol: "accessing",
  13619. fn: function (aString){
  13620. var self=this;
  13621. return $core.withContext(function($ctx1) {
  13622. return $recv(self._methods())._select_((function(each){
  13623. return $core.withContext(function($ctx2) {
  13624. return $recv($recv(each)._protocol()).__eq(aString);
  13625. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13626. }));
  13627. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.BehaviorBody)});
  13628. },
  13629. args: ["aString"],
  13630. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  13631. referencedClasses: [],
  13632. messageSends: ["select:", "methods", "=", "protocol"]
  13633. }),
  13634. $globals.BehaviorBody);
  13635. $core.addMethod(
  13636. $core.method({
  13637. selector: "name",
  13638. protocol: "accessing",
  13639. fn: function (){
  13640. var self=this;
  13641. return $core.withContext(function($ctx1) {
  13642. return self.className || nil;
  13643. return self;
  13644. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.BehaviorBody)});
  13645. },
  13646. args: [],
  13647. source: "name\x0a\x09<inlineJS: 'return self.className || nil'>",
  13648. referencedClasses: [],
  13649. messageSends: []
  13650. }),
  13651. $globals.BehaviorBody);
  13652. $core.addMethod(
  13653. $core.method({
  13654. selector: "organization",
  13655. protocol: "accessing",
  13656. fn: function (){
  13657. var self=this;
  13658. return $core.withContext(function($ctx1) {
  13659. return self._basicAt_("organization");
  13660. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.BehaviorBody)});
  13661. },
  13662. args: [],
  13663. source: "organization\x0a\x09^ self basicAt: 'organization'",
  13664. referencedClasses: [],
  13665. messageSends: ["basicAt:"]
  13666. }),
  13667. $globals.BehaviorBody);
  13668. $core.addMethod(
  13669. $core.method({
  13670. selector: "ownMethods",
  13671. protocol: "accessing",
  13672. fn: function (){
  13673. var self=this;
  13674. return $core.withContext(function($ctx1) {
  13675. var $1;
  13676. return $recv($recv(self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  13677. return $core.withContext(function($ctx2) {
  13678. return $recv(acc).__comma(self._ownMethodsInProtocol_(each));
  13679. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  13680. })))._sorted_((function(a,b){
  13681. return $core.withContext(function($ctx2) {
  13682. $1=$recv(a)._selector();
  13683. $ctx2.sendIdx["selector"]=1;
  13684. return $recv($1).__lt_eq($recv(b)._selector());
  13685. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  13686. }));
  13687. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.BehaviorBody)});
  13688. },
  13689. args: [],
  13690. 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 ]",
  13691. referencedClasses: ["OrderedCollection"],
  13692. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  13693. }),
  13694. $globals.BehaviorBody);
  13695. $core.addMethod(
  13696. $core.method({
  13697. selector: "ownMethodsInProtocol:",
  13698. protocol: "accessing",
  13699. fn: function (aString){
  13700. var self=this;
  13701. return $core.withContext(function($ctx1) {
  13702. return $recv(self._methodsInProtocol_(aString))._select_((function(each){
  13703. return $core.withContext(function($ctx2) {
  13704. return $recv($recv(each)._methodClass()).__eq(self);
  13705. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13706. }));
  13707. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.BehaviorBody)});
  13708. },
  13709. args: ["aString"],
  13710. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  13711. referencedClasses: [],
  13712. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  13713. }),
  13714. $globals.BehaviorBody);
  13715. $core.addMethod(
  13716. $core.method({
  13717. selector: "ownProtocols",
  13718. protocol: "accessing",
  13719. fn: function (){
  13720. var self=this;
  13721. return $core.withContext(function($ctx1) {
  13722. return $recv(self._protocols())._reject_((function(each){
  13723. return $core.withContext(function($ctx2) {
  13724. return $recv(each)._match_("^\x5c*");
  13725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13726. }));
  13727. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.BehaviorBody)});
  13728. },
  13729. args: [],
  13730. 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*' ]",
  13731. referencedClasses: [],
  13732. messageSends: ["reject:", "protocols", "match:"]
  13733. }),
  13734. $globals.BehaviorBody);
  13735. $core.addMethod(
  13736. $core.method({
  13737. selector: "packageOfProtocol:",
  13738. protocol: "accessing",
  13739. fn: function (aString){
  13740. var self=this;
  13741. return $core.withContext(function($ctx1) {
  13742. var $1;
  13743. $1=$recv(aString)._beginsWith_("*");
  13744. if(!$core.assert($1)){
  13745. return self._package();
  13746. }
  13747. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  13748. return nil;
  13749. }));
  13750. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.BehaviorBody)});
  13751. },
  13752. args: ["aString"],
  13753. 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 ]",
  13754. referencedClasses: ["Package"],
  13755. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  13756. }),
  13757. $globals.BehaviorBody);
  13758. $core.addMethod(
  13759. $core.method({
  13760. selector: "printOn:",
  13761. protocol: "printing",
  13762. fn: function (aStream){
  13763. var self=this;
  13764. return $core.withContext(function($ctx1) {
  13765. var $1,$receiver;
  13766. $1=self._name();
  13767. if(($receiver = $1) == null || $receiver.isNil){
  13768. (
  13769. $ctx1.supercall = true,
  13770. ($globals.BehaviorBody.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  13771. $ctx1.supercall = false;
  13772. } else {
  13773. var name;
  13774. name=$receiver;
  13775. $recv(aStream)._nextPutAll_(name);
  13776. }
  13777. return self;
  13778. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.BehaviorBody)});
  13779. },
  13780. args: ["aStream"],
  13781. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  13782. referencedClasses: [],
  13783. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  13784. }),
  13785. $globals.BehaviorBody);
  13786. $core.addMethod(
  13787. $core.method({
  13788. selector: "protocols",
  13789. protocol: "accessing",
  13790. fn: function (){
  13791. var self=this;
  13792. return $core.withContext(function($ctx1) {
  13793. return $recv($recv(self._organization())._elements())._sorted();
  13794. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.BehaviorBody)});
  13795. },
  13796. args: [],
  13797. source: "protocols\x0a\x09^ self organization elements sorted",
  13798. referencedClasses: [],
  13799. messageSends: ["sorted", "elements", "organization"]
  13800. }),
  13801. $globals.BehaviorBody);
  13802. $core.addMethod(
  13803. $core.method({
  13804. selector: "protocolsDo:",
  13805. protocol: "enumerating",
  13806. fn: function (aBlock){
  13807. var self=this;
  13808. var methodsByProtocol;
  13809. return $core.withContext(function($ctx1) {
  13810. methodsByProtocol=$recv($globals.HashedCollection)._new();
  13811. $ctx1.sendIdx["new"]=1;
  13812. $recv(self._methodDictionary())._valuesDo_((function(m){
  13813. return $core.withContext(function($ctx2) {
  13814. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  13815. return $core.withContext(function($ctx3) {
  13816. return $recv($globals.Array)._new();
  13817. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13818. })))._add_(m);
  13819. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  13820. }));
  13821. $recv(self._protocols())._do_((function(protocol){
  13822. return $core.withContext(function($ctx2) {
  13823. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  13824. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  13825. }));
  13826. return self;
  13827. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.BehaviorBody)});
  13828. },
  13829. args: ["aBlock"],
  13830. 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) ]",
  13831. referencedClasses: ["HashedCollection", "Array"],
  13832. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  13833. }),
  13834. $globals.BehaviorBody);
  13835. $core.addMethod(
  13836. $core.method({
  13837. selector: "recompile",
  13838. protocol: "compiling",
  13839. fn: function (){
  13840. var self=this;
  13841. return $core.withContext(function($ctx1) {
  13842. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  13843. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.BehaviorBody)});
  13844. },
  13845. args: [],
  13846. source: "recompile\x0a\x09^ Compiler new recompile: self",
  13847. referencedClasses: ["Compiler"],
  13848. messageSends: ["recompile:", "new"]
  13849. }),
  13850. $globals.BehaviorBody);
  13851. $core.addMethod(
  13852. $core.method({
  13853. selector: "removeCompiledMethod:",
  13854. protocol: "compiling",
  13855. fn: function (aMethod){
  13856. var self=this;
  13857. return $core.withContext(function($ctx1) {
  13858. var $1,$3,$2;
  13859. self._basicRemoveCompiledMethod_(aMethod);
  13860. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  13861. $1=$recv($globals.SystemAnnouncer)._current();
  13862. $3=$recv($globals.MethodRemoved)._new();
  13863. $recv($3)._method_(aMethod);
  13864. $2=$recv($3)._yourself();
  13865. $recv($1)._announce_($2);
  13866. return self;
  13867. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.BehaviorBody)});
  13868. },
  13869. args: ["aMethod"],
  13870. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  13871. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  13872. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  13873. }),
  13874. $globals.BehaviorBody);
  13875. $core.addMethod(
  13876. $core.method({
  13877. selector: "removeProtocolIfEmpty:",
  13878. protocol: "accessing",
  13879. fn: function (aString){
  13880. var self=this;
  13881. return $core.withContext(function($ctx1) {
  13882. $recv(self._methods())._detect_ifNone_((function(each){
  13883. return $core.withContext(function($ctx2) {
  13884. return $recv($recv(each)._protocol()).__eq(aString);
  13885. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13886. }),(function(){
  13887. return $core.withContext(function($ctx2) {
  13888. return $recv(self._organization())._removeElement_(aString);
  13889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13890. }));
  13891. return self;
  13892. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.BehaviorBody)});
  13893. },
  13894. args: ["aString"],
  13895. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  13896. referencedClasses: [],
  13897. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  13898. }),
  13899. $globals.BehaviorBody);
  13900. $core.addMethod(
  13901. $core.method({
  13902. selector: "selectors",
  13903. protocol: "accessing",
  13904. fn: function (){
  13905. var self=this;
  13906. return $core.withContext(function($ctx1) {
  13907. return $recv(self._methodDictionary())._keys();
  13908. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.BehaviorBody)});
  13909. },
  13910. args: [],
  13911. source: "selectors\x0a\x09^ self methodDictionary keys",
  13912. referencedClasses: [],
  13913. messageSends: ["keys", "methodDictionary"]
  13914. }),
  13915. $globals.BehaviorBody);
  13916. $core.addMethod(
  13917. $core.method({
  13918. selector: "setTraitComposition:",
  13919. protocol: "compiling",
  13920. fn: function (aTraitComposition){
  13921. var self=this;
  13922. return $core.withContext(function($ctx1) {
  13923. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  13924. return self;
  13925. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.BehaviorBody)});
  13926. },
  13927. args: ["aTraitComposition"],
  13928. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  13929. referencedClasses: [],
  13930. messageSends: []
  13931. }),
  13932. $globals.BehaviorBody);
  13933. $core.addMethod(
  13934. $core.method({
  13935. selector: "superclass",
  13936. protocol: "accessing",
  13937. fn: function (){
  13938. var self=this;
  13939. return nil;
  13940. },
  13941. args: [],
  13942. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  13943. referencedClasses: [],
  13944. messageSends: []
  13945. }),
  13946. $globals.BehaviorBody);
  13947. $core.addMethod(
  13948. $core.method({
  13949. selector: "theMetaClass",
  13950. protocol: "accessing",
  13951. fn: function (){
  13952. var self=this;
  13953. return $core.withContext(function($ctx1) {
  13954. self._subclassResponsibility();
  13955. return self;
  13956. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.BehaviorBody)});
  13957. },
  13958. args: [],
  13959. source: "theMetaClass\x0a\x09self subclassResponsibility",
  13960. referencedClasses: [],
  13961. messageSends: ["subclassResponsibility"]
  13962. }),
  13963. $globals.BehaviorBody);
  13964. $core.addMethod(
  13965. $core.method({
  13966. selector: "theNonMetaClass",
  13967. protocol: "accessing",
  13968. fn: function (){
  13969. var self=this;
  13970. return $core.withContext(function($ctx1) {
  13971. self._subclassResponsibility();
  13972. return self;
  13973. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.BehaviorBody)});
  13974. },
  13975. args: [],
  13976. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  13977. referencedClasses: [],
  13978. messageSends: ["subclassResponsibility"]
  13979. }),
  13980. $globals.BehaviorBody);
  13981. $core.addMethod(
  13982. $core.method({
  13983. selector: "traitComposition",
  13984. protocol: "accessing",
  13985. fn: function (){
  13986. var self=this;
  13987. return $core.withContext(function($ctx1) {
  13988. return $recv(self._basicAt_("traitComposition"))._collect_((function(each){
  13989. return $core.withContext(function($ctx2) {
  13990. return $recv($globals.TraitTransformation)._fromJSON_(each);
  13991. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13992. }));
  13993. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.BehaviorBody)});
  13994. },
  13995. args: [],
  13996. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition') collect: [ :each | TraitTransformation fromJSON: each ]",
  13997. referencedClasses: ["TraitTransformation"],
  13998. messageSends: ["collect:", "basicAt:", "fromJSON:"]
  13999. }),
  14000. $globals.BehaviorBody);
  14001. $core.addMethod(
  14002. $core.method({
  14003. selector: "traitCompositionDefinition",
  14004. protocol: "accessing",
  14005. fn: function (){
  14006. var self=this;
  14007. return $core.withContext(function($ctx1) {
  14008. return $recv(self._traitComposition())._ifNotEmpty_((function(traitComposition){
  14009. return $core.withContext(function($ctx2) {
  14010. return $recv($globals.String)._streamContents_((function(str){
  14011. return $core.withContext(function($ctx3) {
  14012. $recv(str)._write_("{");
  14013. $ctx3.sendIdx["write:"]=1;
  14014. $recv(traitComposition)._do_separatedBy_((function(each){
  14015. return $core.withContext(function($ctx4) {
  14016. return $recv(str)._write_($recv(each)._definition());
  14017. $ctx4.sendIdx["write:"]=2;
  14018. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  14019. }),(function(){
  14020. return $core.withContext(function($ctx4) {
  14021. return $recv(str)._write_(". ");
  14022. $ctx4.sendIdx["write:"]=3;
  14023. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  14024. }));
  14025. return $recv(str)._write_("}");
  14026. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  14027. }));
  14028. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  14029. }));
  14030. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.BehaviorBody)});
  14031. },
  14032. args: [],
  14033. 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: '}' ] ]",
  14034. referencedClasses: ["String"],
  14035. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  14036. }),
  14037. $globals.BehaviorBody);
  14038. $core.addMethod(
  14039. $core.method({
  14040. selector: "traitUsers",
  14041. protocol: "accessing",
  14042. fn: function (){
  14043. var self=this;
  14044. return [];
  14045. },
  14046. args: [],
  14047. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  14048. referencedClasses: [],
  14049. messageSends: []
  14050. }),
  14051. $globals.BehaviorBody);
  14052. $core.addClass("Behavior", $globals.BehaviorBody, [], "Kernel-Classes");
  14053. $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.";
  14054. $core.addMethod(
  14055. $core.method({
  14056. selector: "allInstanceVariableNames",
  14057. protocol: "accessing",
  14058. fn: function (){
  14059. var self=this;
  14060. var result;
  14061. return $core.withContext(function($ctx1) {
  14062. var $1,$receiver;
  14063. result=$recv(self._instanceVariableNames())._copy();
  14064. $1=self._superclass();
  14065. $ctx1.sendIdx["superclass"]=1;
  14066. if(($receiver = $1) == null || $receiver.isNil){
  14067. $1;
  14068. } else {
  14069. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  14070. }
  14071. return result;
  14072. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14073. },
  14074. args: [],
  14075. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14076. referencedClasses: [],
  14077. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14078. }),
  14079. $globals.Behavior);
  14080. $core.addMethod(
  14081. $core.method({
  14082. selector: "allSelectors",
  14083. protocol: "accessing",
  14084. fn: function (){
  14085. var self=this;
  14086. return $core.withContext(function($ctx1) {
  14087. var $1,$2;
  14088. $1=self._allSuperclasses();
  14089. $2=self._selectors();
  14090. $ctx1.sendIdx["selectors"]=1;
  14091. return $recv($1)._inject_into_($2,(function(acc,each){
  14092. return $core.withContext(function($ctx2) {
  14093. $recv(acc)._addAll_($recv(each)._selectors());
  14094. return $recv(acc)._yourself();
  14095. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14096. }));
  14097. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14098. },
  14099. args: [],
  14100. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14101. referencedClasses: [],
  14102. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14103. }),
  14104. $globals.Behavior);
  14105. $core.addMethod(
  14106. $core.method({
  14107. selector: "allSubclasses",
  14108. protocol: "accessing",
  14109. fn: function (){
  14110. var self=this;
  14111. return $core.withContext(function($ctx1) {
  14112. return $recv($globals.Array)._streamContents_((function(str){
  14113. return $core.withContext(function($ctx2) {
  14114. return self._allSubclassesDo_((function(each){
  14115. return $core.withContext(function($ctx3) {
  14116. return $recv(str)._nextPut_(each);
  14117. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14118. }));
  14119. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14120. }));
  14121. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14122. },
  14123. args: [],
  14124. 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 ] ]",
  14125. referencedClasses: ["Array"],
  14126. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14127. }),
  14128. $globals.Behavior);
  14129. $core.addMethod(
  14130. $core.method({
  14131. selector: "allSubclassesDo:",
  14132. protocol: "enumerating",
  14133. fn: function (aBlock){
  14134. var self=this;
  14135. return $core.withContext(function($ctx1) {
  14136. $core.traverseClassTree(self, function(subclass) {
  14137. if (subclass !== self) aBlock._value_(subclass);
  14138. });
  14139. return self;
  14140. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14141. },
  14142. args: ["aBlock"],
  14143. 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})'>",
  14144. referencedClasses: [],
  14145. messageSends: []
  14146. }),
  14147. $globals.Behavior);
  14148. $core.addMethod(
  14149. $core.method({
  14150. selector: "allSuperclasses",
  14151. protocol: "accessing",
  14152. fn: function (){
  14153. var self=this;
  14154. return $core.withContext(function($ctx1) {
  14155. var $1,$3,$2,$receiver;
  14156. $1=self._superclass();
  14157. $ctx1.sendIdx["superclass"]=1;
  14158. if(($receiver = $1) == null || $receiver.isNil){
  14159. return [];
  14160. } else {
  14161. $1;
  14162. }
  14163. $3=self._superclass();
  14164. $ctx1.sendIdx["superclass"]=2;
  14165. $2=$recv($globals.OrderedCollection)._with_($3);
  14166. $recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
  14167. return $recv($2)._yourself();
  14168. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14169. },
  14170. args: [],
  14171. 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",
  14172. referencedClasses: ["OrderedCollection"],
  14173. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14174. }),
  14175. $globals.Behavior);
  14176. $core.addMethod(
  14177. $core.method({
  14178. selector: "basicNew",
  14179. protocol: "instance creation",
  14180. fn: function (){
  14181. var self=this;
  14182. return $core.withContext(function($ctx1) {
  14183. return new self.fn();
  14184. return self;
  14185. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14186. },
  14187. args: [],
  14188. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14189. referencedClasses: [],
  14190. messageSends: []
  14191. }),
  14192. $globals.Behavior);
  14193. $core.addMethod(
  14194. $core.method({
  14195. selector: "canUnderstand:",
  14196. protocol: "testing",
  14197. fn: function (aSelector){
  14198. var self=this;
  14199. return $core.withContext(function($ctx1) {
  14200. var $2,$1;
  14201. return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14202. return $core.withContext(function($ctx2) {
  14203. $2=self._superclass();
  14204. $ctx2.sendIdx["superclass"]=1;
  14205. $1=$recv($2)._notNil();
  14206. return $recv($1)._and_((function(){
  14207. return $core.withContext(function($ctx3) {
  14208. return $recv(self._superclass())._canUnderstand_(aSelector);
  14209. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14210. }));
  14211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14212. }));
  14213. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14214. },
  14215. args: ["aSelector"],
  14216. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14217. referencedClasses: [],
  14218. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14219. }),
  14220. $globals.Behavior);
  14221. $core.addMethod(
  14222. $core.method({
  14223. selector: "includesBehavior:",
  14224. protocol: "testing",
  14225. fn: function (aClass){
  14226. var self=this;
  14227. return $core.withContext(function($ctx1) {
  14228. return $recv(self.__eq_eq(aClass))._or_((function(){
  14229. return $core.withContext(function($ctx2) {
  14230. return self._inheritsFrom_(aClass);
  14231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14232. }));
  14233. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14234. },
  14235. args: ["aClass"],
  14236. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14237. referencedClasses: [],
  14238. messageSends: ["or:", "==", "inheritsFrom:"]
  14239. }),
  14240. $globals.Behavior);
  14241. $core.addMethod(
  14242. $core.method({
  14243. selector: "inheritsFrom:",
  14244. protocol: "testing",
  14245. fn: function (aClass){
  14246. var self=this;
  14247. return $core.withContext(function($ctx1) {
  14248. var $1,$3,$2,$receiver;
  14249. $1=self._superclass();
  14250. $ctx1.sendIdx["superclass"]=1;
  14251. if(($receiver = $1) == null || $receiver.isNil){
  14252. return false;
  14253. } else {
  14254. $1;
  14255. }
  14256. $3=self._superclass();
  14257. $ctx1.sendIdx["superclass"]=2;
  14258. $2=$recv(aClass).__eq_eq($3);
  14259. return $recv($2)._or_((function(){
  14260. return $core.withContext(function($ctx2) {
  14261. return $recv(self._superclass())._inheritsFrom_(aClass);
  14262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14263. }));
  14264. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14265. },
  14266. args: ["aClass"],
  14267. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14268. referencedClasses: [],
  14269. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14270. }),
  14271. $globals.Behavior);
  14272. $core.addMethod(
  14273. $core.method({
  14274. selector: "instanceVariableNames",
  14275. protocol: "accessing",
  14276. fn: function (){
  14277. var self=this;
  14278. return $core.withContext(function($ctx1) {
  14279. return self.iVarNames;
  14280. return self;
  14281. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14282. },
  14283. args: [],
  14284. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14285. referencedClasses: [],
  14286. messageSends: []
  14287. }),
  14288. $globals.Behavior);
  14289. $core.addMethod(
  14290. $core.method({
  14291. selector: "isBehavior",
  14292. protocol: "testing",
  14293. fn: function (){
  14294. var self=this;
  14295. return true;
  14296. },
  14297. args: [],
  14298. source: "isBehavior\x0a\x09^ true",
  14299. referencedClasses: [],
  14300. messageSends: []
  14301. }),
  14302. $globals.Behavior);
  14303. $core.addMethod(
  14304. $core.method({
  14305. selector: "javascriptConstructor",
  14306. protocol: "accessing",
  14307. fn: function (){
  14308. var self=this;
  14309. return $core.withContext(function($ctx1) {
  14310. return self.fn;
  14311. return self;
  14312. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14313. },
  14314. args: [],
  14315. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14316. referencedClasses: [],
  14317. messageSends: []
  14318. }),
  14319. $globals.Behavior);
  14320. $core.addMethod(
  14321. $core.method({
  14322. selector: "javascriptConstructor:",
  14323. protocol: "accessing",
  14324. fn: function (aJavaScriptFunction){
  14325. var self=this;
  14326. return $core.withContext(function($ctx1) {
  14327. $core.setClassConstructor(self, aJavaScriptFunction);;
  14328. return self;
  14329. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14330. },
  14331. args: ["aJavaScriptFunction"],
  14332. 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);'>",
  14333. referencedClasses: [],
  14334. messageSends: []
  14335. }),
  14336. $globals.Behavior);
  14337. $core.addMethod(
  14338. $core.method({
  14339. selector: "lookupSelector:",
  14340. protocol: "accessing",
  14341. fn: function (selector){
  14342. var self=this;
  14343. var lookupClass;
  14344. return $core.withContext(function($ctx1) {
  14345. var $1;
  14346. var $early={};
  14347. try {
  14348. lookupClass=self;
  14349. $recv((function(){
  14350. return $core.withContext(function($ctx2) {
  14351. return $recv(lookupClass).__eq(nil);
  14352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14353. }))._whileFalse_((function(){
  14354. return $core.withContext(function($ctx2) {
  14355. $1=$recv(lookupClass)._includesSelector_(selector);
  14356. if($core.assert($1)){
  14357. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14358. }
  14359. lookupClass=$recv(lookupClass)._superclass();
  14360. return lookupClass;
  14361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14362. }));
  14363. return nil;
  14364. }
  14365. catch(e) {if(e===$early)return e[0]; throw e}
  14366. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14367. },
  14368. args: ["selector"],
  14369. 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",
  14370. referencedClasses: [],
  14371. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14372. }),
  14373. $globals.Behavior);
  14374. $core.addMethod(
  14375. $core.method({
  14376. selector: "new",
  14377. protocol: "instance creation",
  14378. fn: function (){
  14379. var self=this;
  14380. return $core.withContext(function($ctx1) {
  14381. return $recv(self._basicNew())._initialize();
  14382. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14383. },
  14384. args: [],
  14385. source: "new\x0a\x09^ self basicNew initialize",
  14386. referencedClasses: [],
  14387. messageSends: ["initialize", "basicNew"]
  14388. }),
  14389. $globals.Behavior);
  14390. $core.addMethod(
  14391. $core.method({
  14392. selector: "prototype",
  14393. protocol: "accessing",
  14394. fn: function (){
  14395. var self=this;
  14396. return $core.withContext(function($ctx1) {
  14397. return self.fn.prototype;
  14398. return self;
  14399. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14400. },
  14401. args: [],
  14402. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14403. referencedClasses: [],
  14404. messageSends: []
  14405. }),
  14406. $globals.Behavior);
  14407. $core.addMethod(
  14408. $core.method({
  14409. selector: "subclasses",
  14410. protocol: "accessing",
  14411. fn: function (){
  14412. var self=this;
  14413. return $core.withContext(function($ctx1) {
  14414. self._subclassResponsibility();
  14415. return self;
  14416. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14417. },
  14418. args: [],
  14419. source: "subclasses\x0a\x09self subclassResponsibility",
  14420. referencedClasses: [],
  14421. messageSends: ["subclassResponsibility"]
  14422. }),
  14423. $globals.Behavior);
  14424. $core.addMethod(
  14425. $core.method({
  14426. selector: "superclass",
  14427. protocol: "accessing",
  14428. fn: function (){
  14429. var self=this;
  14430. return $core.withContext(function($ctx1) {
  14431. return self.superclass;
  14432. return self;
  14433. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14434. },
  14435. args: [],
  14436. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14437. referencedClasses: [],
  14438. messageSends: []
  14439. }),
  14440. $globals.Behavior);
  14441. $core.addMethod(
  14442. $core.method({
  14443. selector: "theMetaClass",
  14444. protocol: "accessing",
  14445. fn: function (){
  14446. var self=this;
  14447. return $core.withContext(function($ctx1) {
  14448. self._subclassResponsibility();
  14449. return self;
  14450. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14451. },
  14452. args: [],
  14453. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14454. referencedClasses: [],
  14455. messageSends: ["subclassResponsibility"]
  14456. }),
  14457. $globals.Behavior);
  14458. $core.addMethod(
  14459. $core.method({
  14460. selector: "theNonMetaClass",
  14461. protocol: "accessing",
  14462. fn: function (){
  14463. var self=this;
  14464. return $core.withContext(function($ctx1) {
  14465. self._subclassResponsibility();
  14466. return self;
  14467. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14468. },
  14469. args: [],
  14470. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14471. referencedClasses: [],
  14472. messageSends: ["subclassResponsibility"]
  14473. }),
  14474. $globals.Behavior);
  14475. $core.addMethod(
  14476. $core.method({
  14477. selector: "withAllSubclasses",
  14478. protocol: "accessing",
  14479. fn: function (){
  14480. var self=this;
  14481. return $core.withContext(function($ctx1) {
  14482. var $1;
  14483. $1=$recv($globals.Array)._with_(self);
  14484. $recv($1)._addAll_(self._allSubclasses());
  14485. return $recv($1)._yourself();
  14486. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14487. },
  14488. args: [],
  14489. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14490. referencedClasses: ["Array"],
  14491. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14492. }),
  14493. $globals.Behavior);
  14494. $core.addClass("Class", $globals.Behavior, [], "Kernel-Classes");
  14495. $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.";
  14496. $core.addMethod(
  14497. $core.method({
  14498. selector: "asJavaScriptSource",
  14499. protocol: "converting",
  14500. fn: function (){
  14501. var self=this;
  14502. return $core.withContext(function($ctx1) {
  14503. return "$globals.".__comma(self._name());
  14504. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Class)});
  14505. },
  14506. args: [],
  14507. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  14508. referencedClasses: [],
  14509. messageSends: [",", "name"]
  14510. }),
  14511. $globals.Class);
  14512. $core.addMethod(
  14513. $core.method({
  14514. selector: "browse",
  14515. protocol: "browsing",
  14516. fn: function (){
  14517. var self=this;
  14518. return $core.withContext(function($ctx1) {
  14519. $recv($globals.Finder)._findClass_(self);
  14520. return self;
  14521. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  14522. },
  14523. args: [],
  14524. source: "browse\x0a\x09Finder findClass: self",
  14525. referencedClasses: ["Finder"],
  14526. messageSends: ["findClass:"]
  14527. }),
  14528. $globals.Class);
  14529. $core.addMethod(
  14530. $core.method({
  14531. selector: "category",
  14532. protocol: "accessing",
  14533. fn: function (){
  14534. var self=this;
  14535. return $core.withContext(function($ctx1) {
  14536. var $1,$receiver;
  14537. $1=self._package();
  14538. $ctx1.sendIdx["package"]=1;
  14539. if(($receiver = $1) == null || $receiver.isNil){
  14540. return "Unclassified";
  14541. } else {
  14542. return $recv(self._package())._name();
  14543. }
  14544. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  14545. },
  14546. args: [],
  14547. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  14548. referencedClasses: [],
  14549. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  14550. }),
  14551. $globals.Class);
  14552. $core.addMethod(
  14553. $core.method({
  14554. selector: "classTag",
  14555. protocol: "accessing",
  14556. fn: function (){
  14557. var self=this;
  14558. return "class";
  14559. },
  14560. args: [],
  14561. 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'",
  14562. referencedClasses: [],
  14563. messageSends: []
  14564. }),
  14565. $globals.Class);
  14566. $core.addMethod(
  14567. $core.method({
  14568. selector: "definition",
  14569. protocol: "accessing",
  14570. fn: function (){
  14571. var self=this;
  14572. return $core.withContext(function($ctx1) {
  14573. var $1,$2;
  14574. return $recv($globals.String)._streamContents_((function(stream){
  14575. return $core.withContext(function($ctx2) {
  14576. $recv(stream)._print_(self._superclass());
  14577. $ctx2.sendIdx["print:"]=1;
  14578. $recv(stream)._write_(" subclass: ");
  14579. $ctx2.sendIdx["write:"]=1;
  14580. $recv(stream)._printSymbol_(self._name());
  14581. $recv(stream)._lf();
  14582. $ctx2.sendIdx["lf"]=1;
  14583. $recv(stream)._write_($recv(self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14584. return $core.withContext(function($ctx3) {
  14585. $1=$recv($globals.String)._tab();
  14586. $ctx3.sendIdx["tab"]=1;
  14587. $2=$recv($globals.String)._lf();
  14588. $ctx3.sendIdx["lf"]=2;
  14589. return [$1,"uses: ",tcd,$2];
  14590. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14591. })));
  14592. $ctx2.sendIdx["write:"]=2;
  14593. $recv(stream)._tab();
  14594. $ctx2.sendIdx["tab"]=2;
  14595. $recv(stream)._write_("instanceVariableNames: ");
  14596. $ctx2.sendIdx["write:"]=3;
  14597. $recv(stream)._print_(" "._join_(self._instanceVariableNames()));
  14598. $ctx2.sendIdx["print:"]=2;
  14599. $recv(stream)._lf();
  14600. $recv(stream)._tab();
  14601. $recv(stream)._write_("package: ");
  14602. return $recv(stream)._print_(self._category());
  14603. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14604. }));
  14605. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14606. },
  14607. args: [],
  14608. 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 ]",
  14609. referencedClasses: ["String"],
  14610. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14611. }),
  14612. $globals.Class);
  14613. $core.addMethod(
  14614. $core.method({
  14615. selector: "isClass",
  14616. protocol: "testing",
  14617. fn: function (){
  14618. var self=this;
  14619. return true;
  14620. },
  14621. args: [],
  14622. source: "isClass\x0a\x09^ true",
  14623. referencedClasses: [],
  14624. messageSends: []
  14625. }),
  14626. $globals.Class);
  14627. $core.addMethod(
  14628. $core.method({
  14629. selector: "package",
  14630. protocol: "accessing",
  14631. fn: function (){
  14632. var self=this;
  14633. return $core.withContext(function($ctx1) {
  14634. return self._basicAt_("pkg");
  14635. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  14636. },
  14637. args: [],
  14638. source: "package\x0a\x09^ self basicAt: 'pkg'",
  14639. referencedClasses: [],
  14640. messageSends: ["basicAt:"]
  14641. }),
  14642. $globals.Class);
  14643. $core.addMethod(
  14644. $core.method({
  14645. selector: "package:",
  14646. protocol: "accessing",
  14647. fn: function (aPackage){
  14648. var self=this;
  14649. var oldPackage;
  14650. return $core.withContext(function($ctx1) {
  14651. var $2,$1,$3,$4,$6,$5;
  14652. $2=self._package();
  14653. $ctx1.sendIdx["package"]=1;
  14654. $1=$recv($2).__eq(aPackage);
  14655. if($core.assert($1)){
  14656. return self;
  14657. }
  14658. oldPackage=self._package();
  14659. self._basicAt_put_("pkg",aPackage);
  14660. $3=$recv(oldPackage)._organization();
  14661. $ctx1.sendIdx["organization"]=1;
  14662. $recv($3)._removeElement_(self);
  14663. $recv($recv(aPackage)._organization())._addElement_(self);
  14664. $4=$recv($globals.SystemAnnouncer)._current();
  14665. $6=$recv($globals.ClassMoved)._new();
  14666. $recv($6)._theClass_(self);
  14667. $recv($6)._oldPackage_(oldPackage);
  14668. $5=$recv($6)._yourself();
  14669. $recv($4)._announce_($5);
  14670. return self;
  14671. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  14672. },
  14673. args: ["aPackage"],
  14674. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  14675. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  14676. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  14677. }),
  14678. $globals.Class);
  14679. $core.addMethod(
  14680. $core.method({
  14681. selector: "rename:",
  14682. protocol: "accessing",
  14683. fn: function (aString){
  14684. var self=this;
  14685. return $core.withContext(function($ctx1) {
  14686. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  14687. return self;
  14688. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  14689. },
  14690. args: ["aString"],
  14691. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  14692. referencedClasses: ["ClassBuilder"],
  14693. messageSends: ["renameClass:to:", "new"]
  14694. }),
  14695. $globals.Class);
  14696. $core.addMethod(
  14697. $core.method({
  14698. selector: "subclass:",
  14699. protocol: "class creation",
  14700. fn: function (aString){
  14701. var self=this;
  14702. return $core.withContext(function($ctx1) {
  14703. return self._subclass_instanceVariableNames_package_(aString,"",nil);
  14704. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.Class)});
  14705. },
  14706. args: ["aString"],
  14707. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  14708. referencedClasses: [],
  14709. messageSends: ["subclass:instanceVariableNames:package:"]
  14710. }),
  14711. $globals.Class);
  14712. $core.addMethod(
  14713. $core.method({
  14714. selector: "subclass:instanceVariableNames:",
  14715. protocol: "class creation",
  14716. fn: function (aString,anotherString){
  14717. var self=this;
  14718. return $core.withContext(function($ctx1) {
  14719. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  14720. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  14721. },
  14722. args: ["aString", "anotherString"],
  14723. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  14724. referencedClasses: [],
  14725. messageSends: ["subclass:instanceVariableNames:package:"]
  14726. }),
  14727. $globals.Class);
  14728. $core.addMethod(
  14729. $core.method({
  14730. selector: "subclass:instanceVariableNames:category:",
  14731. protocol: "class creation",
  14732. fn: function (aString,aString2,aString3){
  14733. var self=this;
  14734. return $core.withContext(function($ctx1) {
  14735. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  14736. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  14737. },
  14738. args: ["aString", "aString2", "aString3"],
  14739. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  14740. referencedClasses: [],
  14741. messageSends: ["subclass:instanceVariableNames:package:"]
  14742. }),
  14743. $globals.Class);
  14744. $core.addMethod(
  14745. $core.method({
  14746. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  14747. protocol: "class creation",
  14748. fn: function (aString,aString2,classVars,pools,aString3){
  14749. var self=this;
  14750. return $core.withContext(function($ctx1) {
  14751. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  14752. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  14753. },
  14754. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  14755. 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",
  14756. referencedClasses: [],
  14757. messageSends: ["subclass:instanceVariableNames:package:"]
  14758. }),
  14759. $globals.Class);
  14760. $core.addMethod(
  14761. $core.method({
  14762. selector: "subclass:instanceVariableNames:package:",
  14763. protocol: "class creation",
  14764. fn: function (aString,aString2,aString3){
  14765. var self=this;
  14766. return $core.withContext(function($ctx1) {
  14767. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  14768. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  14769. },
  14770. args: ["aString", "aString2", "aString3"],
  14771. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  14772. referencedClasses: ["ClassBuilder"],
  14773. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  14774. }),
  14775. $globals.Class);
  14776. $core.addMethod(
  14777. $core.method({
  14778. selector: "subclass:uses:",
  14779. protocol: "class creation",
  14780. fn: function (aString,aTraitCompositionDescription){
  14781. var self=this;
  14782. return $core.withContext(function($ctx1) {
  14783. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  14784. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.Class)});
  14785. },
  14786. args: ["aString", "aTraitCompositionDescription"],
  14787. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  14788. referencedClasses: [],
  14789. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  14790. }),
  14791. $globals.Class);
  14792. $core.addMethod(
  14793. $core.method({
  14794. selector: "subclass:uses:instanceVariableNames:",
  14795. protocol: "class creation",
  14796. fn: function (aString,aTraitCompositionDescription,anotherString){
  14797. var self=this;
  14798. return $core.withContext(function($ctx1) {
  14799. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  14800. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.Class)});
  14801. },
  14802. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  14803. 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",
  14804. referencedClasses: [],
  14805. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  14806. }),
  14807. $globals.Class);
  14808. $core.addMethod(
  14809. $core.method({
  14810. selector: "subclass:uses:instanceVariableNames:category:",
  14811. protocol: "class creation",
  14812. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  14813. var self=this;
  14814. return $core.withContext(function($ctx1) {
  14815. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  14816. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.Class)});
  14817. },
  14818. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  14819. 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",
  14820. referencedClasses: [],
  14821. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  14822. }),
  14823. $globals.Class);
  14824. $core.addMethod(
  14825. $core.method({
  14826. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  14827. protocol: "class creation",
  14828. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  14829. var self=this;
  14830. return $core.withContext(function($ctx1) {
  14831. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  14832. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  14833. },
  14834. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  14835. 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",
  14836. referencedClasses: [],
  14837. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  14838. }),
  14839. $globals.Class);
  14840. $core.addMethod(
  14841. $core.method({
  14842. selector: "subclass:uses:instanceVariableNames:package:",
  14843. protocol: "class creation",
  14844. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  14845. var self=this;
  14846. var cls;
  14847. return $core.withContext(function($ctx1) {
  14848. cls=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  14849. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  14850. return cls;
  14851. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.Class)});
  14852. },
  14853. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  14854. 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",
  14855. referencedClasses: [],
  14856. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  14857. }),
  14858. $globals.Class);
  14859. $core.addMethod(
  14860. $core.method({
  14861. selector: "subclasses",
  14862. protocol: "accessing",
  14863. fn: function (){
  14864. var self=this;
  14865. return $core.withContext(function($ctx1) {
  14866. return self.subclasses._copy();
  14867. return self;
  14868. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  14869. },
  14870. args: [],
  14871. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  14872. referencedClasses: [],
  14873. messageSends: []
  14874. }),
  14875. $globals.Class);
  14876. $core.addMethod(
  14877. $core.method({
  14878. selector: "theMetaClass",
  14879. protocol: "accessing",
  14880. fn: function (){
  14881. var self=this;
  14882. return $core.withContext(function($ctx1) {
  14883. return self._class();
  14884. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  14885. },
  14886. args: [],
  14887. source: "theMetaClass\x0a\x09^ self class",
  14888. referencedClasses: [],
  14889. messageSends: ["class"]
  14890. }),
  14891. $globals.Class);
  14892. $core.addMethod(
  14893. $core.method({
  14894. selector: "theNonMetaClass",
  14895. protocol: "accessing",
  14896. fn: function (){
  14897. var self=this;
  14898. return self;
  14899. },
  14900. args: [],
  14901. source: "theNonMetaClass\x0a\x09^ self",
  14902. referencedClasses: [],
  14903. messageSends: []
  14904. }),
  14905. $globals.Class);
  14906. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  14907. $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.";
  14908. $core.addMethod(
  14909. $core.method({
  14910. selector: "asJavaScriptSource",
  14911. protocol: "converting",
  14912. fn: function (){
  14913. var self=this;
  14914. return $core.withContext(function($ctx1) {
  14915. var $1;
  14916. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  14917. $ctx1.sendIdx[","]=1;
  14918. return $1;
  14919. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  14920. },
  14921. args: [],
  14922. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  14923. referencedClasses: [],
  14924. messageSends: [",", "name", "instanceClass"]
  14925. }),
  14926. $globals.Metaclass);
  14927. $core.addMethod(
  14928. $core.method({
  14929. selector: "definition",
  14930. protocol: "accessing",
  14931. fn: function (){
  14932. var self=this;
  14933. return $core.withContext(function($ctx1) {
  14934. var $1,$2;
  14935. return $recv($globals.String)._streamContents_((function(stream){
  14936. return $core.withContext(function($ctx2) {
  14937. $recv(stream)._print_(self);
  14938. $ctx2.sendIdx["print:"]=1;
  14939. $recv(stream)._write_($recv(self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  14940. return " ";
  14941. }),(function(tcd){
  14942. return $core.withContext(function($ctx3) {
  14943. $1=$recv($globals.String)._lf();
  14944. $ctx3.sendIdx["lf"]=1;
  14945. $2=$recv($globals.String)._tab();
  14946. $ctx3.sendIdx["tab"]=1;
  14947. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  14948. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  14949. })));
  14950. $ctx2.sendIdx["write:"]=1;
  14951. $recv(stream)._write_("instanceVariableNames: ");
  14952. return $recv(stream)._print_(" "._join_(self._instanceVariableNames()));
  14953. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14954. }));
  14955. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  14956. },
  14957. args: [],
  14958. 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) ]",
  14959. referencedClasses: ["String"],
  14960. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  14961. }),
  14962. $globals.Metaclass);
  14963. $core.addMethod(
  14964. $core.method({
  14965. selector: "instanceClass",
  14966. protocol: "accessing",
  14967. fn: function (){
  14968. var self=this;
  14969. return $core.withContext(function($ctx1) {
  14970. return self.instanceClass;
  14971. return self;
  14972. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  14973. },
  14974. args: [],
  14975. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  14976. referencedClasses: [],
  14977. messageSends: []
  14978. }),
  14979. $globals.Metaclass);
  14980. $core.addMethod(
  14981. $core.method({
  14982. selector: "instanceVariableNames:",
  14983. protocol: "accessing",
  14984. fn: function (aCollection){
  14985. var self=this;
  14986. return $core.withContext(function($ctx1) {
  14987. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  14988. return self;
  14989. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  14990. },
  14991. args: ["aCollection"],
  14992. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  14993. referencedClasses: ["ClassBuilder"],
  14994. messageSends: ["class:instanceVariableNames:", "new"]
  14995. }),
  14996. $globals.Metaclass);
  14997. $core.addMethod(
  14998. $core.method({
  14999. selector: "isMetaclass",
  15000. protocol: "testing",
  15001. fn: function (){
  15002. var self=this;
  15003. return true;
  15004. },
  15005. args: [],
  15006. source: "isMetaclass\x0a\x09^ true",
  15007. referencedClasses: [],
  15008. messageSends: []
  15009. }),
  15010. $globals.Metaclass);
  15011. $core.addMethod(
  15012. $core.method({
  15013. selector: "name",
  15014. protocol: "accessing",
  15015. fn: function (){
  15016. var self=this;
  15017. return $core.withContext(function($ctx1) {
  15018. return $recv($recv(self._instanceClass())._name()).__comma(" class");
  15019. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15020. },
  15021. args: [],
  15022. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15023. referencedClasses: [],
  15024. messageSends: [",", "name", "instanceClass"]
  15025. }),
  15026. $globals.Metaclass);
  15027. $core.addMethod(
  15028. $core.method({
  15029. selector: "package",
  15030. protocol: "accessing",
  15031. fn: function (){
  15032. var self=this;
  15033. return $core.withContext(function($ctx1) {
  15034. return $recv(self._instanceClass())._package();
  15035. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15036. },
  15037. args: [],
  15038. source: "package\x0a\x09^ self instanceClass package",
  15039. referencedClasses: [],
  15040. messageSends: ["package", "instanceClass"]
  15041. }),
  15042. $globals.Metaclass);
  15043. $core.addMethod(
  15044. $core.method({
  15045. selector: "subclasses",
  15046. protocol: "accessing",
  15047. fn: function (){
  15048. var self=this;
  15049. return $core.withContext(function($ctx1) {
  15050. return $core.metaSubclasses(self);
  15051. return self;
  15052. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15053. },
  15054. args: [],
  15055. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15056. referencedClasses: [],
  15057. messageSends: []
  15058. }),
  15059. $globals.Metaclass);
  15060. $core.addMethod(
  15061. $core.method({
  15062. selector: "theMetaClass",
  15063. protocol: "accessing",
  15064. fn: function (){
  15065. var self=this;
  15066. return self;
  15067. },
  15068. args: [],
  15069. source: "theMetaClass\x0a\x09^ self",
  15070. referencedClasses: [],
  15071. messageSends: []
  15072. }),
  15073. $globals.Metaclass);
  15074. $core.addMethod(
  15075. $core.method({
  15076. selector: "theNonMetaClass",
  15077. protocol: "accessing",
  15078. fn: function (){
  15079. var self=this;
  15080. return $core.withContext(function($ctx1) {
  15081. return self._instanceClass();
  15082. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15083. },
  15084. args: [],
  15085. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15086. referencedClasses: [],
  15087. messageSends: ["instanceClass"]
  15088. }),
  15089. $globals.Metaclass);
  15090. $core.addMethod(
  15091. $core.method({
  15092. selector: "uses:instanceVariableNames:",
  15093. protocol: "accessing",
  15094. fn: function (aTraitCompositionDescription,aCollection){
  15095. var self=this;
  15096. var metaclass;
  15097. return $core.withContext(function($ctx1) {
  15098. metaclass=self._instanceVariableNames_(aCollection);
  15099. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15100. return metaclass;
  15101. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15102. },
  15103. args: ["aTraitCompositionDescription", "aCollection"],
  15104. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15105. referencedClasses: [],
  15106. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15107. }),
  15108. $globals.Metaclass);
  15109. $core.addClass("Trait", $globals.BehaviorBody, [], "Kernel-Classes");
  15110. $core.addMethod(
  15111. $core.method({
  15112. selector: "-",
  15113. protocol: "composition",
  15114. fn: function (anArray){
  15115. var self=this;
  15116. return $core.withContext(function($ctx1) {
  15117. return $recv(self._asTraitTransformation()).__minus(anArray);
  15118. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  15119. },
  15120. args: ["anArray"],
  15121. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  15122. referencedClasses: [],
  15123. messageSends: ["-", "asTraitTransformation"]
  15124. }),
  15125. $globals.Trait);
  15126. $core.addMethod(
  15127. $core.method({
  15128. selector: "@",
  15129. protocol: "composition",
  15130. fn: function (anArrayOfAssociations){
  15131. var self=this;
  15132. return $core.withContext(function($ctx1) {
  15133. return $recv(self._asTraitTransformation()).__at(anArrayOfAssociations);
  15134. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  15135. },
  15136. args: ["anArrayOfAssociations"],
  15137. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  15138. referencedClasses: [],
  15139. messageSends: ["@", "asTraitTransformation"]
  15140. }),
  15141. $globals.Trait);
  15142. $core.addMethod(
  15143. $core.method({
  15144. selector: "asJavaScriptSource",
  15145. protocol: "converting",
  15146. fn: function (){
  15147. var self=this;
  15148. return $core.withContext(function($ctx1) {
  15149. return "$globals.".__comma(self._name());
  15150. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Trait)});
  15151. },
  15152. args: [],
  15153. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  15154. referencedClasses: [],
  15155. messageSends: [",", "name"]
  15156. }),
  15157. $globals.Trait);
  15158. $core.addMethod(
  15159. $core.method({
  15160. selector: "asTraitComposition",
  15161. protocol: "converting",
  15162. fn: function (){
  15163. var self=this;
  15164. return $core.withContext(function($ctx1) {
  15165. return $recv(self._asTraitTransformation())._asTraitComposition();
  15166. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  15167. },
  15168. args: [],
  15169. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  15170. referencedClasses: [],
  15171. messageSends: ["asTraitComposition", "asTraitTransformation"]
  15172. }),
  15173. $globals.Trait);
  15174. $core.addMethod(
  15175. $core.method({
  15176. selector: "asTraitTransformation",
  15177. protocol: "converting",
  15178. fn: function (){
  15179. var self=this;
  15180. return $core.withContext(function($ctx1) {
  15181. return $recv($globals.TraitTransformation)._on_(self);
  15182. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  15183. },
  15184. args: [],
  15185. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  15186. referencedClasses: ["TraitTransformation"],
  15187. messageSends: ["on:"]
  15188. }),
  15189. $globals.Trait);
  15190. $core.addMethod(
  15191. $core.method({
  15192. selector: "category",
  15193. protocol: "accessing",
  15194. fn: function (){
  15195. var self=this;
  15196. return $core.withContext(function($ctx1) {
  15197. var $1,$receiver;
  15198. $1=self._package();
  15199. $ctx1.sendIdx["package"]=1;
  15200. if(($receiver = $1) == null || $receiver.isNil){
  15201. return "Unclassified";
  15202. } else {
  15203. return $recv(self._package())._name();
  15204. }
  15205. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Trait)});
  15206. },
  15207. args: [],
  15208. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  15209. referencedClasses: [],
  15210. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  15211. }),
  15212. $globals.Trait);
  15213. $core.addMethod(
  15214. $core.method({
  15215. selector: "classTag",
  15216. protocol: "accessing",
  15217. fn: function (){
  15218. var self=this;
  15219. return "trait";
  15220. },
  15221. args: [],
  15222. source: "classTag\x0a\x09^ 'trait'",
  15223. referencedClasses: [],
  15224. messageSends: []
  15225. }),
  15226. $globals.Trait);
  15227. $core.addMethod(
  15228. $core.method({
  15229. selector: "definition",
  15230. protocol: "accessing",
  15231. fn: function (){
  15232. var self=this;
  15233. return $core.withContext(function($ctx1) {
  15234. var $1;
  15235. return $recv($globals.String)._streamContents_((function(stream){
  15236. return $core.withContext(function($ctx2) {
  15237. $recv(stream)._write_("Trait named: ");
  15238. $ctx2.sendIdx["write:"]=1;
  15239. $recv(stream)._printSymbol_(self._name());
  15240. $recv(stream)._lf();
  15241. $ctx2.sendIdx["lf"]=1;
  15242. $recv(stream)._write_($recv(self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  15243. return $core.withContext(function($ctx3) {
  15244. $1=$recv($globals.String)._tab();
  15245. $ctx3.sendIdx["tab"]=1;
  15246. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  15247. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  15248. })));
  15249. $ctx2.sendIdx["write:"]=2;
  15250. $recv(stream)._tab();
  15251. $recv(stream)._write_("package: ");
  15252. return $recv(stream)._print_(self._category());
  15253. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15254. }));
  15255. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  15256. },
  15257. args: [],
  15258. 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 ]",
  15259. referencedClasses: ["String"],
  15260. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  15261. }),
  15262. $globals.Trait);
  15263. $core.addMethod(
  15264. $core.method({
  15265. selector: "package",
  15266. protocol: "accessing",
  15267. fn: function (){
  15268. var self=this;
  15269. return $core.withContext(function($ctx1) {
  15270. return self._basicAt_("pkg");
  15271. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Trait)});
  15272. },
  15273. args: [],
  15274. source: "package\x0a\x09^ self basicAt: 'pkg'",
  15275. referencedClasses: [],
  15276. messageSends: ["basicAt:"]
  15277. }),
  15278. $globals.Trait);
  15279. $core.addMethod(
  15280. $core.method({
  15281. selector: "package:",
  15282. protocol: "accessing",
  15283. fn: function (aPackage){
  15284. var self=this;
  15285. var oldPackage;
  15286. return $core.withContext(function($ctx1) {
  15287. var $2,$1,$3,$4,$6,$5;
  15288. $2=self._package();
  15289. $ctx1.sendIdx["package"]=1;
  15290. $1=$recv($2).__eq(aPackage);
  15291. if($core.assert($1)){
  15292. return self;
  15293. }
  15294. oldPackage=self._package();
  15295. self._basicAt_put_("pkg",aPackage);
  15296. $3=$recv(oldPackage)._organization();
  15297. $ctx1.sendIdx["organization"]=1;
  15298. $recv($3)._removeElement_(self);
  15299. $recv($recv(aPackage)._organization())._addElement_(self);
  15300. $4=$recv($globals.SystemAnnouncer)._current();
  15301. $6=$recv($globals.ClassMoved)._new();
  15302. $recv($6)._theClass_(self);
  15303. $recv($6)._oldPackage_(oldPackage);
  15304. $5=$recv($6)._yourself();
  15305. $recv($4)._announce_($5);
  15306. return self;
  15307. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Trait)});
  15308. },
  15309. args: ["aPackage"],
  15310. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  15311. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  15312. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  15313. }),
  15314. $globals.Trait);
  15315. $core.addMethod(
  15316. $core.method({
  15317. selector: "theMetaClass",
  15318. protocol: "accessing",
  15319. fn: function (){
  15320. var self=this;
  15321. return nil;
  15322. },
  15323. args: [],
  15324. source: "theMetaClass\x0a\x09^ nil",
  15325. referencedClasses: [],
  15326. messageSends: []
  15327. }),
  15328. $globals.Trait);
  15329. $core.addMethod(
  15330. $core.method({
  15331. selector: "theNonMetaClass",
  15332. protocol: "accessing",
  15333. fn: function (){
  15334. var self=this;
  15335. return self;
  15336. },
  15337. args: [],
  15338. source: "theNonMetaClass\x0a\x09^ self",
  15339. referencedClasses: [],
  15340. messageSends: []
  15341. }),
  15342. $globals.Trait);
  15343. $core.addMethod(
  15344. $core.method({
  15345. selector: "traitUsers",
  15346. protocol: "accessing",
  15347. fn: function (){
  15348. var self=this;
  15349. return $core.withContext(function($ctx1) {
  15350. return $recv(self._basicAt_("traitUsers"))._copy();
  15351. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  15352. },
  15353. args: [],
  15354. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  15355. referencedClasses: [],
  15356. messageSends: ["copy", "basicAt:"]
  15357. }),
  15358. $globals.Trait);
  15359. $core.addMethod(
  15360. $core.method({
  15361. selector: "named:package:",
  15362. protocol: "instance creation",
  15363. fn: function (aString,anotherString){
  15364. var self=this;
  15365. return $core.withContext(function($ctx1) {
  15366. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  15367. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.klass)});
  15368. },
  15369. args: ["aString", "anotherString"],
  15370. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  15371. referencedClasses: ["ClassBuilder"],
  15372. messageSends: ["addTraitNamed:package:", "new"]
  15373. }),
  15374. $globals.Trait.klass);
  15375. $core.addMethod(
  15376. $core.method({
  15377. selector: "named:uses:package:",
  15378. protocol: "instance creation",
  15379. fn: function (aString,aTraitCompositionDescription,anotherString){
  15380. var self=this;
  15381. var trait;
  15382. return $core.withContext(function($ctx1) {
  15383. trait=self._named_package_(aString,anotherString);
  15384. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15385. return trait;
  15386. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.klass)});
  15387. },
  15388. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  15389. 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",
  15390. referencedClasses: [],
  15391. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  15392. }),
  15393. $globals.Trait.klass);
  15394. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15395. $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:`.";
  15396. $core.addMethod(
  15397. $core.method({
  15398. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15399. protocol: "class definition",
  15400. fn: function (aClass,className,aCollection,packageName){
  15401. var self=this;
  15402. var theClass,thePackage;
  15403. return $core.withContext(function($ctx1) {
  15404. var $1,$2,$3,$receiver;
  15405. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15406. thePackage=$recv($globals.Package)._named_(packageName);
  15407. $1=theClass;
  15408. if(($receiver = $1) == null || $receiver.isNil){
  15409. $1;
  15410. } else {
  15411. $recv(theClass)._package_(thePackage);
  15412. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15413. if(!$core.assert($2)){
  15414. return self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15415. }
  15416. }
  15417. $3=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15418. $recv($3)._recompile();
  15419. return $recv($3)._yourself();
  15420. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15421. },
  15422. args: ["aClass", "className", "aCollection", "packageName"],
  15423. 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",
  15424. referencedClasses: ["Smalltalk", "Package"],
  15425. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15426. }),
  15427. $globals.ClassBuilder);
  15428. $core.addMethod(
  15429. $core.method({
  15430. selector: "addTraitNamed:package:",
  15431. protocol: "class definition",
  15432. fn: function (traitName,packageName){
  15433. var self=this;
  15434. var theTrait,thePackage;
  15435. return $core.withContext(function($ctx1) {
  15436. var $1,$2,$receiver;
  15437. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15438. thePackage=$recv($globals.Package)._named_(packageName);
  15439. $1=theTrait;
  15440. if(($receiver = $1) == null || $receiver.isNil){
  15441. $1;
  15442. } else {
  15443. $2=theTrait;
  15444. $recv($2)._package_(thePackage);
  15445. $recv($2)._recompile();
  15446. return $recv($2)._yourself();
  15447. }
  15448. return self._basicAddTraitNamed_package_(traitName,packageName);
  15449. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15450. },
  15451. args: ["traitName", "packageName"],
  15452. 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",
  15453. referencedClasses: ["Smalltalk", "Package"],
  15454. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15455. }),
  15456. $globals.ClassBuilder);
  15457. $core.addMethod(
  15458. $core.method({
  15459. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15460. protocol: "private",
  15461. fn: function (aClass,aString,aCollection,packageName){
  15462. var self=this;
  15463. return $core.withContext(function($ctx1) {
  15464. return $core.addClass(aString, aClass, aCollection, packageName);
  15465. ;
  15466. return self;
  15467. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15468. },
  15469. args: ["aClass", "aString", "aCollection", "packageName"],
  15470. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15471. referencedClasses: [],
  15472. messageSends: []
  15473. }),
  15474. $globals.ClassBuilder);
  15475. $core.addMethod(
  15476. $core.method({
  15477. selector: "basicAddTraitNamed:package:",
  15478. protocol: "private",
  15479. fn: function (aString,anotherString){
  15480. var self=this;
  15481. return $core.withContext(function($ctx1) {
  15482. return $core.addTrait(aString, anotherString);
  15483. return self;
  15484. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15485. },
  15486. args: ["aString", "anotherString"],
  15487. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15488. referencedClasses: [],
  15489. messageSends: []
  15490. }),
  15491. $globals.ClassBuilder);
  15492. $core.addMethod(
  15493. $core.method({
  15494. selector: "basicClass:instanceVariableNames:",
  15495. protocol: "private",
  15496. fn: function (aClass,aString){
  15497. var self=this;
  15498. return $core.withContext(function($ctx1) {
  15499. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  15500. return self;
  15501. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15502. },
  15503. args: ["aClass", "aString"],
  15504. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  15505. referencedClasses: [],
  15506. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  15507. }),
  15508. $globals.ClassBuilder);
  15509. $core.addMethod(
  15510. $core.method({
  15511. selector: "basicClass:instanceVariables:",
  15512. protocol: "private",
  15513. fn: function (aClass,aCollection){
  15514. var self=this;
  15515. return $core.withContext(function($ctx1) {
  15516. var $1;
  15517. $1=$recv(aClass)._isMetaclass();
  15518. if(!$core.assert($1)){
  15519. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15520. }
  15521. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15522. return self;
  15523. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15524. },
  15525. args: ["aClass", "aCollection"],
  15526. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15527. referencedClasses: [],
  15528. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15529. }),
  15530. $globals.ClassBuilder);
  15531. $core.addMethod(
  15532. $core.method({
  15533. selector: "basicRemoveClass:",
  15534. protocol: "private",
  15535. fn: function (aClass){
  15536. var self=this;
  15537. return $core.withContext(function($ctx1) {
  15538. $core.removeClass(aClass);
  15539. return self;
  15540. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15541. },
  15542. args: ["aClass"],
  15543. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15544. referencedClasses: [],
  15545. messageSends: []
  15546. }),
  15547. $globals.ClassBuilder);
  15548. $core.addMethod(
  15549. $core.method({
  15550. selector: "basicRenameClass:to:",
  15551. protocol: "private",
  15552. fn: function (aClass,aString){
  15553. var self=this;
  15554. return $core.withContext(function($ctx1) {
  15555. $globals[aString] = aClass;
  15556. delete $globals[aClass.className];
  15557. aClass.className = aString;
  15558. ;
  15559. return self;
  15560. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15561. },
  15562. args: ["aClass", "aString"],
  15563. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09'>",
  15564. referencedClasses: [],
  15565. messageSends: []
  15566. }),
  15567. $globals.ClassBuilder);
  15568. $core.addMethod(
  15569. $core.method({
  15570. selector: "basicSwapClassNames:with:",
  15571. protocol: "private",
  15572. fn: function (aClass,anotherClass){
  15573. var self=this;
  15574. return $core.withContext(function($ctx1) {
  15575. var tmp = aClass.className;
  15576. aClass.className = anotherClass.className;
  15577. anotherClass.className = tmp;
  15578. ;
  15579. return self;
  15580. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15581. },
  15582. args: ["aClass", "anotherClass"],
  15583. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09'>",
  15584. referencedClasses: [],
  15585. messageSends: []
  15586. }),
  15587. $globals.ClassBuilder);
  15588. $core.addMethod(
  15589. $core.method({
  15590. selector: "class:instanceVariableNames:",
  15591. protocol: "class definition",
  15592. fn: function (aClass,ivarNames){
  15593. var self=this;
  15594. return $core.withContext(function($ctx1) {
  15595. var $1,$3,$2;
  15596. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  15597. $1=$recv($globals.SystemAnnouncer)._current();
  15598. $3=$recv($globals.ClassDefinitionChanged)._new();
  15599. $recv($3)._theClass_(aClass);
  15600. $2=$recv($3)._yourself();
  15601. $recv($1)._announce_($2);
  15602. return self;
  15603. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15604. },
  15605. args: ["aClass", "ivarNames"],
  15606. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15607. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15608. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  15609. }),
  15610. $globals.ClassBuilder);
  15611. $core.addMethod(
  15612. $core.method({
  15613. selector: "copyClass:named:",
  15614. protocol: "copying",
  15615. fn: function (aClass,className){
  15616. var self=this;
  15617. var newClass;
  15618. return $core.withContext(function($ctx1) {
  15619. var $1,$3,$2;
  15620. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15621. self._copyClass_to_(aClass,newClass);
  15622. $1=$recv($globals.SystemAnnouncer)._current();
  15623. $3=$recv($globals.ClassAdded)._new();
  15624. $recv($3)._theClass_(newClass);
  15625. $2=$recv($3)._yourself();
  15626. $recv($1)._announce_($2);
  15627. return newClass;
  15628. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15629. },
  15630. args: ["aClass", "className"],
  15631. 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",
  15632. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15633. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15634. }),
  15635. $globals.ClassBuilder);
  15636. $core.addMethod(
  15637. $core.method({
  15638. selector: "copyClass:to:",
  15639. protocol: "copying",
  15640. fn: function (aClass,anotherClass){
  15641. var self=this;
  15642. return $core.withContext(function($ctx1) {
  15643. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15644. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15645. $1=$recv(aClass)._methodDictionary();
  15646. $ctx1.sendIdx["methodDictionary"]=1;
  15647. $recv($1)._valuesDo_((function(each){
  15648. return $core.withContext(function($ctx2) {
  15649. $3=$recv(each)._methodClass();
  15650. $ctx2.sendIdx["methodClass"]=1;
  15651. $2=$recv($3).__eq(aClass);
  15652. $ctx2.sendIdx["="]=1;
  15653. if($core.assert($2)){
  15654. $4=$recv($globals.Compiler)._new();
  15655. $ctx2.sendIdx["new"]=1;
  15656. $5=$recv(each)._source();
  15657. $ctx2.sendIdx["source"]=1;
  15658. $6=$recv(each)._protocol();
  15659. $ctx2.sendIdx["protocol"]=1;
  15660. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15661. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15662. }
  15663. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15664. }));
  15665. $ctx1.sendIdx["valuesDo:"]=1;
  15666. $7=$recv(aClass)._traitComposition();
  15667. $ctx1.sendIdx["traitComposition"]=1;
  15668. $recv(anotherClass)._setTraitComposition_($7);
  15669. $ctx1.sendIdx["setTraitComposition:"]=1;
  15670. $8=$recv(anotherClass)._class();
  15671. $ctx1.sendIdx["class"]=1;
  15672. $10=$recv(aClass)._class();
  15673. $ctx1.sendIdx["class"]=2;
  15674. $9=$recv($10)._instanceVariableNames();
  15675. self._basicClass_instanceVariables_($8,$9);
  15676. $12=$recv(aClass)._class();
  15677. $ctx1.sendIdx["class"]=3;
  15678. $11=$recv($12)._methodDictionary();
  15679. $recv($11)._valuesDo_((function(each){
  15680. return $core.withContext(function($ctx2) {
  15681. $14=$recv(each)._methodClass();
  15682. $15=$recv(aClass)._class();
  15683. $ctx2.sendIdx["class"]=4;
  15684. $13=$recv($14).__eq($15);
  15685. if($core.assert($13)){
  15686. $16=$recv($globals.Compiler)._new();
  15687. $17=$recv(each)._source();
  15688. $18=$recv(anotherClass)._class();
  15689. $ctx2.sendIdx["class"]=5;
  15690. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15691. }
  15692. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15693. }));
  15694. $19=$recv(anotherClass)._class();
  15695. $ctx1.sendIdx["class"]=6;
  15696. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15697. return self;
  15698. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15699. },
  15700. args: ["aClass", "anotherClass"],
  15701. 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",
  15702. referencedClasses: ["Compiler"],
  15703. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15704. }),
  15705. $globals.ClassBuilder);
  15706. $core.addMethod(
  15707. $core.method({
  15708. selector: "installMethod:forClass:protocol:",
  15709. protocol: "method definition",
  15710. fn: function (aCompiledMethod,aBehavior,aString){
  15711. var self=this;
  15712. return $core.withContext(function($ctx1) {
  15713. $recv(aCompiledMethod)._protocol_(aString);
  15714. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15715. return aCompiledMethod;
  15716. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15717. },
  15718. args: ["aCompiledMethod", "aBehavior", "aString"],
  15719. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15720. referencedClasses: [],
  15721. messageSends: ["protocol:", "addCompiledMethod:"]
  15722. }),
  15723. $globals.ClassBuilder);
  15724. $core.addMethod(
  15725. $core.method({
  15726. selector: "instanceVariableNamesFor:",
  15727. protocol: "accessing",
  15728. fn: function (aString){
  15729. var self=this;
  15730. return $core.withContext(function($ctx1) {
  15731. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15732. return $core.withContext(function($ctx2) {
  15733. return $recv(each)._isEmpty();
  15734. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15735. }));
  15736. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15737. },
  15738. args: ["aString"],
  15739. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15740. referencedClasses: [],
  15741. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15742. }),
  15743. $globals.ClassBuilder);
  15744. $core.addMethod(
  15745. $core.method({
  15746. selector: "migrateClass:superclass:",
  15747. protocol: "class migration",
  15748. fn: function (aClass,anotherClass){
  15749. var self=this;
  15750. return $core.withContext(function($ctx1) {
  15751. var $1;
  15752. $1=$recv(aClass)._name();
  15753. $ctx1.sendIdx["name"]=1;
  15754. return self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15755. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15756. },
  15757. args: ["aClass", "anotherClass"],
  15758. 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",
  15759. referencedClasses: [],
  15760. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15761. }),
  15762. $globals.ClassBuilder);
  15763. $core.addMethod(
  15764. $core.method({
  15765. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15766. protocol: "class migration",
  15767. fn: function (className,aClass,aCollection,packageName){
  15768. var self=this;
  15769. var oldClass,newClass,tmp;
  15770. return $core.withContext(function($ctx1) {
  15771. var $1,$2,$4,$3;
  15772. tmp="new*".__comma(className);
  15773. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15774. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15775. self._basicSwapClassNames_with_(oldClass,newClass);
  15776. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15777. $recv((function(){
  15778. return $core.withContext(function($ctx2) {
  15779. return self._copyClass_to_(oldClass,newClass);
  15780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15781. }))._on_do_($globals.Error,(function(exception){
  15782. return $core.withContext(function($ctx2) {
  15783. self._basicSwapClassNames_with_(oldClass,newClass);
  15784. $1=self._basicRemoveClass_(newClass);
  15785. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15786. $1;
  15787. return $recv(exception)._resignal();
  15788. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15789. }));
  15790. self._rawRenameClass_to_(oldClass,tmp);
  15791. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15792. self._rawRenameClass_to_(newClass,className);
  15793. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15794. return $core.withContext(function($ctx2) {
  15795. return self._migrateClass_superclass_(each,newClass);
  15796. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15797. }));
  15798. self._basicRemoveClass_(oldClass);
  15799. $2=$recv($globals.SystemAnnouncer)._current();
  15800. $4=$recv($globals.ClassMigrated)._new();
  15801. $recv($4)._theClass_(newClass);
  15802. $recv($4)._oldClass_(oldClass);
  15803. $3=$recv($4)._yourself();
  15804. $recv($2)._announce_($3);
  15805. return newClass;
  15806. }, 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)});
  15807. },
  15808. args: ["className", "aClass", "aCollection", "packageName"],
  15809. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15810. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15811. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15812. }),
  15813. $globals.ClassBuilder);
  15814. $core.addMethod(
  15815. $core.method({
  15816. selector: "rawRenameClass:to:",
  15817. protocol: "private",
  15818. fn: function (aClass,aString){
  15819. var self=this;
  15820. return $core.withContext(function($ctx1) {
  15821. $globals[aString] = aClass;
  15822. ;
  15823. return self;
  15824. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15825. },
  15826. args: ["aClass", "aString"],
  15827. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15828. referencedClasses: [],
  15829. messageSends: []
  15830. }),
  15831. $globals.ClassBuilder);
  15832. $core.addMethod(
  15833. $core.method({
  15834. selector: "renameClass:to:",
  15835. protocol: "class migration",
  15836. fn: function (aClass,className){
  15837. var self=this;
  15838. return $core.withContext(function($ctx1) {
  15839. var $1,$3,$2;
  15840. self._basicRenameClass_to_(aClass,className);
  15841. $recv(aClass)._recompile();
  15842. $1=$recv($globals.SystemAnnouncer)._current();
  15843. $3=$recv($globals.ClassRenamed)._new();
  15844. $recv($3)._theClass_(aClass);
  15845. $2=$recv($3)._yourself();
  15846. $recv($1)._announce_($2);
  15847. return self;
  15848. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15849. },
  15850. args: ["aClass", "className"],
  15851. 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)",
  15852. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15853. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15854. }),
  15855. $globals.ClassBuilder);
  15856. $core.addMethod(
  15857. $core.method({
  15858. selector: "setupClass:",
  15859. protocol: "public",
  15860. fn: function (aClass){
  15861. var self=this;
  15862. return $core.withContext(function($ctx1) {
  15863. self._deprecatedAPI_("Classes are now auto-inited.");
  15864. return self;
  15865. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  15866. },
  15867. args: ["aClass"],
  15868. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  15869. referencedClasses: [],
  15870. messageSends: ["deprecatedAPI:"]
  15871. }),
  15872. $globals.ClassBuilder);
  15873. $core.addMethod(
  15874. $core.method({
  15875. selector: "superclass:subclass:",
  15876. protocol: "class definition",
  15877. fn: function (aClass,className){
  15878. var self=this;
  15879. return $core.withContext(function($ctx1) {
  15880. return self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15881. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15882. },
  15883. args: ["aClass", "className"],
  15884. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15885. referencedClasses: [],
  15886. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15887. }),
  15888. $globals.ClassBuilder);
  15889. $core.addMethod(
  15890. $core.method({
  15891. selector: "superclass:subclass:instanceVariableNames:package:",
  15892. protocol: "class definition",
  15893. fn: function (aClass,className,ivarNames,packageName){
  15894. var self=this;
  15895. var newClass;
  15896. return $core.withContext(function($ctx1) {
  15897. var $1,$2,$3,$5,$4,$receiver;
  15898. $1=self._instanceVariableNamesFor_(ivarNames);
  15899. if(($receiver = packageName) == null || $receiver.isNil){
  15900. $2="unclassified";
  15901. } else {
  15902. $2=packageName;
  15903. }
  15904. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15905. $3=$recv($globals.SystemAnnouncer)._current();
  15906. $5=$recv($globals.ClassAdded)._new();
  15907. $recv($5)._theClass_(newClass);
  15908. $4=$recv($5)._yourself();
  15909. $recv($3)._announce_($4);
  15910. return newClass;
  15911. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15912. },
  15913. args: ["aClass", "className", "ivarNames", "packageName"],
  15914. 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",
  15915. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15916. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15917. }),
  15918. $globals.ClassBuilder);
  15919. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15920. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15921. $core.addMethod(
  15922. $core.method({
  15923. selector: "getNodesFrom:",
  15924. protocol: "accessing",
  15925. fn: function (aCollection){
  15926. var self=this;
  15927. var children,others;
  15928. return $core.withContext(function($ctx1) {
  15929. var $1;
  15930. children=[];
  15931. others=[];
  15932. $recv(aCollection)._do_((function(each){
  15933. return $core.withContext(function($ctx2) {
  15934. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  15935. if($core.assert($1)){
  15936. return $recv(children)._add_(each);
  15937. $ctx2.sendIdx["add:"]=1;
  15938. } else {
  15939. return $recv(others)._add_(each);
  15940. }
  15941. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15942. }));
  15943. self["@nodes"]=$recv(children)._collect_((function(each){
  15944. return $core.withContext(function($ctx2) {
  15945. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  15946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15947. }));
  15948. return self;
  15949. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15950. },
  15951. args: ["aCollection"],
  15952. 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 ]",
  15953. referencedClasses: ["ClassSorterNode"],
  15954. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15955. }),
  15956. $globals.ClassSorterNode);
  15957. $core.addMethod(
  15958. $core.method({
  15959. selector: "level",
  15960. protocol: "accessing",
  15961. fn: function (){
  15962. var self=this;
  15963. return self["@level"];
  15964. },
  15965. args: [],
  15966. source: "level\x0a\x09^ level",
  15967. referencedClasses: [],
  15968. messageSends: []
  15969. }),
  15970. $globals.ClassSorterNode);
  15971. $core.addMethod(
  15972. $core.method({
  15973. selector: "level:",
  15974. protocol: "accessing",
  15975. fn: function (anInteger){
  15976. var self=this;
  15977. self["@level"]=anInteger;
  15978. return self;
  15979. },
  15980. args: ["anInteger"],
  15981. source: "level: anInteger\x0a\x09level := anInteger",
  15982. referencedClasses: [],
  15983. messageSends: []
  15984. }),
  15985. $globals.ClassSorterNode);
  15986. $core.addMethod(
  15987. $core.method({
  15988. selector: "nodes",
  15989. protocol: "accessing",
  15990. fn: function (){
  15991. var self=this;
  15992. return self["@nodes"];
  15993. },
  15994. args: [],
  15995. source: "nodes\x0a\x09^ nodes",
  15996. referencedClasses: [],
  15997. messageSends: []
  15998. }),
  15999. $globals.ClassSorterNode);
  16000. $core.addMethod(
  16001. $core.method({
  16002. selector: "theClass",
  16003. protocol: "accessing",
  16004. fn: function (){
  16005. var self=this;
  16006. return self["@theClass"];
  16007. },
  16008. args: [],
  16009. source: "theClass\x0a\x09^ theClass",
  16010. referencedClasses: [],
  16011. messageSends: []
  16012. }),
  16013. $globals.ClassSorterNode);
  16014. $core.addMethod(
  16015. $core.method({
  16016. selector: "theClass:",
  16017. protocol: "accessing",
  16018. fn: function (aClass){
  16019. var self=this;
  16020. self["@theClass"]=aClass;
  16021. return self;
  16022. },
  16023. args: ["aClass"],
  16024. source: "theClass: aClass\x0a\x09theClass := aClass",
  16025. referencedClasses: [],
  16026. messageSends: []
  16027. }),
  16028. $globals.ClassSorterNode);
  16029. $core.addMethod(
  16030. $core.method({
  16031. selector: "traverseClassesWith:",
  16032. protocol: "visiting",
  16033. fn: function (aCollection){
  16034. var self=this;
  16035. return $core.withContext(function($ctx1) {
  16036. var $1,$3,$2;
  16037. $1=self._theClass();
  16038. $ctx1.sendIdx["theClass"]=1;
  16039. $recv(aCollection)._add_($1);
  16040. $recv($recv(self._nodes())._sorted_((function(a,b){
  16041. return $core.withContext(function($ctx2) {
  16042. $3=$recv(a)._theClass();
  16043. $ctx2.sendIdx["theClass"]=2;
  16044. $2=$recv($3)._name();
  16045. $ctx2.sendIdx["name"]=1;
  16046. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  16047. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  16048. })))._do_((function(aNode){
  16049. return $core.withContext(function($ctx2) {
  16050. return $recv(aNode)._traverseClassesWith_(aCollection);
  16051. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  16052. }));
  16053. return self;
  16054. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  16055. },
  16056. args: ["aCollection"],
  16057. 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 ].",
  16058. referencedClasses: [],
  16059. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  16060. }),
  16061. $globals.ClassSorterNode);
  16062. $core.addMethod(
  16063. $core.method({
  16064. selector: "on:classes:level:",
  16065. protocol: "instance creation",
  16066. fn: function (aClass,aCollection,anInteger){
  16067. var self=this;
  16068. return $core.withContext(function($ctx1) {
  16069. var $1;
  16070. $1=self._new();
  16071. $recv($1)._theClass_(aClass);
  16072. $recv($1)._level_(anInteger);
  16073. $recv($1)._getNodesFrom_(aCollection);
  16074. return $recv($1)._yourself();
  16075. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  16076. },
  16077. args: ["aClass", "aCollection", "anInteger"],
  16078. 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",
  16079. referencedClasses: [],
  16080. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  16081. }),
  16082. $globals.ClassSorterNode.klass);
  16083. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  16084. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  16085. $core.addMethod(
  16086. $core.method({
  16087. selector: "-",
  16088. protocol: "composition",
  16089. fn: function (anArray){
  16090. var self=this;
  16091. return $core.withContext(function($ctx1) {
  16092. var $1;
  16093. $1=self._copy();
  16094. $recv($1)._addExclusions_(anArray);
  16095. return $recv($1)._yourself();
  16096. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  16097. },
  16098. args: ["anArray"],
  16099. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  16100. referencedClasses: [],
  16101. messageSends: ["addExclusions:", "copy", "yourself"]
  16102. }),
  16103. $globals.TraitTransformation);
  16104. $core.addMethod(
  16105. $core.method({
  16106. selector: "@",
  16107. protocol: "composition",
  16108. fn: function (anArrayOfAssociations){
  16109. var self=this;
  16110. return $core.withContext(function($ctx1) {
  16111. var $1;
  16112. $1=self._copy();
  16113. $recv($1)._addAliases_(anArrayOfAssociations);
  16114. return $recv($1)._yourself();
  16115. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  16116. },
  16117. args: ["anArrayOfAssociations"],
  16118. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  16119. referencedClasses: [],
  16120. messageSends: ["addAliases:", "copy", "yourself"]
  16121. }),
  16122. $globals.TraitTransformation);
  16123. $core.addMethod(
  16124. $core.method({
  16125. selector: "addAliases:",
  16126. protocol: "accessing",
  16127. fn: function (anArrayOfAssociations){
  16128. var self=this;
  16129. return $core.withContext(function($ctx1) {
  16130. $recv(anArrayOfAssociations)._do_((function(each){
  16131. var key;
  16132. return $core.withContext(function($ctx2) {
  16133. key=$recv(each)._key();
  16134. key;
  16135. return $recv(self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  16136. return $core.withContext(function($ctx3) {
  16137. return self._error_("Cannot use same alias name twice.");
  16138. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16139. }),(function(){
  16140. return $core.withContext(function($ctx3) {
  16141. return $recv(self["@aliases"])._at_put_(key,$recv(each)._value());
  16142. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  16143. }));
  16144. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  16145. }));
  16146. return anArrayOfAssociations;
  16147. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  16148. },
  16149. args: ["anArrayOfAssociations"],
  16150. 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",
  16151. referencedClasses: [],
  16152. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  16153. }),
  16154. $globals.TraitTransformation);
  16155. $core.addMethod(
  16156. $core.method({
  16157. selector: "addExclusions:",
  16158. protocol: "accessing",
  16159. fn: function (anArray){
  16160. var self=this;
  16161. return $core.withContext(function($ctx1) {
  16162. $recv(self["@exclusions"])._addAll_(anArray);
  16163. return anArray;
  16164. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  16165. },
  16166. args: ["anArray"],
  16167. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  16168. referencedClasses: [],
  16169. messageSends: ["addAll:"]
  16170. }),
  16171. $globals.TraitTransformation);
  16172. $core.addMethod(
  16173. $core.method({
  16174. selector: "aliases",
  16175. protocol: "accessing",
  16176. fn: function (){
  16177. var self=this;
  16178. return self["@aliases"];
  16179. },
  16180. args: [],
  16181. source: "aliases\x0a\x09^ aliases",
  16182. referencedClasses: [],
  16183. messageSends: []
  16184. }),
  16185. $globals.TraitTransformation);
  16186. $core.addMethod(
  16187. $core.method({
  16188. selector: "asJavaScriptObject",
  16189. protocol: "converting",
  16190. fn: function (){
  16191. var self=this;
  16192. return $core.withContext(function($ctx1) {
  16193. return $globals.HashedCollection._newFromPairs_(["trait",self._trait(),"aliases",self._aliases(),"exclusions",$recv($recv(self._exclusions())._asArray())._sorted()]);
  16194. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  16195. },
  16196. args: [],
  16197. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  16198. referencedClasses: [],
  16199. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  16200. }),
  16201. $globals.TraitTransformation);
  16202. $core.addMethod(
  16203. $core.method({
  16204. selector: "asJavaScriptSource",
  16205. protocol: "converting",
  16206. fn: function (){
  16207. var self=this;
  16208. return $core.withContext(function($ctx1) {
  16209. var $2,$3,$1;
  16210. return $recv($globals.String)._streamContents_((function(str){
  16211. return $core.withContext(function($ctx2) {
  16212. $2=$recv(self._trait())._asJavaScriptSource();
  16213. $ctx2.sendIdx["asJavaScriptSource"]=1;
  16214. $3=$recv(self._aliases())._ifNotEmpty_((function(al){
  16215. return $core.withContext(function($ctx3) {
  16216. return [", aliases: ",$recv(al)._asJSONString()];
  16217. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  16218. }));
  16219. $ctx2.sendIdx["ifNotEmpty:"]=1;
  16220. $1=["{trait: ",$2,$3,$recv(self._exclusions())._ifNotEmpty_((function(ex){
  16221. return $core.withContext(function($ctx3) {
  16222. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  16223. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  16224. })),"}"];
  16225. return $recv(str)._write_($1);
  16226. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  16227. }));
  16228. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  16229. },
  16230. args: [],
  16231. 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'}' } ]",
  16232. referencedClasses: ["String"],
  16233. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  16234. }),
  16235. $globals.TraitTransformation);
  16236. $core.addMethod(
  16237. $core.method({
  16238. selector: "asTraitComposition",
  16239. protocol: "converting",
  16240. fn: function (){
  16241. var self=this;
  16242. return [self];
  16243. },
  16244. args: [],
  16245. source: "asTraitComposition\x0a\x09^ { self }",
  16246. referencedClasses: [],
  16247. messageSends: []
  16248. }),
  16249. $globals.TraitTransformation);
  16250. $core.addMethod(
  16251. $core.method({
  16252. selector: "asTraitTransformation",
  16253. protocol: "converting",
  16254. fn: function (){
  16255. var self=this;
  16256. return self;
  16257. },
  16258. args: [],
  16259. source: "asTraitTransformation\x0a\x09^ self",
  16260. referencedClasses: [],
  16261. messageSends: []
  16262. }),
  16263. $globals.TraitTransformation);
  16264. $core.addMethod(
  16265. $core.method({
  16266. selector: "definition",
  16267. protocol: "accessing",
  16268. fn: function (){
  16269. var self=this;
  16270. return $core.withContext(function($ctx1) {
  16271. return $recv($globals.String)._streamContents_((function(str){
  16272. return $core.withContext(function($ctx2) {
  16273. $recv(str)._print_(self._trait());
  16274. $recv(self._aliases())._ifNotEmpty_((function(al){
  16275. return $core.withContext(function($ctx3) {
  16276. $recv(str)._write_(" @ {");
  16277. $ctx3.sendIdx["write:"]=1;
  16278. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  16279. return $core.withContext(function($ctx4) {
  16280. $recv(str)._printSymbol_($recv(each)._key());
  16281. $ctx4.sendIdx["printSymbol:"]=1;
  16282. $recv(str)._write_(" -> ");
  16283. $ctx4.sendIdx["write:"]=2;
  16284. return $recv(str)._printSymbol_($recv(each)._value());
  16285. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16286. }),(function(){
  16287. return $core.withContext(function($ctx4) {
  16288. return $recv(str)._write_(". ");
  16289. $ctx4.sendIdx["write:"]=3;
  16290. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16291. }));
  16292. $ctx3.sendIdx["do:separatedBy:"]=1;
  16293. return $recv(str)._write_("}");
  16294. $ctx3.sendIdx["write:"]=4;
  16295. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  16296. }));
  16297. $ctx2.sendIdx["ifNotEmpty:"]=1;
  16298. return $recv(self._exclusions())._ifNotEmpty_((function(ex){
  16299. return $core.withContext(function($ctx3) {
  16300. $recv(str)._write_(" - #(");
  16301. $ctx3.sendIdx["write:"]=5;
  16302. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  16303. return $core.withContext(function($ctx4) {
  16304. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  16305. $ctx4.sendIdx["write:"]=6;
  16306. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  16307. }),(function(){
  16308. return $core.withContext(function($ctx4) {
  16309. return $recv(str)._space();
  16310. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  16311. }));
  16312. return $recv(str)._write_(")");
  16313. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  16314. }));
  16315. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  16316. }));
  16317. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  16318. },
  16319. args: [],
  16320. 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: ')' ] ]",
  16321. referencedClasses: ["String"],
  16322. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  16323. }),
  16324. $globals.TraitTransformation);
  16325. $core.addMethod(
  16326. $core.method({
  16327. selector: "exclusions",
  16328. protocol: "accessing",
  16329. fn: function (){
  16330. var self=this;
  16331. return self["@exclusions"];
  16332. },
  16333. args: [],
  16334. source: "exclusions\x0a\x09^ exclusions",
  16335. referencedClasses: [],
  16336. messageSends: []
  16337. }),
  16338. $globals.TraitTransformation);
  16339. $core.addMethod(
  16340. $core.method({
  16341. selector: "initialize",
  16342. protocol: "initialization",
  16343. fn: function (){
  16344. var self=this;
  16345. return $core.withContext(function($ctx1) {
  16346. (
  16347. $ctx1.supercall = true,
  16348. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  16349. $ctx1.supercall = false;
  16350. self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  16351. self["@exclusions"]=$recv($globals.Set)._new();
  16352. self["@trait"]=nil;
  16353. return self;
  16354. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  16355. },
  16356. args: [],
  16357. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  16358. referencedClasses: ["Set"],
  16359. messageSends: ["initialize", "new"]
  16360. }),
  16361. $globals.TraitTransformation);
  16362. $core.addMethod(
  16363. $core.method({
  16364. selector: "postCopy",
  16365. protocol: "copying",
  16366. fn: function (){
  16367. var self=this;
  16368. return $core.withContext(function($ctx1) {
  16369. self["@aliases"]=$recv(self["@aliases"])._copy();
  16370. $ctx1.sendIdx["copy"]=1;
  16371. self["@exclusions"]=$recv(self["@exclusions"])._copy();
  16372. return self;
  16373. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  16374. },
  16375. args: [],
  16376. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  16377. referencedClasses: [],
  16378. messageSends: ["copy"]
  16379. }),
  16380. $globals.TraitTransformation);
  16381. $core.addMethod(
  16382. $core.method({
  16383. selector: "trait",
  16384. protocol: "accessing",
  16385. fn: function (){
  16386. var self=this;
  16387. return self["@trait"];
  16388. },
  16389. args: [],
  16390. source: "trait\x0a\x09^ trait",
  16391. referencedClasses: [],
  16392. messageSends: []
  16393. }),
  16394. $globals.TraitTransformation);
  16395. $core.addMethod(
  16396. $core.method({
  16397. selector: "trait:",
  16398. protocol: "accessing",
  16399. fn: function (anObject){
  16400. var self=this;
  16401. self["@trait"]=anObject;
  16402. return self;
  16403. },
  16404. args: ["anObject"],
  16405. source: "trait: anObject\x0a\x09trait := anObject",
  16406. referencedClasses: [],
  16407. messageSends: []
  16408. }),
  16409. $globals.TraitTransformation);
  16410. $core.addMethod(
  16411. $core.method({
  16412. selector: "fromJSON:",
  16413. protocol: "instance creation",
  16414. fn: function (aJSObject){
  16415. var self=this;
  16416. return $core.withContext(function($ctx1) {
  16417. var $1,$4,$3,$2;
  16418. $1=(
  16419. $ctx1.supercall = true,
  16420. ($globals.TraitTransformation.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  16421. $ctx1.supercall = false;
  16422. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  16423. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  16424. return $globals.HashedCollection._newFromPairs_([]);
  16425. }));
  16426. $ctx1.sendIdx["at:ifAbsent:"]=1;
  16427. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  16428. $2=$recv($3)._associations();
  16429. $recv($1)._addAliases_($2);
  16430. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  16431. return [];
  16432. })));
  16433. return $recv($1)._yourself();
  16434. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.klass)});
  16435. },
  16436. args: ["aJSObject"],
  16437. 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",
  16438. referencedClasses: ["Smalltalk"],
  16439. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  16440. }),
  16441. $globals.TraitTransformation.klass);
  16442. $core.addMethod(
  16443. $core.method({
  16444. selector: "on:",
  16445. protocol: "instance creation",
  16446. fn: function (aTrait){
  16447. var self=this;
  16448. return $core.withContext(function($ctx1) {
  16449. var $1;
  16450. $1=(
  16451. $ctx1.supercall = true,
  16452. ($globals.TraitTransformation.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  16453. $ctx1.supercall = false;
  16454. $recv($1)._trait_(aTrait);
  16455. return $recv($1)._yourself();
  16456. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.klass)});
  16457. },
  16458. args: ["aTrait"],
  16459. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  16460. referencedClasses: [],
  16461. messageSends: ["trait:", "new", "yourself"]
  16462. }),
  16463. $globals.TraitTransformation.klass);
  16464. $core.addMethod(
  16465. $core.method({
  16466. selector: "asTraitComposition",
  16467. protocol: "*Kernel-Classes",
  16468. fn: function (){
  16469. var self=this;
  16470. return $core.withContext(function($ctx1) {
  16471. return self._collect_((function(each){
  16472. return $core.withContext(function($ctx2) {
  16473. return $recv(each)._asTraitTransformation();
  16474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16475. }));
  16476. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  16477. },
  16478. args: [],
  16479. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  16480. referencedClasses: [],
  16481. messageSends: ["collect:", "asTraitTransformation"]
  16482. }),
  16483. $globals.Array);
  16484. $core.addMethod(
  16485. $core.method({
  16486. selector: "subclass:",
  16487. protocol: "*Kernel-Classes",
  16488. fn: function (aString){
  16489. var self=this;
  16490. return $core.withContext(function($ctx1) {
  16491. return self._subclass_instanceVariableNames_package_(aString,"",nil);
  16492. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.UndefinedObject)});
  16493. },
  16494. args: ["aString"],
  16495. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  16496. referencedClasses: [],
  16497. messageSends: ["subclass:instanceVariableNames:package:"]
  16498. }),
  16499. $globals.UndefinedObject);
  16500. $core.addMethod(
  16501. $core.method({
  16502. selector: "subclass:instanceVariableNames:",
  16503. protocol: "*Kernel-Classes",
  16504. fn: function (aString,anotherString){
  16505. var self=this;
  16506. return $core.withContext(function($ctx1) {
  16507. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  16508. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  16509. },
  16510. args: ["aString", "anotherString"],
  16511. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  16512. referencedClasses: [],
  16513. messageSends: ["subclass:instanceVariableNames:package:"]
  16514. }),
  16515. $globals.UndefinedObject);
  16516. $core.addMethod(
  16517. $core.method({
  16518. selector: "subclass:instanceVariableNames:category:",
  16519. protocol: "*Kernel-Classes",
  16520. fn: function (aString,aString2,aString3){
  16521. var self=this;
  16522. return $core.withContext(function($ctx1) {
  16523. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  16524. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  16525. },
  16526. args: ["aString", "aString2", "aString3"],
  16527. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  16528. referencedClasses: [],
  16529. messageSends: ["subclass:instanceVariableNames:package:"]
  16530. }),
  16531. $globals.UndefinedObject);
  16532. $core.addMethod(
  16533. $core.method({
  16534. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  16535. protocol: "*Kernel-Classes",
  16536. fn: function (aString,aString2,classVars,pools,aString3){
  16537. var self=this;
  16538. return $core.withContext(function($ctx1) {
  16539. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  16540. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  16541. },
  16542. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  16543. 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",
  16544. referencedClasses: [],
  16545. messageSends: ["subclass:instanceVariableNames:package:"]
  16546. }),
  16547. $globals.UndefinedObject);
  16548. $core.addMethod(
  16549. $core.method({
  16550. selector: "subclass:instanceVariableNames:package:",
  16551. protocol: "*Kernel-Classes",
  16552. fn: function (aString,aString2,aString3){
  16553. var self=this;
  16554. return $core.withContext(function($ctx1) {
  16555. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  16556. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  16557. },
  16558. args: ["aString", "aString2", "aString3"],
  16559. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  16560. referencedClasses: ["ClassBuilder"],
  16561. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  16562. }),
  16563. $globals.UndefinedObject);
  16564. $core.addMethod(
  16565. $core.method({
  16566. selector: "subclass:uses:",
  16567. protocol: "*Kernel-Classes",
  16568. fn: function (aString,aTraitCompositionDescription){
  16569. var self=this;
  16570. return $core.withContext(function($ctx1) {
  16571. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  16572. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.UndefinedObject)});
  16573. },
  16574. args: ["aString", "aTraitCompositionDescription"],
  16575. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  16576. referencedClasses: [],
  16577. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  16578. }),
  16579. $globals.UndefinedObject);
  16580. $core.addMethod(
  16581. $core.method({
  16582. selector: "subclass:uses:instanceVariableNames:",
  16583. protocol: "*Kernel-Classes",
  16584. fn: function (aString,aTraitCompositionDescription,anotherString){
  16585. var self=this;
  16586. return $core.withContext(function($ctx1) {
  16587. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  16588. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.UndefinedObject)});
  16589. },
  16590. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  16591. 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",
  16592. referencedClasses: [],
  16593. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  16594. }),
  16595. $globals.UndefinedObject);
  16596. $core.addMethod(
  16597. $core.method({
  16598. selector: "subclass:uses:instanceVariableNames:category:",
  16599. protocol: "*Kernel-Classes",
  16600. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  16601. var self=this;
  16602. return $core.withContext(function($ctx1) {
  16603. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  16604. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  16605. },
  16606. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  16607. 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",
  16608. referencedClasses: [],
  16609. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  16610. }),
  16611. $globals.UndefinedObject);
  16612. $core.addMethod(
  16613. $core.method({
  16614. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  16615. protocol: "*Kernel-Classes",
  16616. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  16617. var self=this;
  16618. return $core.withContext(function($ctx1) {
  16619. return self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  16620. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  16621. },
  16622. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  16623. 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",
  16624. referencedClasses: [],
  16625. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  16626. }),
  16627. $globals.UndefinedObject);
  16628. $core.addMethod(
  16629. $core.method({
  16630. selector: "subclass:uses:instanceVariableNames:package:",
  16631. protocol: "*Kernel-Classes",
  16632. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  16633. var self=this;
  16634. var cls;
  16635. return $core.withContext(function($ctx1) {
  16636. cls=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  16637. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  16638. return cls;
  16639. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.UndefinedObject)});
  16640. },
  16641. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  16642. 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",
  16643. referencedClasses: [],
  16644. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  16645. }),
  16646. $globals.UndefinedObject);
  16647. });
  16648. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  16649. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  16650. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  16651. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  16652. $core.addPackage("Kernel-Methods");
  16653. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  16654. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  16655. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  16656. $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 | ... ] `";
  16657. $core.addMethod(
  16658. $core.method({
  16659. selector: "applyTo:arguments:",
  16660. protocol: "evaluating",
  16661. fn: function (anObject,aCollection){
  16662. var self=this;
  16663. return $core.withContext(function($ctx1) {
  16664. return self.apply(anObject, aCollection);
  16665. return self;
  16666. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  16667. },
  16668. args: ["anObject", "aCollection"],
  16669. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  16670. referencedClasses: [],
  16671. messageSends: []
  16672. }),
  16673. $globals.BlockClosure);
  16674. $core.addMethod(
  16675. $core.method({
  16676. selector: "asCompiledMethod:",
  16677. protocol: "converting",
  16678. fn: function (aString){
  16679. var self=this;
  16680. return $core.withContext(function($ctx1) {
  16681. return $core.method({selector:aString, fn:self});;
  16682. return self;
  16683. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  16684. },
  16685. args: ["aString"],
  16686. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  16687. referencedClasses: [],
  16688. messageSends: []
  16689. }),
  16690. $globals.BlockClosure);
  16691. $core.addMethod(
  16692. $core.method({
  16693. selector: "compiledSource",
  16694. protocol: "accessing",
  16695. fn: function (){
  16696. var self=this;
  16697. return $core.withContext(function($ctx1) {
  16698. return self.toString();
  16699. return self;
  16700. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  16701. },
  16702. args: [],
  16703. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  16704. referencedClasses: [],
  16705. messageSends: []
  16706. }),
  16707. $globals.BlockClosure);
  16708. $core.addMethod(
  16709. $core.method({
  16710. selector: "currySelf",
  16711. protocol: "converting",
  16712. fn: function (){
  16713. var self=this;
  16714. return $core.withContext(function($ctx1) {
  16715. return function () {
  16716. var args = [ this ];
  16717. args.push.apply(args, arguments);
  16718. return self.apply(null, args);
  16719. }
  16720. ;
  16721. return self;
  16722. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  16723. },
  16724. args: [],
  16725. 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'>",
  16726. referencedClasses: [],
  16727. messageSends: []
  16728. }),
  16729. $globals.BlockClosure);
  16730. $core.addMethod(
  16731. $core.method({
  16732. selector: "ensure:",
  16733. protocol: "evaluating",
  16734. fn: function (aBlock){
  16735. var self=this;
  16736. return $core.withContext(function($ctx1) {
  16737. try{return self._value()}finally{aBlock._value()};
  16738. return self;
  16739. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  16740. },
  16741. args: ["aBlock"],
  16742. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return self._value()}finally{aBlock._value()}'>",
  16743. referencedClasses: [],
  16744. messageSends: []
  16745. }),
  16746. $globals.BlockClosure);
  16747. $core.addMethod(
  16748. $core.method({
  16749. selector: "fork",
  16750. protocol: "timeout/interval",
  16751. fn: function (){
  16752. var self=this;
  16753. return $core.withContext(function($ctx1) {
  16754. $recv($recv($globals.ForkPool)._default())._fork_(self);
  16755. return self;
  16756. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  16757. },
  16758. args: [],
  16759. source: "fork\x0a\x09ForkPool default fork: self",
  16760. referencedClasses: ["ForkPool"],
  16761. messageSends: ["fork:", "default"]
  16762. }),
  16763. $globals.BlockClosure);
  16764. $core.addMethod(
  16765. $core.method({
  16766. selector: "new",
  16767. protocol: "evaluating",
  16768. fn: function (){
  16769. var self=this;
  16770. return $core.withContext(function($ctx1) {
  16771. return new self();
  16772. return self;
  16773. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  16774. },
  16775. args: [],
  16776. 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()'>",
  16777. referencedClasses: [],
  16778. messageSends: []
  16779. }),
  16780. $globals.BlockClosure);
  16781. $core.addMethod(
  16782. $core.method({
  16783. selector: "newValue:",
  16784. protocol: "evaluating",
  16785. fn: function (anObject){
  16786. var self=this;
  16787. return $core.withContext(function($ctx1) {
  16788. return self._newWithValues_([anObject]);
  16789. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  16790. },
  16791. args: ["anObject"],
  16792. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  16793. referencedClasses: [],
  16794. messageSends: ["newWithValues:"]
  16795. }),
  16796. $globals.BlockClosure);
  16797. $core.addMethod(
  16798. $core.method({
  16799. selector: "newValue:value:",
  16800. protocol: "evaluating",
  16801. fn: function (anObject,anObject2){
  16802. var self=this;
  16803. return $core.withContext(function($ctx1) {
  16804. return self._newWithValues_([anObject,anObject2]);
  16805. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  16806. },
  16807. args: ["anObject", "anObject2"],
  16808. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  16809. referencedClasses: [],
  16810. messageSends: ["newWithValues:"]
  16811. }),
  16812. $globals.BlockClosure);
  16813. $core.addMethod(
  16814. $core.method({
  16815. selector: "newValue:value:value:",
  16816. protocol: "evaluating",
  16817. fn: function (anObject,anObject2,anObject3){
  16818. var self=this;
  16819. return $core.withContext(function($ctx1) {
  16820. return self._newWithValues_([anObject,anObject2,anObject3]);
  16821. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  16822. },
  16823. args: ["anObject", "anObject2", "anObject3"],
  16824. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  16825. referencedClasses: [],
  16826. messageSends: ["newWithValues:"]
  16827. }),
  16828. $globals.BlockClosure);
  16829. $core.addMethod(
  16830. $core.method({
  16831. selector: "newWithValues:",
  16832. protocol: "evaluating",
  16833. fn: function (aCollection){
  16834. var self=this;
  16835. return $core.withContext(function($ctx1) {
  16836. var object = Object.create(self.prototype);
  16837. var result = self.apply(object, aCollection);
  16838. return typeof result === "object" ? result : object;
  16839. ;
  16840. return self;
  16841. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  16842. },
  16843. args: ["aCollection"],
  16844. 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'>",
  16845. referencedClasses: [],
  16846. messageSends: []
  16847. }),
  16848. $globals.BlockClosure);
  16849. $core.addMethod(
  16850. $core.method({
  16851. selector: "numArgs",
  16852. protocol: "accessing",
  16853. fn: function (){
  16854. var self=this;
  16855. return $core.withContext(function($ctx1) {
  16856. return self.length;
  16857. return self;
  16858. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  16859. },
  16860. args: [],
  16861. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  16862. referencedClasses: [],
  16863. messageSends: []
  16864. }),
  16865. $globals.BlockClosure);
  16866. $core.addMethod(
  16867. $core.method({
  16868. selector: "on:do:",
  16869. protocol: "error handling",
  16870. fn: function (anErrorClass,aBlock){
  16871. var self=this;
  16872. return $core.withContext(function($ctx1) {
  16873. var $1;
  16874. return self._tryCatch_((function(error){
  16875. var smalltalkError;
  16876. return $core.withContext(function($ctx2) {
  16877. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  16878. smalltalkError;
  16879. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  16880. if($core.assert($1)){
  16881. return $recv(aBlock)._value_(smalltalkError);
  16882. } else {
  16883. return $recv(smalltalkError)._resignal();
  16884. }
  16885. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  16886. }));
  16887. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  16888. },
  16889. args: ["anErrorClass", "aBlock"],
  16890. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  16891. referencedClasses: ["Smalltalk"],
  16892. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  16893. }),
  16894. $globals.BlockClosure);
  16895. $core.addMethod(
  16896. $core.method({
  16897. selector: "receiver",
  16898. protocol: "accessing",
  16899. fn: function (){
  16900. var self=this;
  16901. return nil;
  16902. },
  16903. args: [],
  16904. source: "receiver\x0a\x09^ nil",
  16905. referencedClasses: [],
  16906. messageSends: []
  16907. }),
  16908. $globals.BlockClosure);
  16909. $core.addMethod(
  16910. $core.method({
  16911. selector: "timeToRun",
  16912. protocol: "evaluating",
  16913. fn: function (){
  16914. var self=this;
  16915. return $core.withContext(function($ctx1) {
  16916. return $recv($globals.Date)._millisecondsToRun_(self);
  16917. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  16918. },
  16919. args: [],
  16920. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  16921. referencedClasses: ["Date"],
  16922. messageSends: ["millisecondsToRun:"]
  16923. }),
  16924. $globals.BlockClosure);
  16925. $core.addMethod(
  16926. $core.method({
  16927. selector: "tryCatch:",
  16928. protocol: "error handling",
  16929. fn: function (aBlock){
  16930. var self=this;
  16931. return $core.withContext(function($ctx1) {
  16932. try {
  16933. return self._value();
  16934. } catch(error) {
  16935. // pass non-local returns undetected
  16936. if (Array.isArray(error) && error.length === 1) throw error;
  16937. return aBlock._value_(error);
  16938. }
  16939. ;
  16940. return self;
  16941. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  16942. },
  16943. args: ["aBlock"],
  16944. 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'>",
  16945. referencedClasses: [],
  16946. messageSends: []
  16947. }),
  16948. $globals.BlockClosure);
  16949. $core.addMethod(
  16950. $core.method({
  16951. selector: "value",
  16952. protocol: "evaluating",
  16953. fn: function (){
  16954. var self=this;
  16955. return $core.withContext(function($ctx1) {
  16956. return self();;
  16957. return self;
  16958. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  16959. },
  16960. args: [],
  16961. source: "value\x0a\x09<inlineJS: 'return self();'>",
  16962. referencedClasses: [],
  16963. messageSends: []
  16964. }),
  16965. $globals.BlockClosure);
  16966. $core.addMethod(
  16967. $core.method({
  16968. selector: "value:",
  16969. protocol: "evaluating",
  16970. fn: function (anArg){
  16971. var self=this;
  16972. return $core.withContext(function($ctx1) {
  16973. return self(anArg);;
  16974. return self;
  16975. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  16976. },
  16977. args: ["anArg"],
  16978. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  16979. referencedClasses: [],
  16980. messageSends: []
  16981. }),
  16982. $globals.BlockClosure);
  16983. $core.addMethod(
  16984. $core.method({
  16985. selector: "value:value:",
  16986. protocol: "evaluating",
  16987. fn: function (firstArg,secondArg){
  16988. var self=this;
  16989. return $core.withContext(function($ctx1) {
  16990. return self(firstArg, secondArg);;
  16991. return self;
  16992. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  16993. },
  16994. args: ["firstArg", "secondArg"],
  16995. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  16996. referencedClasses: [],
  16997. messageSends: []
  16998. }),
  16999. $globals.BlockClosure);
  17000. $core.addMethod(
  17001. $core.method({
  17002. selector: "value:value:value:",
  17003. protocol: "evaluating",
  17004. fn: function (firstArg,secondArg,thirdArg){
  17005. var self=this;
  17006. return $core.withContext(function($ctx1) {
  17007. return self(firstArg, secondArg, thirdArg);;
  17008. return self;
  17009. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17010. },
  17011. args: ["firstArg", "secondArg", "thirdArg"],
  17012. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17013. referencedClasses: [],
  17014. messageSends: []
  17015. }),
  17016. $globals.BlockClosure);
  17017. $core.addMethod(
  17018. $core.method({
  17019. selector: "valueWithInterval:",
  17020. protocol: "timeout/interval",
  17021. fn: function (aNumber){
  17022. var self=this;
  17023. return $core.withContext(function($ctx1) {
  17024. var interval = setInterval(self, aNumber);
  17025. return $globals.Timeout._on_(interval);
  17026. ;
  17027. return self;
  17028. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17029. },
  17030. args: ["aNumber"],
  17031. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17032. referencedClasses: [],
  17033. messageSends: []
  17034. }),
  17035. $globals.BlockClosure);
  17036. $core.addMethod(
  17037. $core.method({
  17038. selector: "valueWithPossibleArguments:",
  17039. protocol: "evaluating",
  17040. fn: function (aCollection){
  17041. var self=this;
  17042. return $core.withContext(function($ctx1) {
  17043. return self.apply(null, aCollection);;
  17044. return self;
  17045. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17046. },
  17047. args: ["aCollection"],
  17048. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17049. referencedClasses: [],
  17050. messageSends: []
  17051. }),
  17052. $globals.BlockClosure);
  17053. $core.addMethod(
  17054. $core.method({
  17055. selector: "valueWithTimeout:",
  17056. protocol: "timeout/interval",
  17057. fn: function (aNumber){
  17058. var self=this;
  17059. return $core.withContext(function($ctx1) {
  17060. var timeout = setTimeout(self, aNumber);
  17061. return $globals.Timeout._on_(timeout);
  17062. ;
  17063. return self;
  17064. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17065. },
  17066. args: ["aNumber"],
  17067. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17068. referencedClasses: [],
  17069. messageSends: []
  17070. }),
  17071. $globals.BlockClosure);
  17072. $core.addMethod(
  17073. $core.method({
  17074. selector: "whileFalse",
  17075. protocol: "controlling",
  17076. fn: function (){
  17077. var self=this;
  17078. return $core.withContext(function($ctx1) {
  17079. self._whileFalse_((function(){
  17080. }));
  17081. return self;
  17082. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17083. },
  17084. args: [],
  17085. source: "whileFalse\x0a\x09self whileFalse: []",
  17086. referencedClasses: [],
  17087. messageSends: ["whileFalse:"]
  17088. }),
  17089. $globals.BlockClosure);
  17090. $core.addMethod(
  17091. $core.method({
  17092. selector: "whileFalse:",
  17093. protocol: "controlling",
  17094. fn: function (aBlock){
  17095. var self=this;
  17096. return $core.withContext(function($ctx1) {
  17097. while(!$core.assert(self._value())) {aBlock._value()};
  17098. return self;
  17099. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17100. },
  17101. args: ["aBlock"],
  17102. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert(self._value())) {aBlock._value()}'>",
  17103. referencedClasses: [],
  17104. messageSends: []
  17105. }),
  17106. $globals.BlockClosure);
  17107. $core.addMethod(
  17108. $core.method({
  17109. selector: "whileTrue",
  17110. protocol: "controlling",
  17111. fn: function (){
  17112. var self=this;
  17113. return $core.withContext(function($ctx1) {
  17114. self._whileTrue_((function(){
  17115. }));
  17116. return self;
  17117. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17118. },
  17119. args: [],
  17120. source: "whileTrue\x0a\x09self whileTrue: []",
  17121. referencedClasses: [],
  17122. messageSends: ["whileTrue:"]
  17123. }),
  17124. $globals.BlockClosure);
  17125. $core.addMethod(
  17126. $core.method({
  17127. selector: "whileTrue:",
  17128. protocol: "controlling",
  17129. fn: function (aBlock){
  17130. var self=this;
  17131. return $core.withContext(function($ctx1) {
  17132. while($core.assert(self._value())) {aBlock._value()};
  17133. return self;
  17134. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  17135. },
  17136. args: ["aBlock"],
  17137. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert(self._value())) {aBlock._value()}'>",
  17138. referencedClasses: [],
  17139. messageSends: []
  17140. }),
  17141. $globals.BlockClosure);
  17142. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  17143. $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";
  17144. $core.addMethod(
  17145. $core.method({
  17146. selector: "arguments",
  17147. protocol: "accessing",
  17148. fn: function (){
  17149. var self=this;
  17150. return $core.withContext(function($ctx1) {
  17151. return self.args || [];
  17152. return self;
  17153. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  17154. },
  17155. args: [],
  17156. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  17157. referencedClasses: [],
  17158. messageSends: []
  17159. }),
  17160. $globals.CompiledMethod);
  17161. $core.addMethod(
  17162. $core.method({
  17163. selector: "browse",
  17164. protocol: "browsing",
  17165. fn: function (){
  17166. var self=this;
  17167. return $core.withContext(function($ctx1) {
  17168. $recv($globals.Finder)._findMethod_(self);
  17169. return self;
  17170. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  17171. },
  17172. args: [],
  17173. source: "browse\x0a\x09Finder findMethod: self",
  17174. referencedClasses: ["Finder"],
  17175. messageSends: ["findMethod:"]
  17176. }),
  17177. $globals.CompiledMethod);
  17178. $core.addMethod(
  17179. $core.method({
  17180. selector: "category",
  17181. protocol: "accessing",
  17182. fn: function (){
  17183. var self=this;
  17184. return $core.withContext(function($ctx1) {
  17185. return self._protocol();
  17186. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  17187. },
  17188. args: [],
  17189. source: "category\x0a\x09^ self protocol",
  17190. referencedClasses: [],
  17191. messageSends: ["protocol"]
  17192. }),
  17193. $globals.CompiledMethod);
  17194. $core.addMethod(
  17195. $core.method({
  17196. selector: "defaultProtocol",
  17197. protocol: "defaults",
  17198. fn: function (){
  17199. var self=this;
  17200. return "as yet unclassified";
  17201. },
  17202. args: [],
  17203. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  17204. referencedClasses: [],
  17205. messageSends: []
  17206. }),
  17207. $globals.CompiledMethod);
  17208. $core.addMethod(
  17209. $core.method({
  17210. selector: "fn",
  17211. protocol: "accessing",
  17212. fn: function (){
  17213. var self=this;
  17214. return $core.withContext(function($ctx1) {
  17215. return self._basicAt_("fn");
  17216. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  17217. },
  17218. args: [],
  17219. source: "fn\x0a\x09^ self basicAt: 'fn'",
  17220. referencedClasses: [],
  17221. messageSends: ["basicAt:"]
  17222. }),
  17223. $globals.CompiledMethod);
  17224. $core.addMethod(
  17225. $core.method({
  17226. selector: "fn:",
  17227. protocol: "accessing",
  17228. fn: function (aBlock){
  17229. var self=this;
  17230. return $core.withContext(function($ctx1) {
  17231. self._basicAt_put_("fn",aBlock);
  17232. return self;
  17233. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  17234. },
  17235. args: ["aBlock"],
  17236. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  17237. referencedClasses: [],
  17238. messageSends: ["basicAt:put:"]
  17239. }),
  17240. $globals.CompiledMethod);
  17241. $core.addMethod(
  17242. $core.method({
  17243. selector: "isCompiledMethod",
  17244. protocol: "testing",
  17245. fn: function (){
  17246. var self=this;
  17247. return true;
  17248. },
  17249. args: [],
  17250. source: "isCompiledMethod\x0a\x09^ true",
  17251. referencedClasses: [],
  17252. messageSends: []
  17253. }),
  17254. $globals.CompiledMethod);
  17255. $core.addMethod(
  17256. $core.method({
  17257. selector: "isOverridden",
  17258. protocol: "testing",
  17259. fn: function (){
  17260. var self=this;
  17261. var selector;
  17262. return $core.withContext(function($ctx1) {
  17263. var $1;
  17264. var $early={};
  17265. try {
  17266. selector=self._selector();
  17267. $recv(self._methodClass())._allSubclassesDo_((function(each){
  17268. return $core.withContext(function($ctx2) {
  17269. $1=$recv(each)._includesSelector_(selector);
  17270. if($core.assert($1)){
  17271. throw $early=[true];
  17272. }
  17273. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17274. }));
  17275. return false;
  17276. }
  17277. catch(e) {if(e===$early)return e[0]; throw e}
  17278. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  17279. },
  17280. args: [],
  17281. 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",
  17282. referencedClasses: [],
  17283. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  17284. }),
  17285. $globals.CompiledMethod);
  17286. $core.addMethod(
  17287. $core.method({
  17288. selector: "isOverride",
  17289. protocol: "testing",
  17290. fn: function (){
  17291. var self=this;
  17292. var superclass;
  17293. return $core.withContext(function($ctx1) {
  17294. var $1,$2,$receiver;
  17295. $1=self._methodClass();
  17296. $ctx1.sendIdx["methodClass"]=1;
  17297. superclass=$recv($1)._superclass();
  17298. $ctx1.sendIdx["superclass"]=1;
  17299. $2=superclass;
  17300. if(($receiver = $2) == null || $receiver.isNil){
  17301. return false;
  17302. } else {
  17303. $2;
  17304. }
  17305. return $recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  17306. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  17307. },
  17308. args: [],
  17309. 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",
  17310. referencedClasses: [],
  17311. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  17312. }),
  17313. $globals.CompiledMethod);
  17314. $core.addMethod(
  17315. $core.method({
  17316. selector: "messageSends",
  17317. protocol: "accessing",
  17318. fn: function (){
  17319. var self=this;
  17320. return $core.withContext(function($ctx1) {
  17321. return self._basicAt_("messageSends");
  17322. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  17323. },
  17324. args: [],
  17325. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  17326. referencedClasses: [],
  17327. messageSends: ["basicAt:"]
  17328. }),
  17329. $globals.CompiledMethod);
  17330. $core.addMethod(
  17331. $core.method({
  17332. selector: "methodClass",
  17333. protocol: "accessing",
  17334. fn: function (){
  17335. var self=this;
  17336. return $core.withContext(function($ctx1) {
  17337. return self._basicAt_("methodClass");
  17338. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  17339. },
  17340. args: [],
  17341. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  17342. referencedClasses: [],
  17343. messageSends: ["basicAt:"]
  17344. }),
  17345. $globals.CompiledMethod);
  17346. $core.addMethod(
  17347. $core.method({
  17348. selector: "package",
  17349. protocol: "accessing",
  17350. fn: function (){
  17351. var self=this;
  17352. return $core.withContext(function($ctx1) {
  17353. var $1,$receiver;
  17354. $1=self._methodClass();
  17355. if(($receiver = $1) == null || $receiver.isNil){
  17356. return $1;
  17357. } else {
  17358. var class_;
  17359. class_=$receiver;
  17360. return $recv(class_)._packageOfProtocol_(self._protocol());
  17361. }
  17362. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  17363. },
  17364. args: [],
  17365. 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 ]",
  17366. referencedClasses: [],
  17367. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  17368. }),
  17369. $globals.CompiledMethod);
  17370. $core.addMethod(
  17371. $core.method({
  17372. selector: "protocol",
  17373. protocol: "accessing",
  17374. fn: function (){
  17375. var self=this;
  17376. return $core.withContext(function($ctx1) {
  17377. var $1,$receiver;
  17378. $1=self._basicAt_("protocol");
  17379. if(($receiver = $1) == null || $receiver.isNil){
  17380. return self._defaultProtocol();
  17381. } else {
  17382. return $1;
  17383. }
  17384. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  17385. },
  17386. args: [],
  17387. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  17388. referencedClasses: [],
  17389. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  17390. }),
  17391. $globals.CompiledMethod);
  17392. $core.addMethod(
  17393. $core.method({
  17394. selector: "protocol:",
  17395. protocol: "accessing",
  17396. fn: function (aString){
  17397. var self=this;
  17398. var oldProtocol;
  17399. return $core.withContext(function($ctx1) {
  17400. var $1,$3,$2,$4,$receiver;
  17401. oldProtocol=self._protocol();
  17402. self._basicAt_put_("protocol",aString);
  17403. $1=$recv($globals.SystemAnnouncer)._current();
  17404. $3=$recv($globals.MethodMoved)._new();
  17405. $recv($3)._method_(self);
  17406. $recv($3)._oldProtocol_(oldProtocol);
  17407. $2=$recv($3)._yourself();
  17408. $recv($1)._announce_($2);
  17409. $4=self._methodClass();
  17410. if(($receiver = $4) == null || $receiver.isNil){
  17411. $4;
  17412. } else {
  17413. var methodClass;
  17414. methodClass=$receiver;
  17415. $recv($recv(methodClass)._organization())._addElement_(aString);
  17416. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  17417. }
  17418. return self;
  17419. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  17420. },
  17421. args: ["aString"],
  17422. 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 ]",
  17423. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  17424. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  17425. }),
  17426. $globals.CompiledMethod);
  17427. $core.addMethod(
  17428. $core.method({
  17429. selector: "referencedClasses",
  17430. protocol: "accessing",
  17431. fn: function (){
  17432. var self=this;
  17433. return $core.withContext(function($ctx1) {
  17434. return self._basicAt_("referencedClasses");
  17435. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  17436. },
  17437. args: [],
  17438. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  17439. referencedClasses: [],
  17440. messageSends: ["basicAt:"]
  17441. }),
  17442. $globals.CompiledMethod);
  17443. $core.addMethod(
  17444. $core.method({
  17445. selector: "selector",
  17446. protocol: "accessing",
  17447. fn: function (){
  17448. var self=this;
  17449. return $core.withContext(function($ctx1) {
  17450. return self._basicAt_("selector");
  17451. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  17452. },
  17453. args: [],
  17454. source: "selector\x0a\x09^ self basicAt: 'selector'",
  17455. referencedClasses: [],
  17456. messageSends: ["basicAt:"]
  17457. }),
  17458. $globals.CompiledMethod);
  17459. $core.addMethod(
  17460. $core.method({
  17461. selector: "selector:",
  17462. protocol: "accessing",
  17463. fn: function (aString){
  17464. var self=this;
  17465. return $core.withContext(function($ctx1) {
  17466. self._basicAt_put_("selector",aString);
  17467. return self;
  17468. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  17469. },
  17470. args: ["aString"],
  17471. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  17472. referencedClasses: [],
  17473. messageSends: ["basicAt:put:"]
  17474. }),
  17475. $globals.CompiledMethod);
  17476. $core.addMethod(
  17477. $core.method({
  17478. selector: "sendTo:arguments:",
  17479. protocol: "evaluating",
  17480. fn: function (anObject,aCollection){
  17481. var self=this;
  17482. return $core.withContext(function($ctx1) {
  17483. return $recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  17484. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  17485. },
  17486. args: ["anObject", "aCollection"],
  17487. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  17488. referencedClasses: [],
  17489. messageSends: ["applyTo:arguments:", "fn"]
  17490. }),
  17491. $globals.CompiledMethod);
  17492. $core.addMethod(
  17493. $core.method({
  17494. selector: "source",
  17495. protocol: "accessing",
  17496. fn: function (){
  17497. var self=this;
  17498. return $core.withContext(function($ctx1) {
  17499. var $1,$receiver;
  17500. $1=self._basicAt_("source");
  17501. if(($receiver = $1) == null || $receiver.isNil){
  17502. return "";
  17503. } else {
  17504. return $1;
  17505. }
  17506. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  17507. },
  17508. args: [],
  17509. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  17510. referencedClasses: [],
  17511. messageSends: ["ifNil:", "basicAt:"]
  17512. }),
  17513. $globals.CompiledMethod);
  17514. $core.addMethod(
  17515. $core.method({
  17516. selector: "source:",
  17517. protocol: "accessing",
  17518. fn: function (aString){
  17519. var self=this;
  17520. return $core.withContext(function($ctx1) {
  17521. self._basicAt_put_("source",aString);
  17522. return self;
  17523. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  17524. },
  17525. args: ["aString"],
  17526. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  17527. referencedClasses: [],
  17528. messageSends: ["basicAt:put:"]
  17529. }),
  17530. $globals.CompiledMethod);
  17531. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  17532. $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`";
  17533. $core.addMethod(
  17534. $core.method({
  17535. selector: "addWorker",
  17536. protocol: "private",
  17537. fn: function (){
  17538. var self=this;
  17539. return $core.withContext(function($ctx1) {
  17540. $recv(self["@worker"])._valueWithTimeout_((0));
  17541. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  17542. return self;
  17543. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  17544. },
  17545. args: [],
  17546. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  17547. referencedClasses: [],
  17548. messageSends: ["valueWithTimeout:", "+"]
  17549. }),
  17550. $globals.ForkPool);
  17551. $core.addMethod(
  17552. $core.method({
  17553. selector: "defaultMaxPoolSize",
  17554. protocol: "defaults",
  17555. fn: function (){
  17556. var self=this;
  17557. return $core.withContext(function($ctx1) {
  17558. return $recv(self._class())._defaultMaxPoolSize();
  17559. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  17560. },
  17561. args: [],
  17562. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  17563. referencedClasses: [],
  17564. messageSends: ["defaultMaxPoolSize", "class"]
  17565. }),
  17566. $globals.ForkPool);
  17567. $core.addMethod(
  17568. $core.method({
  17569. selector: "fork:",
  17570. protocol: "actions",
  17571. fn: function (aBlock){
  17572. var self=this;
  17573. return $core.withContext(function($ctx1) {
  17574. var $1;
  17575. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  17576. if($core.assert($1)){
  17577. self._addWorker();
  17578. }
  17579. $recv(self["@queue"])._nextPut_(aBlock);
  17580. return self;
  17581. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  17582. },
  17583. args: ["aBlock"],
  17584. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  17585. referencedClasses: [],
  17586. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  17587. }),
  17588. $globals.ForkPool);
  17589. $core.addMethod(
  17590. $core.method({
  17591. selector: "initialize",
  17592. protocol: "initialization",
  17593. fn: function (){
  17594. var self=this;
  17595. return $core.withContext(function($ctx1) {
  17596. (
  17597. $ctx1.supercall = true,
  17598. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  17599. $ctx1.supercall = false;
  17600. self["@poolSize"]=(0);
  17601. self["@queue"]=$recv($globals.Queue)._new();
  17602. self["@worker"]=self._makeWorker();
  17603. return self;
  17604. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  17605. },
  17606. args: [],
  17607. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  17608. referencedClasses: ["Queue"],
  17609. messageSends: ["initialize", "new", "makeWorker"]
  17610. }),
  17611. $globals.ForkPool);
  17612. $core.addMethod(
  17613. $core.method({
  17614. selector: "makeWorker",
  17615. protocol: "initialization",
  17616. fn: function (){
  17617. var self=this;
  17618. var sentinel;
  17619. return $core.withContext(function($ctx1) {
  17620. var $1;
  17621. sentinel=$recv($globals.Object)._new();
  17622. return (function(){
  17623. var block;
  17624. return $core.withContext(function($ctx2) {
  17625. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  17626. self["@poolSize"];
  17627. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  17628. return sentinel;
  17629. }));
  17630. block;
  17631. $1=$recv(block).__eq_eq(sentinel);
  17632. if(!$core.assert($1)){
  17633. return $recv((function(){
  17634. return $core.withContext(function($ctx3) {
  17635. return $recv(block)._value();
  17636. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  17637. }))._ensure_((function(){
  17638. return $core.withContext(function($ctx3) {
  17639. return self._addWorker();
  17640. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  17641. }));
  17642. }
  17643. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  17644. });
  17645. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  17646. },
  17647. args: [],
  17648. 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 ] ]]",
  17649. referencedClasses: ["Object"],
  17650. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  17651. }),
  17652. $globals.ForkPool);
  17653. $core.addMethod(
  17654. $core.method({
  17655. selector: "maxPoolSize",
  17656. protocol: "accessing",
  17657. fn: function (){
  17658. var self=this;
  17659. return $core.withContext(function($ctx1) {
  17660. var $1,$receiver;
  17661. $1=self["@maxPoolSize"];
  17662. if(($receiver = $1) == null || $receiver.isNil){
  17663. return self._defaultMaxPoolSize();
  17664. } else {
  17665. return $1;
  17666. }
  17667. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  17668. },
  17669. args: [],
  17670. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  17671. referencedClasses: [],
  17672. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  17673. }),
  17674. $globals.ForkPool);
  17675. $core.addMethod(
  17676. $core.method({
  17677. selector: "maxPoolSize:",
  17678. protocol: "accessing",
  17679. fn: function (anInteger){
  17680. var self=this;
  17681. self["@maxPoolSize"]=anInteger;
  17682. return self;
  17683. },
  17684. args: ["anInteger"],
  17685. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  17686. referencedClasses: [],
  17687. messageSends: []
  17688. }),
  17689. $globals.ForkPool);
  17690. $globals.ForkPool.klass.iVarNames = ["default"];
  17691. $core.addMethod(
  17692. $core.method({
  17693. selector: "default",
  17694. protocol: "accessing",
  17695. fn: function (){
  17696. var self=this;
  17697. return $core.withContext(function($ctx1) {
  17698. var $1,$receiver;
  17699. $1=self["@default"];
  17700. if(($receiver = $1) == null || $receiver.isNil){
  17701. self["@default"]=self._new();
  17702. return self["@default"];
  17703. } else {
  17704. return $1;
  17705. }
  17706. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  17707. },
  17708. args: [],
  17709. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  17710. referencedClasses: [],
  17711. messageSends: ["ifNil:", "new"]
  17712. }),
  17713. $globals.ForkPool.klass);
  17714. $core.addMethod(
  17715. $core.method({
  17716. selector: "defaultMaxPoolSize",
  17717. protocol: "accessing",
  17718. fn: function (){
  17719. var self=this;
  17720. return (100);
  17721. },
  17722. args: [],
  17723. source: "defaultMaxPoolSize\x0a\x09^ 100",
  17724. referencedClasses: [],
  17725. messageSends: []
  17726. }),
  17727. $globals.ForkPool.klass);
  17728. $core.addMethod(
  17729. $core.method({
  17730. selector: "resetDefault",
  17731. protocol: "accessing",
  17732. fn: function (){
  17733. var self=this;
  17734. self["@default"]=nil;
  17735. return self;
  17736. },
  17737. args: [],
  17738. source: "resetDefault\x0a\x09default := nil",
  17739. referencedClasses: [],
  17740. messageSends: []
  17741. }),
  17742. $globals.ForkPool.klass);
  17743. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  17744. $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.";
  17745. $core.addMethod(
  17746. $core.method({
  17747. selector: "arguments",
  17748. protocol: "accessing",
  17749. fn: function (){
  17750. var self=this;
  17751. return self["@arguments"];
  17752. },
  17753. args: [],
  17754. source: "arguments\x0a\x09^ arguments",
  17755. referencedClasses: [],
  17756. messageSends: []
  17757. }),
  17758. $globals.Message);
  17759. $core.addMethod(
  17760. $core.method({
  17761. selector: "arguments:",
  17762. protocol: "accessing",
  17763. fn: function (anArray){
  17764. var self=this;
  17765. self["@arguments"]=anArray;
  17766. return self;
  17767. },
  17768. args: ["anArray"],
  17769. source: "arguments: anArray\x0a\x09arguments := anArray",
  17770. referencedClasses: [],
  17771. messageSends: []
  17772. }),
  17773. $globals.Message);
  17774. $core.addMethod(
  17775. $core.method({
  17776. selector: "printOn:",
  17777. protocol: "printing",
  17778. fn: function (aStream){
  17779. var self=this;
  17780. return $core.withContext(function($ctx1) {
  17781. (
  17782. $ctx1.supercall = true,
  17783. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  17784. $ctx1.supercall = false;
  17785. $recv(aStream)._nextPutAll_("(");
  17786. $ctx1.sendIdx["nextPutAll:"]=1;
  17787. $recv(aStream)._nextPutAll_(self._selector());
  17788. $ctx1.sendIdx["nextPutAll:"]=2;
  17789. $recv(aStream)._nextPutAll_(")");
  17790. return self;
  17791. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  17792. },
  17793. args: ["aStream"],
  17794. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  17795. referencedClasses: [],
  17796. messageSends: ["printOn:", "nextPutAll:", "selector"]
  17797. }),
  17798. $globals.Message);
  17799. $core.addMethod(
  17800. $core.method({
  17801. selector: "selector",
  17802. protocol: "accessing",
  17803. fn: function (){
  17804. var self=this;
  17805. return self["@selector"];
  17806. },
  17807. args: [],
  17808. source: "selector\x0a\x09^ selector",
  17809. referencedClasses: [],
  17810. messageSends: []
  17811. }),
  17812. $globals.Message);
  17813. $core.addMethod(
  17814. $core.method({
  17815. selector: "selector:",
  17816. protocol: "accessing",
  17817. fn: function (aString){
  17818. var self=this;
  17819. self["@selector"]=aString;
  17820. return self;
  17821. },
  17822. args: ["aString"],
  17823. source: "selector: aString\x0a\x09selector := aString",
  17824. referencedClasses: [],
  17825. messageSends: []
  17826. }),
  17827. $globals.Message);
  17828. $core.addMethod(
  17829. $core.method({
  17830. selector: "sendTo:",
  17831. protocol: "actions",
  17832. fn: function (anObject){
  17833. var self=this;
  17834. return $core.withContext(function($ctx1) {
  17835. return $recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  17836. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  17837. },
  17838. args: ["anObject"],
  17839. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  17840. referencedClasses: [],
  17841. messageSends: ["perform:withArguments:", "selector", "arguments"]
  17842. }),
  17843. $globals.Message);
  17844. $core.addMethod(
  17845. $core.method({
  17846. selector: "selector:arguments:",
  17847. protocol: "instance creation",
  17848. fn: function (aString,anArray){
  17849. var self=this;
  17850. return $core.withContext(function($ctx1) {
  17851. var $1;
  17852. $1=self._new();
  17853. $recv($1)._selector_(aString);
  17854. $recv($1)._arguments_(anArray);
  17855. return $recv($1)._yourself();
  17856. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  17857. },
  17858. args: ["aString", "anArray"],
  17859. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  17860. referencedClasses: [],
  17861. messageSends: ["selector:", "new", "arguments:", "yourself"]
  17862. }),
  17863. $globals.Message.klass);
  17864. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  17865. $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.";
  17866. $core.addMethod(
  17867. $core.method({
  17868. selector: "arguments",
  17869. protocol: "accessing",
  17870. fn: function (){
  17871. var self=this;
  17872. return $core.withContext(function($ctx1) {
  17873. return $recv(self["@message"])._arguments();
  17874. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  17875. },
  17876. args: [],
  17877. source: "arguments\x0a\x09^ message arguments",
  17878. referencedClasses: [],
  17879. messageSends: ["arguments"]
  17880. }),
  17881. $globals.MessageSend);
  17882. $core.addMethod(
  17883. $core.method({
  17884. selector: "arguments:",
  17885. protocol: "accessing",
  17886. fn: function (aCollection){
  17887. var self=this;
  17888. return $core.withContext(function($ctx1) {
  17889. $recv(self["@message"])._arguments_(aCollection);
  17890. return self;
  17891. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  17892. },
  17893. args: ["aCollection"],
  17894. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  17895. referencedClasses: [],
  17896. messageSends: ["arguments:"]
  17897. }),
  17898. $globals.MessageSend);
  17899. $core.addMethod(
  17900. $core.method({
  17901. selector: "initialize",
  17902. protocol: "initialization",
  17903. fn: function (){
  17904. var self=this;
  17905. return $core.withContext(function($ctx1) {
  17906. (
  17907. $ctx1.supercall = true,
  17908. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  17909. $ctx1.supercall = false;
  17910. self["@message"]=$recv($globals.Message)._new();
  17911. return self;
  17912. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  17913. },
  17914. args: [],
  17915. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  17916. referencedClasses: ["Message"],
  17917. messageSends: ["initialize", "new"]
  17918. }),
  17919. $globals.MessageSend);
  17920. $core.addMethod(
  17921. $core.method({
  17922. selector: "printOn:",
  17923. protocol: "printing",
  17924. fn: function (aStream){
  17925. var self=this;
  17926. return $core.withContext(function($ctx1) {
  17927. (
  17928. $ctx1.supercall = true,
  17929. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  17930. $ctx1.supercall = false;
  17931. $recv(aStream)._nextPutAll_("(");
  17932. $ctx1.sendIdx["nextPutAll:"]=1;
  17933. $recv(aStream)._nextPutAll_(self._receiver());
  17934. $ctx1.sendIdx["nextPutAll:"]=2;
  17935. $recv(aStream)._nextPutAll_(" >> ");
  17936. $ctx1.sendIdx["nextPutAll:"]=3;
  17937. $recv(aStream)._nextPutAll_(self._selector());
  17938. $ctx1.sendIdx["nextPutAll:"]=4;
  17939. $recv(aStream)._nextPutAll_(")");
  17940. return self;
  17941. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  17942. },
  17943. args: ["aStream"],
  17944. 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: ')'",
  17945. referencedClasses: [],
  17946. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  17947. }),
  17948. $globals.MessageSend);
  17949. $core.addMethod(
  17950. $core.method({
  17951. selector: "receiver",
  17952. protocol: "accessing",
  17953. fn: function (){
  17954. var self=this;
  17955. return self["@receiver"];
  17956. },
  17957. args: [],
  17958. source: "receiver\x0a\x09^ receiver",
  17959. referencedClasses: [],
  17960. messageSends: []
  17961. }),
  17962. $globals.MessageSend);
  17963. $core.addMethod(
  17964. $core.method({
  17965. selector: "receiver:",
  17966. protocol: "accessing",
  17967. fn: function (anObject){
  17968. var self=this;
  17969. self["@receiver"]=anObject;
  17970. return self;
  17971. },
  17972. args: ["anObject"],
  17973. source: "receiver: anObject\x0a\x09receiver := anObject",
  17974. referencedClasses: [],
  17975. messageSends: []
  17976. }),
  17977. $globals.MessageSend);
  17978. $core.addMethod(
  17979. $core.method({
  17980. selector: "selector",
  17981. protocol: "accessing",
  17982. fn: function (){
  17983. var self=this;
  17984. return $core.withContext(function($ctx1) {
  17985. return $recv(self["@message"])._selector();
  17986. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  17987. },
  17988. args: [],
  17989. source: "selector\x0a\x09^ message selector",
  17990. referencedClasses: [],
  17991. messageSends: ["selector"]
  17992. }),
  17993. $globals.MessageSend);
  17994. $core.addMethod(
  17995. $core.method({
  17996. selector: "selector:",
  17997. protocol: "accessing",
  17998. fn: function (aString){
  17999. var self=this;
  18000. return $core.withContext(function($ctx1) {
  18001. $recv(self["@message"])._selector_(aString);
  18002. return self;
  18003. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18004. },
  18005. args: ["aString"],
  18006. source: "selector: aString\x0a\x09message selector: aString",
  18007. referencedClasses: [],
  18008. messageSends: ["selector:"]
  18009. }),
  18010. $globals.MessageSend);
  18011. $core.addMethod(
  18012. $core.method({
  18013. selector: "value",
  18014. protocol: "evaluating",
  18015. fn: function (){
  18016. var self=this;
  18017. return $core.withContext(function($ctx1) {
  18018. return $recv(self["@message"])._sendTo_(self._receiver());
  18019. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18020. },
  18021. args: [],
  18022. source: "value\x0a\x09^ message sendTo: self receiver",
  18023. referencedClasses: [],
  18024. messageSends: ["sendTo:", "receiver"]
  18025. }),
  18026. $globals.MessageSend);
  18027. $core.addMethod(
  18028. $core.method({
  18029. selector: "value:",
  18030. protocol: "evaluating",
  18031. fn: function (anObject){
  18032. var self=this;
  18033. return $core.withContext(function($ctx1) {
  18034. var $1;
  18035. $1=self["@message"];
  18036. $recv($1)._arguments_([anObject]);
  18037. return $recv($1)._sendTo_(self._receiver());
  18038. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18039. },
  18040. args: ["anObject"],
  18041. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18042. referencedClasses: [],
  18043. messageSends: ["arguments:", "sendTo:", "receiver"]
  18044. }),
  18045. $globals.MessageSend);
  18046. $core.addMethod(
  18047. $core.method({
  18048. selector: "value:value:",
  18049. protocol: "evaluating",
  18050. fn: function (firstArgument,secondArgument){
  18051. var self=this;
  18052. return $core.withContext(function($ctx1) {
  18053. var $1;
  18054. $1=self["@message"];
  18055. $recv($1)._arguments_([firstArgument,secondArgument]);
  18056. return $recv($1)._sendTo_(self._receiver());
  18057. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18058. },
  18059. args: ["firstArgument", "secondArgument"],
  18060. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18061. referencedClasses: [],
  18062. messageSends: ["arguments:", "sendTo:", "receiver"]
  18063. }),
  18064. $globals.MessageSend);
  18065. $core.addMethod(
  18066. $core.method({
  18067. selector: "value:value:value:",
  18068. protocol: "evaluating",
  18069. fn: function (firstArgument,secondArgument,thirdArgument){
  18070. var self=this;
  18071. return $core.withContext(function($ctx1) {
  18072. var $1;
  18073. $1=self["@message"];
  18074. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18075. return $recv($1)._sendTo_(self._receiver());
  18076. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18077. },
  18078. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18079. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18080. referencedClasses: [],
  18081. messageSends: ["arguments:", "sendTo:", "receiver"]
  18082. }),
  18083. $globals.MessageSend);
  18084. $core.addMethod(
  18085. $core.method({
  18086. selector: "valueWithPossibleArguments:",
  18087. protocol: "evaluating",
  18088. fn: function (aCollection){
  18089. var self=this;
  18090. return $core.withContext(function($ctx1) {
  18091. self._arguments_(aCollection);
  18092. return self._value();
  18093. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18094. },
  18095. args: ["aCollection"],
  18096. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18097. referencedClasses: [],
  18098. messageSends: ["arguments:", "value"]
  18099. }),
  18100. $globals.MessageSend);
  18101. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  18102. $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`.";
  18103. $core.addMethod(
  18104. $core.method({
  18105. selector: "asString",
  18106. protocol: "converting",
  18107. fn: function (){
  18108. var self=this;
  18109. return $core.withContext(function($ctx1) {
  18110. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  18111. $2=self._isBlockContext();
  18112. if($core.assert($2)){
  18113. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  18114. $ctx1.sendIdx[","]=2;
  18115. $1=$recv($3).__comma(")");
  18116. $ctx1.sendIdx[","]=1;
  18117. } else {
  18118. var methodClass;
  18119. methodClass=$recv(self._method())._methodClass();
  18120. methodClass;
  18121. $5=methodClass;
  18122. $7=self._receiver();
  18123. $ctx1.sendIdx["receiver"]=1;
  18124. $6=$recv($7)._class();
  18125. $ctx1.sendIdx["class"]=1;
  18126. $4=$recv($5).__eq($6);
  18127. if($core.assert($4)){
  18128. $11=self._receiver();
  18129. $ctx1.sendIdx["receiver"]=2;
  18130. $10=$recv($11)._class();
  18131. $ctx1.sendIdx["class"]=2;
  18132. $9=$recv($10)._name();
  18133. $ctx1.sendIdx["name"]=1;
  18134. $8=$recv($9).__comma(" >> ");
  18135. $ctx1.sendIdx[","]=4;
  18136. $12=self._selector();
  18137. $ctx1.sendIdx["selector"]=1;
  18138. $1=$recv($8).__comma($12);
  18139. $ctx1.sendIdx[","]=3;
  18140. } else {
  18141. $16=$recv($recv(self._receiver())._class())._name();
  18142. $ctx1.sendIdx["name"]=2;
  18143. $15=$recv($16).__comma("(");
  18144. $14=$recv($15).__comma($recv(methodClass)._name());
  18145. $ctx1.sendIdx[","]=7;
  18146. $13=$recv($14).__comma(") >> ");
  18147. $ctx1.sendIdx[","]=6;
  18148. $1=$recv($13).__comma(self._selector());
  18149. $ctx1.sendIdx[","]=5;
  18150. }
  18151. }
  18152. return $1;
  18153. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  18154. },
  18155. args: [],
  18156. 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 ] ]",
  18157. referencedClasses: [],
  18158. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  18159. }),
  18160. $globals.MethodContext);
  18161. $core.addMethod(
  18162. $core.method({
  18163. selector: "basicReceiver",
  18164. protocol: "accessing",
  18165. fn: function (){
  18166. var self=this;
  18167. return $core.withContext(function($ctx1) {
  18168. return self.receiver;
  18169. return self;
  18170. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  18171. },
  18172. args: [],
  18173. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  18174. referencedClasses: [],
  18175. messageSends: []
  18176. }),
  18177. $globals.MethodContext);
  18178. $core.addMethod(
  18179. $core.method({
  18180. selector: "evaluatedSelector",
  18181. protocol: "accessing",
  18182. fn: function (){
  18183. var self=this;
  18184. return $core.withContext(function($ctx1) {
  18185. return self.evaluatedSelector;
  18186. return self;
  18187. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  18188. },
  18189. args: [],
  18190. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  18191. referencedClasses: [],
  18192. messageSends: []
  18193. }),
  18194. $globals.MethodContext);
  18195. $core.addMethod(
  18196. $core.method({
  18197. selector: "findContextSuchThat:",
  18198. protocol: "accessing",
  18199. fn: function (testBlock){
  18200. var self=this;
  18201. var context;
  18202. return $core.withContext(function($ctx1) {
  18203. var $1;
  18204. var $early={};
  18205. try {
  18206. context=self;
  18207. $recv((function(){
  18208. return $core.withContext(function($ctx2) {
  18209. return $recv(context)._isNil();
  18210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18211. }))._whileFalse_((function(){
  18212. return $core.withContext(function($ctx2) {
  18213. $1=$recv(testBlock)._value_(context);
  18214. if($core.assert($1)){
  18215. throw $early=[context];
  18216. }
  18217. context=$recv(context)._outerContext();
  18218. return context;
  18219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  18220. }));
  18221. return nil;
  18222. }
  18223. catch(e) {if(e===$early)return e[0]; throw e}
  18224. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  18225. },
  18226. args: ["testBlock"],
  18227. 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",
  18228. referencedClasses: [],
  18229. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  18230. }),
  18231. $globals.MethodContext);
  18232. $core.addMethod(
  18233. $core.method({
  18234. selector: "home",
  18235. protocol: "accessing",
  18236. fn: function (){
  18237. var self=this;
  18238. return $core.withContext(function($ctx1) {
  18239. return self.homeContext;
  18240. return self;
  18241. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  18242. },
  18243. args: [],
  18244. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  18245. referencedClasses: [],
  18246. messageSends: []
  18247. }),
  18248. $globals.MethodContext);
  18249. $core.addMethod(
  18250. $core.method({
  18251. selector: "index",
  18252. protocol: "accessing",
  18253. fn: function (){
  18254. var self=this;
  18255. return $core.withContext(function($ctx1) {
  18256. return self.index || 0;
  18257. return self;
  18258. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  18259. },
  18260. args: [],
  18261. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  18262. referencedClasses: [],
  18263. messageSends: []
  18264. }),
  18265. $globals.MethodContext);
  18266. $core.addMethod(
  18267. $core.method({
  18268. selector: "isBlockContext",
  18269. protocol: "testing",
  18270. fn: function (){
  18271. var self=this;
  18272. return $core.withContext(function($ctx1) {
  18273. return $recv(self._selector())._isNil();
  18274. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  18275. },
  18276. args: [],
  18277. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  18278. referencedClasses: [],
  18279. messageSends: ["isNil", "selector"]
  18280. }),
  18281. $globals.MethodContext);
  18282. $core.addMethod(
  18283. $core.method({
  18284. selector: "locals",
  18285. protocol: "accessing",
  18286. fn: function (){
  18287. var self=this;
  18288. return $core.withContext(function($ctx1) {
  18289. return self.locals || {};
  18290. return self;
  18291. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  18292. },
  18293. args: [],
  18294. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  18295. referencedClasses: [],
  18296. messageSends: []
  18297. }),
  18298. $globals.MethodContext);
  18299. $core.addMethod(
  18300. $core.method({
  18301. selector: "method",
  18302. protocol: "accessing",
  18303. fn: function (){
  18304. var self=this;
  18305. var method,lookupClass,receiverClass,supercall;
  18306. return $core.withContext(function($ctx1) {
  18307. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  18308. $1=self._methodContext();
  18309. $ctx1.sendIdx["methodContext"]=1;
  18310. if(($receiver = $1) == null || $receiver.isNil){
  18311. return nil;
  18312. } else {
  18313. $1;
  18314. }
  18315. $3=self._methodContext();
  18316. $ctx1.sendIdx["methodContext"]=2;
  18317. $2=$recv($3)._receiver();
  18318. receiverClass=$recv($2)._class();
  18319. $4=receiverClass;
  18320. $6=self._methodContext();
  18321. $ctx1.sendIdx["methodContext"]=3;
  18322. $5=$recv($6)._selector();
  18323. $ctx1.sendIdx["selector"]=1;
  18324. method=$recv($4)._lookupSelector_($5);
  18325. $ctx1.sendIdx["lookupSelector:"]=1;
  18326. $7=self._outerContext();
  18327. if(($receiver = $7) == null || $receiver.isNil){
  18328. supercall=false;
  18329. } else {
  18330. var outer;
  18331. outer=$receiver;
  18332. supercall=$recv(outer)._supercall();
  18333. }
  18334. $8=supercall;
  18335. if($core.assert($8)){
  18336. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  18337. } else {
  18338. return method;
  18339. }
  18340. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  18341. },
  18342. args: [],
  18343. 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 ]",
  18344. referencedClasses: [],
  18345. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  18346. }),
  18347. $globals.MethodContext);
  18348. $core.addMethod(
  18349. $core.method({
  18350. selector: "methodContext",
  18351. protocol: "accessing",
  18352. fn: function (){
  18353. var self=this;
  18354. return $core.withContext(function($ctx1) {
  18355. var $1,$2,$receiver;
  18356. $1=self._isBlockContext();
  18357. if(!$core.assert($1)){
  18358. return self;
  18359. }
  18360. $2=self._outerContext();
  18361. if(($receiver = $2) == null || $receiver.isNil){
  18362. return $2;
  18363. } else {
  18364. var outer;
  18365. outer=$receiver;
  18366. return $recv(outer)._methodContext();
  18367. }
  18368. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  18369. },
  18370. args: [],
  18371. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  18372. referencedClasses: [],
  18373. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  18374. }),
  18375. $globals.MethodContext);
  18376. $core.addMethod(
  18377. $core.method({
  18378. selector: "outerContext",
  18379. protocol: "accessing",
  18380. fn: function (){
  18381. var self=this;
  18382. return $core.withContext(function($ctx1) {
  18383. return self.outerContext || self.homeContext;
  18384. return self;
  18385. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  18386. },
  18387. args: [],
  18388. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  18389. referencedClasses: [],
  18390. messageSends: []
  18391. }),
  18392. $globals.MethodContext);
  18393. $core.addMethod(
  18394. $core.method({
  18395. selector: "printOn:",
  18396. protocol: "printing",
  18397. fn: function (aStream){
  18398. var self=this;
  18399. return $core.withContext(function($ctx1) {
  18400. (
  18401. $ctx1.supercall = true,
  18402. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  18403. $ctx1.supercall = false;
  18404. $recv(aStream)._nextPutAll_("(");
  18405. $ctx1.sendIdx["nextPutAll:"]=1;
  18406. $recv(aStream)._nextPutAll_(self._asString());
  18407. $ctx1.sendIdx["nextPutAll:"]=2;
  18408. $recv(aStream)._nextPutAll_(")");
  18409. return self;
  18410. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  18411. },
  18412. args: ["aStream"],
  18413. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  18414. referencedClasses: [],
  18415. messageSends: ["printOn:", "nextPutAll:", "asString"]
  18416. }),
  18417. $globals.MethodContext);
  18418. $core.addMethod(
  18419. $core.method({
  18420. selector: "receiver",
  18421. protocol: "accessing",
  18422. fn: function (){
  18423. var self=this;
  18424. return $core.withContext(function($ctx1) {
  18425. var $2,$1;
  18426. $1=$recv(self._isBlockContext())._and_((function(){
  18427. return $core.withContext(function($ctx2) {
  18428. $2=self._outerContext();
  18429. $ctx2.sendIdx["outerContext"]=1;
  18430. return $recv($2)._notNil();
  18431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18432. }));
  18433. if($core.assert($1)){
  18434. return $recv(self._outerContext())._receiver();
  18435. } else {
  18436. return self._basicReceiver();
  18437. }
  18438. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  18439. },
  18440. args: [],
  18441. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  18442. referencedClasses: [],
  18443. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  18444. }),
  18445. $globals.MethodContext);
  18446. $core.addMethod(
  18447. $core.method({
  18448. selector: "selector",
  18449. protocol: "accessing",
  18450. fn: function (){
  18451. var self=this;
  18452. return $core.withContext(function($ctx1) {
  18453. if(self.selector) {
  18454. return $core.js2st(self.selector);
  18455. } else {
  18456. return nil;
  18457. }
  18458. ;
  18459. return self;
  18460. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  18461. },
  18462. args: [],
  18463. 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'>",
  18464. referencedClasses: [],
  18465. messageSends: []
  18466. }),
  18467. $globals.MethodContext);
  18468. $core.addMethod(
  18469. $core.method({
  18470. selector: "sendIndexAt:",
  18471. protocol: "accessing",
  18472. fn: function (aSelector){
  18473. var self=this;
  18474. return $core.withContext(function($ctx1) {
  18475. return self.sendIdx[aSelector] || 0;
  18476. return self;
  18477. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  18478. },
  18479. args: ["aSelector"],
  18480. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  18481. referencedClasses: [],
  18482. messageSends: []
  18483. }),
  18484. $globals.MethodContext);
  18485. $core.addMethod(
  18486. $core.method({
  18487. selector: "sendIndexes",
  18488. protocol: "accessing",
  18489. fn: function (){
  18490. var self=this;
  18491. return $core.withContext(function($ctx1) {
  18492. return self.sendIdx;
  18493. return self;
  18494. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  18495. },
  18496. args: [],
  18497. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  18498. referencedClasses: [],
  18499. messageSends: []
  18500. }),
  18501. $globals.MethodContext);
  18502. $core.addMethod(
  18503. $core.method({
  18504. selector: "supercall",
  18505. protocol: "accessing",
  18506. fn: function (){
  18507. var self=this;
  18508. return $core.withContext(function($ctx1) {
  18509. return self.supercall == true;
  18510. return self;
  18511. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  18512. },
  18513. args: [],
  18514. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  18515. referencedClasses: [],
  18516. messageSends: []
  18517. }),
  18518. $globals.MethodContext);
  18519. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  18520. $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' ]";
  18521. $core.addMethod(
  18522. $core.method({
  18523. selector: "constructorNamed:",
  18524. protocol: "instance creation",
  18525. fn: function (aString){
  18526. var self=this;
  18527. return $core.withContext(function($ctx1) {
  18528. var nativeFunc=(new Function('return this'))()[aString];
  18529. return new nativeFunc();
  18530. ;
  18531. return self;
  18532. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  18533. },
  18534. args: ["aString"],
  18535. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  18536. referencedClasses: [],
  18537. messageSends: []
  18538. }),
  18539. $globals.NativeFunction.klass);
  18540. $core.addMethod(
  18541. $core.method({
  18542. selector: "constructorNamed:value:",
  18543. protocol: "instance creation",
  18544. fn: function (aString,anObject){
  18545. var self=this;
  18546. return $core.withContext(function($ctx1) {
  18547. var nativeFunc=(new Function('return this'))()[aString];
  18548. return new nativeFunc(anObject);
  18549. ;
  18550. return self;
  18551. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  18552. },
  18553. args: ["aString", "anObject"],
  18554. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  18555. referencedClasses: [],
  18556. messageSends: []
  18557. }),
  18558. $globals.NativeFunction.klass);
  18559. $core.addMethod(
  18560. $core.method({
  18561. selector: "constructorNamed:value:value:",
  18562. protocol: "instance creation",
  18563. fn: function (aString,anObject,anObject2){
  18564. var self=this;
  18565. return $core.withContext(function($ctx1) {
  18566. var nativeFunc=(new Function('return this'))()[aString];
  18567. return new nativeFunc(anObject,anObject2);
  18568. ;
  18569. return self;
  18570. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  18571. },
  18572. args: ["aString", "anObject", "anObject2"],
  18573. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  18574. referencedClasses: [],
  18575. messageSends: []
  18576. }),
  18577. $globals.NativeFunction.klass);
  18578. $core.addMethod(
  18579. $core.method({
  18580. selector: "constructorNamed:value:value:value:",
  18581. protocol: "instance creation",
  18582. fn: function (aString,anObject,anObject2,anObject3){
  18583. var self=this;
  18584. return $core.withContext(function($ctx1) {
  18585. var nativeFunc=(new Function('return this'))()[aString];
  18586. return new nativeFunc(anObject,anObject2, anObject3);
  18587. ;
  18588. return self;
  18589. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  18590. },
  18591. args: ["aString", "anObject", "anObject2", "anObject3"],
  18592. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18593. referencedClasses: [],
  18594. messageSends: []
  18595. }),
  18596. $globals.NativeFunction.klass);
  18597. $core.addMethod(
  18598. $core.method({
  18599. selector: "constructorOf:",
  18600. protocol: "instance creation",
  18601. fn: function (nativeFunc){
  18602. var self=this;
  18603. return $core.withContext(function($ctx1) {
  18604. return new nativeFunc();
  18605. ;
  18606. return self;
  18607. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  18608. },
  18609. args: ["nativeFunc"],
  18610. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  18611. referencedClasses: [],
  18612. messageSends: []
  18613. }),
  18614. $globals.NativeFunction.klass);
  18615. $core.addMethod(
  18616. $core.method({
  18617. selector: "constructorOf:value:",
  18618. protocol: "instance creation",
  18619. fn: function (nativeFunc,anObject){
  18620. var self=this;
  18621. return $core.withContext(function($ctx1) {
  18622. return new nativeFunc(anObject);
  18623. ;
  18624. return self;
  18625. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  18626. },
  18627. args: ["nativeFunc", "anObject"],
  18628. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  18629. referencedClasses: [],
  18630. messageSends: []
  18631. }),
  18632. $globals.NativeFunction.klass);
  18633. $core.addMethod(
  18634. $core.method({
  18635. selector: "constructorOf:value:value:",
  18636. protocol: "instance creation",
  18637. fn: function (nativeFunc,anObject,anObject2){
  18638. var self=this;
  18639. return $core.withContext(function($ctx1) {
  18640. return new nativeFunc(anObject,anObject2);
  18641. ;
  18642. return self;
  18643. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  18644. },
  18645. args: ["nativeFunc", "anObject", "anObject2"],
  18646. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  18647. referencedClasses: [],
  18648. messageSends: []
  18649. }),
  18650. $globals.NativeFunction.klass);
  18651. $core.addMethod(
  18652. $core.method({
  18653. selector: "constructorOf:value:value:value:",
  18654. protocol: "instance creation",
  18655. fn: function (nativeFunc,anObject,anObject2,anObject3){
  18656. var self=this;
  18657. return $core.withContext(function($ctx1) {
  18658. return new nativeFunc(anObject,anObject2, anObject3);
  18659. ;
  18660. return self;
  18661. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  18662. },
  18663. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  18664. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18665. referencedClasses: [],
  18666. messageSends: []
  18667. }),
  18668. $globals.NativeFunction.klass);
  18669. $core.addMethod(
  18670. $core.method({
  18671. selector: "exists:",
  18672. protocol: "testing",
  18673. fn: function (aString){
  18674. var self=this;
  18675. return $core.withContext(function($ctx1) {
  18676. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  18677. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  18678. },
  18679. args: ["aString"],
  18680. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  18681. referencedClasses: ["Smalltalk"],
  18682. messageSends: ["existsJsGlobal:"]
  18683. }),
  18684. $globals.NativeFunction.klass);
  18685. $core.addMethod(
  18686. $core.method({
  18687. selector: "functionNamed:",
  18688. protocol: "function calling",
  18689. fn: function (aString){
  18690. var self=this;
  18691. return $core.withContext(function($ctx1) {
  18692. var nativeFunc=(new Function('return this'))()[aString];
  18693. return nativeFunc();
  18694. ;
  18695. return self;
  18696. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  18697. },
  18698. args: ["aString"],
  18699. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  18700. referencedClasses: [],
  18701. messageSends: []
  18702. }),
  18703. $globals.NativeFunction.klass);
  18704. $core.addMethod(
  18705. $core.method({
  18706. selector: "functionNamed:value:",
  18707. protocol: "function calling",
  18708. fn: function (aString,anObject){
  18709. var self=this;
  18710. return $core.withContext(function($ctx1) {
  18711. var nativeFunc=(new Function('return this'))()[aString];
  18712. return nativeFunc(anObject);
  18713. ;
  18714. return self;
  18715. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  18716. },
  18717. args: ["aString", "anObject"],
  18718. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  18719. referencedClasses: [],
  18720. messageSends: []
  18721. }),
  18722. $globals.NativeFunction.klass);
  18723. $core.addMethod(
  18724. $core.method({
  18725. selector: "functionNamed:value:value:",
  18726. protocol: "function calling",
  18727. fn: function (aString,anObject,anObject2){
  18728. var self=this;
  18729. return $core.withContext(function($ctx1) {
  18730. var nativeFunc=(new Function('return this'))()[aString];
  18731. return nativeFunc(anObject,anObject2);
  18732. ;
  18733. return self;
  18734. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  18735. },
  18736. args: ["aString", "anObject", "anObject2"],
  18737. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  18738. referencedClasses: [],
  18739. messageSends: []
  18740. }),
  18741. $globals.NativeFunction.klass);
  18742. $core.addMethod(
  18743. $core.method({
  18744. selector: "functionNamed:value:value:value:",
  18745. protocol: "function calling",
  18746. fn: function (aString,anObject,anObject2,anObject3){
  18747. var self=this;
  18748. return $core.withContext(function($ctx1) {
  18749. var nativeFunc=(new Function('return this'))()[aString];
  18750. return nativeFunc(anObject,anObject2, anObject3);
  18751. ;
  18752. return self;
  18753. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  18754. },
  18755. args: ["aString", "anObject", "anObject2", "anObject3"],
  18756. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18757. referencedClasses: [],
  18758. messageSends: []
  18759. }),
  18760. $globals.NativeFunction.klass);
  18761. $core.addMethod(
  18762. $core.method({
  18763. selector: "functionNamed:valueWithArgs:",
  18764. protocol: "function calling",
  18765. fn: function (aString,args){
  18766. var self=this;
  18767. return $core.withContext(function($ctx1) {
  18768. var nativeFunc=(new Function('return this'))()[aString];
  18769. return Function.prototype.apply.call(nativeFunc, null, args);
  18770. ;
  18771. return self;
  18772. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  18773. },
  18774. args: ["aString", "args"],
  18775. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  18776. referencedClasses: [],
  18777. messageSends: []
  18778. }),
  18779. $globals.NativeFunction.klass);
  18780. $core.addMethod(
  18781. $core.method({
  18782. selector: "functionOf:",
  18783. protocol: "function calling",
  18784. fn: function (nativeFunc){
  18785. var self=this;
  18786. return $core.withContext(function($ctx1) {
  18787. return nativeFunc();
  18788. ;
  18789. return self;
  18790. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  18791. },
  18792. args: ["nativeFunc"],
  18793. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  18794. referencedClasses: [],
  18795. messageSends: []
  18796. }),
  18797. $globals.NativeFunction.klass);
  18798. $core.addMethod(
  18799. $core.method({
  18800. selector: "functionOf:value:",
  18801. protocol: "function calling",
  18802. fn: function (nativeFunc,anObject){
  18803. var self=this;
  18804. return $core.withContext(function($ctx1) {
  18805. return nativeFunc(anObject);
  18806. ;
  18807. return self;
  18808. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  18809. },
  18810. args: ["nativeFunc", "anObject"],
  18811. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  18812. referencedClasses: [],
  18813. messageSends: []
  18814. }),
  18815. $globals.NativeFunction.klass);
  18816. $core.addMethod(
  18817. $core.method({
  18818. selector: "functionOf:value:value:",
  18819. protocol: "function calling",
  18820. fn: function (nativeFunc,anObject,anObject2){
  18821. var self=this;
  18822. return $core.withContext(function($ctx1) {
  18823. return nativeFunc(anObject,anObject2);
  18824. ;
  18825. return self;
  18826. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  18827. },
  18828. args: ["nativeFunc", "anObject", "anObject2"],
  18829. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  18830. referencedClasses: [],
  18831. messageSends: []
  18832. }),
  18833. $globals.NativeFunction.klass);
  18834. $core.addMethod(
  18835. $core.method({
  18836. selector: "functionOf:value:value:value:",
  18837. protocol: "function calling",
  18838. fn: function (nativeFunc,anObject,anObject2,anObject3){
  18839. var self=this;
  18840. return $core.withContext(function($ctx1) {
  18841. return nativeFunc(anObject,anObject2, anObject3);
  18842. ;
  18843. return self;
  18844. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  18845. },
  18846. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  18847. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  18848. referencedClasses: [],
  18849. messageSends: []
  18850. }),
  18851. $globals.NativeFunction.klass);
  18852. $core.addMethod(
  18853. $core.method({
  18854. selector: "functionOf:valueWithArgs:",
  18855. protocol: "function calling",
  18856. fn: function (nativeFunc,args){
  18857. var self=this;
  18858. return $core.withContext(function($ctx1) {
  18859. return Function.prototype.apply.call(nativeFunc, null, args);
  18860. ;
  18861. return self;
  18862. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  18863. },
  18864. args: ["nativeFunc", "args"],
  18865. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  18866. referencedClasses: [],
  18867. messageSends: []
  18868. }),
  18869. $globals.NativeFunction.klass);
  18870. $core.addMethod(
  18871. $core.method({
  18872. selector: "methodOf:this:",
  18873. protocol: "method calling",
  18874. fn: function (nativeFunc,thisObject){
  18875. var self=this;
  18876. return $core.withContext(function($ctx1) {
  18877. return Function.prototype.call.call(nativeFunc, thisObject);
  18878. ;
  18879. return self;
  18880. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  18881. },
  18882. args: ["nativeFunc", "thisObject"],
  18883. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  18884. referencedClasses: [],
  18885. messageSends: []
  18886. }),
  18887. $globals.NativeFunction.klass);
  18888. $core.addMethod(
  18889. $core.method({
  18890. selector: "methodOf:this:value:",
  18891. protocol: "method calling",
  18892. fn: function (nativeFunc,thisObject,anObject){
  18893. var self=this;
  18894. return $core.withContext(function($ctx1) {
  18895. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  18896. ;
  18897. return self;
  18898. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  18899. },
  18900. args: ["nativeFunc", "thisObject", "anObject"],
  18901. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  18902. referencedClasses: [],
  18903. messageSends: []
  18904. }),
  18905. $globals.NativeFunction.klass);
  18906. $core.addMethod(
  18907. $core.method({
  18908. selector: "methodOf:this:value:value:",
  18909. protocol: "method calling",
  18910. fn: function (nativeFunc,thisObject,anObject,anObject2){
  18911. var self=this;
  18912. return $core.withContext(function($ctx1) {
  18913. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  18914. ;
  18915. return self;
  18916. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  18917. },
  18918. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  18919. 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'>",
  18920. referencedClasses: [],
  18921. messageSends: []
  18922. }),
  18923. $globals.NativeFunction.klass);
  18924. $core.addMethod(
  18925. $core.method({
  18926. selector: "methodOf:this:value:value:value:",
  18927. protocol: "method calling",
  18928. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  18929. var self=this;
  18930. return $core.withContext(function($ctx1) {
  18931. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  18932. ;
  18933. return self;
  18934. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  18935. },
  18936. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  18937. 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'>",
  18938. referencedClasses: [],
  18939. messageSends: []
  18940. }),
  18941. $globals.NativeFunction.klass);
  18942. $core.addMethod(
  18943. $core.method({
  18944. selector: "methodOf:this:valueWithArgs:",
  18945. protocol: "method calling",
  18946. fn: function (nativeFunc,thisObject,args){
  18947. var self=this;
  18948. return $core.withContext(function($ctx1) {
  18949. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  18950. ;
  18951. return self;
  18952. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  18953. },
  18954. args: ["nativeFunc", "thisObject", "args"],
  18955. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  18956. referencedClasses: [],
  18957. messageSends: []
  18958. }),
  18959. $globals.NativeFunction.klass);
  18960. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  18961. $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.";
  18962. $core.addMethod(
  18963. $core.method({
  18964. selector: "clearInterval",
  18965. protocol: "timeout/interval",
  18966. fn: function (){
  18967. var self=this;
  18968. return $core.withContext(function($ctx1) {
  18969. var interval = self["@rawTimeout"];
  18970. clearInterval(interval);
  18971. ;
  18972. return self;
  18973. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  18974. },
  18975. args: [],
  18976. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  18977. referencedClasses: [],
  18978. messageSends: []
  18979. }),
  18980. $globals.Timeout);
  18981. $core.addMethod(
  18982. $core.method({
  18983. selector: "clearTimeout",
  18984. protocol: "timeout/interval",
  18985. fn: function (){
  18986. var self=this;
  18987. return $core.withContext(function($ctx1) {
  18988. var timeout = self["@rawTimeout"];
  18989. clearTimeout(timeout);
  18990. ;
  18991. return self;
  18992. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  18993. },
  18994. args: [],
  18995. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  18996. referencedClasses: [],
  18997. messageSends: []
  18998. }),
  18999. $globals.Timeout);
  19000. $core.addMethod(
  19001. $core.method({
  19002. selector: "rawTimeout:",
  19003. protocol: "accessing",
  19004. fn: function (anObject){
  19005. var self=this;
  19006. self["@rawTimeout"]=anObject;
  19007. return self;
  19008. },
  19009. args: ["anObject"],
  19010. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19011. referencedClasses: [],
  19012. messageSends: []
  19013. }),
  19014. $globals.Timeout);
  19015. $core.addMethod(
  19016. $core.method({
  19017. selector: "on:",
  19018. protocol: "instance creation",
  19019. fn: function (anObject){
  19020. var self=this;
  19021. return $core.withContext(function($ctx1) {
  19022. var $1;
  19023. $1=self._new();
  19024. $recv($1)._rawTimeout_(anObject);
  19025. return $recv($1)._yourself();
  19026. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  19027. },
  19028. args: ["anObject"],
  19029. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  19030. referencedClasses: [],
  19031. messageSends: ["rawTimeout:", "new", "yourself"]
  19032. }),
  19033. $globals.Timeout.klass);
  19034. });
  19035. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19036. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  19037. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19038. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  19039. $core.addPackage("Kernel-Dag");
  19040. $core.packages["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  19041. $core.packages["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19042. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  19043. $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:`.";
  19044. $core.addMethod(
  19045. $core.method({
  19046. selector: "value:",
  19047. protocol: "evaluating",
  19048. fn: function (anObject){
  19049. var self=this;
  19050. return $core.withContext(function($ctx1) {
  19051. return self._visit_(anObject);
  19052. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  19053. },
  19054. args: ["anObject"],
  19055. source: "value: anObject\x0a\x09^ self visit: anObject",
  19056. referencedClasses: [],
  19057. messageSends: ["visit:"]
  19058. }),
  19059. $globals.AbstractDagVisitor);
  19060. $core.addMethod(
  19061. $core.method({
  19062. selector: "visit:",
  19063. protocol: "visiting",
  19064. fn: function (aNode){
  19065. var self=this;
  19066. return $core.withContext(function($ctx1) {
  19067. return $recv(aNode)._acceptDagVisitor_(self);
  19068. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19069. },
  19070. args: ["aNode"],
  19071. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  19072. referencedClasses: [],
  19073. messageSends: ["acceptDagVisitor:"]
  19074. }),
  19075. $globals.AbstractDagVisitor);
  19076. $core.addMethod(
  19077. $core.method({
  19078. selector: "visitAll:",
  19079. protocol: "visiting",
  19080. fn: function (aCollection){
  19081. var self=this;
  19082. return $core.withContext(function($ctx1) {
  19083. return $recv(aCollection)._collect_((function(each){
  19084. return $core.withContext(function($ctx2) {
  19085. return self._visit_(each);
  19086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19087. }));
  19088. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  19089. },
  19090. args: ["aCollection"],
  19091. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  19092. referencedClasses: [],
  19093. messageSends: ["collect:", "visit:"]
  19094. }),
  19095. $globals.AbstractDagVisitor);
  19096. $core.addMethod(
  19097. $core.method({
  19098. selector: "visitAllChildren:",
  19099. protocol: "visiting",
  19100. fn: function (aDagNode){
  19101. var self=this;
  19102. return $core.withContext(function($ctx1) {
  19103. return self._visitAll_($recv(aDagNode)._dagChildren());
  19104. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  19105. },
  19106. args: ["aDagNode"],
  19107. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  19108. referencedClasses: [],
  19109. messageSends: ["visitAll:", "dagChildren"]
  19110. }),
  19111. $globals.AbstractDagVisitor);
  19112. $core.addMethod(
  19113. $core.method({
  19114. selector: "visitDagNode:",
  19115. protocol: "visiting",
  19116. fn: function (aNode){
  19117. var self=this;
  19118. return $core.withContext(function($ctx1) {
  19119. self._subclassResponsibility();
  19120. return self;
  19121. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19122. },
  19123. args: ["aNode"],
  19124. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  19125. referencedClasses: [],
  19126. messageSends: ["subclassResponsibility"]
  19127. }),
  19128. $globals.AbstractDagVisitor);
  19129. $core.addMethod(
  19130. $core.method({
  19131. selector: "visitDagNodeVariantRedux:",
  19132. protocol: "visiting",
  19133. fn: function (aNode){
  19134. var self=this;
  19135. var newChildren,oldChildren;
  19136. return $core.withContext(function($ctx1) {
  19137. var $2,$3,$1,$4,$5;
  19138. var $early={};
  19139. try {
  19140. oldChildren=$recv(aNode)._dagChildren();
  19141. newChildren=self._visitAllChildren_(aNode);
  19142. $2=$recv(oldChildren)._size();
  19143. $ctx1.sendIdx["size"]=1;
  19144. $3=$recv(newChildren)._size();
  19145. $ctx1.sendIdx["size"]=2;
  19146. $1=$recv($2).__eq($3);
  19147. if($core.assert($1)){
  19148. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  19149. return $core.withContext(function($ctx2) {
  19150. $4=$recv(oldChildren)._at_(i);
  19151. $ctx2.sendIdx["at:"]=1;
  19152. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  19153. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  19154. }),(function(){
  19155. throw $early=[aNode];
  19156. }));
  19157. }
  19158. $5=$recv(aNode)._copy();
  19159. $recv($5)._dagChildren_(newChildren);
  19160. return $recv($5)._yourself();
  19161. }
  19162. catch(e) {if(e===$early)return e[0]; throw e}
  19163. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  19164. },
  19165. args: ["aNode"],
  19166. 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",
  19167. referencedClasses: [],
  19168. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  19169. }),
  19170. $globals.AbstractDagVisitor);
  19171. $core.addMethod(
  19172. $core.method({
  19173. selector: "visitDagNodeVariantSimple:",
  19174. protocol: "visiting",
  19175. fn: function (aNode){
  19176. var self=this;
  19177. return $core.withContext(function($ctx1) {
  19178. self._visitAllChildren_(aNode);
  19179. return aNode;
  19180. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  19181. },
  19182. args: ["aNode"],
  19183. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  19184. referencedClasses: [],
  19185. messageSends: ["visitAllChildren:"]
  19186. }),
  19187. $globals.AbstractDagVisitor);
  19188. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  19189. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  19190. $core.addMethod(
  19191. $core.method({
  19192. selector: "initialize",
  19193. protocol: "initialization",
  19194. fn: function (){
  19195. var self=this;
  19196. return $core.withContext(function($ctx1) {
  19197. (
  19198. $ctx1.supercall = true,
  19199. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  19200. $ctx1.supercall = false;
  19201. self["@path"]=[];
  19202. return self;
  19203. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  19204. },
  19205. args: [],
  19206. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  19207. referencedClasses: [],
  19208. messageSends: ["initialize"]
  19209. }),
  19210. $globals.PathDagVisitor);
  19211. $core.addMethod(
  19212. $core.method({
  19213. selector: "path",
  19214. protocol: "accessing",
  19215. fn: function (){
  19216. var self=this;
  19217. return self["@path"];
  19218. },
  19219. args: [],
  19220. source: "path\x0a\x09^ path",
  19221. referencedClasses: [],
  19222. messageSends: []
  19223. }),
  19224. $globals.PathDagVisitor);
  19225. $core.addMethod(
  19226. $core.method({
  19227. selector: "visit:",
  19228. protocol: "visiting",
  19229. fn: function (aNode){
  19230. var self=this;
  19231. var oldPath,result;
  19232. return $core.withContext(function($ctx1) {
  19233. result=aNode;
  19234. oldPath=self["@path"];
  19235. $recv((function(){
  19236. return $core.withContext(function($ctx2) {
  19237. self["@path"]=$recv(self["@path"]).__comma([aNode]);
  19238. self["@path"];
  19239. result=(
  19240. $ctx2.supercall = true,
  19241. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  19242. $ctx2.supercall = false;
  19243. return result;
  19244. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19245. }))._ensure_((function(){
  19246. self["@path"]=oldPath;
  19247. return self["@path"];
  19248. }));
  19249. return result;
  19250. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  19251. },
  19252. args: ["aNode"],
  19253. 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",
  19254. referencedClasses: [],
  19255. messageSends: ["ensure:", ",", "visit:"]
  19256. }),
  19257. $globals.PathDagVisitor);
  19258. $core.addMethod(
  19259. $core.method({
  19260. selector: "visitDagNodeVariantRedux:",
  19261. protocol: "visiting",
  19262. fn: function (aNode){
  19263. var self=this;
  19264. var newNode;
  19265. return $core.withContext(function($ctx1) {
  19266. var $1;
  19267. newNode=(
  19268. $ctx1.supercall = true,
  19269. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($recv(self), [aNode]));
  19270. $ctx1.supercall = false;
  19271. $1=$recv(aNode).__eq_eq(newNode);
  19272. if(!$core.assert($1)){
  19273. $recv(self["@path"])._at_put_($recv(self["@path"])._size(),newNode);
  19274. }
  19275. return newNode;
  19276. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  19277. },
  19278. args: ["aNode"],
  19279. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  19280. referencedClasses: [],
  19281. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  19282. }),
  19283. $globals.PathDagVisitor);
  19284. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  19285. $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).";
  19286. $core.addMethod(
  19287. $core.method({
  19288. selector: "acceptDagVisitor:",
  19289. protocol: "visiting",
  19290. fn: function (aVisitor){
  19291. var self=this;
  19292. return $core.withContext(function($ctx1) {
  19293. return $recv(aVisitor)._visitDagNode_(self);
  19294. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  19295. },
  19296. args: ["aVisitor"],
  19297. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  19298. referencedClasses: [],
  19299. messageSends: ["visitDagNode:"]
  19300. }),
  19301. $globals.DagNode);
  19302. $core.addMethod(
  19303. $core.method({
  19304. selector: "allDagChildren",
  19305. protocol: "accessing",
  19306. fn: function (){
  19307. var self=this;
  19308. var allNodes;
  19309. return $core.withContext(function($ctx1) {
  19310. var $1;
  19311. $1=self._dagChildren();
  19312. $ctx1.sendIdx["dagChildren"]=1;
  19313. allNodes=$recv($1)._asSet();
  19314. $recv(self._dagChildren())._do_((function(each){
  19315. return $core.withContext(function($ctx2) {
  19316. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  19317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19318. }));
  19319. return allNodes;
  19320. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  19321. },
  19322. args: [],
  19323. 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",
  19324. referencedClasses: [],
  19325. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  19326. }),
  19327. $globals.DagNode);
  19328. $core.addMethod(
  19329. $core.method({
  19330. selector: "dagChildren",
  19331. protocol: "accessing",
  19332. fn: function (){
  19333. var self=this;
  19334. return $core.withContext(function($ctx1) {
  19335. self._subclassResponsibility();
  19336. return self;
  19337. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  19338. },
  19339. args: [],
  19340. source: "dagChildren\x0a\x09self subclassResponsibility",
  19341. referencedClasses: [],
  19342. messageSends: ["subclassResponsibility"]
  19343. }),
  19344. $globals.DagNode);
  19345. $core.addMethod(
  19346. $core.method({
  19347. selector: "dagChildren:",
  19348. protocol: "accessing",
  19349. fn: function (aCollection){
  19350. var self=this;
  19351. return $core.withContext(function($ctx1) {
  19352. self._subclassResponsibility();
  19353. return self;
  19354. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  19355. },
  19356. args: ["aCollection"],
  19357. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  19358. referencedClasses: [],
  19359. messageSends: ["subclassResponsibility"]
  19360. }),
  19361. $globals.DagNode);
  19362. $core.addMethod(
  19363. $core.method({
  19364. selector: "isDagNode",
  19365. protocol: "testing",
  19366. fn: function (){
  19367. var self=this;
  19368. return true;
  19369. },
  19370. args: [],
  19371. source: "isDagNode\x0a\x09^ true",
  19372. referencedClasses: [],
  19373. messageSends: []
  19374. }),
  19375. $globals.DagNode);
  19376. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  19377. $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.";
  19378. $core.addMethod(
  19379. $core.method({
  19380. selector: "addDagChild:",
  19381. protocol: "accessing",
  19382. fn: function (aDagNode){
  19383. var self=this;
  19384. return $core.withContext(function($ctx1) {
  19385. $recv(self._dagChildren())._add_(aDagNode);
  19386. return self;
  19387. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  19388. },
  19389. args: ["aDagNode"],
  19390. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  19391. referencedClasses: [],
  19392. messageSends: ["add:", "dagChildren"]
  19393. }),
  19394. $globals.DagParentNode);
  19395. $core.addMethod(
  19396. $core.method({
  19397. selector: "dagChildren",
  19398. protocol: "accessing",
  19399. fn: function (){
  19400. var self=this;
  19401. return $core.withContext(function($ctx1) {
  19402. var $1,$receiver;
  19403. $1=self["@nodes"];
  19404. if(($receiver = $1) == null || $receiver.isNil){
  19405. self["@nodes"]=$recv($globals.Array)._new();
  19406. return self["@nodes"];
  19407. } else {
  19408. return $1;
  19409. }
  19410. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  19411. },
  19412. args: [],
  19413. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  19414. referencedClasses: ["Array"],
  19415. messageSends: ["ifNil:", "new"]
  19416. }),
  19417. $globals.DagParentNode);
  19418. $core.addMethod(
  19419. $core.method({
  19420. selector: "dagChildren:",
  19421. protocol: "accessing",
  19422. fn: function (aCollection){
  19423. var self=this;
  19424. self["@nodes"]=aCollection;
  19425. return self;
  19426. },
  19427. args: ["aCollection"],
  19428. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  19429. referencedClasses: [],
  19430. messageSends: []
  19431. }),
  19432. $globals.DagParentNode);
  19433. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  19434. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  19435. $core.addMethod(
  19436. $core.method({
  19437. selector: "dagChildren",
  19438. protocol: "accessing",
  19439. fn: function (){
  19440. var self=this;
  19441. return [];
  19442. },
  19443. args: [],
  19444. source: "dagChildren\x0a\x09^ #()",
  19445. referencedClasses: [],
  19446. messageSends: []
  19447. }),
  19448. $globals.DagSink);
  19449. $core.addMethod(
  19450. $core.method({
  19451. selector: "dagChildren:",
  19452. protocol: "accessing",
  19453. fn: function (aCollection){
  19454. var self=this;
  19455. return $core.withContext(function($ctx1) {
  19456. $recv(aCollection)._ifNotEmpty_((function(){
  19457. return $core.withContext(function($ctx2) {
  19458. return self._error_("A DagSink cannot have children.");
  19459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19460. }));
  19461. return self;
  19462. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  19463. },
  19464. args: ["aCollection"],
  19465. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  19466. referencedClasses: [],
  19467. messageSends: ["ifNotEmpty:", "error:"]
  19468. }),
  19469. $globals.DagSink);
  19470. $core.addMethod(
  19471. $core.method({
  19472. selector: "isDagNode",
  19473. protocol: "*Kernel-Dag",
  19474. fn: function (){
  19475. var self=this;
  19476. return false;
  19477. },
  19478. args: [],
  19479. source: "isDagNode\x0a\x09^ false",
  19480. referencedClasses: [],
  19481. messageSends: []
  19482. }),
  19483. $globals.Object);
  19484. });
  19485. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19486. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  19487. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19488. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  19489. $core.addPackage("Kernel-Exceptions");
  19490. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  19491. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19492. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  19493. $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.";
  19494. $core.addMethod(
  19495. $core.method({
  19496. selector: "beHandled",
  19497. protocol: "accessing",
  19498. fn: function (){
  19499. var self=this;
  19500. return $core.withContext(function($ctx1) {
  19501. self.amberHandled = true;
  19502. return self;
  19503. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  19504. },
  19505. args: [],
  19506. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  19507. referencedClasses: [],
  19508. messageSends: []
  19509. }),
  19510. $globals.Error);
  19511. $core.addMethod(
  19512. $core.method({
  19513. selector: "beUnhandled",
  19514. protocol: "accessing",
  19515. fn: function (){
  19516. var self=this;
  19517. return $core.withContext(function($ctx1) {
  19518. self.amberHandled = false;
  19519. return self;
  19520. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  19521. },
  19522. args: [],
  19523. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  19524. referencedClasses: [],
  19525. messageSends: []
  19526. }),
  19527. $globals.Error);
  19528. $core.addMethod(
  19529. $core.method({
  19530. selector: "context",
  19531. protocol: "accessing",
  19532. fn: function (){
  19533. var self=this;
  19534. return $core.withContext(function($ctx1) {
  19535. return self.context;
  19536. return self;
  19537. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  19538. },
  19539. args: [],
  19540. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  19541. referencedClasses: [],
  19542. messageSends: []
  19543. }),
  19544. $globals.Error);
  19545. $core.addMethod(
  19546. $core.method({
  19547. selector: "initialize",
  19548. protocol: "initialization",
  19549. fn: function (){
  19550. var self=this;
  19551. return $core.withContext(function($ctx1) {
  19552. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  19553. return self;
  19554. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  19555. },
  19556. args: [],
  19557. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  19558. referencedClasses: [],
  19559. messageSends: ["messageText:", ",", "name", "class"]
  19560. }),
  19561. $globals.Error);
  19562. $core.addMethod(
  19563. $core.method({
  19564. selector: "isSmalltalkError",
  19565. protocol: "testing",
  19566. fn: function (){
  19567. var self=this;
  19568. return $core.withContext(function($ctx1) {
  19569. return self.smalltalkError === true;
  19570. return self;
  19571. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  19572. },
  19573. args: [],
  19574. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  19575. referencedClasses: [],
  19576. messageSends: []
  19577. }),
  19578. $globals.Error);
  19579. $core.addMethod(
  19580. $core.method({
  19581. selector: "jsStack",
  19582. protocol: "accessing",
  19583. fn: function (){
  19584. var self=this;
  19585. return $core.withContext(function($ctx1) {
  19586. return self.stack;
  19587. return self;
  19588. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  19589. },
  19590. args: [],
  19591. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  19592. referencedClasses: [],
  19593. messageSends: []
  19594. }),
  19595. $globals.Error);
  19596. $core.addMethod(
  19597. $core.method({
  19598. selector: "messageText",
  19599. protocol: "accessing",
  19600. fn: function (){
  19601. var self=this;
  19602. return self["@messageText"];
  19603. },
  19604. args: [],
  19605. source: "messageText\x0a\x09^ messageText",
  19606. referencedClasses: [],
  19607. messageSends: []
  19608. }),
  19609. $globals.Error);
  19610. $core.addMethod(
  19611. $core.method({
  19612. selector: "messageText:",
  19613. protocol: "accessing",
  19614. fn: function (aString){
  19615. var self=this;
  19616. self["@messageText"]=aString;
  19617. return self;
  19618. },
  19619. args: ["aString"],
  19620. source: "messageText: aString\x0a\x09messageText := aString",
  19621. referencedClasses: [],
  19622. messageSends: []
  19623. }),
  19624. $globals.Error);
  19625. $core.addMethod(
  19626. $core.method({
  19627. selector: "resignal",
  19628. protocol: "signaling",
  19629. fn: function (){
  19630. var self=this;
  19631. return $core.withContext(function($ctx1) {
  19632. self.amberHandled = false;
  19633. throw(self);
  19634. ;
  19635. return self;
  19636. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  19637. },
  19638. args: [],
  19639. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09'>",
  19640. referencedClasses: [],
  19641. messageSends: []
  19642. }),
  19643. $globals.Error);
  19644. $core.addMethod(
  19645. $core.method({
  19646. selector: "signal",
  19647. protocol: "signaling",
  19648. fn: function (){
  19649. var self=this;
  19650. return $core.withContext(function($ctx1) {
  19651. self.amberHandled = false;
  19652. self.context = $core.getThisContext();
  19653. self.smalltalkError = true;
  19654. throw self;
  19655. ;
  19656. return self;
  19657. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  19658. },
  19659. args: [],
  19660. 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'>",
  19661. referencedClasses: [],
  19662. messageSends: []
  19663. }),
  19664. $globals.Error);
  19665. $core.addMethod(
  19666. $core.method({
  19667. selector: "signal:",
  19668. protocol: "signaling",
  19669. fn: function (aString){
  19670. var self=this;
  19671. return $core.withContext(function($ctx1) {
  19672. self._messageText_(aString);
  19673. self._signal();
  19674. return self;
  19675. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  19676. },
  19677. args: ["aString"],
  19678. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  19679. referencedClasses: [],
  19680. messageSends: ["messageText:", "signal"]
  19681. }),
  19682. $globals.Error);
  19683. $core.addMethod(
  19684. $core.method({
  19685. selector: "signalerContext",
  19686. protocol: "accessing",
  19687. fn: function (){
  19688. var self=this;
  19689. return $core.withContext(function($ctx1) {
  19690. return self._signalerContextFrom_(self._context());
  19691. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  19692. },
  19693. args: [],
  19694. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  19695. referencedClasses: [],
  19696. messageSends: ["signalerContextFrom:", "context"]
  19697. }),
  19698. $globals.Error);
  19699. $core.addMethod(
  19700. $core.method({
  19701. selector: "signalerContextFrom:",
  19702. protocol: "accessing",
  19703. fn: function (aContext){
  19704. var self=this;
  19705. return $core.withContext(function($ctx1) {
  19706. var $3,$2,$1;
  19707. return $recv(aContext)._findContextSuchThat_((function(context){
  19708. return $core.withContext(function($ctx2) {
  19709. $3=$recv(context)._receiver();
  19710. $ctx2.sendIdx["receiver"]=1;
  19711. $2=$recv($3).__eq_eq(self);
  19712. $ctx2.sendIdx["=="]=1;
  19713. $1=$recv($2)._or_((function(){
  19714. return $core.withContext(function($ctx3) {
  19715. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  19716. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19717. }));
  19718. return $recv($1)._not();
  19719. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  19720. }));
  19721. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  19722. },
  19723. args: ["aContext"],
  19724. 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 ]",
  19725. referencedClasses: [],
  19726. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  19727. }),
  19728. $globals.Error);
  19729. $core.addMethod(
  19730. $core.method({
  19731. selector: "wasHandled",
  19732. protocol: "testing",
  19733. fn: function (){
  19734. var self=this;
  19735. return $core.withContext(function($ctx1) {
  19736. return self.amberHandled || false;
  19737. return self;
  19738. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  19739. },
  19740. args: [],
  19741. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  19742. referencedClasses: [],
  19743. messageSends: []
  19744. }),
  19745. $globals.Error);
  19746. $core.addMethod(
  19747. $core.method({
  19748. selector: "classTag",
  19749. protocol: "accessing",
  19750. fn: function (){
  19751. var self=this;
  19752. return "exception";
  19753. },
  19754. args: [],
  19755. 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'",
  19756. referencedClasses: [],
  19757. messageSends: []
  19758. }),
  19759. $globals.Error.klass);
  19760. $core.addMethod(
  19761. $core.method({
  19762. selector: "signal",
  19763. protocol: "instance creation",
  19764. fn: function (){
  19765. var self=this;
  19766. return $core.withContext(function($ctx1) {
  19767. return $recv(self._new())._signal();
  19768. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  19769. },
  19770. args: [],
  19771. source: "signal\x0a\x09^ self new signal",
  19772. referencedClasses: [],
  19773. messageSends: ["signal", "new"]
  19774. }),
  19775. $globals.Error.klass);
  19776. $core.addMethod(
  19777. $core.method({
  19778. selector: "signal:",
  19779. protocol: "instance creation",
  19780. fn: function (aString){
  19781. var self=this;
  19782. return $core.withContext(function($ctx1) {
  19783. return $recv(self._new())._signal_(aString);
  19784. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  19785. },
  19786. args: ["aString"],
  19787. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  19788. referencedClasses: [],
  19789. messageSends: ["signal:", "new"]
  19790. }),
  19791. $globals.Error.klass);
  19792. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  19793. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  19794. $core.addMethod(
  19795. $core.method({
  19796. selector: "messageText",
  19797. protocol: "accessing",
  19798. fn: function (){
  19799. var self=this;
  19800. return "Halt encountered";
  19801. },
  19802. args: [],
  19803. source: "messageText\x0a\x09^ 'Halt encountered'",
  19804. referencedClasses: [],
  19805. messageSends: []
  19806. }),
  19807. $globals.Halt);
  19808. $core.addMethod(
  19809. $core.method({
  19810. selector: "signalerContextFrom:",
  19811. protocol: "accessing",
  19812. fn: function (aContext){
  19813. var self=this;
  19814. return $core.withContext(function($ctx1) {
  19815. var $3,$2,$1;
  19816. return $recv(aContext)._findContextSuchThat_((function(context){
  19817. return $core.withContext(function($ctx2) {
  19818. $3=$recv(context)._receiver();
  19819. $ctx2.sendIdx["receiver"]=1;
  19820. $2=$recv($3).__eq_eq(self);
  19821. $ctx2.sendIdx["=="]=1;
  19822. $1=$recv($2)._or_((function(){
  19823. return $core.withContext(function($ctx3) {
  19824. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  19825. return $core.withContext(function($ctx4) {
  19826. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  19827. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  19828. }));
  19829. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19830. }));
  19831. $ctx2.sendIdx["or:"]=1;
  19832. return $recv($1)._not();
  19833. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  19834. }));
  19835. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  19836. },
  19837. args: ["aContext"],
  19838. 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 ]",
  19839. referencedClasses: [],
  19840. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  19841. }),
  19842. $globals.Halt);
  19843. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  19844. $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:`";
  19845. $core.addMethod(
  19846. $core.method({
  19847. selector: "context:",
  19848. protocol: "accessing",
  19849. fn: function (aMethodContext){
  19850. var self=this;
  19851. return $core.withContext(function($ctx1) {
  19852. self.context = aMethodContext;
  19853. return self;
  19854. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  19855. },
  19856. args: ["aMethodContext"],
  19857. 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'>",
  19858. referencedClasses: [],
  19859. messageSends: []
  19860. }),
  19861. $globals.JavaScriptException);
  19862. $core.addMethod(
  19863. $core.method({
  19864. selector: "exception",
  19865. protocol: "accessing",
  19866. fn: function (){
  19867. var self=this;
  19868. return self["@exception"];
  19869. },
  19870. args: [],
  19871. source: "exception\x0a\x09^ exception",
  19872. referencedClasses: [],
  19873. messageSends: []
  19874. }),
  19875. $globals.JavaScriptException);
  19876. $core.addMethod(
  19877. $core.method({
  19878. selector: "exception:",
  19879. protocol: "accessing",
  19880. fn: function (anException){
  19881. var self=this;
  19882. self["@exception"]=anException;
  19883. return self;
  19884. },
  19885. args: ["anException"],
  19886. source: "exception: anException\x0a\x09exception := anException",
  19887. referencedClasses: [],
  19888. messageSends: []
  19889. }),
  19890. $globals.JavaScriptException);
  19891. $core.addMethod(
  19892. $core.method({
  19893. selector: "messageText",
  19894. protocol: "accessing",
  19895. fn: function (){
  19896. var self=this;
  19897. return $core.withContext(function($ctx1) {
  19898. return "JavaScript exception: " + self["@exception"].toString();
  19899. return self;
  19900. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  19901. },
  19902. args: [],
  19903. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + self[\x22@exception\x22].toString()'>",
  19904. referencedClasses: [],
  19905. messageSends: []
  19906. }),
  19907. $globals.JavaScriptException);
  19908. $core.addMethod(
  19909. $core.method({
  19910. selector: "on:",
  19911. protocol: "instance creation",
  19912. fn: function (anException){
  19913. var self=this;
  19914. return $core.withContext(function($ctx1) {
  19915. var $1;
  19916. $1=self._new();
  19917. $recv($1)._exception_(anException);
  19918. return $recv($1)._yourself();
  19919. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  19920. },
  19921. args: ["anException"],
  19922. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  19923. referencedClasses: [],
  19924. messageSends: ["exception:", "new", "yourself"]
  19925. }),
  19926. $globals.JavaScriptException.klass);
  19927. $core.addMethod(
  19928. $core.method({
  19929. selector: "on:context:",
  19930. protocol: "instance creation",
  19931. fn: function (anException,aMethodContext){
  19932. var self=this;
  19933. return $core.withContext(function($ctx1) {
  19934. var $1;
  19935. $1=self._new();
  19936. $recv($1)._exception_(anException);
  19937. $recv($1)._context_(aMethodContext);
  19938. return $recv($1)._yourself();
  19939. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  19940. },
  19941. args: ["anException", "aMethodContext"],
  19942. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  19943. referencedClasses: [],
  19944. messageSends: ["exception:", "new", "context:", "yourself"]
  19945. }),
  19946. $globals.JavaScriptException.klass);
  19947. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  19948. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  19949. $core.addMethod(
  19950. $core.method({
  19951. selector: "message",
  19952. protocol: "accessing",
  19953. fn: function (){
  19954. var self=this;
  19955. return self["@message"];
  19956. },
  19957. args: [],
  19958. source: "message\x0a\x09^ message",
  19959. referencedClasses: [],
  19960. messageSends: []
  19961. }),
  19962. $globals.MessageNotUnderstood);
  19963. $core.addMethod(
  19964. $core.method({
  19965. selector: "message:",
  19966. protocol: "accessing",
  19967. fn: function (aMessage){
  19968. var self=this;
  19969. self["@message"]=aMessage;
  19970. return self;
  19971. },
  19972. args: ["aMessage"],
  19973. source: "message: aMessage\x0a\x09message := aMessage",
  19974. referencedClasses: [],
  19975. messageSends: []
  19976. }),
  19977. $globals.MessageNotUnderstood);
  19978. $core.addMethod(
  19979. $core.method({
  19980. selector: "messageText",
  19981. protocol: "accessing",
  19982. fn: function (){
  19983. var self=this;
  19984. return $core.withContext(function($ctx1) {
  19985. var $1;
  19986. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  19987. $ctx1.sendIdx[","]=1;
  19988. return $1;
  19989. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  19990. },
  19991. args: [],
  19992. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  19993. referencedClasses: [],
  19994. messageSends: [",", "asString", "receiver", "selector", "message"]
  19995. }),
  19996. $globals.MessageNotUnderstood);
  19997. $core.addMethod(
  19998. $core.method({
  19999. selector: "receiver",
  20000. protocol: "accessing",
  20001. fn: function (){
  20002. var self=this;
  20003. return self["@receiver"];
  20004. },
  20005. args: [],
  20006. source: "receiver\x0a\x09^ receiver",
  20007. referencedClasses: [],
  20008. messageSends: []
  20009. }),
  20010. $globals.MessageNotUnderstood);
  20011. $core.addMethod(
  20012. $core.method({
  20013. selector: "receiver:",
  20014. protocol: "accessing",
  20015. fn: function (anObject){
  20016. var self=this;
  20017. self["@receiver"]=anObject;
  20018. return self;
  20019. },
  20020. args: ["anObject"],
  20021. source: "receiver: anObject\x0a\x09receiver := anObject",
  20022. referencedClasses: [],
  20023. messageSends: []
  20024. }),
  20025. $globals.MessageNotUnderstood);
  20026. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  20027. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20028. $core.addMethod(
  20029. $core.method({
  20030. selector: "object",
  20031. protocol: "accessing",
  20032. fn: function (){
  20033. var self=this;
  20034. return self["@object"];
  20035. },
  20036. args: [],
  20037. source: "object\x0a\x09^ object",
  20038. referencedClasses: [],
  20039. messageSends: []
  20040. }),
  20041. $globals.NonBooleanReceiver);
  20042. $core.addMethod(
  20043. $core.method({
  20044. selector: "object:",
  20045. protocol: "accessing",
  20046. fn: function (anObject){
  20047. var self=this;
  20048. self["@object"]=anObject;
  20049. return self;
  20050. },
  20051. args: ["anObject"],
  20052. source: "object: anObject\x0a\x09object := anObject",
  20053. referencedClasses: [],
  20054. messageSends: []
  20055. }),
  20056. $globals.NonBooleanReceiver);
  20057. });
  20058. define('amber_core/Kernel-Infrastructure',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20059. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  20060. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20061. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  20062. $core.addPackage("Kernel-Infrastructure");
  20063. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  20064. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20065. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  20066. $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`.";
  20067. $core.addMethod(
  20068. $core.method({
  20069. selector: "=",
  20070. protocol: "comparing",
  20071. fn: function (anObject){
  20072. var self=this;
  20073. return $core.withContext(function($ctx1) {
  20074. var $2,$1;
  20075. $2=$recv(anObject)._class();
  20076. $ctx1.sendIdx["class"]=1;
  20077. $1=$recv($2).__eq_eq(self._class());
  20078. if(!$core.assert($1)){
  20079. return false;
  20080. }
  20081. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  20082. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  20083. },
  20084. args: ["anObject"],
  20085. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  20086. referencedClasses: ["JSObjectProxy"],
  20087. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  20088. }),
  20089. $globals.JSObjectProxy);
  20090. $core.addMethod(
  20091. $core.method({
  20092. selector: "asJavaScriptObject",
  20093. protocol: "converting",
  20094. fn: function (){
  20095. var self=this;
  20096. return self["@jsObject"];
  20097. },
  20098. args: [],
  20099. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  20100. referencedClasses: [],
  20101. messageSends: []
  20102. }),
  20103. $globals.JSObjectProxy);
  20104. $core.addMethod(
  20105. $core.method({
  20106. selector: "at:",
  20107. protocol: "accessing",
  20108. fn: function (aString){
  20109. var self=this;
  20110. return $core.withContext(function($ctx1) {
  20111. return self['@jsObject'][aString];
  20112. return self;
  20113. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  20114. },
  20115. args: ["aString"],
  20116. source: "at: aString\x0a\x09<inlineJS: 'return self[''@jsObject''][aString]'>",
  20117. referencedClasses: [],
  20118. messageSends: []
  20119. }),
  20120. $globals.JSObjectProxy);
  20121. $core.addMethod(
  20122. $core.method({
  20123. selector: "at:ifAbsent:",
  20124. protocol: "accessing",
  20125. fn: function (aString,aBlock){
  20126. var self=this;
  20127. return $core.withContext(function($ctx1) {
  20128. var obj = self['@jsObject'];
  20129. return aString in obj ? obj[aString] : aBlock._value();
  20130. ;
  20131. return self;
  20132. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  20133. },
  20134. args: ["aString", "aBlock"],
  20135. 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'>",
  20136. referencedClasses: [],
  20137. messageSends: []
  20138. }),
  20139. $globals.JSObjectProxy);
  20140. $core.addMethod(
  20141. $core.method({
  20142. selector: "at:ifPresent:",
  20143. protocol: "accessing",
  20144. fn: function (aString,aBlock){
  20145. var self=this;
  20146. return $core.withContext(function($ctx1) {
  20147. var obj = self['@jsObject'];
  20148. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  20149. ;
  20150. return self;
  20151. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  20152. },
  20153. args: ["aString", "aBlock"],
  20154. 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'>",
  20155. referencedClasses: [],
  20156. messageSends: []
  20157. }),
  20158. $globals.JSObjectProxy);
  20159. $core.addMethod(
  20160. $core.method({
  20161. selector: "at:ifPresent:ifAbsent:",
  20162. protocol: "accessing",
  20163. fn: function (aString,aBlock,anotherBlock){
  20164. var self=this;
  20165. return $core.withContext(function($ctx1) {
  20166. var obj = self['@jsObject'];
  20167. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  20168. ;
  20169. return self;
  20170. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20171. },
  20172. args: ["aString", "aBlock", "anotherBlock"],
  20173. 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'>",
  20174. referencedClasses: [],
  20175. messageSends: []
  20176. }),
  20177. $globals.JSObjectProxy);
  20178. $core.addMethod(
  20179. $core.method({
  20180. selector: "at:put:",
  20181. protocol: "accessing",
  20182. fn: function (aString,anObject){
  20183. var self=this;
  20184. return $core.withContext(function($ctx1) {
  20185. return self['@jsObject'][aString] = anObject;
  20186. return self;
  20187. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  20188. },
  20189. args: ["aString", "anObject"],
  20190. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return self[''@jsObject''][aString] = anObject'>",
  20191. referencedClasses: [],
  20192. messageSends: []
  20193. }),
  20194. $globals.JSObjectProxy);
  20195. $core.addMethod(
  20196. $core.method({
  20197. selector: "doesNotUnderstand:",
  20198. protocol: "proxy",
  20199. fn: function (aMessage){
  20200. var self=this;
  20201. return $core.withContext(function($ctx1) {
  20202. var $1,$receiver;
  20203. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  20204. if(($receiver = $1) == null || $receiver.isNil){
  20205. return (
  20206. $ctx1.supercall = true,
  20207. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  20208. $ctx1.supercall = false;
  20209. } else {
  20210. var jsSelector;
  20211. jsSelector=$receiver;
  20212. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  20213. }
  20214. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  20215. },
  20216. args: ["aMessage"],
  20217. 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 ]",
  20218. referencedClasses: ["JSObjectProxy"],
  20219. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  20220. }),
  20221. $globals.JSObjectProxy);
  20222. $core.addMethod(
  20223. $core.method({
  20224. selector: "in:",
  20225. protocol: "accessing",
  20226. fn: function (aValuable){
  20227. var self=this;
  20228. return $core.withContext(function($ctx1) {
  20229. return $recv(aValuable)._value_(self["@jsObject"]);
  20230. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  20231. },
  20232. args: ["aValuable"],
  20233. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  20234. referencedClasses: [],
  20235. messageSends: ["value:"]
  20236. }),
  20237. $globals.JSObjectProxy);
  20238. $core.addMethod(
  20239. $core.method({
  20240. selector: "jsObject",
  20241. protocol: "accessing",
  20242. fn: function (){
  20243. var self=this;
  20244. return self["@jsObject"];
  20245. },
  20246. args: [],
  20247. source: "jsObject\x0a\x09^ jsObject",
  20248. referencedClasses: [],
  20249. messageSends: []
  20250. }),
  20251. $globals.JSObjectProxy);
  20252. $core.addMethod(
  20253. $core.method({
  20254. selector: "keysAndValuesDo:",
  20255. protocol: "enumerating",
  20256. fn: function (aBlock){
  20257. var self=this;
  20258. return $core.withContext(function($ctx1) {
  20259. var o = self['@jsObject'];
  20260. for(var i in o) {
  20261. aBlock._value_value_(i, o[i]);
  20262. }
  20263. ;
  20264. return self;
  20265. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  20266. },
  20267. args: ["aBlock"],
  20268. 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'>",
  20269. referencedClasses: [],
  20270. messageSends: []
  20271. }),
  20272. $globals.JSObjectProxy);
  20273. $core.addMethod(
  20274. $core.method({
  20275. selector: "printOn:",
  20276. protocol: "printing",
  20277. fn: function (aStream){
  20278. var self=this;
  20279. return $core.withContext(function($ctx1) {
  20280. $recv(aStream)._nextPutAll_(self._printString());
  20281. return self;
  20282. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  20283. },
  20284. args: ["aStream"],
  20285. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  20286. referencedClasses: [],
  20287. messageSends: ["nextPutAll:", "printString"]
  20288. }),
  20289. $globals.JSObjectProxy);
  20290. $core.addMethod(
  20291. $core.method({
  20292. selector: "printString",
  20293. protocol: "printing",
  20294. fn: function (){
  20295. var self=this;
  20296. return $core.withContext(function($ctx1) {
  20297. var js = self['@jsObject'];
  20298. return js.toString
  20299. ? js.toString()
  20300. : Object.prototype.toString.call(js)
  20301. ;
  20302. return self;
  20303. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  20304. },
  20305. args: [],
  20306. 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'>",
  20307. referencedClasses: [],
  20308. messageSends: []
  20309. }),
  20310. $globals.JSObjectProxy);
  20311. $core.addMethod(
  20312. $core.method({
  20313. selector: "putOn:",
  20314. protocol: "streaming",
  20315. fn: function (aStream){
  20316. var self=this;
  20317. return $core.withContext(function($ctx1) {
  20318. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  20319. return self;
  20320. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  20321. },
  20322. args: ["aStream"],
  20323. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  20324. referencedClasses: [],
  20325. messageSends: ["nextPutJSObject:"]
  20326. }),
  20327. $globals.JSObjectProxy);
  20328. $core.addMethod(
  20329. $core.method({
  20330. selector: "addObjectVariablesTo:ofProxy:",
  20331. protocol: "proxy",
  20332. fn: function (aDictionary,aProxy){
  20333. var self=this;
  20334. return $core.withContext(function($ctx1) {
  20335. var jsObject = aProxy['@jsObject'];
  20336. for(var i in jsObject) {
  20337. aDictionary._at_put_(i, jsObject[i]);
  20338. }
  20339. ;
  20340. return self;
  20341. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  20342. },
  20343. args: ["aDictionary", "aProxy"],
  20344. 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'>",
  20345. referencedClasses: [],
  20346. messageSends: []
  20347. }),
  20348. $globals.JSObjectProxy.klass);
  20349. $core.addMethod(
  20350. $core.method({
  20351. selector: "compareJSObjectOfProxy:withProxy:",
  20352. protocol: "proxy",
  20353. fn: function (aProxy,anotherProxy){
  20354. var self=this;
  20355. return $core.withContext(function($ctx1) {
  20356. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  20357. return aProxy["@jsObject"] === anotherJSObject;
  20358. return self;
  20359. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  20360. },
  20361. args: ["aProxy", "anotherProxy"],
  20362. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>",
  20363. referencedClasses: [],
  20364. messageSends: []
  20365. }),
  20366. $globals.JSObjectProxy.klass);
  20367. $core.addMethod(
  20368. $core.method({
  20369. selector: "forwardMessage:withArguments:ofProxy:",
  20370. protocol: "proxy",
  20371. fn: function (aString,anArray,aProxy){
  20372. var self=this;
  20373. return $core.withContext(function($ctx1) {
  20374. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  20375. ;
  20376. return self;
  20377. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  20378. },
  20379. args: ["aString", "anArray", "aProxy"],
  20380. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  20381. referencedClasses: [],
  20382. messageSends: []
  20383. }),
  20384. $globals.JSObjectProxy.klass);
  20385. $core.addMethod(
  20386. $core.method({
  20387. selector: "jsObject:ofProxy:",
  20388. protocol: "proxy",
  20389. fn: function (aJSObject,aProxy){
  20390. var self=this;
  20391. return $core.withContext(function($ctx1) {
  20392. aProxy['@jsObject'] = aJSObject;
  20393. return self;
  20394. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  20395. },
  20396. args: ["aJSObject", "aProxy"],
  20397. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  20398. referencedClasses: [],
  20399. messageSends: []
  20400. }),
  20401. $globals.JSObjectProxy.klass);
  20402. $core.addMethod(
  20403. $core.method({
  20404. selector: "lookupProperty:ofProxy:",
  20405. protocol: "proxy",
  20406. fn: function (aString,aProxy){
  20407. var self=this;
  20408. return $core.withContext(function($ctx1) {
  20409. return aString in aProxy._jsObject() ? aString : nil;
  20410. return self;
  20411. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  20412. },
  20413. args: ["aString", "aProxy"],
  20414. 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'>",
  20415. referencedClasses: [],
  20416. messageSends: []
  20417. }),
  20418. $globals.JSObjectProxy.klass);
  20419. $core.addMethod(
  20420. $core.method({
  20421. selector: "on:",
  20422. protocol: "instance creation",
  20423. fn: function (aJSObject){
  20424. var self=this;
  20425. var instance;
  20426. return $core.withContext(function($ctx1) {
  20427. instance=self._new();
  20428. self._jsObject_ofProxy_(aJSObject,instance);
  20429. return instance;
  20430. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  20431. },
  20432. args: ["aJSObject"],
  20433. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  20434. referencedClasses: [],
  20435. messageSends: ["new", "jsObject:ofProxy:"]
  20436. }),
  20437. $globals.JSObjectProxy.klass);
  20438. $core.addClass("Organizer", $globals.Object, [], "Kernel-Infrastructure");
  20439. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  20440. $core.addMethod(
  20441. $core.method({
  20442. selector: "addElement:",
  20443. protocol: "accessing",
  20444. fn: function (anObject){
  20445. var self=this;
  20446. return $core.withContext(function($ctx1) {
  20447. $core.addElement(self.elements, anObject);
  20448. return self;
  20449. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  20450. },
  20451. args: ["anObject"],
  20452. source: "addElement: anObject\x0a\x09<inlineJS: '$core.addElement(self.elements, anObject)'>",
  20453. referencedClasses: [],
  20454. messageSends: []
  20455. }),
  20456. $globals.Organizer);
  20457. $core.addMethod(
  20458. $core.method({
  20459. selector: "elements",
  20460. protocol: "accessing",
  20461. fn: function (){
  20462. var self=this;
  20463. return $core.withContext(function($ctx1) {
  20464. return $recv(self._basicAt_("elements"))._copy();
  20465. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  20466. },
  20467. args: [],
  20468. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  20469. referencedClasses: [],
  20470. messageSends: ["copy", "basicAt:"]
  20471. }),
  20472. $globals.Organizer);
  20473. $core.addMethod(
  20474. $core.method({
  20475. selector: "removeElement:",
  20476. protocol: "accessing",
  20477. fn: function (anObject){
  20478. var self=this;
  20479. return $core.withContext(function($ctx1) {
  20480. $core.removeElement(self.elements, anObject);
  20481. return self;
  20482. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  20483. },
  20484. args: ["anObject"],
  20485. source: "removeElement: anObject\x0a\x09<inlineJS: '$core.removeElement(self.elements, anObject)'>",
  20486. referencedClasses: [],
  20487. messageSends: []
  20488. }),
  20489. $globals.Organizer);
  20490. $core.addClass("ClassOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  20491. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  20492. $core.addMethod(
  20493. $core.method({
  20494. selector: "addElement:",
  20495. protocol: "accessing",
  20496. fn: function (aString){
  20497. var self=this;
  20498. return $core.withContext(function($ctx1) {
  20499. var $1,$3,$2;
  20500. (
  20501. $ctx1.supercall = true,
  20502. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($recv(self), [aString]));
  20503. $ctx1.supercall = false;
  20504. $1=$recv($globals.SystemAnnouncer)._current();
  20505. $3=$recv($globals.ProtocolAdded)._new();
  20506. $recv($3)._protocol_(aString);
  20507. $recv($3)._theClass_(self._theClass());
  20508. $2=$recv($3)._yourself();
  20509. $recv($1)._announce_($2);
  20510. return self;
  20511. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  20512. },
  20513. args: ["aString"],
  20514. 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)",
  20515. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  20516. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  20517. }),
  20518. $globals.ClassOrganizer);
  20519. $core.addMethod(
  20520. $core.method({
  20521. selector: "removeElement:",
  20522. protocol: "accessing",
  20523. fn: function (aString){
  20524. var self=this;
  20525. return $core.withContext(function($ctx1) {
  20526. var $1,$3,$2;
  20527. (
  20528. $ctx1.supercall = true,
  20529. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($recv(self), [aString]));
  20530. $ctx1.supercall = false;
  20531. $1=$recv($globals.SystemAnnouncer)._current();
  20532. $3=$recv($globals.ProtocolRemoved)._new();
  20533. $recv($3)._protocol_(aString);
  20534. $recv($3)._theClass_(self._theClass());
  20535. $2=$recv($3)._yourself();
  20536. $recv($1)._announce_($2);
  20537. return self;
  20538. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  20539. },
  20540. args: ["aString"],
  20541. 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)",
  20542. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  20543. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  20544. }),
  20545. $globals.ClassOrganizer);
  20546. $core.addMethod(
  20547. $core.method({
  20548. selector: "theClass",
  20549. protocol: "accessing",
  20550. fn: function (){
  20551. var self=this;
  20552. return $core.withContext(function($ctx1) {
  20553. return self.theClass;
  20554. return self;
  20555. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  20556. },
  20557. args: [],
  20558. source: "theClass\x0a\x09<inlineJS: 'return self.theClass'>",
  20559. referencedClasses: [],
  20560. messageSends: []
  20561. }),
  20562. $globals.ClassOrganizer);
  20563. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  20564. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  20565. $core.addClass("Package", $globals.Object, ["transport", "imports", "dirty"], "Kernel-Infrastructure");
  20566. $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'";
  20567. $core.addMethod(
  20568. $core.method({
  20569. selector: "basicImports",
  20570. protocol: "private",
  20571. fn: function (){
  20572. var self=this;
  20573. return $core.withContext(function($ctx1) {
  20574. return self.imports || [];
  20575. return self;
  20576. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  20577. },
  20578. args: [],
  20579. source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.imports || []'>",
  20580. referencedClasses: [],
  20581. messageSends: []
  20582. }),
  20583. $globals.Package);
  20584. $core.addMethod(
  20585. $core.method({
  20586. selector: "basicName:",
  20587. protocol: "private",
  20588. fn: function (aString){
  20589. var self=this;
  20590. return $core.withContext(function($ctx1) {
  20591. self.pkgName = aString;
  20592. return self;
  20593. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  20594. },
  20595. args: ["aString"],
  20596. source: "basicName: aString\x0a\x09<inlineJS: 'self.pkgName = aString'>",
  20597. referencedClasses: [],
  20598. messageSends: []
  20599. }),
  20600. $globals.Package);
  20601. $core.addMethod(
  20602. $core.method({
  20603. selector: "basicTransport",
  20604. protocol: "private",
  20605. fn: function (){
  20606. var self=this;
  20607. return $core.withContext(function($ctx1) {
  20608. return self.transport;
  20609. return self;
  20610. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  20611. },
  20612. args: [],
  20613. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<inlineJS: 'return self.transport'>",
  20614. referencedClasses: [],
  20615. messageSends: []
  20616. }),
  20617. $globals.Package);
  20618. $core.addMethod(
  20619. $core.method({
  20620. selector: "beClean",
  20621. protocol: "accessing",
  20622. fn: function (){
  20623. var self=this;
  20624. return $core.withContext(function($ctx1) {
  20625. var $1,$3,$2;
  20626. self["@dirty"]=false;
  20627. $1=$recv($globals.SystemAnnouncer)._current();
  20628. $3=$recv($globals.PackageClean)._new();
  20629. $recv($3)._package_(self);
  20630. $2=$recv($3)._yourself();
  20631. $recv($1)._announce_($2);
  20632. return self;
  20633. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  20634. },
  20635. args: [],
  20636. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  20637. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  20638. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  20639. }),
  20640. $globals.Package);
  20641. $core.addMethod(
  20642. $core.method({
  20643. selector: "beDirty",
  20644. protocol: "accessing",
  20645. fn: function (){
  20646. var self=this;
  20647. return $core.withContext(function($ctx1) {
  20648. var $1,$3,$2;
  20649. self["@dirty"]=true;
  20650. $1=$recv($globals.SystemAnnouncer)._current();
  20651. $3=$recv($globals.PackageDirty)._new();
  20652. $recv($3)._package_(self);
  20653. $2=$recv($3)._yourself();
  20654. $recv($1)._announce_($2);
  20655. return self;
  20656. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  20657. },
  20658. args: [],
  20659. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  20660. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  20661. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  20662. }),
  20663. $globals.Package);
  20664. $core.addMethod(
  20665. $core.method({
  20666. selector: "classTemplate",
  20667. protocol: "accessing",
  20668. fn: function (){
  20669. var self=this;
  20670. return $core.withContext(function($ctx1) {
  20671. return $recv($globals.String)._streamContents_((function(stream){
  20672. return $core.withContext(function($ctx2) {
  20673. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  20674. $ctx2.sendIdx["write:"]=1;
  20675. $recv(stream)._lf();
  20676. $ctx2.sendIdx["lf"]=1;
  20677. $recv(stream)._tab();
  20678. $ctx2.sendIdx["tab"]=1;
  20679. $recv(stream)._write_("instanceVariableNames: ''");
  20680. $ctx2.sendIdx["write:"]=2;
  20681. $recv(stream)._lf();
  20682. $recv(stream)._tab();
  20683. $recv(stream)._write_("package: ");
  20684. return $recv(stream)._print_(self._name());
  20685. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  20686. }));
  20687. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  20688. },
  20689. args: [],
  20690. 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 ]",
  20691. referencedClasses: ["String"],
  20692. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  20693. }),
  20694. $globals.Package);
  20695. $core.addMethod(
  20696. $core.method({
  20697. selector: "classes",
  20698. protocol: "classes",
  20699. fn: function (){
  20700. var self=this;
  20701. return $core.withContext(function($ctx1) {
  20702. return $recv(self._organization())._elements();
  20703. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  20704. },
  20705. args: [],
  20706. source: "classes\x0a\x09^ self organization elements",
  20707. referencedClasses: [],
  20708. messageSends: ["elements", "organization"]
  20709. }),
  20710. $globals.Package);
  20711. $core.addMethod(
  20712. $core.method({
  20713. selector: "definition",
  20714. protocol: "accessing",
  20715. fn: function (){
  20716. var self=this;
  20717. return $core.withContext(function($ctx1) {
  20718. var $1;
  20719. return $recv($globals.String)._streamContents_((function(stream){
  20720. return $core.withContext(function($ctx2) {
  20721. $1=$recv(self._class())._name();
  20722. $ctx2.sendIdx["name"]=1;
  20723. $recv(stream)._write_($1);
  20724. $ctx2.sendIdx["write:"]=1;
  20725. $recv(stream)._lf();
  20726. $ctx2.sendIdx["lf"]=1;
  20727. $recv(stream)._tab();
  20728. $ctx2.sendIdx["tab"]=1;
  20729. $recv(stream)._write_("named: ");
  20730. $ctx2.sendIdx["write:"]=2;
  20731. $recv(stream)._print_(self._name());
  20732. $recv(stream)._lf();
  20733. $ctx2.sendIdx["lf"]=2;
  20734. $recv(stream)._tab();
  20735. $ctx2.sendIdx["tab"]=2;
  20736. $recv(stream)._write_(["imports: ",self._importsDefinition()]);
  20737. $ctx2.sendIdx["write:"]=3;
  20738. $recv(stream)._lf();
  20739. $recv(stream)._tab();
  20740. return $recv(stream)._write_(["transport: (",$recv(self._transport())._definition(),")"]);
  20741. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  20742. }));
  20743. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  20744. },
  20745. args: [],
  20746. 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. ')' } ]",
  20747. referencedClasses: ["String"],
  20748. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  20749. }),
  20750. $globals.Package);
  20751. $core.addMethod(
  20752. $core.method({
  20753. selector: "imports",
  20754. protocol: "accessing",
  20755. fn: function (){
  20756. var self=this;
  20757. return $core.withContext(function($ctx1) {
  20758. var $1,$receiver;
  20759. $1=self["@imports"];
  20760. if(($receiver = $1) == null || $receiver.isNil){
  20761. var parsed;
  20762. parsed=self._importsFromJson_(self._basicImports());
  20763. parsed;
  20764. self._imports_(parsed);
  20765. return self["@imports"];
  20766. } else {
  20767. return $1;
  20768. }
  20769. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  20770. },
  20771. args: [],
  20772. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09| parsed |\x0a\x09\x09parsed := self importsFromJson: self basicImports.\x0a\x09\x09self imports: parsed.\x0a\x09\x09imports ]",
  20773. referencedClasses: [],
  20774. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  20775. }),
  20776. $globals.Package);
  20777. $core.addMethod(
  20778. $core.method({
  20779. selector: "imports:",
  20780. protocol: "accessing",
  20781. fn: function (anArray){
  20782. var self=this;
  20783. return $core.withContext(function($ctx1) {
  20784. self._validateImports_(anArray);
  20785. self["@imports"]=$recv(anArray)._asSet();
  20786. return self;
  20787. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  20788. },
  20789. args: ["anArray"],
  20790. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  20791. referencedClasses: [],
  20792. messageSends: ["validateImports:", "asSet"]
  20793. }),
  20794. $globals.Package);
  20795. $core.addMethod(
  20796. $core.method({
  20797. selector: "importsAsJson",
  20798. protocol: "converting",
  20799. fn: function (){
  20800. var self=this;
  20801. return $core.withContext(function($ctx1) {
  20802. var $1;
  20803. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  20804. return $core.withContext(function($ctx2) {
  20805. $1=$recv(each)._isString();
  20806. if($core.assert($1)){
  20807. return each;
  20808. } else {
  20809. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  20810. $ctx2.sendIdx[","]=1;
  20811. }
  20812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20813. }));
  20814. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  20815. },
  20816. args: [],
  20817. 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 ]]",
  20818. referencedClasses: [],
  20819. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  20820. }),
  20821. $globals.Package);
  20822. $core.addMethod(
  20823. $core.method({
  20824. selector: "importsDefinition",
  20825. protocol: "accessing",
  20826. fn: function (){
  20827. var self=this;
  20828. return $core.withContext(function($ctx1) {
  20829. return $recv($globals.String)._streamContents_((function(stream){
  20830. return $core.withContext(function($ctx2) {
  20831. $recv(stream)._write_("{");
  20832. $ctx2.sendIdx["write:"]=1;
  20833. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  20834. return $core.withContext(function($ctx3) {
  20835. return $recv(stream)._print_(each);
  20836. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  20837. }),(function(){
  20838. return $core.withContext(function($ctx3) {
  20839. return $recv(stream)._write_(". ");
  20840. $ctx3.sendIdx["write:"]=2;
  20841. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  20842. }));
  20843. return $recv(stream)._write_("}");
  20844. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  20845. }));
  20846. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  20847. },
  20848. args: [],
  20849. 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: '}' ]",
  20850. referencedClasses: ["String"],
  20851. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  20852. }),
  20853. $globals.Package);
  20854. $core.addMethod(
  20855. $core.method({
  20856. selector: "importsFromJson:",
  20857. protocol: "converting",
  20858. fn: function (anArray){
  20859. var self=this;
  20860. return $core.withContext(function($ctx1) {
  20861. var $1;
  20862. return $recv(anArray)._collect_((function(each){
  20863. var split;
  20864. return $core.withContext(function($ctx2) {
  20865. split=$recv(each)._tokenize_("=");
  20866. split;
  20867. $1=$recv($recv(split)._size()).__eq((1));
  20868. if($core.assert($1)){
  20869. return $recv(split)._first();
  20870. $ctx2.sendIdx["first"]=1;
  20871. } else {
  20872. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  20873. }
  20874. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  20875. }));
  20876. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  20877. },
  20878. args: ["anArray"],
  20879. 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 ]]",
  20880. referencedClasses: [],
  20881. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  20882. }),
  20883. $globals.Package);
  20884. $core.addMethod(
  20885. $core.method({
  20886. selector: "isDirty",
  20887. protocol: "testing",
  20888. fn: function (){
  20889. var self=this;
  20890. return $core.withContext(function($ctx1) {
  20891. var $1,$receiver;
  20892. $1=self["@dirty"];
  20893. if(($receiver = $1) == null || $receiver.isNil){
  20894. return false;
  20895. } else {
  20896. return $1;
  20897. }
  20898. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  20899. },
  20900. args: [],
  20901. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  20902. referencedClasses: [],
  20903. messageSends: ["ifNil:"]
  20904. }),
  20905. $globals.Package);
  20906. $core.addMethod(
  20907. $core.method({
  20908. selector: "isPackage",
  20909. protocol: "testing",
  20910. fn: function (){
  20911. var self=this;
  20912. return true;
  20913. },
  20914. args: [],
  20915. source: "isPackage\x0a\x09^ true",
  20916. referencedClasses: [],
  20917. messageSends: []
  20918. }),
  20919. $globals.Package);
  20920. $core.addMethod(
  20921. $core.method({
  20922. selector: "loadDependencies",
  20923. protocol: "dependencies",
  20924. fn: function (){
  20925. var self=this;
  20926. var classes,packages;
  20927. return $core.withContext(function($ctx1) {
  20928. var $1;
  20929. classes=self._loadDependencyClasses();
  20930. $1=$recv($recv(classes)._collect_((function(each){
  20931. return $core.withContext(function($ctx2) {
  20932. return $recv(each)._package();
  20933. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20934. })))._asSet();
  20935. $recv($1)._remove_ifAbsent_(self,(function(){
  20936. }));
  20937. return $recv($1)._yourself();
  20938. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  20939. },
  20940. args: [],
  20941. 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",
  20942. referencedClasses: [],
  20943. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  20944. }),
  20945. $globals.Package);
  20946. $core.addMethod(
  20947. $core.method({
  20948. selector: "loadDependencyClasses",
  20949. protocol: "dependencies",
  20950. fn: function (){
  20951. var self=this;
  20952. var starCategoryName;
  20953. return $core.withContext(function($ctx1) {
  20954. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  20955. starCategoryName="*".__comma(self._name());
  20956. $ctx1.sendIdx[","]=1;
  20957. $3=self._classes();
  20958. $ctx1.sendIdx["classes"]=1;
  20959. $2=$recv($3)._collect_((function(each){
  20960. return $core.withContext(function($ctx2) {
  20961. return $recv(each)._superclass();
  20962. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20963. }));
  20964. $ctx1.sendIdx["collect:"]=1;
  20965. $1=$recv($2)._asSet();
  20966. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  20967. return $core.withContext(function($ctx2) {
  20968. $5=$recv(each)._protocols();
  20969. $ctx2.sendIdx["protocols"]=1;
  20970. $7=$recv(each)._theMetaClass();
  20971. if(($receiver = $7) == null || $receiver.isNil){
  20972. $6=[];
  20973. } else {
  20974. var meta;
  20975. meta=$receiver;
  20976. $6=$recv(meta)._protocols();
  20977. }
  20978. $4=$recv($5).__comma($6);
  20979. return $recv($4)._includes_(starCategoryName);
  20980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  20981. })));
  20982. $ctx1.sendIdx["addAll:"]=1;
  20983. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  20984. return $core.withContext(function($ctx2) {
  20985. return $recv(self._traitCompositions())._valuesDo_((function(each){
  20986. return $core.withContext(function($ctx3) {
  20987. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  20988. return $core.withContext(function($ctx4) {
  20989. return $recv(eachTT)._trait();
  20990. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  20991. })));
  20992. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  20993. }));
  20994. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  20995. })));
  20996. $recv($1)._remove_ifAbsent_(nil,(function(){
  20997. }));
  20998. return $recv($1)._yourself();
  20999. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  21000. },
  21001. args: [],
  21002. 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",
  21003. referencedClasses: ["Smalltalk", "Array"],
  21004. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  21005. }),
  21006. $globals.Package);
  21007. $core.addMethod(
  21008. $core.method({
  21009. selector: "name",
  21010. protocol: "accessing",
  21011. fn: function (){
  21012. var self=this;
  21013. return $core.withContext(function($ctx1) {
  21014. return self.pkgName;
  21015. return self;
  21016. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  21017. },
  21018. args: [],
  21019. source: "name\x0a\x09<inlineJS: 'return self.pkgName'>",
  21020. referencedClasses: [],
  21021. messageSends: []
  21022. }),
  21023. $globals.Package);
  21024. $core.addMethod(
  21025. $core.method({
  21026. selector: "name:",
  21027. protocol: "accessing",
  21028. fn: function (aString){
  21029. var self=this;
  21030. return $core.withContext(function($ctx1) {
  21031. self._basicName_(aString);
  21032. self._beDirty();
  21033. return self;
  21034. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  21035. },
  21036. args: ["aString"],
  21037. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  21038. referencedClasses: [],
  21039. messageSends: ["basicName:", "beDirty"]
  21040. }),
  21041. $globals.Package);
  21042. $core.addMethod(
  21043. $core.method({
  21044. selector: "organization",
  21045. protocol: "accessing",
  21046. fn: function (){
  21047. var self=this;
  21048. return $core.withContext(function($ctx1) {
  21049. return self._basicAt_("organization");
  21050. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  21051. },
  21052. args: [],
  21053. source: "organization\x0a\x09^ self basicAt: 'organization'",
  21054. referencedClasses: [],
  21055. messageSends: ["basicAt:"]
  21056. }),
  21057. $globals.Package);
  21058. $core.addMethod(
  21059. $core.method({
  21060. selector: "printOn:",
  21061. protocol: "printing",
  21062. fn: function (aStream){
  21063. var self=this;
  21064. return $core.withContext(function($ctx1) {
  21065. (
  21066. $ctx1.supercall = true,
  21067. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  21068. $ctx1.supercall = false;
  21069. $recv(aStream)._nextPutAll_(" (");
  21070. $ctx1.sendIdx["nextPutAll:"]=1;
  21071. $recv(aStream)._nextPutAll_(self._name());
  21072. $ctx1.sendIdx["nextPutAll:"]=2;
  21073. $recv(aStream)._nextPutAll_(")");
  21074. return self;
  21075. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  21076. },
  21077. args: ["aStream"],
  21078. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  21079. referencedClasses: [],
  21080. messageSends: ["printOn:", "nextPutAll:", "name"]
  21081. }),
  21082. $globals.Package);
  21083. $core.addMethod(
  21084. $core.method({
  21085. selector: "setupClasses",
  21086. protocol: "classes",
  21087. fn: function (){
  21088. var self=this;
  21089. return $core.withContext(function($ctx1) {
  21090. $recv(self._classes())._do_((function(each){
  21091. return $core.withContext(function($ctx2) {
  21092. return $recv(each)._initialize();
  21093. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21094. }));
  21095. return self;
  21096. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  21097. },
  21098. args: [],
  21099. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  21100. referencedClasses: [],
  21101. messageSends: ["do:", "classes", "initialize"]
  21102. }),
  21103. $globals.Package);
  21104. $core.addMethod(
  21105. $core.method({
  21106. selector: "sortedClasses",
  21107. protocol: "classes",
  21108. fn: function (){
  21109. var self=this;
  21110. return $core.withContext(function($ctx1) {
  21111. return $recv(self._class())._sortedClasses_(self._classes());
  21112. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  21113. },
  21114. args: [],
  21115. 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",
  21116. referencedClasses: [],
  21117. messageSends: ["sortedClasses:", "class", "classes"]
  21118. }),
  21119. $globals.Package);
  21120. $core.addMethod(
  21121. $core.method({
  21122. selector: "sortedImportsAsArray",
  21123. protocol: "private",
  21124. fn: function (){
  21125. var self=this;
  21126. return $core.withContext(function($ctx1) {
  21127. var $3,$2,$4,$1,$6,$5,$7;
  21128. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  21129. return $core.withContext(function($ctx2) {
  21130. $3=$recv(a)._isString();
  21131. $ctx2.sendIdx["isString"]=1;
  21132. $2=$recv($3)._not();
  21133. $4=$recv(b)._isString();
  21134. $ctx2.sendIdx["isString"]=2;
  21135. $1=$recv($2).__and($4);
  21136. return $recv($1)._or_((function(){
  21137. return $core.withContext(function($ctx3) {
  21138. $6=$recv(a)._isString();
  21139. $ctx3.sendIdx["isString"]=3;
  21140. $5=$recv($6).__eq($recv(b)._isString());
  21141. return $recv($5)._and_((function(){
  21142. return $core.withContext(function($ctx4) {
  21143. $7=$recv(a)._value();
  21144. $ctx4.sendIdx["value"]=1;
  21145. return $recv($7).__lt_eq($recv(b)._value());
  21146. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  21147. }));
  21148. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  21149. }));
  21150. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  21151. }));
  21152. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  21153. },
  21154. args: [],
  21155. 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 ]]]",
  21156. referencedClasses: [],
  21157. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  21158. }),
  21159. $globals.Package);
  21160. $core.addMethod(
  21161. $core.method({
  21162. selector: "traitCompositions",
  21163. protocol: "dependencies",
  21164. fn: function (){
  21165. var self=this;
  21166. var traitCompositions;
  21167. return $core.withContext(function($ctx1) {
  21168. var $1,$2,$3,$receiver;
  21169. traitCompositions=$recv($globals.Dictionary)._new();
  21170. $recv(self._classes())._do_((function(each){
  21171. return $core.withContext(function($ctx2) {
  21172. $1=traitCompositions;
  21173. $2=$recv(each)._traitComposition();
  21174. $ctx2.sendIdx["traitComposition"]=1;
  21175. $recv($1)._at_put_(each,$2);
  21176. $ctx2.sendIdx["at:put:"]=1;
  21177. $3=$recv(each)._theMetaClass();
  21178. if(($receiver = $3) == null || $receiver.isNil){
  21179. return $3;
  21180. } else {
  21181. var meta;
  21182. meta=$receiver;
  21183. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  21184. }
  21185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21186. }));
  21187. return $recv(traitCompositions)._reject_((function(each){
  21188. return $core.withContext(function($ctx2) {
  21189. return $recv(each)._isEmpty();
  21190. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  21191. }));
  21192. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  21193. },
  21194. args: [],
  21195. 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 ]",
  21196. referencedClasses: ["Dictionary"],
  21197. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  21198. }),
  21199. $globals.Package);
  21200. $core.addMethod(
  21201. $core.method({
  21202. selector: "transport",
  21203. protocol: "accessing",
  21204. fn: function (){
  21205. var self=this;
  21206. return $core.withContext(function($ctx1) {
  21207. var $1,$2,$receiver;
  21208. $1=self["@transport"];
  21209. if(($receiver = $1) == null || $receiver.isNil){
  21210. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  21211. $recv($2)._package_(self);
  21212. self["@transport"]=$recv($2)._yourself();
  21213. return self["@transport"];
  21214. } else {
  21215. return $1;
  21216. }
  21217. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  21218. },
  21219. args: [],
  21220. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  21221. referencedClasses: ["PackageTransport"],
  21222. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  21223. }),
  21224. $globals.Package);
  21225. $core.addMethod(
  21226. $core.method({
  21227. selector: "transport:",
  21228. protocol: "accessing",
  21229. fn: function (aPackageTransport){
  21230. var self=this;
  21231. return $core.withContext(function($ctx1) {
  21232. self["@transport"]=aPackageTransport;
  21233. $recv(aPackageTransport)._package_(self);
  21234. return self;
  21235. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  21236. },
  21237. args: ["aPackageTransport"],
  21238. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  21239. referencedClasses: [],
  21240. messageSends: ["package:"]
  21241. }),
  21242. $globals.Package);
  21243. $core.addMethod(
  21244. $core.method({
  21245. selector: "validateImports:",
  21246. protocol: "validation",
  21247. fn: function (aCollection){
  21248. var self=this;
  21249. return $core.withContext(function($ctx1) {
  21250. var $1,$2,$5,$4,$3,$6;
  21251. $recv(aCollection)._do_((function(import_){
  21252. return $core.withContext(function($ctx2) {
  21253. $1=$recv(import_)._isString();
  21254. $ctx2.sendIdx["isString"]=1;
  21255. if(!$core.assert($1)){
  21256. $2=$recv(import_)._respondsTo_("key");
  21257. if(!$core.assert($2)){
  21258. self._error_("Imports must be Strings or Associations");
  21259. $ctx2.sendIdx["error:"]=1;
  21260. }
  21261. $5=$recv(import_)._key();
  21262. $ctx2.sendIdx["key"]=1;
  21263. $4=$recv($5)._isString();
  21264. $ctx2.sendIdx["isString"]=2;
  21265. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  21266. if(!$core.assert($3)){
  21267. self._error_("Key and value must be Strings");
  21268. $ctx2.sendIdx["error:"]=2;
  21269. }
  21270. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  21271. if(!$core.assert($6)){
  21272. return self._error_("Keys must be identifiers");
  21273. }
  21274. }
  21275. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  21276. }));
  21277. return self;
  21278. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  21279. },
  21280. args: ["aCollection"],
  21281. 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' ]]]",
  21282. referencedClasses: [],
  21283. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  21284. }),
  21285. $globals.Package);
  21286. $globals.Package.klass.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  21287. $core.addMethod(
  21288. $core.method({
  21289. selector: "named:",
  21290. protocol: "accessing",
  21291. fn: function (aPackageName){
  21292. var self=this;
  21293. return $core.withContext(function($ctx1) {
  21294. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  21295. return $core.withContext(function($ctx2) {
  21296. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  21297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21298. }));
  21299. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  21300. },
  21301. args: ["aPackageName"],
  21302. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  21303. referencedClasses: ["Smalltalk"],
  21304. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  21305. }),
  21306. $globals.Package.klass);
  21307. $core.addMethod(
  21308. $core.method({
  21309. selector: "named:ifAbsent:",
  21310. protocol: "accessing",
  21311. fn: function (aPackageName,aBlock){
  21312. var self=this;
  21313. return $core.withContext(function($ctx1) {
  21314. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  21315. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  21316. },
  21317. args: ["aPackageName", "aBlock"],
  21318. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  21319. referencedClasses: ["Smalltalk"],
  21320. messageSends: ["packageAt:ifAbsent:"]
  21321. }),
  21322. $globals.Package.klass);
  21323. $core.addMethod(
  21324. $core.method({
  21325. selector: "named:imports:transport:",
  21326. protocol: "accessing",
  21327. fn: function (aPackageName,anArray,aTransport){
  21328. var self=this;
  21329. var package_;
  21330. return $core.withContext(function($ctx1) {
  21331. package_=self._named_(aPackageName);
  21332. $recv(package_)._imports_(anArray);
  21333. $recv(package_)._transport_(aTransport);
  21334. return package_;
  21335. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  21336. },
  21337. args: ["aPackageName", "anArray", "aTransport"],
  21338. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package imports: anArray.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  21339. referencedClasses: [],
  21340. messageSends: ["named:", "imports:", "transport:"]
  21341. }),
  21342. $globals.Package.klass);
  21343. $core.addMethod(
  21344. $core.method({
  21345. selector: "named:transport:",
  21346. protocol: "accessing",
  21347. fn: function (aPackageName,aTransport){
  21348. var self=this;
  21349. var package_;
  21350. return $core.withContext(function($ctx1) {
  21351. package_=self._named_(aPackageName);
  21352. $recv(package_)._transport_(aTransport);
  21353. return package_;
  21354. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  21355. },
  21356. args: ["aPackageName", "aTransport"],
  21357. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  21358. referencedClasses: [],
  21359. messageSends: ["named:", "transport:"]
  21360. }),
  21361. $globals.Package.klass);
  21362. $core.addMethod(
  21363. $core.method({
  21364. selector: "sortedClasses:",
  21365. protocol: "sorting",
  21366. fn: function (classes){
  21367. var self=this;
  21368. var children,others,nodes,expandedClasses;
  21369. return $core.withContext(function($ctx1) {
  21370. var $1,$3,$2;
  21371. children=[];
  21372. others=[];
  21373. $recv(classes)._do_((function(each){
  21374. return $core.withContext(function($ctx2) {
  21375. $1=$recv(classes)._includes_($recv(each)._superclass());
  21376. if($core.assert($1)){
  21377. return $recv(others)._add_(each);
  21378. } else {
  21379. return $recv(children)._add_(each);
  21380. $ctx2.sendIdx["add:"]=1;
  21381. }
  21382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21383. }));
  21384. $ctx1.sendIdx["do:"]=1;
  21385. nodes=$recv(children)._collect_((function(each){
  21386. return $core.withContext(function($ctx2) {
  21387. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  21388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  21389. }));
  21390. nodes=$recv(nodes)._sorted_((function(a,b){
  21391. return $core.withContext(function($ctx2) {
  21392. $3=$recv(a)._theClass();
  21393. $ctx2.sendIdx["theClass"]=1;
  21394. $2=$recv($3)._name();
  21395. $ctx2.sendIdx["name"]=1;
  21396. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  21397. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  21398. }));
  21399. expandedClasses=$recv($globals.Array)._new();
  21400. $recv(nodes)._do_((function(aNode){
  21401. return $core.withContext(function($ctx2) {
  21402. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  21403. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  21404. }));
  21405. return expandedClasses;
  21406. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  21407. },
  21408. args: ["classes"],
  21409. 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",
  21410. referencedClasses: ["ClassSorterNode", "Array"],
  21411. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  21412. }),
  21413. $globals.Package.klass);
  21414. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  21415. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  21416. $core.addMethod(
  21417. $core.method({
  21418. selector: "announcer",
  21419. protocol: "accessing",
  21420. fn: function (){
  21421. var self=this;
  21422. return $core.withContext(function($ctx1) {
  21423. return $recv($globals.SystemAnnouncer)._current();
  21424. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  21425. },
  21426. args: [],
  21427. source: "announcer\x0a\x09^ SystemAnnouncer current",
  21428. referencedClasses: ["SystemAnnouncer"],
  21429. messageSends: ["current"]
  21430. }),
  21431. $globals.PackageStateObserver);
  21432. $core.addMethod(
  21433. $core.method({
  21434. selector: "observeSystem",
  21435. protocol: "actions",
  21436. fn: function (){
  21437. var self=this;
  21438. return $core.withContext(function($ctx1) {
  21439. var $1;
  21440. $1=self._announcer();
  21441. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  21442. $ctx1.sendIdx["on:send:to:"]=1;
  21443. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  21444. $ctx1.sendIdx["on:send:to:"]=2;
  21445. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  21446. $ctx1.sendIdx["on:send:to:"]=3;
  21447. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  21448. return self;
  21449. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  21450. },
  21451. args: [],
  21452. 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",
  21453. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  21454. messageSends: ["on:send:to:", "announcer"]
  21455. }),
  21456. $globals.PackageStateObserver);
  21457. $core.addMethod(
  21458. $core.method({
  21459. selector: "onClassModification:",
  21460. protocol: "reactions",
  21461. fn: function (anAnnouncement){
  21462. var self=this;
  21463. return $core.withContext(function($ctx1) {
  21464. var $1,$receiver;
  21465. $1=$recv(anAnnouncement)._theClass();
  21466. if(($receiver = $1) == null || $receiver.isNil){
  21467. $1;
  21468. } else {
  21469. var theClass;
  21470. theClass=$receiver;
  21471. $recv($recv(theClass)._package())._beDirty();
  21472. }
  21473. return self;
  21474. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21475. },
  21476. args: ["anAnnouncement"],
  21477. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  21478. referencedClasses: [],
  21479. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  21480. }),
  21481. $globals.PackageStateObserver);
  21482. $core.addMethod(
  21483. $core.method({
  21484. selector: "onMethodModification:",
  21485. protocol: "reactions",
  21486. fn: function (anAnnouncement){
  21487. var self=this;
  21488. return $core.withContext(function($ctx1) {
  21489. var $1,$receiver;
  21490. $1=$recv($recv(anAnnouncement)._method())._package();
  21491. if(($receiver = $1) == null || $receiver.isNil){
  21492. $1;
  21493. } else {
  21494. var package_;
  21495. package_=$receiver;
  21496. $recv(package_)._beDirty();
  21497. }
  21498. return self;
  21499. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21500. },
  21501. args: ["anAnnouncement"],
  21502. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  21503. referencedClasses: [],
  21504. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  21505. }),
  21506. $globals.PackageStateObserver);
  21507. $core.addMethod(
  21508. $core.method({
  21509. selector: "onPackageAdded:",
  21510. protocol: "reactions",
  21511. fn: function (anAnnouncement){
  21512. var self=this;
  21513. return $core.withContext(function($ctx1) {
  21514. $recv($recv(anAnnouncement)._package())._beDirty();
  21515. return self;
  21516. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21517. },
  21518. args: ["anAnnouncement"],
  21519. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  21520. referencedClasses: [],
  21521. messageSends: ["beDirty", "package"]
  21522. }),
  21523. $globals.PackageStateObserver);
  21524. $core.addMethod(
  21525. $core.method({
  21526. selector: "onProtocolModification:",
  21527. protocol: "reactions",
  21528. fn: function (anAnnouncement){
  21529. var self=this;
  21530. return $core.withContext(function($ctx1) {
  21531. var $1,$receiver;
  21532. $1=$recv(anAnnouncement)._package();
  21533. if(($receiver = $1) == null || $receiver.isNil){
  21534. $1;
  21535. } else {
  21536. var package_;
  21537. package_=$receiver;
  21538. $recv(package_)._beDirty();
  21539. }
  21540. return self;
  21541. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  21542. },
  21543. args: ["anAnnouncement"],
  21544. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  21545. referencedClasses: [],
  21546. messageSends: ["ifNotNil:", "package", "beDirty"]
  21547. }),
  21548. $globals.PackageStateObserver);
  21549. $globals.PackageStateObserver.klass.iVarNames = ["current"];
  21550. $core.addMethod(
  21551. $core.method({
  21552. selector: "current",
  21553. protocol: "accessing",
  21554. fn: function (){
  21555. var self=this;
  21556. return $core.withContext(function($ctx1) {
  21557. var $1,$receiver;
  21558. $1=self["@current"];
  21559. if(($receiver = $1) == null || $receiver.isNil){
  21560. self["@current"]=self._new();
  21561. return self["@current"];
  21562. } else {
  21563. return $1;
  21564. }
  21565. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  21566. },
  21567. args: [],
  21568. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  21569. referencedClasses: [],
  21570. messageSends: ["ifNil:", "new"]
  21571. }),
  21572. $globals.PackageStateObserver.klass);
  21573. $core.addMethod(
  21574. $core.method({
  21575. selector: "initialize",
  21576. protocol: "initialization",
  21577. fn: function (){
  21578. var self=this;
  21579. return $core.withContext(function($ctx1) {
  21580. $recv(self._current())._observeSystem();
  21581. return self;
  21582. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  21583. },
  21584. args: [],
  21585. source: "initialize\x0a\x09self current observeSystem",
  21586. referencedClasses: [],
  21587. messageSends: ["observeSystem", "current"]
  21588. }),
  21589. $globals.PackageStateObserver.klass);
  21590. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  21591. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  21592. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  21593. $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`";
  21594. $core.addMethod(
  21595. $core.method({
  21596. selector: "defaultValue",
  21597. protocol: "accessing",
  21598. fn: function (){
  21599. var self=this;
  21600. return self["@defaultValue"];
  21601. },
  21602. args: [],
  21603. source: "defaultValue\x0a\x09^ defaultValue",
  21604. referencedClasses: [],
  21605. messageSends: []
  21606. }),
  21607. $globals.Setting);
  21608. $core.addMethod(
  21609. $core.method({
  21610. selector: "defaultValue:",
  21611. protocol: "accessing",
  21612. fn: function (aStringifiableObject){
  21613. var self=this;
  21614. self["@defaultValue"]=aStringifiableObject;
  21615. return self;
  21616. },
  21617. args: ["aStringifiableObject"],
  21618. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  21619. referencedClasses: [],
  21620. messageSends: []
  21621. }),
  21622. $globals.Setting);
  21623. $core.addMethod(
  21624. $core.method({
  21625. selector: "key",
  21626. protocol: "accessing",
  21627. fn: function (){
  21628. var self=this;
  21629. return self["@key"];
  21630. },
  21631. args: [],
  21632. source: "key\x0a\x09^ key",
  21633. referencedClasses: [],
  21634. messageSends: []
  21635. }),
  21636. $globals.Setting);
  21637. $core.addMethod(
  21638. $core.method({
  21639. selector: "key:",
  21640. protocol: "accessing",
  21641. fn: function (aString){
  21642. var self=this;
  21643. self["@key"]=aString;
  21644. return self;
  21645. },
  21646. args: ["aString"],
  21647. source: "key: aString\x0a\x09key := aString",
  21648. referencedClasses: [],
  21649. messageSends: []
  21650. }),
  21651. $globals.Setting);
  21652. $core.addMethod(
  21653. $core.method({
  21654. selector: "value",
  21655. protocol: "accessing",
  21656. fn: function (){
  21657. var self=this;
  21658. return $core.withContext(function($ctx1) {
  21659. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  21660. return $core.withContext(function($ctx2) {
  21661. return self._defaultValue();
  21662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21663. }));
  21664. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  21665. },
  21666. args: [],
  21667. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  21668. referencedClasses: ["Smalltalk"],
  21669. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  21670. }),
  21671. $globals.Setting);
  21672. $core.addMethod(
  21673. $core.method({
  21674. selector: "value:",
  21675. protocol: "accessing",
  21676. fn: function (aStringifiableObject){
  21677. var self=this;
  21678. return $core.withContext(function($ctx1) {
  21679. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  21680. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  21681. },
  21682. args: ["aStringifiableObject"],
  21683. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  21684. referencedClasses: ["Smalltalk"],
  21685. messageSends: ["at:put:", "settings", "key"]
  21686. }),
  21687. $globals.Setting);
  21688. $core.addMethod(
  21689. $core.method({
  21690. selector: "at:ifAbsent:",
  21691. protocol: "instance creation",
  21692. fn: function (aString,aDefaultValue){
  21693. var self=this;
  21694. return $core.withContext(function($ctx1) {
  21695. var $1;
  21696. $1=(
  21697. $ctx1.supercall = true,
  21698. ($globals.Setting.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  21699. $ctx1.supercall = false;
  21700. $recv($1)._key_(aString);
  21701. $recv($1)._defaultValue_(aDefaultValue);
  21702. return $recv($1)._yourself();
  21703. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  21704. },
  21705. args: ["aString", "aDefaultValue"],
  21706. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  21707. referencedClasses: [],
  21708. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  21709. }),
  21710. $globals.Setting.klass);
  21711. $core.addMethod(
  21712. $core.method({
  21713. selector: "new",
  21714. protocol: "instance creation",
  21715. fn: function (){
  21716. var self=this;
  21717. return $core.withContext(function($ctx1) {
  21718. self._shouldNotImplement();
  21719. return self;
  21720. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  21721. },
  21722. args: [],
  21723. source: "new\x0a\x09self shouldNotImplement",
  21724. referencedClasses: [],
  21725. messageSends: ["shouldNotImplement"]
  21726. }),
  21727. $globals.Setting.klass);
  21728. $core.addClass("SmalltalkImage", $globals.Object, [], "Kernel-Infrastructure");
  21729. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
  21730. $core.addMethod(
  21731. $core.method({
  21732. selector: "addGlobalJsVariable:",
  21733. protocol: "globals",
  21734. fn: function (aString){
  21735. var self=this;
  21736. return $core.withContext(function($ctx1) {
  21737. $recv(self._globalJsVariables())._add_(aString);
  21738. return self;
  21739. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  21740. },
  21741. args: ["aString"],
  21742. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  21743. referencedClasses: [],
  21744. messageSends: ["add:", "globalJsVariables"]
  21745. }),
  21746. $globals.SmalltalkImage);
  21747. $core.addMethod(
  21748. $core.method({
  21749. selector: "amdRequire",
  21750. protocol: "accessing amd",
  21751. fn: function (){
  21752. var self=this;
  21753. return $core.withContext(function($ctx1) {
  21754. return $recv(self._core())._at_("amdRequire");
  21755. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  21756. },
  21757. args: [],
  21758. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  21759. referencedClasses: [],
  21760. messageSends: ["at:", "core"]
  21761. }),
  21762. $globals.SmalltalkImage);
  21763. $core.addMethod(
  21764. $core.method({
  21765. selector: "asSmalltalkException:",
  21766. protocol: "error handling",
  21767. fn: function (anObject){
  21768. var self=this;
  21769. return $core.withContext(function($ctx1) {
  21770. var $1;
  21771. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  21772. return $core.withContext(function($ctx2) {
  21773. return $recv(anObject)._isKindOf_($globals.Error);
  21774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21775. }));
  21776. if($core.assert($1)){
  21777. return anObject;
  21778. } else {
  21779. return $recv($globals.JavaScriptException)._on_(anObject);
  21780. }
  21781. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  21782. },
  21783. args: ["anObject"],
  21784. 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 ]",
  21785. referencedClasses: ["Error", "JavaScriptException"],
  21786. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  21787. }),
  21788. $globals.SmalltalkImage);
  21789. $core.addMethod(
  21790. $core.method({
  21791. selector: "basicCreatePackage:",
  21792. protocol: "private",
  21793. fn: function (packageName){
  21794. var self=this;
  21795. return $core.withContext(function($ctx1) {
  21796. return $core.addPackage(packageName);
  21797. return self;
  21798. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  21799. },
  21800. args: ["packageName"],
  21801. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<inlineJS: 'return $core.addPackage(packageName)'>",
  21802. referencedClasses: [],
  21803. messageSends: []
  21804. }),
  21805. $globals.SmalltalkImage);
  21806. $core.addMethod(
  21807. $core.method({
  21808. selector: "basicParse:",
  21809. protocol: "private",
  21810. fn: function (aString){
  21811. var self=this;
  21812. return $core.withContext(function($ctx1) {
  21813. return $recv($globals.SmalltalkParser)._parse_(aString);
  21814. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  21815. },
  21816. args: ["aString"],
  21817. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  21818. referencedClasses: ["SmalltalkParser"],
  21819. messageSends: ["parse:"]
  21820. }),
  21821. $globals.SmalltalkImage);
  21822. $core.addMethod(
  21823. $core.method({
  21824. selector: "basicRegisterPackage:",
  21825. protocol: "private",
  21826. fn: function (aPackage){
  21827. var self=this;
  21828. return $core.withContext(function($ctx1) {
  21829. $core.packages[aPackage.pkgName]=aPackage;
  21830. return self;
  21831. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  21832. },
  21833. args: ["aPackage"],
  21834. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<inlineJS: '$core.packages[aPackage.pkgName]=aPackage'>",
  21835. referencedClasses: [],
  21836. messageSends: []
  21837. }),
  21838. $globals.SmalltalkImage);
  21839. $core.addMethod(
  21840. $core.method({
  21841. selector: "cancelOptOut:",
  21842. protocol: "accessing",
  21843. fn: function (anObject){
  21844. var self=this;
  21845. return $core.withContext(function($ctx1) {
  21846. delete anObject.klass;
  21847. return self;
  21848. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  21849. },
  21850. args: ["anObject"],
  21851. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.klass'>",
  21852. referencedClasses: [],
  21853. messageSends: []
  21854. }),
  21855. $globals.SmalltalkImage);
  21856. $core.addMethod(
  21857. $core.method({
  21858. selector: "classes",
  21859. protocol: "classes",
  21860. fn: function (){
  21861. var self=this;
  21862. return $core.withContext(function($ctx1) {
  21863. return $core.classes();
  21864. return self;
  21865. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  21866. },
  21867. args: [],
  21868. source: "classes\x0a\x09<inlineJS: 'return $core.classes()'>",
  21869. referencedClasses: [],
  21870. messageSends: []
  21871. }),
  21872. $globals.SmalltalkImage);
  21873. $core.addMethod(
  21874. $core.method({
  21875. selector: "core",
  21876. protocol: "accessing",
  21877. fn: function (){
  21878. var self=this;
  21879. return $core.withContext(function($ctx1) {
  21880. return $core;
  21881. return self;
  21882. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  21883. },
  21884. args: [],
  21885. source: "core\x0a\x09<inlineJS: 'return $core'>",
  21886. referencedClasses: [],
  21887. messageSends: []
  21888. }),
  21889. $globals.SmalltalkImage);
  21890. $core.addMethod(
  21891. $core.method({
  21892. selector: "createPackage:",
  21893. protocol: "packages",
  21894. fn: function (packageName){
  21895. var self=this;
  21896. var package_,announcement;
  21897. return $core.withContext(function($ctx1) {
  21898. var $1;
  21899. package_=self._basicCreatePackage_(packageName);
  21900. $1=$recv($globals.PackageAdded)._new();
  21901. $recv($1)._package_(package_);
  21902. announcement=$recv($1)._yourself();
  21903. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  21904. return package_;
  21905. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  21906. },
  21907. args: ["packageName"],
  21908. 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",
  21909. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  21910. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  21911. }),
  21912. $globals.SmalltalkImage);
  21913. $core.addMethod(
  21914. $core.method({
  21915. selector: "defaultAmdNamespace",
  21916. protocol: "accessing amd",
  21917. fn: function (){
  21918. var self=this;
  21919. return $core.withContext(function($ctx1) {
  21920. return "transport.defaultAmdNamespace"._settingValue();
  21921. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  21922. },
  21923. args: [],
  21924. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  21925. referencedClasses: [],
  21926. messageSends: ["settingValue"]
  21927. }),
  21928. $globals.SmalltalkImage);
  21929. $core.addMethod(
  21930. $core.method({
  21931. selector: "defaultAmdNamespace:",
  21932. protocol: "accessing amd",
  21933. fn: function (aString){
  21934. var self=this;
  21935. return $core.withContext(function($ctx1) {
  21936. "transport.defaultAmdNamespace"._settingValue_(aString);
  21937. return self;
  21938. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  21939. },
  21940. args: ["aString"],
  21941. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  21942. referencedClasses: [],
  21943. messageSends: ["settingValue:"]
  21944. }),
  21945. $globals.SmalltalkImage);
  21946. $core.addMethod(
  21947. $core.method({
  21948. selector: "deleteClass:",
  21949. protocol: "private",
  21950. fn: function (aClass){
  21951. var self=this;
  21952. return $core.withContext(function($ctx1) {
  21953. $core.removeClass(aClass);
  21954. return self;
  21955. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  21956. },
  21957. args: ["aClass"],
  21958. 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)'>",
  21959. referencedClasses: [],
  21960. messageSends: []
  21961. }),
  21962. $globals.SmalltalkImage);
  21963. $core.addMethod(
  21964. $core.method({
  21965. selector: "deleteGlobalJsVariable:",
  21966. protocol: "globals",
  21967. fn: function (aString){
  21968. var self=this;
  21969. return $core.withContext(function($ctx1) {
  21970. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  21971. }));
  21972. return self;
  21973. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  21974. },
  21975. args: ["aString"],
  21976. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  21977. referencedClasses: [],
  21978. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  21979. }),
  21980. $globals.SmalltalkImage);
  21981. $core.addMethod(
  21982. $core.method({
  21983. selector: "deletePackage:",
  21984. protocol: "private",
  21985. fn: function (packageName){
  21986. var self=this;
  21987. return $core.withContext(function($ctx1) {
  21988. delete $core.packages[packageName];
  21989. return self;
  21990. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  21991. },
  21992. args: ["packageName"],
  21993. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<inlineJS: 'delete $core.packages[packageName]'>",
  21994. referencedClasses: [],
  21995. messageSends: []
  21996. }),
  21997. $globals.SmalltalkImage);
  21998. $core.addMethod(
  21999. $core.method({
  22000. selector: "existsJsGlobal:",
  22001. protocol: "testing",
  22002. fn: function (aString){
  22003. var self=this;
  22004. return $core.withContext(function($ctx1) {
  22005. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22006. return true;
  22007. }),(function(){
  22008. return false;
  22009. }));
  22010. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  22011. },
  22012. args: ["aString"],
  22013. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  22014. referencedClasses: ["Platform"],
  22015. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  22016. }),
  22017. $globals.SmalltalkImage);
  22018. $core.addMethod(
  22019. $core.method({
  22020. selector: "globalJsVariables",
  22021. protocol: "globals",
  22022. fn: function (){
  22023. var self=this;
  22024. return $core.withContext(function($ctx1) {
  22025. return $core.globalJsVariables;
  22026. return self;
  22027. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  22028. },
  22029. args: [],
  22030. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<inlineJS: 'return $core.globalJsVariables'>",
  22031. referencedClasses: [],
  22032. messageSends: []
  22033. }),
  22034. $globals.SmalltalkImage);
  22035. $core.addMethod(
  22036. $core.method({
  22037. selector: "globals",
  22038. protocol: "accessing",
  22039. fn: function (){
  22040. var self=this;
  22041. return $core.withContext(function($ctx1) {
  22042. return $globals;
  22043. return self;
  22044. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  22045. },
  22046. args: [],
  22047. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  22048. referencedClasses: [],
  22049. messageSends: []
  22050. }),
  22051. $globals.SmalltalkImage);
  22052. $core.addMethod(
  22053. $core.method({
  22054. selector: "includesKey:",
  22055. protocol: "accessing",
  22056. fn: function (aKey){
  22057. var self=this;
  22058. return $core.withContext(function($ctx1) {
  22059. return $core.hasOwnProperty(aKey);
  22060. return self;
  22061. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  22062. },
  22063. args: ["aKey"],
  22064. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  22065. referencedClasses: [],
  22066. messageSends: []
  22067. }),
  22068. $globals.SmalltalkImage);
  22069. $core.addMethod(
  22070. $core.method({
  22071. selector: "isSmalltalkObject:",
  22072. protocol: "testing",
  22073. fn: function (anObject){
  22074. var self=this;
  22075. return $core.withContext(function($ctx1) {
  22076. return anObject.klass != null;
  22077. return self;
  22078. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  22079. },
  22080. args: ["anObject"],
  22081. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.klass != null'>",
  22082. referencedClasses: [],
  22083. messageSends: []
  22084. }),
  22085. $globals.SmalltalkImage);
  22086. $core.addMethod(
  22087. $core.method({
  22088. selector: "optOut:",
  22089. protocol: "accessing",
  22090. fn: function (anObject){
  22091. var self=this;
  22092. return $core.withContext(function($ctx1) {
  22093. anObject.klass = null;
  22094. return self;
  22095. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  22096. },
  22097. args: ["anObject"],
  22098. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.klass = null'>",
  22099. referencedClasses: [],
  22100. messageSends: []
  22101. }),
  22102. $globals.SmalltalkImage);
  22103. $core.addMethod(
  22104. $core.method({
  22105. selector: "packageAt:",
  22106. protocol: "packages",
  22107. fn: function (packageName){
  22108. var self=this;
  22109. return $core.withContext(function($ctx1) {
  22110. return $core.packages[packageName];
  22111. return self;
  22112. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  22113. },
  22114. args: ["packageName"],
  22115. source: "packageAt: packageName\x0a\x09<inlineJS: 'return $core.packages[packageName]'>",
  22116. referencedClasses: [],
  22117. messageSends: []
  22118. }),
  22119. $globals.SmalltalkImage);
  22120. $core.addMethod(
  22121. $core.method({
  22122. selector: "packageAt:ifAbsent:",
  22123. protocol: "packages",
  22124. fn: function (packageName,aBlock){
  22125. var self=this;
  22126. return $core.withContext(function($ctx1) {
  22127. var $1;
  22128. $1=self._packageAt_(packageName);
  22129. return $recv($1)._ifNil_(aBlock);
  22130. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  22131. },
  22132. args: ["packageName", "aBlock"],
  22133. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  22134. referencedClasses: [],
  22135. messageSends: ["ifNil:", "packageAt:"]
  22136. }),
  22137. $globals.SmalltalkImage);
  22138. $core.addMethod(
  22139. $core.method({
  22140. selector: "packages",
  22141. protocol: "packages",
  22142. fn: function (){
  22143. var self=this;
  22144. return $core.withContext(function($ctx1) {
  22145. return Object.keys($core.packages).map(function(k) {
  22146. return $core.packages[k];
  22147. })
  22148. ;
  22149. return self;
  22150. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  22151. },
  22152. args: [],
  22153. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<inlineJS: '\x0a\x09\x09return Object.keys($core.packages).map(function(k) {\x0a\x09\x09\x09return $core.packages[k];\x0a\x09\x09})\x0a\x09'>",
  22154. referencedClasses: [],
  22155. messageSends: []
  22156. }),
  22157. $globals.SmalltalkImage);
  22158. $core.addMethod(
  22159. $core.method({
  22160. selector: "parse:",
  22161. protocol: "accessing",
  22162. fn: function (aString){
  22163. var self=this;
  22164. var result;
  22165. return $core.withContext(function($ctx1) {
  22166. var $1;
  22167. $recv((function(){
  22168. return $core.withContext(function($ctx2) {
  22169. result=self._basicParse_(aString);
  22170. return result;
  22171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22172. }))._tryCatch_((function(ex){
  22173. return $core.withContext(function($ctx2) {
  22174. return $recv(self._parseError_parsing_(ex,aString))._signal();
  22175. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  22176. }));
  22177. $1=result;
  22178. $recv($1)._source_(aString);
  22179. return $recv($1)._yourself();
  22180. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  22181. },
  22182. args: ["aString"],
  22183. 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",
  22184. referencedClasses: [],
  22185. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  22186. }),
  22187. $globals.SmalltalkImage);
  22188. $core.addMethod(
  22189. $core.method({
  22190. selector: "parseError:parsing:",
  22191. protocol: "error handling",
  22192. fn: function (anException,aString){
  22193. var self=this;
  22194. return $core.withContext(function($ctx1) {
  22195. var $1,$7,$6,$5,$8,$4,$3,$2;
  22196. $1=$recv($globals.ParseError)._new();
  22197. $7=$recv(anException)._basicAt_("line");
  22198. $ctx1.sendIdx["basicAt:"]=1;
  22199. $6="Parse error on line ".__comma($7);
  22200. $5=$recv($6).__comma(" column ");
  22201. $ctx1.sendIdx[","]=4;
  22202. $8=$recv(anException)._basicAt_("column");
  22203. $ctx1.sendIdx["basicAt:"]=2;
  22204. $4=$recv($5).__comma($8);
  22205. $ctx1.sendIdx[","]=3;
  22206. $3=$recv($4).__comma(" : Unexpected character ");
  22207. $ctx1.sendIdx[","]=2;
  22208. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  22209. $ctx1.sendIdx[","]=1;
  22210. return $recv($1)._messageText_($2);
  22211. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  22212. },
  22213. args: ["anException", "aString"],
  22214. source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
  22215. referencedClasses: ["ParseError"],
  22216. messageSends: ["messageText:", "new", ",", "basicAt:"]
  22217. }),
  22218. $globals.SmalltalkImage);
  22219. $core.addMethod(
  22220. $core.method({
  22221. selector: "pseudoVariableNames",
  22222. protocol: "accessing",
  22223. fn: function (){
  22224. var self=this;
  22225. return ["self", "super", "nil", "true", "false", "thisContext"];
  22226. },
  22227. args: [],
  22228. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  22229. referencedClasses: [],
  22230. messageSends: []
  22231. }),
  22232. $globals.SmalltalkImage);
  22233. $core.addMethod(
  22234. $core.method({
  22235. selector: "readJSObject:",
  22236. protocol: "accessing",
  22237. fn: function (anObject){
  22238. var self=this;
  22239. return $core.withContext(function($ctx1) {
  22240. return $core.readJSObject(anObject);
  22241. return self;
  22242. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  22243. },
  22244. args: ["anObject"],
  22245. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  22246. referencedClasses: [],
  22247. messageSends: []
  22248. }),
  22249. $globals.SmalltalkImage);
  22250. $core.addMethod(
  22251. $core.method({
  22252. selector: "removeClass:",
  22253. protocol: "classes",
  22254. fn: function (aClass){
  22255. var self=this;
  22256. return $core.withContext(function($ctx1) {
  22257. var $1,$2,$5,$4,$6,$3,$7,$9,$8;
  22258. $1=$recv(aClass)._isMetaclass();
  22259. if($core.assert($1)){
  22260. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  22261. $ctx1.sendIdx[","]=1;
  22262. self._error_($2);
  22263. $ctx1.sendIdx["error:"]=1;
  22264. }
  22265. $recv(aClass)._allSubclassesDo_((function(subclass){
  22266. return $core.withContext(function($ctx2) {
  22267. $5=$recv(aClass)._name();
  22268. $ctx2.sendIdx["name"]=1;
  22269. $4=$recv($5).__comma(" has a subclass: ");
  22270. $ctx2.sendIdx[","]=3;
  22271. $6=$recv(subclass)._name();
  22272. $ctx2.sendIdx["name"]=2;
  22273. $3=$recv($4).__comma($6);
  22274. $ctx2.sendIdx[","]=2;
  22275. return self._error_($3);
  22276. $ctx2.sendIdx["error:"]=2;
  22277. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  22278. }));
  22279. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  22280. return $core.withContext(function($ctx2) {
  22281. return self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  22282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  22283. }));
  22284. self._deleteClass_(aClass);
  22285. $recv(aClass)._setTraitComposition_([]);
  22286. $ctx1.sendIdx["setTraitComposition:"]=1;
  22287. $recv($recv(aClass)._class())._setTraitComposition_([]);
  22288. $7=$recv($globals.SystemAnnouncer)._current();
  22289. $9=$recv($globals.ClassRemoved)._new();
  22290. $recv($9)._theClass_(aClass);
  22291. $8=$recv($9)._yourself();
  22292. $recv($7)._announce_($8);
  22293. return self;
  22294. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  22295. },
  22296. args: ["aClass"],
  22297. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09aClass allSubclassesDo: [ :subclass | self error: aClass name, ' has a subclass: ', subclass name ].\x0a\x09aClass traitUsers ifNotEmpty: [ self error: aClass name, ' has trait users.' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09aClass setTraitComposition: #().\x0a\x09aClass class setTraitComposition: #().\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  22298. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  22299. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "class", "announce:", "current", "theClass:", "new", "yourself"]
  22300. }),
  22301. $globals.SmalltalkImage);
  22302. $core.addMethod(
  22303. $core.method({
  22304. selector: "removePackage:",
  22305. protocol: "packages",
  22306. fn: function (packageName){
  22307. var self=this;
  22308. var pkg;
  22309. return $core.withContext(function($ctx1) {
  22310. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  22311. return $core.withContext(function($ctx2) {
  22312. return self._error_("Missing package: ".__comma(packageName));
  22313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22314. }));
  22315. $recv($recv(pkg)._classes())._do_((function(each){
  22316. return $core.withContext(function($ctx2) {
  22317. return self._removeClass_(each);
  22318. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22319. }));
  22320. self._deletePackage_(packageName);
  22321. return self;
  22322. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  22323. },
  22324. args: ["packageName"],
  22325. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self deletePackage: packageName",
  22326. referencedClasses: [],
  22327. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  22328. }),
  22329. $globals.SmalltalkImage);
  22330. $core.addMethod(
  22331. $core.method({
  22332. selector: "renamePackage:to:",
  22333. protocol: "packages",
  22334. fn: function (packageName,newName){
  22335. var self=this;
  22336. var pkg;
  22337. return $core.withContext(function($ctx1) {
  22338. var $1,$2,$receiver;
  22339. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  22340. return $core.withContext(function($ctx2) {
  22341. $1="Missing package: ".__comma(packageName);
  22342. $ctx2.sendIdx[","]=1;
  22343. return self._error_($1);
  22344. $ctx2.sendIdx["error:"]=1;
  22345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22346. }));
  22347. $2=self._packageAt_(newName);
  22348. if(($receiver = $2) == null || $receiver.isNil){
  22349. $2;
  22350. } else {
  22351. self._error_("Already exists a package called: ".__comma(newName));
  22352. }
  22353. $recv(pkg)._name_(newName);
  22354. self._basicRegisterPackage_(pkg);
  22355. self._deletePackage_(packageName);
  22356. return self;
  22357. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  22358. },
  22359. args: ["packageName", "newName"],
  22360. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName.\x0a\x09self basicRegisterPackage: pkg.\x0a\x09self deletePackage: packageName.",
  22361. referencedClasses: [],
  22362. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  22363. }),
  22364. $globals.SmalltalkImage);
  22365. $core.addMethod(
  22366. $core.method({
  22367. selector: "reservedWords",
  22368. protocol: "accessing",
  22369. fn: function (){
  22370. var self=this;
  22371. return $core.withContext(function($ctx1) {
  22372. return $core.reservedWords;
  22373. return self;
  22374. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  22375. },
  22376. args: [],
  22377. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<inlineJS: 'return $core.reservedWords'>",
  22378. referencedClasses: [],
  22379. messageSends: []
  22380. }),
  22381. $globals.SmalltalkImage);
  22382. $core.addMethod(
  22383. $core.method({
  22384. selector: "settings",
  22385. protocol: "accessing",
  22386. fn: function (){
  22387. var self=this;
  22388. return $globals.SmalltalkSettings;
  22389. },
  22390. args: [],
  22391. source: "settings\x0a\x09^ SmalltalkSettings",
  22392. referencedClasses: ["SmalltalkSettings"],
  22393. messageSends: []
  22394. }),
  22395. $globals.SmalltalkImage);
  22396. $core.addMethod(
  22397. $core.method({
  22398. selector: "version",
  22399. protocol: "accessing",
  22400. fn: function (){
  22401. var self=this;
  22402. return "0.18.5";
  22403. },
  22404. args: [],
  22405. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.18.5'",
  22406. referencedClasses: [],
  22407. messageSends: []
  22408. }),
  22409. $globals.SmalltalkImage);
  22410. $globals.SmalltalkImage.klass.iVarNames = ["current"];
  22411. $core.addMethod(
  22412. $core.method({
  22413. selector: "current",
  22414. protocol: "instance creation",
  22415. fn: function (){
  22416. var self=this;
  22417. return $core.withContext(function($ctx1) {
  22418. var $1,$receiver;
  22419. $1=self["@current"];
  22420. if(($receiver = $1) == null || $receiver.isNil){
  22421. self["@current"]=(
  22422. $ctx1.supercall = true,
  22423. ($globals.SmalltalkImage.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  22424. $ctx1.supercall = false;
  22425. return self["@current"];
  22426. } else {
  22427. self._deprecatedAPI();
  22428. return self["@current"];
  22429. }
  22430. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  22431. },
  22432. args: [],
  22433. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  22434. referencedClasses: [],
  22435. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  22436. }),
  22437. $globals.SmalltalkImage.klass);
  22438. $core.addMethod(
  22439. $core.method({
  22440. selector: "initialize",
  22441. protocol: "initialization",
  22442. fn: function (){
  22443. var self=this;
  22444. var st;
  22445. return $core.withContext(function($ctx1) {
  22446. st=self._current();
  22447. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  22448. return self;
  22449. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  22450. },
  22451. args: [],
  22452. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  22453. referencedClasses: [],
  22454. messageSends: ["current", "at:put:", "globals"]
  22455. }),
  22456. $globals.SmalltalkImage.klass);
  22457. $core.addMethod(
  22458. $core.method({
  22459. selector: "new",
  22460. protocol: "instance creation",
  22461. fn: function (){
  22462. var self=this;
  22463. return $core.withContext(function($ctx1) {
  22464. self._shouldNotImplement();
  22465. return self;
  22466. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  22467. },
  22468. args: [],
  22469. source: "new\x0a\x09self shouldNotImplement",
  22470. referencedClasses: [],
  22471. messageSends: ["shouldNotImplement"]
  22472. }),
  22473. $globals.SmalltalkImage.klass);
  22474. $core.addMethod(
  22475. $core.method({
  22476. selector: "nextPutJSObject:",
  22477. protocol: "*Kernel-Infrastructure",
  22478. fn: function (aJSObject){
  22479. var self=this;
  22480. return $core.withContext(function($ctx1) {
  22481. self._nextPut_(aJSObject);
  22482. return self;
  22483. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  22484. },
  22485. args: ["aJSObject"],
  22486. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  22487. referencedClasses: [],
  22488. messageSends: ["nextPut:"]
  22489. }),
  22490. $globals.ProtoStream);
  22491. $core.addMethod(
  22492. $core.method({
  22493. selector: "asJavaScriptPropertyName",
  22494. protocol: "*Kernel-Infrastructure",
  22495. fn: function (){
  22496. var self=this;
  22497. return $core.withContext(function($ctx1) {
  22498. return $core.st2prop(self);
  22499. return self;
  22500. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  22501. },
  22502. args: [],
  22503. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  22504. referencedClasses: [],
  22505. messageSends: []
  22506. }),
  22507. $globals.String);
  22508. $core.addMethod(
  22509. $core.method({
  22510. selector: "asSetting",
  22511. protocol: "*Kernel-Infrastructure",
  22512. fn: function (){
  22513. var self=this;
  22514. return $core.withContext(function($ctx1) {
  22515. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  22516. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  22517. },
  22518. args: [],
  22519. 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",
  22520. referencedClasses: ["Setting"],
  22521. messageSends: ["at:ifAbsent:"]
  22522. }),
  22523. $globals.String);
  22524. $core.addMethod(
  22525. $core.method({
  22526. selector: "asSettingIfAbsent:",
  22527. protocol: "*Kernel-Infrastructure",
  22528. fn: function (aDefaultValue){
  22529. var self=this;
  22530. return $core.withContext(function($ctx1) {
  22531. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  22532. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  22533. },
  22534. args: ["aDefaultValue"],
  22535. 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",
  22536. referencedClasses: ["Setting"],
  22537. messageSends: ["at:ifAbsent:"]
  22538. }),
  22539. $globals.String);
  22540. $core.addMethod(
  22541. $core.method({
  22542. selector: "settingValue",
  22543. protocol: "*Kernel-Infrastructure",
  22544. fn: function (){
  22545. var self=this;
  22546. return $core.withContext(function($ctx1) {
  22547. return $recv(self._asSetting())._value();
  22548. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  22549. },
  22550. args: [],
  22551. source: "settingValue\x0a\x09^ self asSetting value",
  22552. referencedClasses: [],
  22553. messageSends: ["value", "asSetting"]
  22554. }),
  22555. $globals.String);
  22556. $core.addMethod(
  22557. $core.method({
  22558. selector: "settingValue:",
  22559. protocol: "*Kernel-Infrastructure",
  22560. fn: function (aValue){
  22561. var self=this;
  22562. return $core.withContext(function($ctx1) {
  22563. return $recv(self._asSetting())._value_(aValue);
  22564. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  22565. },
  22566. args: ["aValue"],
  22567. 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",
  22568. referencedClasses: [],
  22569. messageSends: ["value:", "asSetting"]
  22570. }),
  22571. $globals.String);
  22572. $core.addMethod(
  22573. $core.method({
  22574. selector: "settingValueIfAbsent:",
  22575. protocol: "*Kernel-Infrastructure",
  22576. fn: function (aDefaultValue){
  22577. var self=this;
  22578. return $core.withContext(function($ctx1) {
  22579. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  22580. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  22581. },
  22582. args: ["aDefaultValue"],
  22583. 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",
  22584. referencedClasses: [],
  22585. messageSends: ["value", "asSettingIfAbsent:"]
  22586. }),
  22587. $globals.String);
  22588. });
  22589. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  22590. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  22591. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  22592. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  22593. $core.addPackage("Kernel-Promises");
  22594. $core.packages["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  22595. $core.packages["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  22596. $core.addClass("Thenable", $globals.Object, [], "Kernel-Promises");
  22597. $globals.Thenable.comment="I am the abstract base class for Promises.\x0a\x0aMy subclasses should wrap existing JS implementations.\x0a\x0aI contain methods that wrap Promises/A+ `.then` behaviour.";
  22598. $core.addMethod(
  22599. $core.method({
  22600. selector: "catch:",
  22601. protocol: "promises",
  22602. fn: function (aBlock){
  22603. var self=this;
  22604. return $core.withContext(function($ctx1) {
  22605. return self.then(null, function (err) {return $core.seamless(function () {
  22606. return aBlock._value_(err);
  22607. })});
  22608. return self;
  22609. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.Thenable)});
  22610. },
  22611. args: ["aBlock"],
  22612. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  22613. referencedClasses: [],
  22614. messageSends: []
  22615. }),
  22616. $globals.Thenable);
  22617. $core.addMethod(
  22618. $core.method({
  22619. selector: "on:do:",
  22620. protocol: "promises",
  22621. fn: function (aClass,aBlock){
  22622. var self=this;
  22623. return $core.withContext(function($ctx1) {
  22624. return self.then(null, function (err) {return $core.seamless(function () {
  22625. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  22626. else throw err;
  22627. })});
  22628. return self;
  22629. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  22630. },
  22631. args: ["aClass", "aBlock"],
  22632. 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})})'>",
  22633. referencedClasses: [],
  22634. messageSends: []
  22635. }),
  22636. $globals.Thenable);
  22637. $core.addMethod(
  22638. $core.method({
  22639. selector: "on:do:catch:",
  22640. protocol: "promises",
  22641. fn: function (aClass,aBlock,anotherBlock){
  22642. var self=this;
  22643. return $core.withContext(function($ctx1) {
  22644. return self.then(null, function (err) {return $core.seamless(function () {
  22645. try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }
  22646. return anotherBlock._value_(err);
  22647. })});
  22648. return self;
  22649. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  22650. },
  22651. args: ["aClass", "aBlock", "anotherBlock"],
  22652. source: "on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }\x0a return anotherBlock._value_(err);\x0a})})'>",
  22653. referencedClasses: [],
  22654. messageSends: []
  22655. }),
  22656. $globals.Thenable);
  22657. $core.addMethod(
  22658. $core.method({
  22659. selector: "then:",
  22660. protocol: "promises",
  22661. fn: function (aBlockOrArray){
  22662. var self=this;
  22663. return $core.withContext(function($ctx1) {
  22664. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  22665. return array.reduce(function (soFar, aBlock) {
  22666. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  22667. function (result) {return $core.seamless(function () {
  22668. if (Array.isArray(result)) {
  22669. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  22670. } else {
  22671. return aBlock._value_(result);
  22672. }
  22673. })} :
  22674. function (result) {return $core.seamless(function () {
  22675. return aBlock._value_(result);
  22676. })}
  22677. );
  22678. }, self);
  22679. return self;
  22680. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.Thenable)});
  22681. },
  22682. args: ["aBlockOrArray"],
  22683. 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)'>",
  22684. referencedClasses: [],
  22685. messageSends: []
  22686. }),
  22687. $globals.Thenable);
  22688. $core.addMethod(
  22689. $core.method({
  22690. selector: "then:catch:",
  22691. protocol: "promises",
  22692. fn: function (aBlockOrArray,anotherBlock){
  22693. var self=this;
  22694. return $core.withContext(function($ctx1) {
  22695. return $recv(self._then_(aBlockOrArray))._catch_(anotherBlock);
  22696. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.Thenable)});
  22697. },
  22698. args: ["aBlockOrArray", "anotherBlock"],
  22699. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  22700. referencedClasses: [],
  22701. messageSends: ["catch:", "then:"]
  22702. }),
  22703. $globals.Thenable);
  22704. $core.addMethod(
  22705. $core.method({
  22706. selector: "then:on:do:",
  22707. protocol: "promises",
  22708. fn: function (aBlockOrArray,aClass,aBlock){
  22709. var self=this;
  22710. return $core.withContext(function($ctx1) {
  22711. return $recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  22712. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  22713. },
  22714. args: ["aBlockOrArray", "aClass", "aBlock"],
  22715. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  22716. referencedClasses: [],
  22717. messageSends: ["on:do:", "then:"]
  22718. }),
  22719. $globals.Thenable);
  22720. $core.addMethod(
  22721. $core.method({
  22722. selector: "then:on:do:catch:",
  22723. protocol: "promises",
  22724. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  22725. var self=this;
  22726. return $core.withContext(function($ctx1) {
  22727. return $recv($recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  22728. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  22729. },
  22730. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  22731. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  22732. referencedClasses: [],
  22733. messageSends: ["catch:", "on:do:", "then:"]
  22734. }),
  22735. $globals.Thenable);
  22736. $core.addClass("Promise", $globals.Thenable, [], "Kernel-Promises");
  22737. $core.addMethod(
  22738. $core.method({
  22739. selector: "all:",
  22740. protocol: "composites",
  22741. fn: function (aCollection){
  22742. var self=this;
  22743. return $core.withContext(function($ctx1) {
  22744. return Promise.all($recv(aCollection)._asArray());
  22745. return self;
  22746. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.klass)});
  22747. },
  22748. args: ["aCollection"],
  22749. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  22750. referencedClasses: [],
  22751. messageSends: []
  22752. }),
  22753. $globals.Promise.klass);
  22754. $core.addMethod(
  22755. $core.method({
  22756. selector: "any:",
  22757. protocol: "composites",
  22758. fn: function (aCollection){
  22759. var self=this;
  22760. return $core.withContext(function($ctx1) {
  22761. return Promise.race($recv(aCollection)._asArray());
  22762. return self;
  22763. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.klass)});
  22764. },
  22765. args: ["aCollection"],
  22766. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  22767. referencedClasses: [],
  22768. messageSends: []
  22769. }),
  22770. $globals.Promise.klass);
  22771. $core.addMethod(
  22772. $core.method({
  22773. selector: "forBlock:",
  22774. protocol: "instance creation",
  22775. fn: function (aBlock){
  22776. var self=this;
  22777. return $core.withContext(function($ctx1) {
  22778. return $recv(self._new())._then_(aBlock);
  22779. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.klass)});
  22780. },
  22781. args: ["aBlock"],
  22782. 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",
  22783. referencedClasses: [],
  22784. messageSends: ["then:", "new"]
  22785. }),
  22786. $globals.Promise.klass);
  22787. $core.addMethod(
  22788. $core.method({
  22789. selector: "new",
  22790. protocol: "instance creation",
  22791. fn: function (){
  22792. var self=this;
  22793. return $core.withContext(function($ctx1) {
  22794. return Promise.resolve();
  22795. return self;
  22796. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.klass)});
  22797. },
  22798. args: [],
  22799. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  22800. referencedClasses: [],
  22801. messageSends: []
  22802. }),
  22803. $globals.Promise.klass);
  22804. $core.addMethod(
  22805. $core.method({
  22806. selector: "new:",
  22807. protocol: "instance creation",
  22808. fn: function (aBlock){
  22809. var self=this;
  22810. return $core.withContext(function($ctx1) {
  22811. return new Promise(function (resolve, reject) {
  22812. var model = {value: resolve, signal: reject}; // TODO make faster
  22813. aBlock._value_(model);
  22814. });
  22815. return self;
  22816. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.klass)});
  22817. },
  22818. args: ["aBlock"],
  22819. source: "new: aBlock\x0a\x22Returns a Promise that is eventually resolved or rejected.\x0aPass a block that is called with one argument, model.\x0aYou should call model value: ... to resolve the promise\x0aand model signal: ... to reject the promise.\x0aIf error happens during run of the block,\x0apromise is rejected with that error as well.\x22\x0a<inlineJS: 'return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject}; // TODO make faster\x0a aBlock._value_(model);\x0a})'>",
  22820. referencedClasses: [],
  22821. messageSends: []
  22822. }),
  22823. $globals.Promise.klass);
  22824. $core.addMethod(
  22825. $core.method({
  22826. selector: "signal:",
  22827. protocol: "instance creation",
  22828. fn: function (anObject){
  22829. var self=this;
  22830. return $core.withContext(function($ctx1) {
  22831. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  22832. return self;
  22833. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.klass)});
  22834. },
  22835. args: ["anObject"],
  22836. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  22837. referencedClasses: [],
  22838. messageSends: []
  22839. }),
  22840. $globals.Promise.klass);
  22841. $core.addMethod(
  22842. $core.method({
  22843. selector: "value:",
  22844. protocol: "instance creation",
  22845. fn: function (anObject){
  22846. var self=this;
  22847. return $core.withContext(function($ctx1) {
  22848. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  22849. return self;
  22850. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.klass)});
  22851. },
  22852. args: ["anObject"],
  22853. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  22854. referencedClasses: [],
  22855. messageSends: []
  22856. }),
  22857. $globals.Promise.klass);
  22858. $core.addMethod(
  22859. $core.method({
  22860. selector: "catch:",
  22861. protocol: "*Kernel-Promises",
  22862. fn: function (aBlock){
  22863. var self=this;
  22864. return $core.withContext(function($ctx1) {
  22865. var js = self["@jsObject"];
  22866. if (typeof js.then === "function")
  22867. return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);
  22868. else
  22869. return self._doesNotUnderstand_(
  22870. $globals.Message._new()
  22871. ._selector_("catch:")
  22872. ._arguments_([aBlock])
  22873. );
  22874. return self;
  22875. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  22876. },
  22877. args: ["aBlock"],
  22878. source: "catch: aBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22catch:\x22)\x0a ._arguments_([aBlock])\x0a )'>",
  22879. referencedClasses: [],
  22880. messageSends: []
  22881. }),
  22882. $globals.JSObjectProxy);
  22883. $core.addMethod(
  22884. $core.method({
  22885. selector: "on:do:",
  22886. protocol: "*Kernel-Promises",
  22887. fn: function (aClass,aBlock){
  22888. var self=this;
  22889. return $core.withContext(function($ctx1) {
  22890. var js = self["@jsObject"];
  22891. if (typeof js.then === "function")
  22892. return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);
  22893. else
  22894. return self._doesNotUnderstand_(
  22895. $globals.Message._new()
  22896. ._selector_("on:do:")
  22897. ._arguments_([aClass, aBlock])
  22898. );
  22899. return self;
  22900. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  22901. },
  22902. args: ["aClass", "aBlock"],
  22903. source: "on: aClass do: aBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22on:do:\x22)\x0a ._arguments_([aClass, aBlock])\x0a )'>",
  22904. referencedClasses: [],
  22905. messageSends: []
  22906. }),
  22907. $globals.JSObjectProxy);
  22908. $core.addMethod(
  22909. $core.method({
  22910. selector: "on:do:catch:",
  22911. protocol: "*Kernel-Promises",
  22912. fn: function (aClass,aBlock,anotherBlock){
  22913. var self=this;
  22914. return $core.withContext(function($ctx1) {
  22915. var js = self["@jsObject"];
  22916. if (typeof js.then === "function")
  22917. return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);
  22918. else
  22919. return self._doesNotUnderstand_(
  22920. $globals.Message._new()
  22921. ._selector_("on:do:catch:")
  22922. ._arguments_([aClass, aBlock, anotherBlock])
  22923. );
  22924. return self;
  22925. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  22926. },
  22927. args: ["aClass", "aBlock", "anotherBlock"],
  22928. source: "on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22on:do:catch:\x22)\x0a ._arguments_([aClass, aBlock, anotherBlock])\x0a )'>",
  22929. referencedClasses: [],
  22930. messageSends: []
  22931. }),
  22932. $globals.JSObjectProxy);
  22933. $core.addMethod(
  22934. $core.method({
  22935. selector: "then:",
  22936. protocol: "*Kernel-Promises",
  22937. fn: function (aBlockOrArray){
  22938. var self=this;
  22939. return $core.withContext(function($ctx1) {
  22940. var js = self["@jsObject"];
  22941. if (typeof js.then === "function")
  22942. return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);
  22943. else
  22944. return self._doesNotUnderstand_(
  22945. $globals.Message._new()
  22946. ._selector_("then:")
  22947. ._arguments_([aBlockOrArray])
  22948. );
  22949. return self;
  22950. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  22951. },
  22952. args: ["aBlockOrArray"],
  22953. source: "then: aBlockOrArray\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:\x22)\x0a ._arguments_([aBlockOrArray])\x0a )'>",
  22954. referencedClasses: [],
  22955. messageSends: []
  22956. }),
  22957. $globals.JSObjectProxy);
  22958. $core.addMethod(
  22959. $core.method({
  22960. selector: "then:catch:",
  22961. protocol: "*Kernel-Promises",
  22962. fn: function (aBlockOrArray,anotherBlock){
  22963. var self=this;
  22964. return $core.withContext(function($ctx1) {
  22965. var js = self["@jsObject"];
  22966. if (typeof js.then === "function")
  22967. return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);
  22968. else
  22969. return self._doesNotUnderstand_(
  22970. $globals.Message._new()
  22971. ._selector_("then:catch:")
  22972. ._arguments_([aBlockOrArray, anotherBlock])
  22973. );
  22974. return self;
  22975. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  22976. },
  22977. args: ["aBlockOrArray", "anotherBlock"],
  22978. source: "then: aBlockOrArray catch: anotherBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:catch:\x22)\x0a ._arguments_([aBlockOrArray, anotherBlock])\x0a )'>",
  22979. referencedClasses: [],
  22980. messageSends: []
  22981. }),
  22982. $globals.JSObjectProxy);
  22983. $core.addMethod(
  22984. $core.method({
  22985. selector: "then:on:do:",
  22986. protocol: "*Kernel-Promises",
  22987. fn: function (aBlockOrArray,aClass,aBlock){
  22988. var self=this;
  22989. return $core.withContext(function($ctx1) {
  22990. var js = self["@jsObject"];
  22991. if (typeof js.then === "function")
  22992. return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);
  22993. else
  22994. return self._doesNotUnderstand_(
  22995. $globals.Message._new()
  22996. ._selector_("then:on:do:")
  22997. ._arguments_([aBlockOrArray, aClass, aBlock])
  22998. );
  22999. return self;
  23000. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  23001. },
  23002. args: ["aBlockOrArray", "aClass", "aBlock"],
  23003. source: "then: aBlockOrArray on: aClass do: aBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:on:do:\x22)\x0a ._arguments_([aBlockOrArray, aClass, aBlock])\x0a )'>",
  23004. referencedClasses: [],
  23005. messageSends: []
  23006. }),
  23007. $globals.JSObjectProxy);
  23008. $core.addMethod(
  23009. $core.method({
  23010. selector: "then:on:do:catch:",
  23011. protocol: "*Kernel-Promises",
  23012. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  23013. var self=this;
  23014. return $core.withContext(function($ctx1) {
  23015. var js = self["@jsObject"];
  23016. if (typeof js.then === "function")
  23017. return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);
  23018. else
  23019. return self._doesNotUnderstand_(
  23020. $globals.Message._new()
  23021. ._selector_("then:on:do:catch:")
  23022. ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])
  23023. );
  23024. return self;
  23025. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  23026. },
  23027. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  23028. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a<inlineJS: 'var js = self[\x22@jsObject\x22];\x0aif (typeof js.then === \x22function\x22)\x0a return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);\x0aelse\x0a return self._doesNotUnderstand_(\x0a $globals.Message._new()\x0a ._selector_(\x22then:on:do:catch:\x22)\x0a ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])\x0a )'>",
  23029. referencedClasses: [],
  23030. messageSends: []
  23031. }),
  23032. $globals.JSObjectProxy);
  23033. });
  23034. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23035. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  23036. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  23037. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  23038. $core.addPackage("Kernel-Announcements");
  23039. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  23040. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23041. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  23042. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  23043. $core.addMethod(
  23044. $core.method({
  23045. selector: "announcementClass",
  23046. protocol: "accessing",
  23047. fn: function (){
  23048. var self=this;
  23049. return self["@announcementClass"];
  23050. },
  23051. args: [],
  23052. source: "announcementClass\x0a\x09^ announcementClass",
  23053. referencedClasses: [],
  23054. messageSends: []
  23055. }),
  23056. $globals.AnnouncementSubscription);
  23057. $core.addMethod(
  23058. $core.method({
  23059. selector: "announcementClass:",
  23060. protocol: "accessing",
  23061. fn: function (aClass){
  23062. var self=this;
  23063. self["@announcementClass"]=aClass;
  23064. return self;
  23065. },
  23066. args: ["aClass"],
  23067. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  23068. referencedClasses: [],
  23069. messageSends: []
  23070. }),
  23071. $globals.AnnouncementSubscription);
  23072. $core.addMethod(
  23073. $core.method({
  23074. selector: "deliver:",
  23075. protocol: "announcing",
  23076. fn: function (anAnnouncement){
  23077. var self=this;
  23078. return $core.withContext(function($ctx1) {
  23079. var $1;
  23080. $1=self._handlesAnnouncement_(anAnnouncement);
  23081. if($core.assert($1)){
  23082. $recv(self._valuable())._value_(anAnnouncement);
  23083. }
  23084. return self;
  23085. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  23086. },
  23087. args: ["anAnnouncement"],
  23088. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  23089. referencedClasses: [],
  23090. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  23091. }),
  23092. $globals.AnnouncementSubscription);
  23093. $core.addMethod(
  23094. $core.method({
  23095. selector: "handlesAnnouncement:",
  23096. protocol: "announcing",
  23097. fn: function (anAnnouncement){
  23098. var self=this;
  23099. return $core.withContext(function($ctx1) {
  23100. var $2,$3,$1,$receiver;
  23101. $2=$recv($globals.Smalltalk)._globals();
  23102. $ctx1.sendIdx["globals"]=1;
  23103. $3=$recv(self._announcementClass())._name();
  23104. $ctx1.sendIdx["name"]=1;
  23105. $1=$recv($2)._at_($3);
  23106. $ctx1.sendIdx["at:"]=1;
  23107. if(($receiver = $1) == null || $receiver.isNil){
  23108. return false;
  23109. } else {
  23110. var class_;
  23111. class_=$receiver;
  23112. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  23113. }
  23114. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  23115. },
  23116. args: ["anAnnouncement"],
  23117. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  23118. referencedClasses: ["Smalltalk"],
  23119. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  23120. }),
  23121. $globals.AnnouncementSubscription);
  23122. $core.addMethod(
  23123. $core.method({
  23124. selector: "receiver",
  23125. protocol: "accessing",
  23126. fn: function (){
  23127. var self=this;
  23128. return $core.withContext(function($ctx1) {
  23129. return $recv(self._valuable())._receiver();
  23130. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  23131. },
  23132. args: [],
  23133. source: "receiver\x0a\x09^ self valuable receiver",
  23134. referencedClasses: [],
  23135. messageSends: ["receiver", "valuable"]
  23136. }),
  23137. $globals.AnnouncementSubscription);
  23138. $core.addMethod(
  23139. $core.method({
  23140. selector: "valuable",
  23141. protocol: "accessing",
  23142. fn: function (){
  23143. var self=this;
  23144. return self["@valuable"];
  23145. },
  23146. args: [],
  23147. source: "valuable\x0a\x09^ valuable",
  23148. referencedClasses: [],
  23149. messageSends: []
  23150. }),
  23151. $globals.AnnouncementSubscription);
  23152. $core.addMethod(
  23153. $core.method({
  23154. selector: "valuable:",
  23155. protocol: "accessing",
  23156. fn: function (aValuable){
  23157. var self=this;
  23158. self["@valuable"]=aValuable;
  23159. return self;
  23160. },
  23161. args: ["aValuable"],
  23162. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  23163. referencedClasses: [],
  23164. messageSends: []
  23165. }),
  23166. $globals.AnnouncementSubscription);
  23167. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  23168. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  23169. $core.addMethod(
  23170. $core.method({
  23171. selector: "receiver",
  23172. protocol: "accessing",
  23173. fn: function (){
  23174. var self=this;
  23175. return self["@receiver"];
  23176. },
  23177. args: [],
  23178. source: "receiver\x0a\x09^ receiver",
  23179. referencedClasses: [],
  23180. messageSends: []
  23181. }),
  23182. $globals.AnnouncementValuable);
  23183. $core.addMethod(
  23184. $core.method({
  23185. selector: "receiver:",
  23186. protocol: "accessing",
  23187. fn: function (anObject){
  23188. var self=this;
  23189. self["@receiver"]=anObject;
  23190. return self;
  23191. },
  23192. args: ["anObject"],
  23193. source: "receiver: anObject\x0a\x09receiver := anObject",
  23194. referencedClasses: [],
  23195. messageSends: []
  23196. }),
  23197. $globals.AnnouncementValuable);
  23198. $core.addMethod(
  23199. $core.method({
  23200. selector: "valuable",
  23201. protocol: "accessing",
  23202. fn: function (){
  23203. var self=this;
  23204. return self["@valuable"];
  23205. },
  23206. args: [],
  23207. source: "valuable\x0a\x09^ valuable",
  23208. referencedClasses: [],
  23209. messageSends: []
  23210. }),
  23211. $globals.AnnouncementValuable);
  23212. $core.addMethod(
  23213. $core.method({
  23214. selector: "valuable:",
  23215. protocol: "accessing",
  23216. fn: function (anObject){
  23217. var self=this;
  23218. self["@valuable"]=anObject;
  23219. return self;
  23220. },
  23221. args: ["anObject"],
  23222. source: "valuable: anObject\x0a\x09valuable := anObject",
  23223. referencedClasses: [],
  23224. messageSends: []
  23225. }),
  23226. $globals.AnnouncementValuable);
  23227. $core.addMethod(
  23228. $core.method({
  23229. selector: "value",
  23230. protocol: "evaluating",
  23231. fn: function (){
  23232. var self=this;
  23233. return $core.withContext(function($ctx1) {
  23234. return $recv(self._valuable())._value();
  23235. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  23236. },
  23237. args: [],
  23238. source: "value\x0a\x09^ self valuable value",
  23239. referencedClasses: [],
  23240. messageSends: ["value", "valuable"]
  23241. }),
  23242. $globals.AnnouncementValuable);
  23243. $core.addMethod(
  23244. $core.method({
  23245. selector: "value:",
  23246. protocol: "evaluating",
  23247. fn: function (anObject){
  23248. var self=this;
  23249. return $core.withContext(function($ctx1) {
  23250. return $recv(self._valuable())._value_(anObject);
  23251. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  23252. },
  23253. args: ["anObject"],
  23254. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  23255. referencedClasses: [],
  23256. messageSends: ["value:", "valuable"]
  23257. }),
  23258. $globals.AnnouncementValuable);
  23259. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  23260. $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' ].";
  23261. $core.addMethod(
  23262. $core.method({
  23263. selector: "announce:",
  23264. protocol: "announcing",
  23265. fn: function (anAnnouncement){
  23266. var self=this;
  23267. return $core.withContext(function($ctx1) {
  23268. $recv(self["@subscriptions"])._do_((function(each){
  23269. return $core.withContext(function($ctx2) {
  23270. return $recv(each)._deliver_(anAnnouncement);
  23271. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23272. }));
  23273. return self;
  23274. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  23275. },
  23276. args: ["anAnnouncement"],
  23277. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  23278. referencedClasses: [],
  23279. messageSends: ["do:", "deliver:"]
  23280. }),
  23281. $globals.Announcer);
  23282. $core.addMethod(
  23283. $core.method({
  23284. selector: "initialize",
  23285. protocol: "initialization",
  23286. fn: function (){
  23287. var self=this;
  23288. return $core.withContext(function($ctx1) {
  23289. (
  23290. $ctx1.supercall = true,
  23291. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  23292. $ctx1.supercall = false;
  23293. self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  23294. return self;
  23295. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  23296. },
  23297. args: [],
  23298. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  23299. referencedClasses: ["OrderedCollection"],
  23300. messageSends: ["initialize", "new"]
  23301. }),
  23302. $globals.Announcer);
  23303. $core.addMethod(
  23304. $core.method({
  23305. selector: "on:do:",
  23306. protocol: "subscribing",
  23307. fn: function (aClass,aBlock){
  23308. var self=this;
  23309. return $core.withContext(function($ctx1) {
  23310. self._on_do_for_(aClass,aBlock,nil);
  23311. return self;
  23312. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  23313. },
  23314. args: ["aClass", "aBlock"],
  23315. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  23316. referencedClasses: [],
  23317. messageSends: ["on:do:for:"]
  23318. }),
  23319. $globals.Announcer);
  23320. $core.addMethod(
  23321. $core.method({
  23322. selector: "on:do:for:",
  23323. protocol: "subscribing",
  23324. fn: function (aClass,aBlock,aReceiver){
  23325. var self=this;
  23326. return $core.withContext(function($ctx1) {
  23327. var $1,$3,$5,$6,$4,$2;
  23328. $1=self["@subscriptions"];
  23329. $3=$recv($globals.AnnouncementSubscription)._new();
  23330. $ctx1.sendIdx["new"]=1;
  23331. $5=$recv($globals.AnnouncementValuable)._new();
  23332. $recv($5)._valuable_(aBlock);
  23333. $recv($5)._receiver_(aReceiver);
  23334. $6=$recv($5)._yourself();
  23335. $ctx1.sendIdx["yourself"]=1;
  23336. $4=$6;
  23337. $recv($3)._valuable_($4);
  23338. $ctx1.sendIdx["valuable:"]=1;
  23339. $recv($3)._announcementClass_(aClass);
  23340. $2=$recv($3)._yourself();
  23341. $recv($1)._add_($2);
  23342. return self;
  23343. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  23344. },
  23345. args: ["aClass", "aBlock", "aReceiver"],
  23346. 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)",
  23347. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  23348. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  23349. }),
  23350. $globals.Announcer);
  23351. $core.addMethod(
  23352. $core.method({
  23353. selector: "on:doOnce:",
  23354. protocol: "subscribing",
  23355. fn: function (aClass,aBlock){
  23356. var self=this;
  23357. var subscription;
  23358. return $core.withContext(function($ctx1) {
  23359. var $1;
  23360. $1=$recv($globals.AnnouncementSubscription)._new();
  23361. $recv($1)._announcementClass_(aClass);
  23362. subscription=$recv($1)._yourself();
  23363. $recv(subscription)._valuable_((function(ann){
  23364. return $core.withContext(function($ctx2) {
  23365. $recv(self["@subscriptions"])._remove_(subscription);
  23366. return $recv(aBlock)._value_(ann);
  23367. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  23368. }));
  23369. $recv(self["@subscriptions"])._add_(subscription);
  23370. return self;
  23371. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  23372. },
  23373. args: ["aClass", "aBlock"],
  23374. 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",
  23375. referencedClasses: ["AnnouncementSubscription"],
  23376. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  23377. }),
  23378. $globals.Announcer);
  23379. $core.addMethod(
  23380. $core.method({
  23381. selector: "on:send:to:",
  23382. protocol: "subscribing",
  23383. fn: function (aClass,aSelector,anObject){
  23384. var self=this;
  23385. return $core.withContext(function($ctx1) {
  23386. var $1,$3,$5,$6,$4,$2;
  23387. $1=self["@subscriptions"];
  23388. $3=$recv($globals.AnnouncementSubscription)._new();
  23389. $ctx1.sendIdx["new"]=1;
  23390. $5=$recv($globals.MessageSend)._new();
  23391. $recv($5)._receiver_(anObject);
  23392. $recv($5)._selector_(aSelector);
  23393. $6=$recv($5)._yourself();
  23394. $ctx1.sendIdx["yourself"]=1;
  23395. $4=$6;
  23396. $recv($3)._valuable_($4);
  23397. $recv($3)._announcementClass_(aClass);
  23398. $2=$recv($3)._yourself();
  23399. $recv($1)._add_($2);
  23400. return self;
  23401. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  23402. },
  23403. args: ["aClass", "aSelector", "anObject"],
  23404. 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)",
  23405. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  23406. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  23407. }),
  23408. $globals.Announcer);
  23409. $core.addMethod(
  23410. $core.method({
  23411. selector: "unsubscribe:",
  23412. protocol: "subscribing",
  23413. fn: function (anObject){
  23414. var self=this;
  23415. return $core.withContext(function($ctx1) {
  23416. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  23417. return $core.withContext(function($ctx2) {
  23418. return $recv($recv(each)._receiver()).__eq(anObject);
  23419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23420. }));
  23421. return self;
  23422. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  23423. },
  23424. args: ["anObject"],
  23425. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  23426. referencedClasses: [],
  23427. messageSends: ["reject:", "=", "receiver"]
  23428. }),
  23429. $globals.Announcer);
  23430. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  23431. $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`";
  23432. $globals.SystemAnnouncer.klass.iVarNames = ["current"];
  23433. $core.addMethod(
  23434. $core.method({
  23435. selector: "current",
  23436. protocol: "accessing",
  23437. fn: function (){
  23438. var self=this;
  23439. return $core.withContext(function($ctx1) {
  23440. var $1,$receiver;
  23441. $1=self["@current"];
  23442. if(($receiver = $1) == null || $receiver.isNil){
  23443. self["@current"]=(
  23444. $ctx1.supercall = true,
  23445. ($globals.SystemAnnouncer.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  23446. $ctx1.supercall = false;
  23447. return self["@current"];
  23448. } else {
  23449. return $1;
  23450. }
  23451. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  23452. },
  23453. args: [],
  23454. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  23455. referencedClasses: [],
  23456. messageSends: ["ifNil:", "new"]
  23457. }),
  23458. $globals.SystemAnnouncer.klass);
  23459. $core.addMethod(
  23460. $core.method({
  23461. selector: "new",
  23462. protocol: "instance creation",
  23463. fn: function (){
  23464. var self=this;
  23465. return $core.withContext(function($ctx1) {
  23466. self._shouldNotImplement();
  23467. return self;
  23468. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  23469. },
  23470. args: [],
  23471. source: "new\x0a\x09self shouldNotImplement",
  23472. referencedClasses: [],
  23473. messageSends: ["shouldNotImplement"]
  23474. }),
  23475. $globals.SystemAnnouncer.klass);
  23476. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  23477. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  23478. $core.addMethod(
  23479. $core.method({
  23480. selector: "classTag",
  23481. protocol: "accessing",
  23482. fn: function (){
  23483. var self=this;
  23484. return "announcement";
  23485. },
  23486. args: [],
  23487. 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'",
  23488. referencedClasses: [],
  23489. messageSends: []
  23490. }),
  23491. $globals.SystemAnnouncement.klass);
  23492. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  23493. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  23494. $core.addMethod(
  23495. $core.method({
  23496. selector: "theClass",
  23497. protocol: "accessing",
  23498. fn: function (){
  23499. var self=this;
  23500. return self["@theClass"];
  23501. },
  23502. args: [],
  23503. source: "theClass\x0a\x09^ theClass",
  23504. referencedClasses: [],
  23505. messageSends: []
  23506. }),
  23507. $globals.ClassAnnouncement);
  23508. $core.addMethod(
  23509. $core.method({
  23510. selector: "theClass:",
  23511. protocol: "accessing",
  23512. fn: function (aClass){
  23513. var self=this;
  23514. self["@theClass"]=aClass;
  23515. return self;
  23516. },
  23517. args: ["aClass"],
  23518. source: "theClass: aClass\x0a\x09theClass := aClass",
  23519. referencedClasses: [],
  23520. messageSends: []
  23521. }),
  23522. $globals.ClassAnnouncement);
  23523. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23524. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  23525. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23526. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  23527. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23528. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  23529. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  23530. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  23531. $core.addMethod(
  23532. $core.method({
  23533. selector: "oldClass",
  23534. protocol: "accessing",
  23535. fn: function (){
  23536. var self=this;
  23537. return self["@oldClass"];
  23538. },
  23539. args: [],
  23540. source: "oldClass\x0a\x09^ oldClass",
  23541. referencedClasses: [],
  23542. messageSends: []
  23543. }),
  23544. $globals.ClassMigrated);
  23545. $core.addMethod(
  23546. $core.method({
  23547. selector: "oldClass:",
  23548. protocol: "accessing",
  23549. fn: function (aClass){
  23550. var self=this;
  23551. self["@oldClass"]=aClass;
  23552. return self;
  23553. },
  23554. args: ["aClass"],
  23555. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  23556. referencedClasses: [],
  23557. messageSends: []
  23558. }),
  23559. $globals.ClassMigrated);
  23560. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  23561. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  23562. $core.addMethod(
  23563. $core.method({
  23564. selector: "oldPackage",
  23565. protocol: "accessing",
  23566. fn: function (){
  23567. var self=this;
  23568. return self["@oldPackage"];
  23569. },
  23570. args: [],
  23571. source: "oldPackage\x0a\x09^ oldPackage",
  23572. referencedClasses: [],
  23573. messageSends: []
  23574. }),
  23575. $globals.ClassMoved);
  23576. $core.addMethod(
  23577. $core.method({
  23578. selector: "oldPackage:",
  23579. protocol: "accessing",
  23580. fn: function (aPackage){
  23581. var self=this;
  23582. self["@oldPackage"]=aPackage;
  23583. return self;
  23584. },
  23585. args: ["aPackage"],
  23586. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  23587. referencedClasses: [],
  23588. messageSends: []
  23589. }),
  23590. $globals.ClassMoved);
  23591. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23592. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  23593. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  23594. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  23595. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  23596. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  23597. $core.addMethod(
  23598. $core.method({
  23599. selector: "method",
  23600. protocol: "accessing",
  23601. fn: function (){
  23602. var self=this;
  23603. return self["@method"];
  23604. },
  23605. args: [],
  23606. source: "method\x0a\x09^ method",
  23607. referencedClasses: [],
  23608. messageSends: []
  23609. }),
  23610. $globals.MethodAnnouncement);
  23611. $core.addMethod(
  23612. $core.method({
  23613. selector: "method:",
  23614. protocol: "accessing",
  23615. fn: function (aCompiledMethod){
  23616. var self=this;
  23617. self["@method"]=aCompiledMethod;
  23618. return self;
  23619. },
  23620. args: ["aCompiledMethod"],
  23621. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  23622. referencedClasses: [],
  23623. messageSends: []
  23624. }),
  23625. $globals.MethodAnnouncement);
  23626. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  23627. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  23628. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  23629. $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.";
  23630. $core.addMethod(
  23631. $core.method({
  23632. selector: "oldMethod",
  23633. protocol: "accessing",
  23634. fn: function (){
  23635. var self=this;
  23636. return self["@oldMethod"];
  23637. },
  23638. args: [],
  23639. source: "oldMethod\x0a\x09^ oldMethod",
  23640. referencedClasses: [],
  23641. messageSends: []
  23642. }),
  23643. $globals.MethodModified);
  23644. $core.addMethod(
  23645. $core.method({
  23646. selector: "oldMethod:",
  23647. protocol: "accessing",
  23648. fn: function (aMethod){
  23649. var self=this;
  23650. self["@oldMethod"]=aMethod;
  23651. return self;
  23652. },
  23653. args: ["aMethod"],
  23654. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  23655. referencedClasses: [],
  23656. messageSends: []
  23657. }),
  23658. $globals.MethodModified);
  23659. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  23660. $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.";
  23661. $core.addMethod(
  23662. $core.method({
  23663. selector: "oldProtocol",
  23664. protocol: "accessing",
  23665. fn: function (){
  23666. var self=this;
  23667. return self["@oldProtocol"];
  23668. },
  23669. args: [],
  23670. source: "oldProtocol\x0a\x09^ oldProtocol",
  23671. referencedClasses: [],
  23672. messageSends: []
  23673. }),
  23674. $globals.MethodMoved);
  23675. $core.addMethod(
  23676. $core.method({
  23677. selector: "oldProtocol:",
  23678. protocol: "accessing",
  23679. fn: function (aString){
  23680. var self=this;
  23681. self["@oldProtocol"]=aString;
  23682. return self;
  23683. },
  23684. args: ["aString"],
  23685. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  23686. referencedClasses: [],
  23687. messageSends: []
  23688. }),
  23689. $globals.MethodMoved);
  23690. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  23691. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  23692. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  23693. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  23694. $core.addMethod(
  23695. $core.method({
  23696. selector: "package",
  23697. protocol: "accessing",
  23698. fn: function (){
  23699. var self=this;
  23700. return self["@package"];
  23701. },
  23702. args: [],
  23703. source: "package\x0a\x09^ package",
  23704. referencedClasses: [],
  23705. messageSends: []
  23706. }),
  23707. $globals.PackageAnnouncement);
  23708. $core.addMethod(
  23709. $core.method({
  23710. selector: "package:",
  23711. protocol: "accessing",
  23712. fn: function (aPackage){
  23713. var self=this;
  23714. self["@package"]=aPackage;
  23715. return self;
  23716. },
  23717. args: ["aPackage"],
  23718. source: "package: aPackage\x0a\x09package := aPackage",
  23719. referencedClasses: [],
  23720. messageSends: []
  23721. }),
  23722. $globals.PackageAnnouncement);
  23723. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23724. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  23725. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23726. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  23727. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23728. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  23729. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  23730. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  23731. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  23732. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  23733. $core.addMethod(
  23734. $core.method({
  23735. selector: "package",
  23736. protocol: "accessing",
  23737. fn: function (){
  23738. var self=this;
  23739. return $core.withContext(function($ctx1) {
  23740. var $1,$receiver;
  23741. $1=self._theClass();
  23742. if(($receiver = $1) == null || $receiver.isNil){
  23743. return $1;
  23744. } else {
  23745. var class_;
  23746. class_=$receiver;
  23747. return $recv(class_)._packageOfProtocol_(self._protocol());
  23748. }
  23749. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  23750. },
  23751. args: [],
  23752. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  23753. referencedClasses: [],
  23754. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  23755. }),
  23756. $globals.ProtocolAnnouncement);
  23757. $core.addMethod(
  23758. $core.method({
  23759. selector: "protocol",
  23760. protocol: "accessing",
  23761. fn: function (){
  23762. var self=this;
  23763. return self["@protocol"];
  23764. },
  23765. args: [],
  23766. source: "protocol\x0a\x09^ protocol",
  23767. referencedClasses: [],
  23768. messageSends: []
  23769. }),
  23770. $globals.ProtocolAnnouncement);
  23771. $core.addMethod(
  23772. $core.method({
  23773. selector: "protocol:",
  23774. protocol: "accessing",
  23775. fn: function (aString){
  23776. var self=this;
  23777. self["@protocol"]=aString;
  23778. return self;
  23779. },
  23780. args: ["aString"],
  23781. source: "protocol: aString\x0a\x09protocol := aString",
  23782. referencedClasses: [],
  23783. messageSends: []
  23784. }),
  23785. $globals.ProtocolAnnouncement);
  23786. $core.addMethod(
  23787. $core.method({
  23788. selector: "theClass",
  23789. protocol: "accessing",
  23790. fn: function (){
  23791. var self=this;
  23792. return self["@theClass"];
  23793. },
  23794. args: [],
  23795. source: "theClass\x0a\x09^ theClass",
  23796. referencedClasses: [],
  23797. messageSends: []
  23798. }),
  23799. $globals.ProtocolAnnouncement);
  23800. $core.addMethod(
  23801. $core.method({
  23802. selector: "theClass:",
  23803. protocol: "accessing",
  23804. fn: function (aClass){
  23805. var self=this;
  23806. self["@theClass"]=aClass;
  23807. return self;
  23808. },
  23809. args: ["aClass"],
  23810. source: "theClass: aClass\x0a\x09theClass := aClass",
  23811. referencedClasses: [],
  23812. messageSends: []
  23813. }),
  23814. $globals.ProtocolAnnouncement);
  23815. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  23816. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  23817. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  23818. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  23819. });
  23820. 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";
  23821. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  23822. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  23823. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  23824. $core.addPackage("Platform-Services");
  23825. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  23826. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23827. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  23828. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  23829. $core.addMethod(
  23830. $core.method({
  23831. selector: "handleError:",
  23832. protocol: "error handling",
  23833. fn: function (anError){
  23834. var self=this;
  23835. return $core.withContext(function($ctx1) {
  23836. var $1,$receiver;
  23837. $1=$recv(anError)._context();
  23838. $ctx1.sendIdx["context"]=1;
  23839. if(($receiver = $1) == null || $receiver.isNil){
  23840. $1;
  23841. } else {
  23842. self._logErrorContext_($recv(anError)._context());
  23843. }
  23844. self._logError_(anError);
  23845. return self;
  23846. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  23847. },
  23848. args: ["anError"],
  23849. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  23850. referencedClasses: [],
  23851. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  23852. }),
  23853. $globals.ConsoleErrorHandler);
  23854. $core.addMethod(
  23855. $core.method({
  23856. selector: "log:",
  23857. protocol: "private",
  23858. fn: function (aString){
  23859. var self=this;
  23860. return $core.withContext(function($ctx1) {
  23861. $recv(console)._log_(aString);
  23862. return self;
  23863. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  23864. },
  23865. args: ["aString"],
  23866. source: "log: aString\x0a\x09console log: aString",
  23867. referencedClasses: [],
  23868. messageSends: ["log:"]
  23869. }),
  23870. $globals.ConsoleErrorHandler);
  23871. $core.addMethod(
  23872. $core.method({
  23873. selector: "logContext:",
  23874. protocol: "private",
  23875. fn: function (aContext){
  23876. var self=this;
  23877. return $core.withContext(function($ctx1) {
  23878. var $1,$receiver;
  23879. $1=$recv(aContext)._home();
  23880. $ctx1.sendIdx["home"]=1;
  23881. if(($receiver = $1) == null || $receiver.isNil){
  23882. $1;
  23883. } else {
  23884. self._logContext_($recv(aContext)._home());
  23885. }
  23886. self._log_($recv(aContext)._asString());
  23887. return self;
  23888. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  23889. },
  23890. args: ["aContext"],
  23891. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  23892. referencedClasses: [],
  23893. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  23894. }),
  23895. $globals.ConsoleErrorHandler);
  23896. $core.addMethod(
  23897. $core.method({
  23898. selector: "logError:",
  23899. protocol: "private",
  23900. fn: function (anError){
  23901. var self=this;
  23902. return $core.withContext(function($ctx1) {
  23903. self._log_($recv(anError)._messageText());
  23904. return self;
  23905. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  23906. },
  23907. args: ["anError"],
  23908. source: "logError: anError\x0a\x09self log: anError messageText",
  23909. referencedClasses: [],
  23910. messageSends: ["log:", "messageText"]
  23911. }),
  23912. $globals.ConsoleErrorHandler);
  23913. $core.addMethod(
  23914. $core.method({
  23915. selector: "logErrorContext:",
  23916. protocol: "private",
  23917. fn: function (aContext){
  23918. var self=this;
  23919. return $core.withContext(function($ctx1) {
  23920. var $1,$receiver;
  23921. if(($receiver = aContext) == null || $receiver.isNil){
  23922. aContext;
  23923. } else {
  23924. $1=$recv(aContext)._home();
  23925. $ctx1.sendIdx["home"]=1;
  23926. if(($receiver = $1) == null || $receiver.isNil){
  23927. $1;
  23928. } else {
  23929. self._logContext_($recv(aContext)._home());
  23930. }
  23931. }
  23932. return self;
  23933. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  23934. },
  23935. args: ["aContext"],
  23936. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  23937. referencedClasses: [],
  23938. messageSends: ["ifNotNil:", "home", "logContext:"]
  23939. }),
  23940. $globals.ConsoleErrorHandler);
  23941. $globals.ConsoleErrorHandler.klass.iVarNames = ["current"];
  23942. $core.addMethod(
  23943. $core.method({
  23944. selector: "initialize",
  23945. protocol: "initialization",
  23946. fn: function (){
  23947. var self=this;
  23948. return $core.withContext(function($ctx1) {
  23949. $recv($globals.ErrorHandler)._registerIfNone_(self._new());
  23950. return self;
  23951. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  23952. },
  23953. args: [],
  23954. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  23955. referencedClasses: ["ErrorHandler"],
  23956. messageSends: ["registerIfNone:", "new"]
  23957. }),
  23958. $globals.ConsoleErrorHandler.klass);
  23959. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  23960. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  23961. $core.addMethod(
  23962. $core.method({
  23963. selector: "clear",
  23964. protocol: "printing",
  23965. fn: function (){
  23966. var self=this;
  23967. return self;
  23968. },
  23969. args: [],
  23970. source: "clear\x0a\x09\x22no op\x22",
  23971. referencedClasses: [],
  23972. messageSends: []
  23973. }),
  23974. $globals.ConsoleTranscript);
  23975. $core.addMethod(
  23976. $core.method({
  23977. selector: "cr",
  23978. protocol: "printing",
  23979. fn: function (){
  23980. var self=this;
  23981. return self;
  23982. },
  23983. args: [],
  23984. source: "cr\x0a\x09\x22no op\x22",
  23985. referencedClasses: [],
  23986. messageSends: []
  23987. }),
  23988. $globals.ConsoleTranscript);
  23989. $core.addMethod(
  23990. $core.method({
  23991. selector: "open",
  23992. protocol: "actions",
  23993. fn: function (){
  23994. var self=this;
  23995. return self;
  23996. },
  23997. args: [],
  23998. source: "open",
  23999. referencedClasses: [],
  24000. messageSends: []
  24001. }),
  24002. $globals.ConsoleTranscript);
  24003. $core.addMethod(
  24004. $core.method({
  24005. selector: "show:",
  24006. protocol: "printing",
  24007. fn: function (anObject){
  24008. var self=this;
  24009. return $core.withContext(function($ctx1) {
  24010. console.log(String($recv(anObject)._asString()));
  24011. return self;
  24012. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  24013. },
  24014. args: ["anObject"],
  24015. 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()))'>",
  24016. referencedClasses: [],
  24017. messageSends: []
  24018. }),
  24019. $globals.ConsoleTranscript);
  24020. $core.addMethod(
  24021. $core.method({
  24022. selector: "initialize",
  24023. protocol: "initialization",
  24024. fn: function (){
  24025. var self=this;
  24026. return $core.withContext(function($ctx1) {
  24027. $recv($globals.Transcript)._registerIfNone_(self._new());
  24028. return self;
  24029. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  24030. },
  24031. args: [],
  24032. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  24033. referencedClasses: ["Transcript"],
  24034. messageSends: ["registerIfNone:", "new"]
  24035. }),
  24036. $globals.ConsoleTranscript.klass);
  24037. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  24038. $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.";
  24039. $core.addMethod(
  24040. $core.method({
  24041. selector: "addInstVarNamed:to:",
  24042. protocol: "compiling",
  24043. fn: function (aString,aClass){
  24044. var self=this;
  24045. return $core.withContext(function($ctx1) {
  24046. var $1,$2,$3,$5,$4;
  24047. $1=self._classBuilder();
  24048. $2=$recv(aClass)._superclass();
  24049. $3=$recv(aClass)._name();
  24050. $ctx1.sendIdx["name"]=1;
  24051. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  24052. $recv($5)._add_(aString);
  24053. $4=$recv($5)._yourself();
  24054. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  24055. return self;
  24056. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  24057. },
  24058. args: ["aString", "aClass"],
  24059. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  24060. referencedClasses: [],
  24061. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  24062. }),
  24063. $globals.Environment);
  24064. $core.addMethod(
  24065. $core.method({
  24066. selector: "allSelectors",
  24067. protocol: "accessing",
  24068. fn: function (){
  24069. var self=this;
  24070. return $core.withContext(function($ctx1) {
  24071. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  24072. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  24073. },
  24074. args: [],
  24075. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  24076. referencedClasses: ["Smalltalk"],
  24077. messageSends: ["allSelectors", "core"]
  24078. }),
  24079. $globals.Environment);
  24080. $core.addMethod(
  24081. $core.method({
  24082. selector: "availableClassNames",
  24083. protocol: "accessing",
  24084. fn: function (){
  24085. var self=this;
  24086. return $core.withContext(function($ctx1) {
  24087. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  24088. return $core.withContext(function($ctx2) {
  24089. return $recv(each)._name();
  24090. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24091. }));
  24092. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  24093. },
  24094. args: [],
  24095. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  24096. referencedClasses: ["Smalltalk"],
  24097. messageSends: ["collect:", "classes", "name"]
  24098. }),
  24099. $globals.Environment);
  24100. $core.addMethod(
  24101. $core.method({
  24102. selector: "availablePackageNames",
  24103. protocol: "accessing",
  24104. fn: function (){
  24105. var self=this;
  24106. return $core.withContext(function($ctx1) {
  24107. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  24108. return $core.withContext(function($ctx2) {
  24109. return $recv(each)._name();
  24110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24111. }));
  24112. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  24113. },
  24114. args: [],
  24115. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  24116. referencedClasses: ["Smalltalk"],
  24117. messageSends: ["collect:", "packages", "name"]
  24118. }),
  24119. $globals.Environment);
  24120. $core.addMethod(
  24121. $core.method({
  24122. selector: "availableProtocolsFor:",
  24123. protocol: "accessing",
  24124. fn: function (aClass){
  24125. var self=this;
  24126. var protocols;
  24127. return $core.withContext(function($ctx1) {
  24128. var $1,$receiver;
  24129. protocols=$recv(aClass)._protocols();
  24130. $1=$recv(aClass)._superclass();
  24131. $ctx1.sendIdx["superclass"]=1;
  24132. if(($receiver = $1) == null || $receiver.isNil){
  24133. $1;
  24134. } else {
  24135. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  24136. }
  24137. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  24138. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  24139. },
  24140. args: ["aClass"],
  24141. 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",
  24142. referencedClasses: [],
  24143. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  24144. }),
  24145. $globals.Environment);
  24146. $core.addMethod(
  24147. $core.method({
  24148. selector: "classBuilder",
  24149. protocol: "accessing",
  24150. fn: function (){
  24151. var self=this;
  24152. return $core.withContext(function($ctx1) {
  24153. return $recv($globals.ClassBuilder)._new();
  24154. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  24155. },
  24156. args: [],
  24157. source: "classBuilder\x0a\x09^ ClassBuilder new",
  24158. referencedClasses: ["ClassBuilder"],
  24159. messageSends: ["new"]
  24160. }),
  24161. $globals.Environment);
  24162. $core.addMethod(
  24163. $core.method({
  24164. selector: "classNamed:",
  24165. protocol: "accessing",
  24166. fn: function (aString){
  24167. var self=this;
  24168. return $core.withContext(function($ctx1) {
  24169. var $1,$receiver;
  24170. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  24171. if(($receiver = $1) == null || $receiver.isNil){
  24172. return self._error_("Invalid class name");
  24173. } else {
  24174. return $1;
  24175. }
  24176. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  24177. },
  24178. args: ["aString"],
  24179. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  24180. referencedClasses: ["Smalltalk"],
  24181. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  24182. }),
  24183. $globals.Environment);
  24184. $core.addMethod(
  24185. $core.method({
  24186. selector: "classes",
  24187. protocol: "accessing",
  24188. fn: function (){
  24189. var self=this;
  24190. return $core.withContext(function($ctx1) {
  24191. return $recv($globals.Smalltalk)._classes();
  24192. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  24193. },
  24194. args: [],
  24195. source: "classes\x0a\x09^ Smalltalk classes",
  24196. referencedClasses: ["Smalltalk"],
  24197. messageSends: ["classes"]
  24198. }),
  24199. $globals.Environment);
  24200. $core.addMethod(
  24201. $core.method({
  24202. selector: "commitPackage:onSuccess:onError:",
  24203. protocol: "actions",
  24204. fn: function (aPackage,aBlock,anotherBlock){
  24205. var self=this;
  24206. return $core.withContext(function($ctx1) {
  24207. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  24208. return self;
  24209. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  24210. },
  24211. args: ["aPackage", "aBlock", "anotherBlock"],
  24212. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  24213. referencedClasses: [],
  24214. messageSends: ["commitOnSuccess:onError:", "transport"]
  24215. }),
  24216. $globals.Environment);
  24217. $core.addMethod(
  24218. $core.method({
  24219. selector: "compileClassComment:for:",
  24220. protocol: "compiling",
  24221. fn: function (aString,aClass){
  24222. var self=this;
  24223. return $core.withContext(function($ctx1) {
  24224. $recv(aClass)._comment_(aString);
  24225. return self;
  24226. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  24227. },
  24228. args: ["aString", "aClass"],
  24229. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  24230. referencedClasses: [],
  24231. messageSends: ["comment:"]
  24232. }),
  24233. $globals.Environment);
  24234. $core.addMethod(
  24235. $core.method({
  24236. selector: "compileClassDefinition:",
  24237. protocol: "compiling",
  24238. fn: function (aString){
  24239. var self=this;
  24240. return $core.withContext(function($ctx1) {
  24241. $recv((function(){
  24242. return $core.withContext(function($ctx2) {
  24243. return self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  24244. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24245. }))._on_do_($globals.Error,(function(error){
  24246. return $core.withContext(function($ctx2) {
  24247. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  24248. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  24249. }));
  24250. return self;
  24251. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  24252. },
  24253. args: ["aString"],
  24254. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  24255. referencedClasses: ["DoIt", "Error", "Terminal"],
  24256. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  24257. }),
  24258. $globals.Environment);
  24259. $core.addMethod(
  24260. $core.method({
  24261. selector: "compileMethod:for:protocol:",
  24262. protocol: "compiling",
  24263. fn: function (sourceCode,class_,protocol){
  24264. var self=this;
  24265. return $core.withContext(function($ctx1) {
  24266. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  24267. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  24268. },
  24269. args: ["sourceCode", "class", "protocol"],
  24270. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  24271. referencedClasses: [],
  24272. messageSends: ["compile:protocol:"]
  24273. }),
  24274. $globals.Environment);
  24275. $core.addMethod(
  24276. $core.method({
  24277. selector: "copyClass:to:",
  24278. protocol: "actions",
  24279. fn: function (aClass,aClassName){
  24280. var self=this;
  24281. return $core.withContext(function($ctx1) {
  24282. var $1,$2,$receiver;
  24283. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  24284. if(($receiver = $1) == null || $receiver.isNil){
  24285. $1;
  24286. } else {
  24287. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  24288. $ctx1.sendIdx[","]=1;
  24289. self._error_($2);
  24290. }
  24291. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  24292. return self;
  24293. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  24294. },
  24295. args: ["aClass", "aClassName"],
  24296. 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",
  24297. referencedClasses: ["Smalltalk", "ClassBuilder"],
  24298. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  24299. }),
  24300. $globals.Environment);
  24301. $core.addMethod(
  24302. $core.method({
  24303. selector: "doItReceiver",
  24304. protocol: "accessing",
  24305. fn: function (){
  24306. var self=this;
  24307. return $core.withContext(function($ctx1) {
  24308. return $recv($globals.DoIt)._new();
  24309. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  24310. },
  24311. args: [],
  24312. source: "doItReceiver\x0a\x09^ DoIt new",
  24313. referencedClasses: ["DoIt"],
  24314. messageSends: ["new"]
  24315. }),
  24316. $globals.Environment);
  24317. $core.addMethod(
  24318. $core.method({
  24319. selector: "evaluate:for:",
  24320. protocol: "evaluating",
  24321. fn: function (aString,anObject){
  24322. var self=this;
  24323. return $core.withContext(function($ctx1) {
  24324. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  24325. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  24326. },
  24327. args: ["aString", "anObject"],
  24328. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  24329. referencedClasses: ["Evaluator"],
  24330. messageSends: ["evaluate:for:"]
  24331. }),
  24332. $globals.Environment);
  24333. $core.addMethod(
  24334. $core.method({
  24335. selector: "evaluate:on:do:",
  24336. protocol: "error handling",
  24337. fn: function (aBlock,anErrorClass,exceptionBlock){
  24338. var self=this;
  24339. return $core.withContext(function($ctx1) {
  24340. var $1;
  24341. $recv(aBlock)._tryCatch_((function(exception){
  24342. return $core.withContext(function($ctx2) {
  24343. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  24344. if($core.assert($1)){
  24345. return $recv(exceptionBlock)._value_(exception);
  24346. } else {
  24347. return $recv(exception)._resignal();
  24348. }
  24349. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  24350. }));
  24351. return self;
  24352. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  24353. },
  24354. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  24355. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  24356. referencedClasses: [],
  24357. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  24358. }),
  24359. $globals.Environment);
  24360. $core.addMethod(
  24361. $core.method({
  24362. selector: "inspect:",
  24363. protocol: "actions",
  24364. fn: function (anObject){
  24365. var self=this;
  24366. return $core.withContext(function($ctx1) {
  24367. $recv($globals.Inspector)._inspect_(anObject);
  24368. return self;
  24369. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  24370. },
  24371. args: ["anObject"],
  24372. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  24373. referencedClasses: ["Inspector"],
  24374. messageSends: ["inspect:"]
  24375. }),
  24376. $globals.Environment);
  24377. $core.addMethod(
  24378. $core.method({
  24379. selector: "moveClass:toPackage:",
  24380. protocol: "actions",
  24381. fn: function (aClass,aPackageName){
  24382. var self=this;
  24383. var package_;
  24384. return $core.withContext(function($ctx1) {
  24385. var $1,$2,$receiver;
  24386. package_=$recv($globals.Package)._named_(aPackageName);
  24387. $1=package_;
  24388. if(($receiver = $1) == null || $receiver.isNil){
  24389. self._error_("Invalid package name");
  24390. } else {
  24391. $1;
  24392. }
  24393. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  24394. if($core.assert($2)){
  24395. return self;
  24396. }
  24397. $recv(aClass)._package_(package_);
  24398. $recv(aClass)._recompile();
  24399. return self;
  24400. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  24401. },
  24402. args: ["aClass", "aPackageName"],
  24403. 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",
  24404. referencedClasses: ["Package"],
  24405. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  24406. }),
  24407. $globals.Environment);
  24408. $core.addMethod(
  24409. $core.method({
  24410. selector: "moveMethod:toClass:",
  24411. protocol: "actions",
  24412. fn: function (aMethod,aClassName){
  24413. var self=this;
  24414. var destinationClass;
  24415. return $core.withContext(function($ctx1) {
  24416. var $2,$3,$1,$5,$4;
  24417. destinationClass=self._classNamed_(aClassName);
  24418. $2=destinationClass;
  24419. $3=$recv(aMethod)._methodClass();
  24420. $ctx1.sendIdx["methodClass"]=1;
  24421. $1=$recv($2).__eq_eq($3);
  24422. if($core.assert($1)){
  24423. return self;
  24424. }
  24425. $5=$recv(aMethod)._methodClass();
  24426. $ctx1.sendIdx["methodClass"]=2;
  24427. $4=$recv($5)._isMetaclass();
  24428. if($core.assert($4)){
  24429. destinationClass=$recv(destinationClass)._theMetaClass();
  24430. destinationClass;
  24431. }
  24432. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  24433. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  24434. return self;
  24435. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  24436. },
  24437. args: ["aMethod", "aClassName"],
  24438. 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",
  24439. referencedClasses: [],
  24440. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  24441. }),
  24442. $globals.Environment);
  24443. $core.addMethod(
  24444. $core.method({
  24445. selector: "moveMethod:toProtocol:",
  24446. protocol: "actions",
  24447. fn: function (aMethod,aProtocol){
  24448. var self=this;
  24449. return $core.withContext(function($ctx1) {
  24450. $recv(aMethod)._protocol_(aProtocol);
  24451. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  24452. return self;
  24453. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  24454. },
  24455. args: ["aMethod", "aProtocol"],
  24456. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  24457. referencedClasses: [],
  24458. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  24459. }),
  24460. $globals.Environment);
  24461. $core.addMethod(
  24462. $core.method({
  24463. selector: "packages",
  24464. protocol: "accessing",
  24465. fn: function (){
  24466. var self=this;
  24467. return $core.withContext(function($ctx1) {
  24468. return $recv($globals.Smalltalk)._packages();
  24469. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  24470. },
  24471. args: [],
  24472. source: "packages\x0a\x09^ Smalltalk packages",
  24473. referencedClasses: ["Smalltalk"],
  24474. messageSends: ["packages"]
  24475. }),
  24476. $globals.Environment);
  24477. $core.addMethod(
  24478. $core.method({
  24479. selector: "registerErrorHandler:",
  24480. protocol: "services",
  24481. fn: function (anErrorHandler){
  24482. var self=this;
  24483. return $core.withContext(function($ctx1) {
  24484. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  24485. return self;
  24486. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  24487. },
  24488. args: ["anErrorHandler"],
  24489. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  24490. referencedClasses: ["ErrorHandler"],
  24491. messageSends: ["register:"]
  24492. }),
  24493. $globals.Environment);
  24494. $core.addMethod(
  24495. $core.method({
  24496. selector: "registerFinder:",
  24497. protocol: "services",
  24498. fn: function (aFinder){
  24499. var self=this;
  24500. return $core.withContext(function($ctx1) {
  24501. $recv($globals.Finder)._register_(aFinder);
  24502. return self;
  24503. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  24504. },
  24505. args: ["aFinder"],
  24506. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  24507. referencedClasses: ["Finder"],
  24508. messageSends: ["register:"]
  24509. }),
  24510. $globals.Environment);
  24511. $core.addMethod(
  24512. $core.method({
  24513. selector: "registerInspector:",
  24514. protocol: "services",
  24515. fn: function (anInspector){
  24516. var self=this;
  24517. return $core.withContext(function($ctx1) {
  24518. $recv($globals.Inspector)._register_(anInspector);
  24519. return self;
  24520. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  24521. },
  24522. args: ["anInspector"],
  24523. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  24524. referencedClasses: ["Inspector"],
  24525. messageSends: ["register:"]
  24526. }),
  24527. $globals.Environment);
  24528. $core.addMethod(
  24529. $core.method({
  24530. selector: "registerProgressHandler:",
  24531. protocol: "services",
  24532. fn: function (aProgressHandler){
  24533. var self=this;
  24534. return $core.withContext(function($ctx1) {
  24535. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  24536. return self;
  24537. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  24538. },
  24539. args: ["aProgressHandler"],
  24540. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  24541. referencedClasses: ["ProgressHandler"],
  24542. messageSends: ["register:"]
  24543. }),
  24544. $globals.Environment);
  24545. $core.addMethod(
  24546. $core.method({
  24547. selector: "registerTranscript:",
  24548. protocol: "services",
  24549. fn: function (aTranscript){
  24550. var self=this;
  24551. return $core.withContext(function($ctx1) {
  24552. $recv($globals.Transcript)._register_(aTranscript);
  24553. return self;
  24554. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  24555. },
  24556. args: ["aTranscript"],
  24557. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  24558. referencedClasses: ["Transcript"],
  24559. messageSends: ["register:"]
  24560. }),
  24561. $globals.Environment);
  24562. $core.addMethod(
  24563. $core.method({
  24564. selector: "removeClass:",
  24565. protocol: "actions",
  24566. fn: function (aClass){
  24567. var self=this;
  24568. return $core.withContext(function($ctx1) {
  24569. $recv($globals.Smalltalk)._removeClass_(aClass);
  24570. return self;
  24571. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  24572. },
  24573. args: ["aClass"],
  24574. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  24575. referencedClasses: ["Smalltalk"],
  24576. messageSends: ["removeClass:"]
  24577. }),
  24578. $globals.Environment);
  24579. $core.addMethod(
  24580. $core.method({
  24581. selector: "removeMethod:",
  24582. protocol: "actions",
  24583. fn: function (aMethod){
  24584. var self=this;
  24585. return $core.withContext(function($ctx1) {
  24586. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  24587. return self;
  24588. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  24589. },
  24590. args: ["aMethod"],
  24591. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  24592. referencedClasses: [],
  24593. messageSends: ["removeCompiledMethod:", "methodClass"]
  24594. }),
  24595. $globals.Environment);
  24596. $core.addMethod(
  24597. $core.method({
  24598. selector: "removeProtocol:from:",
  24599. protocol: "actions",
  24600. fn: function (aString,aClass){
  24601. var self=this;
  24602. return $core.withContext(function($ctx1) {
  24603. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  24604. return $core.withContext(function($ctx2) {
  24605. return $recv(aClass)._removeCompiledMethod_(each);
  24606. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24607. }));
  24608. return self;
  24609. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  24610. },
  24611. args: ["aString", "aClass"],
  24612. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  24613. referencedClasses: [],
  24614. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  24615. }),
  24616. $globals.Environment);
  24617. $core.addMethod(
  24618. $core.method({
  24619. selector: "renameClass:to:",
  24620. protocol: "actions",
  24621. fn: function (aClass,aClassName){
  24622. var self=this;
  24623. return $core.withContext(function($ctx1) {
  24624. var $1,$2,$receiver;
  24625. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  24626. if(($receiver = $1) == null || $receiver.isNil){
  24627. $1;
  24628. } else {
  24629. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  24630. $ctx1.sendIdx[","]=1;
  24631. self._error_($2);
  24632. }
  24633. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  24634. return self;
  24635. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  24636. },
  24637. args: ["aClass", "aClassName"],
  24638. 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",
  24639. referencedClasses: ["Smalltalk", "ClassBuilder"],
  24640. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  24641. }),
  24642. $globals.Environment);
  24643. $core.addMethod(
  24644. $core.method({
  24645. selector: "renamePackage:to:",
  24646. protocol: "actions",
  24647. fn: function (aPackageName,aNewPackageName){
  24648. var self=this;
  24649. return $core.withContext(function($ctx1) {
  24650. var $1,$2,$receiver;
  24651. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aNewPackageName);
  24652. if(($receiver = $1) == null || $receiver.isNil){
  24653. $1;
  24654. } else {
  24655. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  24656. $ctx1.sendIdx[","]=1;
  24657. self._error_($2);
  24658. }
  24659. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  24660. return self;
  24661. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  24662. },
  24663. args: ["aPackageName", "aNewPackageName"],
  24664. source: "renamePackage: aPackageName to: aNewPackageName\x0a (Smalltalk globals at: aNewPackageName)\x0a ifNotNil: [ self error: 'A package named ', aNewPackageName, ' already exists' ].\x0a\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  24665. referencedClasses: ["Smalltalk"],
  24666. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  24667. }),
  24668. $globals.Environment);
  24669. $core.addMethod(
  24670. $core.method({
  24671. selector: "renameProtocol:to:in:",
  24672. protocol: "actions",
  24673. fn: function (aString,anotherString,aClass){
  24674. var self=this;
  24675. return $core.withContext(function($ctx1) {
  24676. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  24677. return $core.withContext(function($ctx2) {
  24678. return $recv(each)._protocol_(anotherString);
  24679. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24680. }));
  24681. return self;
  24682. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  24683. },
  24684. args: ["aString", "anotherString", "aClass"],
  24685. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  24686. referencedClasses: [],
  24687. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  24688. }),
  24689. $globals.Environment);
  24690. $core.addMethod(
  24691. $core.method({
  24692. selector: "setClassCommentOf:to:",
  24693. protocol: "actions",
  24694. fn: function (aClass,aString){
  24695. var self=this;
  24696. return $core.withContext(function($ctx1) {
  24697. $recv(aClass)._comment_(aString);
  24698. return self;
  24699. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  24700. },
  24701. args: ["aClass", "aString"],
  24702. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  24703. referencedClasses: [],
  24704. messageSends: ["comment:"]
  24705. }),
  24706. $globals.Environment);
  24707. $core.addMethod(
  24708. $core.method({
  24709. selector: "systemAnnouncer",
  24710. protocol: "accessing",
  24711. fn: function (){
  24712. var self=this;
  24713. return $core.withContext(function($ctx1) {
  24714. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  24715. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  24716. },
  24717. args: [],
  24718. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  24719. referencedClasses: ["Smalltalk"],
  24720. messageSends: ["current", "at:", "globals"]
  24721. }),
  24722. $globals.Environment);
  24723. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  24724. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  24725. $core.addMethod(
  24726. $core.method({
  24727. selector: "do:on:displaying:",
  24728. protocol: "progress handling",
  24729. fn: function (aBlock,aCollection,aString){
  24730. var self=this;
  24731. return $core.withContext(function($ctx1) {
  24732. $recv(aCollection)._do_(aBlock);
  24733. return self;
  24734. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  24735. },
  24736. args: ["aBlock", "aCollection", "aString"],
  24737. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  24738. referencedClasses: [],
  24739. messageSends: ["do:"]
  24740. }),
  24741. $globals.NullProgressHandler);
  24742. $globals.NullProgressHandler.klass.iVarNames = ["current"];
  24743. $core.addMethod(
  24744. $core.method({
  24745. selector: "initialize",
  24746. protocol: "initialization",
  24747. fn: function (){
  24748. var self=this;
  24749. return $core.withContext(function($ctx1) {
  24750. $recv($globals.ProgressHandler)._registerIfNone_(self._new());
  24751. return self;
  24752. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  24753. },
  24754. args: [],
  24755. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  24756. referencedClasses: ["ProgressHandler"],
  24757. messageSends: ["registerIfNone:", "new"]
  24758. }),
  24759. $globals.NullProgressHandler.klass);
  24760. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  24761. $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.";
  24762. $globals.Service.klass.iVarNames = ["current"];
  24763. $core.addMethod(
  24764. $core.method({
  24765. selector: "current",
  24766. protocol: "accessing",
  24767. fn: function (){
  24768. var self=this;
  24769. return self["@current"];
  24770. },
  24771. args: [],
  24772. source: "current\x0a\x09^ current",
  24773. referencedClasses: [],
  24774. messageSends: []
  24775. }),
  24776. $globals.Service.klass);
  24777. $core.addMethod(
  24778. $core.method({
  24779. selector: "new",
  24780. protocol: "instance creation",
  24781. fn: function (){
  24782. var self=this;
  24783. return $core.withContext(function($ctx1) {
  24784. self._shouldNotImplement();
  24785. return self;
  24786. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  24787. },
  24788. args: [],
  24789. source: "new\x0a\x09self shouldNotImplement",
  24790. referencedClasses: [],
  24791. messageSends: ["shouldNotImplement"]
  24792. }),
  24793. $globals.Service.klass);
  24794. $core.addMethod(
  24795. $core.method({
  24796. selector: "register:",
  24797. protocol: "registration",
  24798. fn: function (anObject){
  24799. var self=this;
  24800. self["@current"]=anObject;
  24801. return self;
  24802. },
  24803. args: ["anObject"],
  24804. source: "register: anObject\x0a\x09current := anObject",
  24805. referencedClasses: [],
  24806. messageSends: []
  24807. }),
  24808. $globals.Service.klass);
  24809. $core.addMethod(
  24810. $core.method({
  24811. selector: "registerIfNone:",
  24812. protocol: "registration",
  24813. fn: function (anObject){
  24814. var self=this;
  24815. return $core.withContext(function($ctx1) {
  24816. var $1,$receiver;
  24817. $1=self._current();
  24818. if(($receiver = $1) == null || $receiver.isNil){
  24819. self._register_(anObject);
  24820. } else {
  24821. $1;
  24822. }
  24823. return self;
  24824. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  24825. },
  24826. args: ["anObject"],
  24827. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  24828. referencedClasses: [],
  24829. messageSends: ["ifNil:", "current", "register:"]
  24830. }),
  24831. $globals.Service.klass);
  24832. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  24833. $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.";
  24834. $core.addMethod(
  24835. $core.method({
  24836. selector: "handleError:",
  24837. protocol: "error handling",
  24838. fn: function (anError){
  24839. var self=this;
  24840. return $core.withContext(function($ctx1) {
  24841. self._handleUnhandledError_(anError);
  24842. return self;
  24843. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  24844. },
  24845. args: ["anError"],
  24846. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  24847. referencedClasses: [],
  24848. messageSends: ["handleUnhandledError:"]
  24849. }),
  24850. $globals.ErrorHandler.klass);
  24851. $core.addMethod(
  24852. $core.method({
  24853. selector: "handleUnhandledError:",
  24854. protocol: "error handling",
  24855. fn: function (anError){
  24856. var self=this;
  24857. return $core.withContext(function($ctx1) {
  24858. var $1;
  24859. $1=$recv(anError)._wasHandled();
  24860. if($core.assert($1)){
  24861. return self;
  24862. }
  24863. return $recv(self._current())._handleError_(anError);
  24864. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  24865. },
  24866. args: ["anError"],
  24867. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  24868. referencedClasses: [],
  24869. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  24870. }),
  24871. $globals.ErrorHandler.klass);
  24872. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  24873. $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.";
  24874. $core.addMethod(
  24875. $core.method({
  24876. selector: "findClass:",
  24877. protocol: "finding",
  24878. fn: function (aClass){
  24879. var self=this;
  24880. return $core.withContext(function($ctx1) {
  24881. return $recv(self._current())._findClass_(aClass);
  24882. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  24883. },
  24884. args: ["aClass"],
  24885. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  24886. referencedClasses: [],
  24887. messageSends: ["findClass:", "current"]
  24888. }),
  24889. $globals.Finder.klass);
  24890. $core.addMethod(
  24891. $core.method({
  24892. selector: "findMethod:",
  24893. protocol: "finding",
  24894. fn: function (aCompiledMethod){
  24895. var self=this;
  24896. return $core.withContext(function($ctx1) {
  24897. return $recv(self._current())._findMethod_(aCompiledMethod);
  24898. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  24899. },
  24900. args: ["aCompiledMethod"],
  24901. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  24902. referencedClasses: [],
  24903. messageSends: ["findMethod:", "current"]
  24904. }),
  24905. $globals.Finder.klass);
  24906. $core.addMethod(
  24907. $core.method({
  24908. selector: "findString:",
  24909. protocol: "finding",
  24910. fn: function (aString){
  24911. var self=this;
  24912. return $core.withContext(function($ctx1) {
  24913. return $recv(self._current())._findString_(aString);
  24914. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  24915. },
  24916. args: ["aString"],
  24917. source: "findString: aString\x0a\x09^ self current findString: aString",
  24918. referencedClasses: [],
  24919. messageSends: ["findString:", "current"]
  24920. }),
  24921. $globals.Finder.klass);
  24922. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  24923. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  24924. $core.addMethod(
  24925. $core.method({
  24926. selector: "inspect:",
  24927. protocol: "inspecting",
  24928. fn: function (anObject){
  24929. var self=this;
  24930. return $core.withContext(function($ctx1) {
  24931. return $recv(self._current())._inspect_(anObject);
  24932. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  24933. },
  24934. args: ["anObject"],
  24935. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  24936. referencedClasses: [],
  24937. messageSends: ["inspect:", "current"]
  24938. }),
  24939. $globals.Inspector.klass);
  24940. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  24941. $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";
  24942. $core.addMethod(
  24943. $core.method({
  24944. selector: "globals",
  24945. protocol: "accessing",
  24946. fn: function (){
  24947. var self=this;
  24948. return $core.withContext(function($ctx1) {
  24949. return $recv(self._current())._globals();
  24950. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  24951. },
  24952. args: [],
  24953. source: "globals\x0a\x09^ self current globals",
  24954. referencedClasses: [],
  24955. messageSends: ["globals", "current"]
  24956. }),
  24957. $globals.Platform.klass);
  24958. $core.addMethod(
  24959. $core.method({
  24960. selector: "newXhr",
  24961. protocol: "accessing",
  24962. fn: function (){
  24963. var self=this;
  24964. return $core.withContext(function($ctx1) {
  24965. return $recv(self._current())._newXhr();
  24966. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  24967. },
  24968. args: [],
  24969. source: "newXhr\x0a\x09^ self current newXhr",
  24970. referencedClasses: [],
  24971. messageSends: ["newXhr", "current"]
  24972. }),
  24973. $globals.Platform.klass);
  24974. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  24975. $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`.";
  24976. $core.addMethod(
  24977. $core.method({
  24978. selector: "do:on:displaying:",
  24979. protocol: "progress handling",
  24980. fn: function (aBlock,aCollection,aString){
  24981. var self=this;
  24982. return $core.withContext(function($ctx1) {
  24983. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  24984. return self;
  24985. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  24986. },
  24987. args: ["aBlock", "aCollection", "aString"],
  24988. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  24989. referencedClasses: [],
  24990. messageSends: ["do:on:displaying:", "current"]
  24991. }),
  24992. $globals.ProgressHandler.klass);
  24993. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  24994. $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:'.";
  24995. $core.addMethod(
  24996. $core.method({
  24997. selector: "alert:",
  24998. protocol: "dialogs",
  24999. fn: function (aString){
  25000. var self=this;
  25001. return $core.withContext(function($ctx1) {
  25002. return $recv(self._current())._alert_(aString);
  25003. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  25004. },
  25005. args: ["aString"],
  25006. source: "alert: aString\x0a\x09^ self current alert: aString",
  25007. referencedClasses: [],
  25008. messageSends: ["alert:", "current"]
  25009. }),
  25010. $globals.Terminal.klass);
  25011. $core.addMethod(
  25012. $core.method({
  25013. selector: "confirm:",
  25014. protocol: "dialogs",
  25015. fn: function (aString){
  25016. var self=this;
  25017. return $core.withContext(function($ctx1) {
  25018. return $recv(self._current())._confirm_(aString);
  25019. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  25020. },
  25021. args: ["aString"],
  25022. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  25023. referencedClasses: [],
  25024. messageSends: ["confirm:", "current"]
  25025. }),
  25026. $globals.Terminal.klass);
  25027. $core.addMethod(
  25028. $core.method({
  25029. selector: "prompt:",
  25030. protocol: "dialogs",
  25031. fn: function (aString){
  25032. var self=this;
  25033. return $core.withContext(function($ctx1) {
  25034. return $recv(self._current())._prompt_(aString);
  25035. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  25036. },
  25037. args: ["aString"],
  25038. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  25039. referencedClasses: [],
  25040. messageSends: ["prompt:", "current"]
  25041. }),
  25042. $globals.Terminal.klass);
  25043. $core.addMethod(
  25044. $core.method({
  25045. selector: "prompt:default:",
  25046. protocol: "dialogs",
  25047. fn: function (aString,defaultString){
  25048. var self=this;
  25049. return $core.withContext(function($ctx1) {
  25050. return $recv(self._current())._prompt_default_(aString,defaultString);
  25051. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  25052. },
  25053. args: ["aString", "defaultString"],
  25054. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  25055. referencedClasses: [],
  25056. messageSends: ["prompt:default:", "current"]
  25057. }),
  25058. $globals.Terminal.klass);
  25059. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  25060. $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.";
  25061. $core.addMethod(
  25062. $core.method({
  25063. selector: "clear",
  25064. protocol: "printing",
  25065. fn: function (){
  25066. var self=this;
  25067. return $core.withContext(function($ctx1) {
  25068. $recv(self._current())._clear();
  25069. return self;
  25070. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  25071. },
  25072. args: [],
  25073. source: "clear\x0a\x09self current clear",
  25074. referencedClasses: [],
  25075. messageSends: ["clear", "current"]
  25076. }),
  25077. $globals.Transcript.klass);
  25078. $core.addMethod(
  25079. $core.method({
  25080. selector: "cr",
  25081. protocol: "printing",
  25082. fn: function (){
  25083. var self=this;
  25084. return $core.withContext(function($ctx1) {
  25085. $recv(self._current())._show_($recv($globals.String)._cr());
  25086. return self;
  25087. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  25088. },
  25089. args: [],
  25090. source: "cr\x0a\x09self current show: String cr",
  25091. referencedClasses: ["String"],
  25092. messageSends: ["show:", "current", "cr"]
  25093. }),
  25094. $globals.Transcript.klass);
  25095. $core.addMethod(
  25096. $core.method({
  25097. selector: "inspect:",
  25098. protocol: "printing",
  25099. fn: function (anObject){
  25100. var self=this;
  25101. return $core.withContext(function($ctx1) {
  25102. self._show_(anObject);
  25103. return self;
  25104. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  25105. },
  25106. args: ["anObject"],
  25107. source: "inspect: anObject\x0a\x09self show: anObject",
  25108. referencedClasses: [],
  25109. messageSends: ["show:"]
  25110. }),
  25111. $globals.Transcript.klass);
  25112. $core.addMethod(
  25113. $core.method({
  25114. selector: "open",
  25115. protocol: "instance creation",
  25116. fn: function (){
  25117. var self=this;
  25118. return $core.withContext(function($ctx1) {
  25119. $recv(self._current())._open();
  25120. return self;
  25121. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  25122. },
  25123. args: [],
  25124. source: "open\x0a\x09self current open",
  25125. referencedClasses: [],
  25126. messageSends: ["open", "current"]
  25127. }),
  25128. $globals.Transcript.klass);
  25129. $core.addMethod(
  25130. $core.method({
  25131. selector: "show:",
  25132. protocol: "printing",
  25133. fn: function (anObject){
  25134. var self=this;
  25135. return $core.withContext(function($ctx1) {
  25136. $recv(self._current())._show_(anObject);
  25137. return self;
  25138. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  25139. },
  25140. args: ["anObject"],
  25141. source: "show: anObject\x0a\x09self current show: anObject",
  25142. referencedClasses: [],
  25143. messageSends: ["show:", "current"]
  25144. }),
  25145. $globals.Transcript.klass);
  25146. $core.addMethod(
  25147. $core.method({
  25148. selector: "inspectOn:",
  25149. protocol: "*Platform-Services",
  25150. fn: function (anInspector){
  25151. var self=this;
  25152. var variables;
  25153. return $core.withContext(function($ctx1) {
  25154. variables=$recv($globals.Dictionary)._new();
  25155. $recv(variables)._at_put_("#self",self);
  25156. $ctx1.sendIdx["at:put:"]=1;
  25157. $recv(variables)._at_put_("#keys",self._keys());
  25158. $ctx1.sendIdx["at:put:"]=2;
  25159. self._keysAndValuesDo_((function(key,value){
  25160. return $core.withContext(function($ctx2) {
  25161. return $recv(variables)._at_put_(key,value);
  25162. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  25163. }));
  25164. $recv(anInspector)._setLabel_(self._printString());
  25165. $recv(anInspector)._setVariables_(variables);
  25166. return self;
  25167. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  25168. },
  25169. args: ["anInspector"],
  25170. 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",
  25171. referencedClasses: ["Dictionary"],
  25172. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  25173. }),
  25174. $globals.AssociativeCollection);
  25175. $core.addMethod(
  25176. $core.method({
  25177. selector: "inspectOn:",
  25178. protocol: "*Platform-Services",
  25179. fn: function (anInspector){
  25180. var self=this;
  25181. var variables;
  25182. return $core.withContext(function($ctx1) {
  25183. variables=$recv($globals.Dictionary)._new();
  25184. $recv(variables)._at_put_("#self",self);
  25185. $ctx1.sendIdx["at:put:"]=1;
  25186. self._withIndexDo_((function(each,i){
  25187. return $core.withContext(function($ctx2) {
  25188. return $recv(variables)._at_put_(i,each);
  25189. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  25190. }));
  25191. $recv(anInspector)._setLabel_(self._printString());
  25192. $recv(anInspector)._setVariables_(variables);
  25193. return self;
  25194. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  25195. },
  25196. args: ["anInspector"],
  25197. 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",
  25198. referencedClasses: ["Dictionary"],
  25199. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  25200. }),
  25201. $globals.Collection);
  25202. $core.addMethod(
  25203. $core.method({
  25204. selector: "inspectOn:",
  25205. protocol: "*Platform-Services",
  25206. fn: function (anInspector){
  25207. var self=this;
  25208. var variables;
  25209. return $core.withContext(function($ctx1) {
  25210. variables=$recv($globals.Dictionary)._new();
  25211. $recv(variables)._at_put_("#self",self);
  25212. $ctx1.sendIdx["at:put:"]=1;
  25213. $recv(variables)._at_put_("#year",self._year());
  25214. $ctx1.sendIdx["at:put:"]=2;
  25215. $recv(variables)._at_put_("#month",self._month());
  25216. $ctx1.sendIdx["at:put:"]=3;
  25217. $recv(variables)._at_put_("#day",self._day());
  25218. $ctx1.sendIdx["at:put:"]=4;
  25219. $recv(variables)._at_put_("#hours",self._hours());
  25220. $ctx1.sendIdx["at:put:"]=5;
  25221. $recv(variables)._at_put_("#minutes",self._minutes());
  25222. $ctx1.sendIdx["at:put:"]=6;
  25223. $recv(variables)._at_put_("#seconds",self._seconds());
  25224. $ctx1.sendIdx["at:put:"]=7;
  25225. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  25226. $recv(anInspector)._setLabel_(self._printString());
  25227. $recv(anInspector)._setVariables_(variables);
  25228. return self;
  25229. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  25230. },
  25231. args: ["anInspector"],
  25232. 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",
  25233. referencedClasses: ["Dictionary"],
  25234. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  25235. }),
  25236. $globals.Date);
  25237. $core.addMethod(
  25238. $core.method({
  25239. selector: "inspectOn:",
  25240. protocol: "*Platform-Services",
  25241. fn: function (anInspector){
  25242. var self=this;
  25243. var variables;
  25244. return $core.withContext(function($ctx1) {
  25245. variables=$recv($globals.Dictionary)._new();
  25246. $recv(variables)._at_put_("#self",self._jsObject());
  25247. $recv(anInspector)._setLabel_(self._printString());
  25248. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  25249. $recv(anInspector)._setVariables_(variables);
  25250. return self;
  25251. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  25252. },
  25253. args: ["anInspector"],
  25254. 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",
  25255. referencedClasses: ["Dictionary", "JSObjectProxy"],
  25256. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  25257. }),
  25258. $globals.JSObjectProxy);
  25259. $core.addMethod(
  25260. $core.method({
  25261. selector: "inspectOn:",
  25262. protocol: "*Platform-Services",
  25263. fn: function (anInspector){
  25264. var self=this;
  25265. var variables;
  25266. return $core.withContext(function($ctx1) {
  25267. variables=$recv($globals.Dictionary)._new();
  25268. $recv(variables)._at_put_("#self",self);
  25269. $ctx1.sendIdx["at:put:"]=1;
  25270. $recv(variables)._at_put_("#home",self._home());
  25271. $ctx1.sendIdx["at:put:"]=2;
  25272. $recv(variables)._at_put_("#receiver",self._receiver());
  25273. $ctx1.sendIdx["at:put:"]=3;
  25274. $recv(variables)._at_put_("#selector",self._selector());
  25275. $ctx1.sendIdx["at:put:"]=4;
  25276. $recv(variables)._at_put_("#locals",self._locals());
  25277. $ctx1.sendIdx["at:put:"]=5;
  25278. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  25279. return $core.withContext(function($ctx2) {
  25280. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  25281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25282. }));
  25283. $recv(anInspector)._setLabel_(self._printString());
  25284. $recv(anInspector)._setVariables_(variables);
  25285. return self;
  25286. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  25287. },
  25288. args: ["anInspector"],
  25289. 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",
  25290. referencedClasses: ["Dictionary"],
  25291. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  25292. }),
  25293. $globals.MethodContext);
  25294. $core.addMethod(
  25295. $core.method({
  25296. selector: "inspectOn:",
  25297. protocol: "*Platform-Services",
  25298. fn: function (anInspector){
  25299. var self=this;
  25300. var variables;
  25301. return $core.withContext(function($ctx1) {
  25302. variables=$recv($globals.Dictionary)._new();
  25303. $recv(variables)._at_put_("#self",self);
  25304. $ctx1.sendIdx["at:put:"]=1;
  25305. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  25306. return $core.withContext(function($ctx2) {
  25307. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  25308. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25309. }));
  25310. $recv(anInspector)._setLabel_(self._printString());
  25311. $recv(anInspector)._setVariables_(variables);
  25312. return self;
  25313. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  25314. },
  25315. args: ["anInspector"],
  25316. 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",
  25317. referencedClasses: ["Dictionary"],
  25318. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  25319. }),
  25320. $globals.Object);
  25321. $core.addMethod(
  25322. $core.method({
  25323. selector: "do:displayingProgress:",
  25324. protocol: "*Platform-Services",
  25325. fn: function (aBlock,aString){
  25326. var self=this;
  25327. return $core.withContext(function($ctx1) {
  25328. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  25329. return self;
  25330. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  25331. },
  25332. args: ["aBlock", "aString"],
  25333. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  25334. referencedClasses: ["ProgressHandler"],
  25335. messageSends: ["do:on:displaying:"]
  25336. }),
  25337. $globals.SequenceableCollection);
  25338. $core.addMethod(
  25339. $core.method({
  25340. selector: "inspectOn:",
  25341. protocol: "*Platform-Services",
  25342. fn: function (anInspector){
  25343. var self=this;
  25344. var variables,i;
  25345. return $core.withContext(function($ctx1) {
  25346. variables=$recv($globals.Dictionary)._new();
  25347. $recv(variables)._at_put_("#self",self);
  25348. $ctx1.sendIdx["at:put:"]=1;
  25349. i=(1);
  25350. self._do_((function(each){
  25351. return $core.withContext(function($ctx2) {
  25352. $recv(variables)._at_put_(i,each);
  25353. i=$recv(i).__plus((1));
  25354. return i;
  25355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25356. }));
  25357. $recv(anInspector)._setLabel_(self._printString());
  25358. $recv(anInspector)._setVariables_(variables);
  25359. return self;
  25360. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  25361. },
  25362. args: ["anInspector"],
  25363. 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",
  25364. referencedClasses: ["Dictionary"],
  25365. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  25366. }),
  25367. $globals.Set);
  25368. $core.addMethod(
  25369. $core.method({
  25370. selector: "inspectOn:",
  25371. protocol: "*Platform-Services",
  25372. fn: function (anInspector){
  25373. var self=this;
  25374. var label;
  25375. return $core.withContext(function($ctx1) {
  25376. var $3,$2,$1,$5,$4;
  25377. (
  25378. $ctx1.supercall = true,
  25379. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  25380. $ctx1.supercall = false;
  25381. $3=self._printString();
  25382. $ctx1.sendIdx["printString"]=1;
  25383. $2=$recv($3)._size();
  25384. $1=$recv($2).__gt((30));
  25385. if($core.assert($1)){
  25386. $5=self._printString();
  25387. $ctx1.sendIdx["printString"]=2;
  25388. $4=$recv($5)._copyFrom_to_((1),(30));
  25389. label=$recv($4).__comma("...'");
  25390. label;
  25391. } else {
  25392. label=self._printString();
  25393. label;
  25394. }
  25395. $recv(anInspector)._setLabel_(label);
  25396. return self;
  25397. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  25398. },
  25399. args: ["anInspector"],
  25400. 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",
  25401. referencedClasses: [],
  25402. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  25403. }),
  25404. $globals.String);
  25405. });
  25406. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  25407. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  25408. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25409. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  25410. $core.addPackage("Platform-Node");
  25411. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  25412. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25413. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  25414. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  25415. $core.addMethod(
  25416. $core.method({
  25417. selector: "globals",
  25418. protocol: "accessing",
  25419. fn: function (){
  25420. var self=this;
  25421. return global;
  25422. },
  25423. args: [],
  25424. source: "globals\x0a\x09^ global",
  25425. referencedClasses: [],
  25426. messageSends: []
  25427. }),
  25428. $globals.NodePlatform);
  25429. $core.addMethod(
  25430. $core.method({
  25431. selector: "newXhr",
  25432. protocol: "accessing",
  25433. fn: function (){
  25434. var self=this;
  25435. return $core.withContext(function($ctx1) {
  25436. var $receiver;
  25437. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.isNil){
  25438. self._error_("XMLHttpRequest not available.");
  25439. } else {
  25440. return $recv($globals.XMLHttpRequest)._new();
  25441. }
  25442. return self;
  25443. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  25444. },
  25445. args: [],
  25446. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  25447. referencedClasses: ["XMLHttpRequest"],
  25448. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  25449. }),
  25450. $globals.NodePlatform);
  25451. $core.addMethod(
  25452. $core.method({
  25453. selector: "initialize",
  25454. protocol: "testing",
  25455. fn: function (){
  25456. var self=this;
  25457. return $core.withContext(function($ctx1) {
  25458. var $1;
  25459. $1=self._isFeasible();
  25460. if($core.assert($1)){
  25461. $recv($globals.Platform)._registerIfNone_(self._new());
  25462. }
  25463. return self;
  25464. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  25465. },
  25466. args: [],
  25467. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  25468. referencedClasses: ["Platform"],
  25469. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  25470. }),
  25471. $globals.NodePlatform.klass);
  25472. $core.addMethod(
  25473. $core.method({
  25474. selector: "isFeasible",
  25475. protocol: "testing",
  25476. fn: function (){
  25477. var self=this;
  25478. return $core.withContext(function($ctx1) {
  25479. return typeof global !== "undefined";
  25480. return self;
  25481. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  25482. },
  25483. args: [],
  25484. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  25485. referencedClasses: [],
  25486. messageSends: []
  25487. }),
  25488. $globals.NodePlatform.klass);
  25489. });
  25490. define('amber/deploy',[
  25491. './helpers',
  25492. './compatibility', // pre-fetch, dep of ./boot
  25493. './kernel-fundamentals', // pre-fetch, dep of ./boot
  25494. './kernel-language', // pre-fetch, dep of ./boot
  25495. './boot', // pre-fetch, dep of ./helpers
  25496. // --- packages of the core Amber begin here ---
  25497. 'amber_core/Kernel-Objects',
  25498. 'amber_core/Kernel-Classes',
  25499. 'amber_core/Kernel-Methods',
  25500. 'amber_core/Kernel-Collections',
  25501. 'amber_core/Kernel-Dag',
  25502. 'amber_core/Kernel-Infrastructure',
  25503. 'amber_core/Kernel-Promises',
  25504. 'amber_core/Kernel-Exceptions',
  25505. 'amber_core/Kernel-Announcements',
  25506. 'amber_core/Platform-Services',
  25507. 'amber/Platform'
  25508. // --- packages of the core Amber end here ---
  25509. ], function (amber) {
  25510. return amber;
  25511. });
  25512. define('amber/parser',['./boot'], function($boot) {
  25513. var $globals = $boot.globals;
  25514. $globals.SmalltalkParser = (function() {
  25515. "use strict";
  25516. /*
  25517. * Generated by PEG.js 0.9.0.
  25518. *
  25519. * http://pegjs.org/
  25520. */
  25521. function peg$subclass(child, parent) {
  25522. function ctor() { this.constructor = child; }
  25523. ctor.prototype = parent.prototype;
  25524. child.prototype = new ctor();
  25525. }
  25526. function peg$SyntaxError(message, expected, found, location) {
  25527. this.message = message;
  25528. this.expected = expected;
  25529. this.found = found;
  25530. this.location = location;
  25531. this.name = "SyntaxError";
  25532. if (typeof Error.captureStackTrace === "function") {
  25533. Error.captureStackTrace(this, peg$SyntaxError);
  25534. }
  25535. }
  25536. peg$subclass(peg$SyntaxError, Error);
  25537. function peg$parse(input) {
  25538. var options = arguments.length > 1 ? arguments[1] : {},
  25539. parser = this,
  25540. peg$FAILED = {},
  25541. peg$startRuleFunctions = { start: peg$parsestart },
  25542. peg$startRuleFunction = peg$parsestart,
  25543. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  25544. 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]" },
  25545. peg$c2 = "\"",
  25546. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  25547. peg$c4 = /^[^"]/,
  25548. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  25549. peg$c6 = ".",
  25550. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  25551. peg$c8 = /^[a-zA-Z]/,
  25552. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  25553. peg$c10 = /^[a-zA-Z0-9]/,
  25554. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  25555. peg$c12 = ":",
  25556. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  25557. peg$c14 = /^[A-Z]/,
  25558. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  25559. peg$c16 = function(val) {
  25560. return $globals.ValueNode._new()
  25561. ._location_(location())
  25562. ._source_(text())
  25563. ._value_(val);
  25564. },
  25565. peg$c17 = "'",
  25566. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  25567. peg$c19 = "''",
  25568. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  25569. peg$c21 = function() {return '\'';},
  25570. peg$c22 = /^[^']/,
  25571. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  25572. peg$c24 = function(val) {return val.join('');},
  25573. peg$c25 = "$",
  25574. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  25575. peg$c27 = { type: "any", description: "any character" },
  25576. peg$c28 = function(char) {
  25577. return $globals.ValueNode._new()
  25578. ._location_(location())
  25579. ._source_(text())
  25580. ._value_(char);
  25581. },
  25582. peg$c29 = "#",
  25583. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  25584. peg$c31 = function(rest) {return rest;},
  25585. peg$c32 = "e",
  25586. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  25587. peg$c34 = function(n) {return parseFloat(n);},
  25588. peg$c35 = "-",
  25589. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  25590. peg$c37 = "16r",
  25591. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  25592. peg$c39 = /^[0-9a-fA-F]/,
  25593. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  25594. peg$c41 = function(neg, num) {
  25595. return parseInt(((neg || '') + num), 16);
  25596. },
  25597. peg$c42 = /^[0-9]/,
  25598. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  25599. peg$c44 = function(n) {return parseFloat(n, 10);},
  25600. peg$c45 = function(n) {return parseInt(n, 10);},
  25601. peg$c46 = "#(",
  25602. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  25603. peg$c48 = ")",
  25604. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  25605. peg$c50 = function(rest) {
  25606. return rest
  25607. ._location_(location())
  25608. ._source_(text());
  25609. },
  25610. peg$c51 = "(",
  25611. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  25612. peg$c53 = function(lit) {return lit._value();},
  25613. peg$c54 = function(lits) {
  25614. return $globals.ValueNode._new()
  25615. ._value_(lits);
  25616. },
  25617. peg$c55 = "{",
  25618. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  25619. peg$c57 = "}",
  25620. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  25621. peg$c59 = function(expressions) {
  25622. return $globals.DynamicArrayNode._new()
  25623. ._location_(location())
  25624. ._source_(text())
  25625. ._dagChildren_(expressions || []);
  25626. },
  25627. peg$c60 = "#{",
  25628. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  25629. peg$c62 = function(expressions) {
  25630. return $globals.DynamicDictionaryNode._new()
  25631. ._location_(location())
  25632. ._source_(text())
  25633. ._dagChildren_(expressions || []);
  25634. },
  25635. peg$c63 = "true",
  25636. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  25637. peg$c65 = function() {return true;},
  25638. peg$c66 = "false",
  25639. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  25640. peg$c68 = function() {return false;},
  25641. peg$c69 = "nil",
  25642. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  25643. peg$c71 = function() {return null;},
  25644. peg$c72 = function(identifier) {
  25645. return $globals.VariableNode._new()
  25646. ._location_(location())
  25647. ._source_(text())
  25648. ._value_(identifier);
  25649. },
  25650. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  25651. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  25652. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  25653. peg$c76 = function(pairs) {
  25654. var selector = '';
  25655. var params = [];
  25656. for(var i = 0; i < pairs.length; i++) {
  25657. selector += pairs[i].key;
  25658. params.push(pairs[i].arg);
  25659. }
  25660. return [selector, params];
  25661. },
  25662. peg$c77 = function(selector, arg) {
  25663. return [selector, [arg]];
  25664. },
  25665. peg$c78 = function(selector) {return [selector, []];},
  25666. peg$c79 = function(expression) {
  25667. return expression;
  25668. },
  25669. peg$c80 = function(first, others) {
  25670. return [first].concat(others);
  25671. },
  25672. peg$c81 = ":=",
  25673. peg$c82 = { type: "literal", value: ":=", description: "\":=\"" },
  25674. peg$c83 = function(variable, expression) {
  25675. return $globals.AssignmentNode._new()
  25676. ._location_(location())
  25677. ._source_(text())
  25678. ._left_(variable)
  25679. ._right_(expression);
  25680. },
  25681. peg$c84 = "^",
  25682. peg$c85 = { type: "literal", value: "^", description: "\"^\"" },
  25683. peg$c86 = function(expression) {
  25684. return $globals.ReturnNode._new()
  25685. ._location_(location())
  25686. ._source_(text())
  25687. ._dagChildren_([expression]);
  25688. },
  25689. peg$c87 = "|",
  25690. peg$c88 = { type: "literal", value: "|", description: "\"|\"" },
  25691. peg$c89 = function(variable) {return variable;},
  25692. peg$c90 = function(vars) {
  25693. return vars;
  25694. },
  25695. peg$c91 = function(param) {return param;},
  25696. peg$c92 = function(params) {
  25697. return params;
  25698. },
  25699. peg$c93 = function(ret) {return [ret];},
  25700. peg$c94 = function(exps, ret) {
  25701. var expressions = exps;
  25702. expressions.push(ret);
  25703. return expressions;
  25704. },
  25705. peg$c95 = function(expressions) {return expressions || [];},
  25706. peg$c96 = function(js) {return js;},
  25707. peg$c97 = function(temps, statements) {
  25708. return $globals.SequenceNode._new()
  25709. ._location_(location())
  25710. ._source_(text())
  25711. ._temps_(temps || [])
  25712. ._dagChildren_(statements || []);
  25713. },
  25714. peg$c98 = "[",
  25715. peg$c99 = { type: "literal", value: "[", description: "\"[\"" },
  25716. peg$c100 = "]",
  25717. peg$c101 = { type: "literal", value: "]", description: "\"]\"" },
  25718. peg$c102 = function(params, sequence) {
  25719. return $globals.BlockNode._new()
  25720. ._location_(location())
  25721. ._source_(text())
  25722. ._parameters_(params || [])
  25723. ._dagChildren_([sequence._asBlockSequenceNode()]);
  25724. },
  25725. peg$c103 = function(selector) {
  25726. return $globals.SendNode._new()
  25727. ._location_(location())
  25728. ._source_(text())
  25729. ._selector_(selector);
  25730. },
  25731. peg$c104 = function(receiver, tail) {
  25732. return receiver._withTail_(tail);
  25733. },
  25734. peg$c105 = function(selector, arg) {
  25735. return $globals.SendNode._new()
  25736. ._location_(location())
  25737. ._source_(text())
  25738. ._selector_(selector)
  25739. ._arguments_([arg]);
  25740. },
  25741. peg$c106 = function(pairs) {
  25742. var selector = '';
  25743. var args = [];
  25744. for(var i = 0; i < pairs.length; i++) {
  25745. selector += pairs[i].key;
  25746. args.push(pairs[i].arg);
  25747. }
  25748. return $globals.SendNode._new()
  25749. ._location_(location())
  25750. ._source_(text())
  25751. ._selector_(selector)
  25752. ._arguments_(args);
  25753. },
  25754. peg$c107 = function(receiver, tail) {
  25755. return tail ? receiver._withTail_([tail]) : receiver;
  25756. },
  25757. peg$c108 = function(send) {return send._isSendNode();},
  25758. peg$c109 = ";",
  25759. peg$c110 = { type: "literal", value: ";", description: "\";\"" },
  25760. peg$c111 = function(send, mess) {return mess;},
  25761. peg$c112 = function(send, messages) {
  25762. messages.unshift(send);
  25763. return $globals.CascadeNode._new()
  25764. ._location_(location())
  25765. ._source_(text())
  25766. ._dagChildren_(messages);
  25767. },
  25768. peg$c113 = "<",
  25769. peg$c114 = { type: "literal", value: "<", description: "\"<\"" },
  25770. peg$c115 = ">>",
  25771. peg$c116 = { type: "literal", value: ">>", description: "\">>\"" },
  25772. peg$c117 = function() {return '>';},
  25773. peg$c118 = /^[^>]/,
  25774. peg$c119 = { type: "class", value: "[^>]", description: "[^>]" },
  25775. peg$c120 = ">",
  25776. peg$c121 = { type: "literal", value: ">", description: "\">\"" },
  25777. peg$c122 = function(val) {return !/^\s*inlineJS/.test(val.join(''));},
  25778. peg$c123 = function(val) {
  25779. console.warn('Use of <...js code...> is deprecated, in:\n' + val.join(''));
  25780. return $globals.JSStatementNode._new()
  25781. ._location_(location())
  25782. ._source_(val.join(''))
  25783. },
  25784. peg$c124 = "inlineJS:",
  25785. peg$c125 = { type: "literal", value: "inlineJS:", description: "\"inlineJS:\"" },
  25786. peg$c126 = function(val) {
  25787. return $globals.JSStatementNode._new()
  25788. ._location_(location())
  25789. ._source_(val)
  25790. },
  25791. peg$c127 = function(pattern, sequence) {
  25792. return $globals.MethodNode._new()
  25793. ._location_(location())
  25794. ._source_(text())
  25795. ._selector_(pattern[0])
  25796. ._arguments_(pattern[1])
  25797. ._dagChildren_([sequence]);
  25798. },
  25799. peg$c128 = function(send) { return send._isSendNode() && send._selector() === '->' },
  25800. peg$c129 = function(send) {
  25801. return [send._receiver(), send._arguments()[0]];
  25802. },
  25803. peg$c130 = function(first, others) {
  25804. return first.concat.apply(first, others);
  25805. },
  25806. peg$currPos = 0,
  25807. peg$savedPos = 0,
  25808. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  25809. peg$maxFailPos = 0,
  25810. peg$maxFailExpected = [],
  25811. peg$silentFails = 0,
  25812. peg$resultsCache = {},
  25813. peg$result;
  25814. if ("startRule" in options) {
  25815. if (!(options.startRule in peg$startRuleFunctions)) {
  25816. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  25817. }
  25818. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  25819. }
  25820. function text() {
  25821. return input.substring(peg$savedPos, peg$currPos);
  25822. }
  25823. function location() {
  25824. return peg$computeLocation(peg$savedPos, peg$currPos);
  25825. }
  25826. function expected(description) {
  25827. throw peg$buildException(
  25828. null,
  25829. [{ type: "other", description: description }],
  25830. input.substring(peg$savedPos, peg$currPos),
  25831. peg$computeLocation(peg$savedPos, peg$currPos)
  25832. );
  25833. }
  25834. function error(message) {
  25835. throw peg$buildException(
  25836. message,
  25837. null,
  25838. input.substring(peg$savedPos, peg$currPos),
  25839. peg$computeLocation(peg$savedPos, peg$currPos)
  25840. );
  25841. }
  25842. function peg$computePosDetails(pos) {
  25843. var details = peg$posDetailsCache[pos],
  25844. p, ch;
  25845. if (details) {
  25846. return details;
  25847. } else {
  25848. p = pos - 1;
  25849. while (!peg$posDetailsCache[p]) {
  25850. p--;
  25851. }
  25852. details = peg$posDetailsCache[p];
  25853. details = {
  25854. line: details.line,
  25855. column: details.column,
  25856. seenCR: details.seenCR
  25857. };
  25858. while (p < pos) {
  25859. ch = input.charAt(p);
  25860. if (ch === "\n") {
  25861. if (!details.seenCR) { details.line++; }
  25862. details.column = 1;
  25863. details.seenCR = false;
  25864. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  25865. details.line++;
  25866. details.column = 1;
  25867. details.seenCR = true;
  25868. } else {
  25869. details.column++;
  25870. details.seenCR = false;
  25871. }
  25872. p++;
  25873. }
  25874. peg$posDetailsCache[pos] = details;
  25875. return details;
  25876. }
  25877. }
  25878. function peg$computeLocation(startPos, endPos) {
  25879. var startPosDetails = peg$computePosDetails(startPos),
  25880. endPosDetails = peg$computePosDetails(endPos);
  25881. return {
  25882. start: {
  25883. offset: startPos,
  25884. line: startPosDetails.line,
  25885. column: startPosDetails.column
  25886. },
  25887. end: {
  25888. offset: endPos,
  25889. line: endPosDetails.line,
  25890. column: endPosDetails.column
  25891. }
  25892. };
  25893. }
  25894. function peg$fail(expected) {
  25895. if (peg$currPos < peg$maxFailPos) { return; }
  25896. if (peg$currPos > peg$maxFailPos) {
  25897. peg$maxFailPos = peg$currPos;
  25898. peg$maxFailExpected = [];
  25899. }
  25900. peg$maxFailExpected.push(expected);
  25901. }
  25902. function peg$buildException(message, expected, found, location) {
  25903. function cleanupExpected(expected) {
  25904. var i = 1;
  25905. expected.sort(function(a, b) {
  25906. if (a.description < b.description) {
  25907. return -1;
  25908. } else if (a.description > b.description) {
  25909. return 1;
  25910. } else {
  25911. return 0;
  25912. }
  25913. });
  25914. while (i < expected.length) {
  25915. if (expected[i - 1] === expected[i]) {
  25916. expected.splice(i, 1);
  25917. } else {
  25918. i++;
  25919. }
  25920. }
  25921. }
  25922. function buildMessage(expected, found) {
  25923. function stringEscape(s) {
  25924. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  25925. return s
  25926. .replace(/\\/g, '\\\\')
  25927. .replace(/"/g, '\\"')
  25928. .replace(/\x08/g, '\\b')
  25929. .replace(/\t/g, '\\t')
  25930. .replace(/\n/g, '\\n')
  25931. .replace(/\f/g, '\\f')
  25932. .replace(/\r/g, '\\r')
  25933. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  25934. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  25935. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  25936. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  25937. }
  25938. var expectedDescs = new Array(expected.length),
  25939. expectedDesc, foundDesc, i;
  25940. for (i = 0; i < expected.length; i++) {
  25941. expectedDescs[i] = expected[i].description;
  25942. }
  25943. expectedDesc = expected.length > 1
  25944. ? expectedDescs.slice(0, -1).join(", ")
  25945. + " or "
  25946. + expectedDescs[expected.length - 1]
  25947. : expectedDescs[0];
  25948. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  25949. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  25950. }
  25951. if (expected !== null) {
  25952. cleanupExpected(expected);
  25953. }
  25954. return new peg$SyntaxError(
  25955. message !== null ? message : buildMessage(expected, found),
  25956. expected,
  25957. found,
  25958. location
  25959. );
  25960. }
  25961. function peg$parsestart() {
  25962. var s0;
  25963. var key = peg$currPos * 62 + 0,
  25964. cached = peg$resultsCache[key];
  25965. if (cached) {
  25966. peg$currPos = cached.nextPos;
  25967. return cached.result;
  25968. }
  25969. s0 = peg$parsemethod();
  25970. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25971. return s0;
  25972. }
  25973. function peg$parseseparator() {
  25974. var s0, s1;
  25975. var key = peg$currPos * 62 + 1,
  25976. cached = peg$resultsCache[key];
  25977. if (cached) {
  25978. peg$currPos = cached.nextPos;
  25979. return cached.result;
  25980. }
  25981. s0 = [];
  25982. if (peg$c0.test(input.charAt(peg$currPos))) {
  25983. s1 = input.charAt(peg$currPos);
  25984. peg$currPos++;
  25985. } else {
  25986. s1 = peg$FAILED;
  25987. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  25988. }
  25989. if (s1 !== peg$FAILED) {
  25990. while (s1 !== peg$FAILED) {
  25991. s0.push(s1);
  25992. if (peg$c0.test(input.charAt(peg$currPos))) {
  25993. s1 = input.charAt(peg$currPos);
  25994. peg$currPos++;
  25995. } else {
  25996. s1 = peg$FAILED;
  25997. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  25998. }
  25999. }
  26000. } else {
  26001. s0 = peg$FAILED;
  26002. }
  26003. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26004. return s0;
  26005. }
  26006. function peg$parsecomments() {
  26007. var s0, s1, s2, s3, s4;
  26008. var key = peg$currPos * 62 + 2,
  26009. cached = peg$resultsCache[key];
  26010. if (cached) {
  26011. peg$currPos = cached.nextPos;
  26012. return cached.result;
  26013. }
  26014. s0 = [];
  26015. s1 = peg$currPos;
  26016. if (input.charCodeAt(peg$currPos) === 34) {
  26017. s2 = peg$c2;
  26018. peg$currPos++;
  26019. } else {
  26020. s2 = peg$FAILED;
  26021. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  26022. }
  26023. if (s2 !== peg$FAILED) {
  26024. s3 = [];
  26025. if (peg$c4.test(input.charAt(peg$currPos))) {
  26026. s4 = input.charAt(peg$currPos);
  26027. peg$currPos++;
  26028. } else {
  26029. s4 = peg$FAILED;
  26030. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  26031. }
  26032. while (s4 !== peg$FAILED) {
  26033. s3.push(s4);
  26034. if (peg$c4.test(input.charAt(peg$currPos))) {
  26035. s4 = input.charAt(peg$currPos);
  26036. peg$currPos++;
  26037. } else {
  26038. s4 = peg$FAILED;
  26039. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  26040. }
  26041. }
  26042. if (s3 !== peg$FAILED) {
  26043. if (input.charCodeAt(peg$currPos) === 34) {
  26044. s4 = peg$c2;
  26045. peg$currPos++;
  26046. } else {
  26047. s4 = peg$FAILED;
  26048. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  26049. }
  26050. if (s4 !== peg$FAILED) {
  26051. s2 = [s2, s3, s4];
  26052. s1 = s2;
  26053. } else {
  26054. peg$currPos = s1;
  26055. s1 = peg$FAILED;
  26056. }
  26057. } else {
  26058. peg$currPos = s1;
  26059. s1 = peg$FAILED;
  26060. }
  26061. } else {
  26062. peg$currPos = s1;
  26063. s1 = peg$FAILED;
  26064. }
  26065. if (s1 !== peg$FAILED) {
  26066. while (s1 !== peg$FAILED) {
  26067. s0.push(s1);
  26068. s1 = peg$currPos;
  26069. if (input.charCodeAt(peg$currPos) === 34) {
  26070. s2 = peg$c2;
  26071. peg$currPos++;
  26072. } else {
  26073. s2 = peg$FAILED;
  26074. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  26075. }
  26076. if (s2 !== peg$FAILED) {
  26077. s3 = [];
  26078. if (peg$c4.test(input.charAt(peg$currPos))) {
  26079. s4 = input.charAt(peg$currPos);
  26080. peg$currPos++;
  26081. } else {
  26082. s4 = peg$FAILED;
  26083. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  26084. }
  26085. while (s4 !== peg$FAILED) {
  26086. s3.push(s4);
  26087. if (peg$c4.test(input.charAt(peg$currPos))) {
  26088. s4 = input.charAt(peg$currPos);
  26089. peg$currPos++;
  26090. } else {
  26091. s4 = peg$FAILED;
  26092. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  26093. }
  26094. }
  26095. if (s3 !== peg$FAILED) {
  26096. if (input.charCodeAt(peg$currPos) === 34) {
  26097. s4 = peg$c2;
  26098. peg$currPos++;
  26099. } else {
  26100. s4 = peg$FAILED;
  26101. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  26102. }
  26103. if (s4 !== peg$FAILED) {
  26104. s2 = [s2, s3, s4];
  26105. s1 = s2;
  26106. } else {
  26107. peg$currPos = s1;
  26108. s1 = peg$FAILED;
  26109. }
  26110. } else {
  26111. peg$currPos = s1;
  26112. s1 = peg$FAILED;
  26113. }
  26114. } else {
  26115. peg$currPos = s1;
  26116. s1 = peg$FAILED;
  26117. }
  26118. }
  26119. } else {
  26120. s0 = peg$FAILED;
  26121. }
  26122. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26123. return s0;
  26124. }
  26125. function peg$parsews() {
  26126. var s0, s1;
  26127. var key = peg$currPos * 62 + 3,
  26128. cached = peg$resultsCache[key];
  26129. if (cached) {
  26130. peg$currPos = cached.nextPos;
  26131. return cached.result;
  26132. }
  26133. s0 = [];
  26134. s1 = peg$parseseparator();
  26135. if (s1 === peg$FAILED) {
  26136. s1 = peg$parsecomments();
  26137. }
  26138. while (s1 !== peg$FAILED) {
  26139. s0.push(s1);
  26140. s1 = peg$parseseparator();
  26141. if (s1 === peg$FAILED) {
  26142. s1 = peg$parsecomments();
  26143. }
  26144. }
  26145. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26146. return s0;
  26147. }
  26148. function peg$parsemaybeDotsWs() {
  26149. var s0, s1;
  26150. var key = peg$currPos * 62 + 4,
  26151. cached = peg$resultsCache[key];
  26152. if (cached) {
  26153. peg$currPos = cached.nextPos;
  26154. return cached.result;
  26155. }
  26156. s0 = [];
  26157. if (input.charCodeAt(peg$currPos) === 46) {
  26158. s1 = peg$c6;
  26159. peg$currPos++;
  26160. } else {
  26161. s1 = peg$FAILED;
  26162. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26163. }
  26164. if (s1 === peg$FAILED) {
  26165. s1 = peg$parseseparator();
  26166. if (s1 === peg$FAILED) {
  26167. s1 = peg$parsecomments();
  26168. }
  26169. }
  26170. while (s1 !== peg$FAILED) {
  26171. s0.push(s1);
  26172. if (input.charCodeAt(peg$currPos) === 46) {
  26173. s1 = peg$c6;
  26174. peg$currPos++;
  26175. } else {
  26176. s1 = peg$FAILED;
  26177. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26178. }
  26179. if (s1 === peg$FAILED) {
  26180. s1 = peg$parseseparator();
  26181. if (s1 === peg$FAILED) {
  26182. s1 = peg$parsecomments();
  26183. }
  26184. }
  26185. }
  26186. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26187. return s0;
  26188. }
  26189. function peg$parseidentifier() {
  26190. var s0, s1, s2, s3, s4;
  26191. var key = peg$currPos * 62 + 5,
  26192. cached = peg$resultsCache[key];
  26193. if (cached) {
  26194. peg$currPos = cached.nextPos;
  26195. return cached.result;
  26196. }
  26197. s0 = peg$currPos;
  26198. s1 = peg$currPos;
  26199. if (peg$c8.test(input.charAt(peg$currPos))) {
  26200. s2 = input.charAt(peg$currPos);
  26201. peg$currPos++;
  26202. } else {
  26203. s2 = peg$FAILED;
  26204. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  26205. }
  26206. if (s2 !== peg$FAILED) {
  26207. s3 = [];
  26208. if (peg$c10.test(input.charAt(peg$currPos))) {
  26209. s4 = input.charAt(peg$currPos);
  26210. peg$currPos++;
  26211. } else {
  26212. s4 = peg$FAILED;
  26213. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  26214. }
  26215. while (s4 !== peg$FAILED) {
  26216. s3.push(s4);
  26217. if (peg$c10.test(input.charAt(peg$currPos))) {
  26218. s4 = input.charAt(peg$currPos);
  26219. peg$currPos++;
  26220. } else {
  26221. s4 = peg$FAILED;
  26222. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  26223. }
  26224. }
  26225. if (s3 !== peg$FAILED) {
  26226. s2 = [s2, s3];
  26227. s1 = s2;
  26228. } else {
  26229. peg$currPos = s1;
  26230. s1 = peg$FAILED;
  26231. }
  26232. } else {
  26233. peg$currPos = s1;
  26234. s1 = peg$FAILED;
  26235. }
  26236. if (s1 !== peg$FAILED) {
  26237. s0 = input.substring(s0, peg$currPos);
  26238. } else {
  26239. s0 = s1;
  26240. }
  26241. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26242. return s0;
  26243. }
  26244. function peg$parsekeyword() {
  26245. var s0, s1, s2, s3;
  26246. var key = peg$currPos * 62 + 6,
  26247. cached = peg$resultsCache[key];
  26248. if (cached) {
  26249. peg$currPos = cached.nextPos;
  26250. return cached.result;
  26251. }
  26252. s0 = peg$currPos;
  26253. s1 = peg$currPos;
  26254. s2 = peg$parseidentifier();
  26255. if (s2 !== peg$FAILED) {
  26256. if (input.charCodeAt(peg$currPos) === 58) {
  26257. s3 = peg$c12;
  26258. peg$currPos++;
  26259. } else {
  26260. s3 = peg$FAILED;
  26261. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  26262. }
  26263. if (s3 !== peg$FAILED) {
  26264. s2 = [s2, s3];
  26265. s1 = s2;
  26266. } else {
  26267. peg$currPos = s1;
  26268. s1 = peg$FAILED;
  26269. }
  26270. } else {
  26271. peg$currPos = s1;
  26272. s1 = peg$FAILED;
  26273. }
  26274. if (s1 !== peg$FAILED) {
  26275. s0 = input.substring(s0, peg$currPos);
  26276. } else {
  26277. s0 = s1;
  26278. }
  26279. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26280. return s0;
  26281. }
  26282. function peg$parseclassName() {
  26283. var s0, s1, s2, s3, s4;
  26284. var key = peg$currPos * 62 + 7,
  26285. cached = peg$resultsCache[key];
  26286. if (cached) {
  26287. peg$currPos = cached.nextPos;
  26288. return cached.result;
  26289. }
  26290. s0 = peg$currPos;
  26291. s1 = peg$currPos;
  26292. if (peg$c14.test(input.charAt(peg$currPos))) {
  26293. s2 = input.charAt(peg$currPos);
  26294. peg$currPos++;
  26295. } else {
  26296. s2 = peg$FAILED;
  26297. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  26298. }
  26299. if (s2 !== peg$FAILED) {
  26300. s3 = [];
  26301. if (peg$c10.test(input.charAt(peg$currPos))) {
  26302. s4 = input.charAt(peg$currPos);
  26303. peg$currPos++;
  26304. } else {
  26305. s4 = peg$FAILED;
  26306. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  26307. }
  26308. while (s4 !== peg$FAILED) {
  26309. s3.push(s4);
  26310. if (peg$c10.test(input.charAt(peg$currPos))) {
  26311. s4 = input.charAt(peg$currPos);
  26312. peg$currPos++;
  26313. } else {
  26314. s4 = peg$FAILED;
  26315. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  26316. }
  26317. }
  26318. if (s3 !== peg$FAILED) {
  26319. s2 = [s2, s3];
  26320. s1 = s2;
  26321. } else {
  26322. peg$currPos = s1;
  26323. s1 = peg$FAILED;
  26324. }
  26325. } else {
  26326. peg$currPos = s1;
  26327. s1 = peg$FAILED;
  26328. }
  26329. if (s1 !== peg$FAILED) {
  26330. s0 = input.substring(s0, peg$currPos);
  26331. } else {
  26332. s0 = s1;
  26333. }
  26334. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26335. return s0;
  26336. }
  26337. function peg$parsestring() {
  26338. var s0, s1;
  26339. var key = peg$currPos * 62 + 8,
  26340. cached = peg$resultsCache[key];
  26341. if (cached) {
  26342. peg$currPos = cached.nextPos;
  26343. return cached.result;
  26344. }
  26345. s0 = peg$currPos;
  26346. s1 = peg$parserawString();
  26347. if (s1 !== peg$FAILED) {
  26348. peg$savedPos = s0;
  26349. s1 = peg$c16(s1);
  26350. }
  26351. s0 = s1;
  26352. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26353. return s0;
  26354. }
  26355. function peg$parserawString() {
  26356. var s0, s1, s2, s3, s4;
  26357. var key = peg$currPos * 62 + 9,
  26358. cached = peg$resultsCache[key];
  26359. if (cached) {
  26360. peg$currPos = cached.nextPos;
  26361. return cached.result;
  26362. }
  26363. s0 = peg$currPos;
  26364. if (input.charCodeAt(peg$currPos) === 39) {
  26365. s1 = peg$c17;
  26366. peg$currPos++;
  26367. } else {
  26368. s1 = peg$FAILED;
  26369. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  26370. }
  26371. if (s1 !== peg$FAILED) {
  26372. s2 = [];
  26373. s3 = peg$currPos;
  26374. if (input.substr(peg$currPos, 2) === peg$c19) {
  26375. s4 = peg$c19;
  26376. peg$currPos += 2;
  26377. } else {
  26378. s4 = peg$FAILED;
  26379. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  26380. }
  26381. if (s4 !== peg$FAILED) {
  26382. peg$savedPos = s3;
  26383. s4 = peg$c21();
  26384. }
  26385. s3 = s4;
  26386. if (s3 === peg$FAILED) {
  26387. if (peg$c22.test(input.charAt(peg$currPos))) {
  26388. s3 = input.charAt(peg$currPos);
  26389. peg$currPos++;
  26390. } else {
  26391. s3 = peg$FAILED;
  26392. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  26393. }
  26394. }
  26395. while (s3 !== peg$FAILED) {
  26396. s2.push(s3);
  26397. s3 = peg$currPos;
  26398. if (input.substr(peg$currPos, 2) === peg$c19) {
  26399. s4 = peg$c19;
  26400. peg$currPos += 2;
  26401. } else {
  26402. s4 = peg$FAILED;
  26403. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  26404. }
  26405. if (s4 !== peg$FAILED) {
  26406. peg$savedPos = s3;
  26407. s4 = peg$c21();
  26408. }
  26409. s3 = s4;
  26410. if (s3 === peg$FAILED) {
  26411. if (peg$c22.test(input.charAt(peg$currPos))) {
  26412. s3 = input.charAt(peg$currPos);
  26413. peg$currPos++;
  26414. } else {
  26415. s3 = peg$FAILED;
  26416. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  26417. }
  26418. }
  26419. }
  26420. if (s2 !== peg$FAILED) {
  26421. if (input.charCodeAt(peg$currPos) === 39) {
  26422. s3 = peg$c17;
  26423. peg$currPos++;
  26424. } else {
  26425. s3 = peg$FAILED;
  26426. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  26427. }
  26428. if (s3 !== peg$FAILED) {
  26429. peg$savedPos = s0;
  26430. s1 = peg$c24(s2);
  26431. s0 = s1;
  26432. } else {
  26433. peg$currPos = s0;
  26434. s0 = peg$FAILED;
  26435. }
  26436. } else {
  26437. peg$currPos = s0;
  26438. s0 = peg$FAILED;
  26439. }
  26440. } else {
  26441. peg$currPos = s0;
  26442. s0 = peg$FAILED;
  26443. }
  26444. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26445. return s0;
  26446. }
  26447. function peg$parsecharacter() {
  26448. var s0, s1, s2;
  26449. var key = peg$currPos * 62 + 10,
  26450. cached = peg$resultsCache[key];
  26451. if (cached) {
  26452. peg$currPos = cached.nextPos;
  26453. return cached.result;
  26454. }
  26455. s0 = peg$currPos;
  26456. if (input.charCodeAt(peg$currPos) === 36) {
  26457. s1 = peg$c25;
  26458. peg$currPos++;
  26459. } else {
  26460. s1 = peg$FAILED;
  26461. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  26462. }
  26463. if (s1 !== peg$FAILED) {
  26464. if (input.length > peg$currPos) {
  26465. s2 = input.charAt(peg$currPos);
  26466. peg$currPos++;
  26467. } else {
  26468. s2 = peg$FAILED;
  26469. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  26470. }
  26471. if (s2 !== peg$FAILED) {
  26472. peg$savedPos = s0;
  26473. s1 = peg$c28(s2);
  26474. s0 = s1;
  26475. } else {
  26476. peg$currPos = s0;
  26477. s0 = peg$FAILED;
  26478. }
  26479. } else {
  26480. peg$currPos = s0;
  26481. s0 = peg$FAILED;
  26482. }
  26483. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26484. return s0;
  26485. }
  26486. function peg$parsesymbol() {
  26487. var s0, s1, s2;
  26488. var key = peg$currPos * 62 + 11,
  26489. cached = peg$resultsCache[key];
  26490. if (cached) {
  26491. peg$currPos = cached.nextPos;
  26492. return cached.result;
  26493. }
  26494. s0 = peg$currPos;
  26495. if (input.charCodeAt(peg$currPos) === 35) {
  26496. s1 = peg$c29;
  26497. peg$currPos++;
  26498. } else {
  26499. s1 = peg$FAILED;
  26500. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  26501. }
  26502. if (s1 !== peg$FAILED) {
  26503. s2 = peg$parsebareSymbol();
  26504. if (s2 !== peg$FAILED) {
  26505. peg$savedPos = s0;
  26506. s1 = peg$c31(s2);
  26507. s0 = s1;
  26508. } else {
  26509. peg$currPos = s0;
  26510. s0 = peg$FAILED;
  26511. }
  26512. } else {
  26513. peg$currPos = s0;
  26514. s0 = peg$FAILED;
  26515. }
  26516. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26517. return s0;
  26518. }
  26519. function peg$parsebareSymbol() {
  26520. var s0, s1, s2, s3;
  26521. var key = peg$currPos * 62 + 12,
  26522. cached = peg$resultsCache[key];
  26523. if (cached) {
  26524. peg$currPos = cached.nextPos;
  26525. return cached.result;
  26526. }
  26527. s0 = peg$currPos;
  26528. s1 = peg$currPos;
  26529. s2 = [];
  26530. s3 = peg$parsekeyword();
  26531. if (s3 !== peg$FAILED) {
  26532. while (s3 !== peg$FAILED) {
  26533. s2.push(s3);
  26534. s3 = peg$parsekeyword();
  26535. }
  26536. } else {
  26537. s2 = peg$FAILED;
  26538. }
  26539. if (s2 !== peg$FAILED) {
  26540. s1 = input.substring(s1, peg$currPos);
  26541. } else {
  26542. s1 = s2;
  26543. }
  26544. if (s1 === peg$FAILED) {
  26545. s1 = peg$parsebinarySelector();
  26546. if (s1 === peg$FAILED) {
  26547. s1 = peg$parseidentifier();
  26548. if (s1 === peg$FAILED) {
  26549. s1 = peg$parserawString();
  26550. }
  26551. }
  26552. }
  26553. if (s1 !== peg$FAILED) {
  26554. peg$savedPos = s0;
  26555. s1 = peg$c16(s1);
  26556. }
  26557. s0 = s1;
  26558. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26559. return s0;
  26560. }
  26561. function peg$parsenumber() {
  26562. var s0, s1;
  26563. var key = peg$currPos * 62 + 13,
  26564. cached = peg$resultsCache[key];
  26565. if (cached) {
  26566. peg$currPos = cached.nextPos;
  26567. return cached.result;
  26568. }
  26569. s0 = peg$currPos;
  26570. s1 = peg$parserawNumber();
  26571. if (s1 !== peg$FAILED) {
  26572. peg$savedPos = s0;
  26573. s1 = peg$c16(s1);
  26574. }
  26575. s0 = s1;
  26576. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26577. return s0;
  26578. }
  26579. function peg$parserawNumber() {
  26580. var s0;
  26581. var key = peg$currPos * 62 + 14,
  26582. cached = peg$resultsCache[key];
  26583. if (cached) {
  26584. peg$currPos = cached.nextPos;
  26585. return cached.result;
  26586. }
  26587. s0 = peg$parsenumberExp();
  26588. if (s0 === peg$FAILED) {
  26589. s0 = peg$parsehex();
  26590. if (s0 === peg$FAILED) {
  26591. s0 = peg$parsefloat();
  26592. if (s0 === peg$FAILED) {
  26593. s0 = peg$parseinteger();
  26594. }
  26595. }
  26596. }
  26597. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26598. return s0;
  26599. }
  26600. function peg$parsenumberExp() {
  26601. var s0, s1, s2, s3, s4, s5;
  26602. var key = peg$currPos * 62 + 15,
  26603. cached = peg$resultsCache[key];
  26604. if (cached) {
  26605. peg$currPos = cached.nextPos;
  26606. return cached.result;
  26607. }
  26608. s0 = peg$currPos;
  26609. s1 = peg$currPos;
  26610. s2 = peg$currPos;
  26611. s3 = peg$parsefloat();
  26612. if (s3 === peg$FAILED) {
  26613. s3 = peg$parseinteger();
  26614. }
  26615. if (s3 !== peg$FAILED) {
  26616. if (input.charCodeAt(peg$currPos) === 101) {
  26617. s4 = peg$c32;
  26618. peg$currPos++;
  26619. } else {
  26620. s4 = peg$FAILED;
  26621. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  26622. }
  26623. if (s4 !== peg$FAILED) {
  26624. s5 = peg$parseinteger();
  26625. if (s5 !== peg$FAILED) {
  26626. s3 = [s3, s4, s5];
  26627. s2 = s3;
  26628. } else {
  26629. peg$currPos = s2;
  26630. s2 = peg$FAILED;
  26631. }
  26632. } else {
  26633. peg$currPos = s2;
  26634. s2 = peg$FAILED;
  26635. }
  26636. } else {
  26637. peg$currPos = s2;
  26638. s2 = peg$FAILED;
  26639. }
  26640. if (s2 !== peg$FAILED) {
  26641. s1 = input.substring(s1, peg$currPos);
  26642. } else {
  26643. s1 = s2;
  26644. }
  26645. if (s1 !== peg$FAILED) {
  26646. peg$savedPos = s0;
  26647. s1 = peg$c34(s1);
  26648. }
  26649. s0 = s1;
  26650. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26651. return s0;
  26652. }
  26653. function peg$parsehex() {
  26654. var s0, s1, s2, s3, s4, s5;
  26655. var key = peg$currPos * 62 + 16,
  26656. cached = peg$resultsCache[key];
  26657. if (cached) {
  26658. peg$currPos = cached.nextPos;
  26659. return cached.result;
  26660. }
  26661. s0 = peg$currPos;
  26662. if (input.charCodeAt(peg$currPos) === 45) {
  26663. s1 = peg$c35;
  26664. peg$currPos++;
  26665. } else {
  26666. s1 = peg$FAILED;
  26667. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  26668. }
  26669. if (s1 === peg$FAILED) {
  26670. s1 = null;
  26671. }
  26672. if (s1 !== peg$FAILED) {
  26673. if (input.substr(peg$currPos, 3) === peg$c37) {
  26674. s2 = peg$c37;
  26675. peg$currPos += 3;
  26676. } else {
  26677. s2 = peg$FAILED;
  26678. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  26679. }
  26680. if (s2 !== peg$FAILED) {
  26681. s3 = peg$currPos;
  26682. s4 = [];
  26683. if (peg$c39.test(input.charAt(peg$currPos))) {
  26684. s5 = input.charAt(peg$currPos);
  26685. peg$currPos++;
  26686. } else {
  26687. s5 = peg$FAILED;
  26688. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  26689. }
  26690. if (s5 !== peg$FAILED) {
  26691. while (s5 !== peg$FAILED) {
  26692. s4.push(s5);
  26693. if (peg$c39.test(input.charAt(peg$currPos))) {
  26694. s5 = input.charAt(peg$currPos);
  26695. peg$currPos++;
  26696. } else {
  26697. s5 = peg$FAILED;
  26698. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  26699. }
  26700. }
  26701. } else {
  26702. s4 = peg$FAILED;
  26703. }
  26704. if (s4 !== peg$FAILED) {
  26705. s3 = input.substring(s3, peg$currPos);
  26706. } else {
  26707. s3 = s4;
  26708. }
  26709. if (s3 !== peg$FAILED) {
  26710. peg$savedPos = s0;
  26711. s1 = peg$c41(s1, s3);
  26712. s0 = s1;
  26713. } else {
  26714. peg$currPos = s0;
  26715. s0 = peg$FAILED;
  26716. }
  26717. } else {
  26718. peg$currPos = s0;
  26719. s0 = peg$FAILED;
  26720. }
  26721. } else {
  26722. peg$currPos = s0;
  26723. s0 = peg$FAILED;
  26724. }
  26725. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26726. return s0;
  26727. }
  26728. function peg$parsefloat() {
  26729. var s0, s1, s2, s3, s4, s5, s6, s7;
  26730. var key = peg$currPos * 62 + 17,
  26731. cached = peg$resultsCache[key];
  26732. if (cached) {
  26733. peg$currPos = cached.nextPos;
  26734. return cached.result;
  26735. }
  26736. s0 = peg$currPos;
  26737. s1 = peg$currPos;
  26738. s2 = peg$currPos;
  26739. if (input.charCodeAt(peg$currPos) === 45) {
  26740. s3 = peg$c35;
  26741. peg$currPos++;
  26742. } else {
  26743. s3 = peg$FAILED;
  26744. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  26745. }
  26746. if (s3 === peg$FAILED) {
  26747. s3 = null;
  26748. }
  26749. if (s3 !== peg$FAILED) {
  26750. s4 = [];
  26751. if (peg$c42.test(input.charAt(peg$currPos))) {
  26752. s5 = input.charAt(peg$currPos);
  26753. peg$currPos++;
  26754. } else {
  26755. s5 = peg$FAILED;
  26756. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26757. }
  26758. if (s5 !== peg$FAILED) {
  26759. while (s5 !== peg$FAILED) {
  26760. s4.push(s5);
  26761. if (peg$c42.test(input.charAt(peg$currPos))) {
  26762. s5 = input.charAt(peg$currPos);
  26763. peg$currPos++;
  26764. } else {
  26765. s5 = peg$FAILED;
  26766. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26767. }
  26768. }
  26769. } else {
  26770. s4 = peg$FAILED;
  26771. }
  26772. if (s4 !== peg$FAILED) {
  26773. if (input.charCodeAt(peg$currPos) === 46) {
  26774. s5 = peg$c6;
  26775. peg$currPos++;
  26776. } else {
  26777. s5 = peg$FAILED;
  26778. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26779. }
  26780. if (s5 !== peg$FAILED) {
  26781. s6 = [];
  26782. if (peg$c42.test(input.charAt(peg$currPos))) {
  26783. s7 = input.charAt(peg$currPos);
  26784. peg$currPos++;
  26785. } else {
  26786. s7 = peg$FAILED;
  26787. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26788. }
  26789. if (s7 !== peg$FAILED) {
  26790. while (s7 !== peg$FAILED) {
  26791. s6.push(s7);
  26792. if (peg$c42.test(input.charAt(peg$currPos))) {
  26793. s7 = input.charAt(peg$currPos);
  26794. peg$currPos++;
  26795. } else {
  26796. s7 = peg$FAILED;
  26797. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26798. }
  26799. }
  26800. } else {
  26801. s6 = peg$FAILED;
  26802. }
  26803. if (s6 !== peg$FAILED) {
  26804. s3 = [s3, s4, s5, s6];
  26805. s2 = s3;
  26806. } else {
  26807. peg$currPos = s2;
  26808. s2 = peg$FAILED;
  26809. }
  26810. } else {
  26811. peg$currPos = s2;
  26812. s2 = peg$FAILED;
  26813. }
  26814. } else {
  26815. peg$currPos = s2;
  26816. s2 = peg$FAILED;
  26817. }
  26818. } else {
  26819. peg$currPos = s2;
  26820. s2 = peg$FAILED;
  26821. }
  26822. if (s2 !== peg$FAILED) {
  26823. s1 = input.substring(s1, peg$currPos);
  26824. } else {
  26825. s1 = s2;
  26826. }
  26827. if (s1 !== peg$FAILED) {
  26828. peg$savedPos = s0;
  26829. s1 = peg$c44(s1);
  26830. }
  26831. s0 = s1;
  26832. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26833. return s0;
  26834. }
  26835. function peg$parseinteger() {
  26836. var s0, s1, s2, s3, s4, s5;
  26837. var key = peg$currPos * 62 + 18,
  26838. cached = peg$resultsCache[key];
  26839. if (cached) {
  26840. peg$currPos = cached.nextPos;
  26841. return cached.result;
  26842. }
  26843. s0 = peg$currPos;
  26844. s1 = peg$currPos;
  26845. s2 = peg$currPos;
  26846. if (input.charCodeAt(peg$currPos) === 45) {
  26847. s3 = peg$c35;
  26848. peg$currPos++;
  26849. } else {
  26850. s3 = peg$FAILED;
  26851. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  26852. }
  26853. if (s3 === peg$FAILED) {
  26854. s3 = null;
  26855. }
  26856. if (s3 !== peg$FAILED) {
  26857. s4 = [];
  26858. if (peg$c42.test(input.charAt(peg$currPos))) {
  26859. s5 = input.charAt(peg$currPos);
  26860. peg$currPos++;
  26861. } else {
  26862. s5 = peg$FAILED;
  26863. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26864. }
  26865. if (s5 !== peg$FAILED) {
  26866. while (s5 !== peg$FAILED) {
  26867. s4.push(s5);
  26868. if (peg$c42.test(input.charAt(peg$currPos))) {
  26869. s5 = input.charAt(peg$currPos);
  26870. peg$currPos++;
  26871. } else {
  26872. s5 = peg$FAILED;
  26873. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  26874. }
  26875. }
  26876. } else {
  26877. s4 = peg$FAILED;
  26878. }
  26879. if (s4 !== peg$FAILED) {
  26880. s3 = [s3, s4];
  26881. s2 = s3;
  26882. } else {
  26883. peg$currPos = s2;
  26884. s2 = peg$FAILED;
  26885. }
  26886. } else {
  26887. peg$currPos = s2;
  26888. s2 = peg$FAILED;
  26889. }
  26890. if (s2 !== peg$FAILED) {
  26891. s1 = input.substring(s1, peg$currPos);
  26892. } else {
  26893. s1 = s2;
  26894. }
  26895. if (s1 !== peg$FAILED) {
  26896. peg$savedPos = s0;
  26897. s1 = peg$c45(s1);
  26898. }
  26899. s0 = s1;
  26900. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26901. return s0;
  26902. }
  26903. function peg$parseliteralArray() {
  26904. var s0, s1, s2, s3, s4;
  26905. var key = peg$currPos * 62 + 19,
  26906. cached = peg$resultsCache[key];
  26907. if (cached) {
  26908. peg$currPos = cached.nextPos;
  26909. return cached.result;
  26910. }
  26911. s0 = peg$currPos;
  26912. if (input.substr(peg$currPos, 2) === peg$c46) {
  26913. s1 = peg$c46;
  26914. peg$currPos += 2;
  26915. } else {
  26916. s1 = peg$FAILED;
  26917. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  26918. }
  26919. if (s1 !== peg$FAILED) {
  26920. s2 = peg$parsewsLiteralArrayContents();
  26921. if (s2 !== peg$FAILED) {
  26922. s3 = peg$parsews();
  26923. if (s3 !== peg$FAILED) {
  26924. if (input.charCodeAt(peg$currPos) === 41) {
  26925. s4 = peg$c48;
  26926. peg$currPos++;
  26927. } else {
  26928. s4 = peg$FAILED;
  26929. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  26930. }
  26931. if (s4 !== peg$FAILED) {
  26932. peg$savedPos = s0;
  26933. s1 = peg$c50(s2);
  26934. s0 = s1;
  26935. } else {
  26936. peg$currPos = s0;
  26937. s0 = peg$FAILED;
  26938. }
  26939. } else {
  26940. peg$currPos = s0;
  26941. s0 = peg$FAILED;
  26942. }
  26943. } else {
  26944. peg$currPos = s0;
  26945. s0 = peg$FAILED;
  26946. }
  26947. } else {
  26948. peg$currPos = s0;
  26949. s0 = peg$FAILED;
  26950. }
  26951. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26952. return s0;
  26953. }
  26954. function peg$parsebareLiteralArray() {
  26955. var s0, s1, s2, s3, s4;
  26956. var key = peg$currPos * 62 + 20,
  26957. cached = peg$resultsCache[key];
  26958. if (cached) {
  26959. peg$currPos = cached.nextPos;
  26960. return cached.result;
  26961. }
  26962. s0 = peg$currPos;
  26963. if (input.charCodeAt(peg$currPos) === 40) {
  26964. s1 = peg$c51;
  26965. peg$currPos++;
  26966. } else {
  26967. s1 = peg$FAILED;
  26968. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26969. }
  26970. if (s1 !== peg$FAILED) {
  26971. s2 = peg$parsewsLiteralArrayContents();
  26972. if (s2 !== peg$FAILED) {
  26973. s3 = peg$parsews();
  26974. if (s3 !== peg$FAILED) {
  26975. if (input.charCodeAt(peg$currPos) === 41) {
  26976. s4 = peg$c48;
  26977. peg$currPos++;
  26978. } else {
  26979. s4 = peg$FAILED;
  26980. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  26981. }
  26982. if (s4 !== peg$FAILED) {
  26983. peg$savedPos = s0;
  26984. s1 = peg$c50(s2);
  26985. s0 = s1;
  26986. } else {
  26987. peg$currPos = s0;
  26988. s0 = peg$FAILED;
  26989. }
  26990. } else {
  26991. peg$currPos = s0;
  26992. s0 = peg$FAILED;
  26993. }
  26994. } else {
  26995. peg$currPos = s0;
  26996. s0 = peg$FAILED;
  26997. }
  26998. } else {
  26999. peg$currPos = s0;
  27000. s0 = peg$FAILED;
  27001. }
  27002. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27003. return s0;
  27004. }
  27005. function peg$parseliteralArrayElement() {
  27006. var s0;
  27007. var key = peg$currPos * 62 + 21,
  27008. cached = peg$resultsCache[key];
  27009. if (cached) {
  27010. peg$currPos = cached.nextPos;
  27011. return cached.result;
  27012. }
  27013. s0 = peg$parseparseTimeLiteral();
  27014. if (s0 === peg$FAILED) {
  27015. s0 = peg$parsebareLiteralArray();
  27016. if (s0 === peg$FAILED) {
  27017. s0 = peg$parsebareSymbol();
  27018. }
  27019. }
  27020. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27021. return s0;
  27022. }
  27023. function peg$parsewsLiteralArrayContents() {
  27024. var s0, s1, s2, s3, s4;
  27025. var key = peg$currPos * 62 + 22,
  27026. cached = peg$resultsCache[key];
  27027. if (cached) {
  27028. peg$currPos = cached.nextPos;
  27029. return cached.result;
  27030. }
  27031. s0 = peg$currPos;
  27032. s1 = [];
  27033. s2 = peg$currPos;
  27034. s3 = peg$parsews();
  27035. if (s3 !== peg$FAILED) {
  27036. s4 = peg$parseliteralArrayElement();
  27037. if (s4 !== peg$FAILED) {
  27038. peg$savedPos = s2;
  27039. s3 = peg$c53(s4);
  27040. s2 = s3;
  27041. } else {
  27042. peg$currPos = s2;
  27043. s2 = peg$FAILED;
  27044. }
  27045. } else {
  27046. peg$currPos = s2;
  27047. s2 = peg$FAILED;
  27048. }
  27049. while (s2 !== peg$FAILED) {
  27050. s1.push(s2);
  27051. s2 = peg$currPos;
  27052. s3 = peg$parsews();
  27053. if (s3 !== peg$FAILED) {
  27054. s4 = peg$parseliteralArrayElement();
  27055. if (s4 !== peg$FAILED) {
  27056. peg$savedPos = s2;
  27057. s3 = peg$c53(s4);
  27058. s2 = s3;
  27059. } else {
  27060. peg$currPos = s2;
  27061. s2 = peg$FAILED;
  27062. }
  27063. } else {
  27064. peg$currPos = s2;
  27065. s2 = peg$FAILED;
  27066. }
  27067. }
  27068. if (s1 !== peg$FAILED) {
  27069. peg$savedPos = s0;
  27070. s1 = peg$c54(s1);
  27071. }
  27072. s0 = s1;
  27073. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27074. return s0;
  27075. }
  27076. function peg$parsedynamicArray() {
  27077. var s0, s1, s2, s3, s4;
  27078. var key = peg$currPos * 62 + 23,
  27079. cached = peg$resultsCache[key];
  27080. if (cached) {
  27081. peg$currPos = cached.nextPos;
  27082. return cached.result;
  27083. }
  27084. s0 = peg$currPos;
  27085. if (input.charCodeAt(peg$currPos) === 123) {
  27086. s1 = peg$c55;
  27087. peg$currPos++;
  27088. } else {
  27089. s1 = peg$FAILED;
  27090. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  27091. }
  27092. if (s1 !== peg$FAILED) {
  27093. s2 = peg$parsewsExpressions();
  27094. if (s2 === peg$FAILED) {
  27095. s2 = null;
  27096. }
  27097. if (s2 !== peg$FAILED) {
  27098. s3 = peg$parsemaybeDotsWs();
  27099. if (s3 !== peg$FAILED) {
  27100. if (input.charCodeAt(peg$currPos) === 125) {
  27101. s4 = peg$c57;
  27102. peg$currPos++;
  27103. } else {
  27104. s4 = peg$FAILED;
  27105. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  27106. }
  27107. if (s4 !== peg$FAILED) {
  27108. peg$savedPos = s0;
  27109. s1 = peg$c59(s2);
  27110. s0 = s1;
  27111. } else {
  27112. peg$currPos = s0;
  27113. s0 = peg$FAILED;
  27114. }
  27115. } else {
  27116. peg$currPos = s0;
  27117. s0 = peg$FAILED;
  27118. }
  27119. } else {
  27120. peg$currPos = s0;
  27121. s0 = peg$FAILED;
  27122. }
  27123. } else {
  27124. peg$currPos = s0;
  27125. s0 = peg$FAILED;
  27126. }
  27127. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27128. return s0;
  27129. }
  27130. function peg$parsedynamicDictionary() {
  27131. var s0, s1, s2, s3, s4;
  27132. var key = peg$currPos * 62 + 24,
  27133. cached = peg$resultsCache[key];
  27134. if (cached) {
  27135. peg$currPos = cached.nextPos;
  27136. return cached.result;
  27137. }
  27138. s0 = peg$currPos;
  27139. if (input.substr(peg$currPos, 2) === peg$c60) {
  27140. s1 = peg$c60;
  27141. peg$currPos += 2;
  27142. } else {
  27143. s1 = peg$FAILED;
  27144. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  27145. }
  27146. if (s1 !== peg$FAILED) {
  27147. s2 = peg$parsewsAssociations();
  27148. if (s2 === peg$FAILED) {
  27149. s2 = null;
  27150. }
  27151. if (s2 !== peg$FAILED) {
  27152. s3 = peg$parsemaybeDotsWs();
  27153. if (s3 !== peg$FAILED) {
  27154. if (input.charCodeAt(peg$currPos) === 125) {
  27155. s4 = peg$c57;
  27156. peg$currPos++;
  27157. } else {
  27158. s4 = peg$FAILED;
  27159. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  27160. }
  27161. if (s4 !== peg$FAILED) {
  27162. peg$savedPos = s0;
  27163. s1 = peg$c62(s2);
  27164. s0 = s1;
  27165. } else {
  27166. peg$currPos = s0;
  27167. s0 = peg$FAILED;
  27168. }
  27169. } else {
  27170. peg$currPos = s0;
  27171. s0 = peg$FAILED;
  27172. }
  27173. } else {
  27174. peg$currPos = s0;
  27175. s0 = peg$FAILED;
  27176. }
  27177. } else {
  27178. peg$currPos = s0;
  27179. s0 = peg$FAILED;
  27180. }
  27181. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27182. return s0;
  27183. }
  27184. function peg$parsepseudoVariable() {
  27185. var s0, s1, s2;
  27186. var key = peg$currPos * 62 + 25,
  27187. cached = peg$resultsCache[key];
  27188. if (cached) {
  27189. peg$currPos = cached.nextPos;
  27190. return cached.result;
  27191. }
  27192. s0 = peg$currPos;
  27193. s1 = peg$currPos;
  27194. if (input.substr(peg$currPos, 4) === peg$c63) {
  27195. s2 = peg$c63;
  27196. peg$currPos += 4;
  27197. } else {
  27198. s2 = peg$FAILED;
  27199. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  27200. }
  27201. if (s2 !== peg$FAILED) {
  27202. peg$savedPos = s1;
  27203. s2 = peg$c65();
  27204. }
  27205. s1 = s2;
  27206. if (s1 === peg$FAILED) {
  27207. s1 = peg$currPos;
  27208. if (input.substr(peg$currPos, 5) === peg$c66) {
  27209. s2 = peg$c66;
  27210. peg$currPos += 5;
  27211. } else {
  27212. s2 = peg$FAILED;
  27213. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  27214. }
  27215. if (s2 !== peg$FAILED) {
  27216. peg$savedPos = s1;
  27217. s2 = peg$c68();
  27218. }
  27219. s1 = s2;
  27220. if (s1 === peg$FAILED) {
  27221. s1 = peg$currPos;
  27222. if (input.substr(peg$currPos, 3) === peg$c69) {
  27223. s2 = peg$c69;
  27224. peg$currPos += 3;
  27225. } else {
  27226. s2 = peg$FAILED;
  27227. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  27228. }
  27229. if (s2 !== peg$FAILED) {
  27230. peg$savedPos = s1;
  27231. s2 = peg$c71();
  27232. }
  27233. s1 = s2;
  27234. }
  27235. }
  27236. if (s1 !== peg$FAILED) {
  27237. peg$savedPos = s0;
  27238. s1 = peg$c16(s1);
  27239. }
  27240. s0 = s1;
  27241. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27242. return s0;
  27243. }
  27244. function peg$parseparseTimeLiteral() {
  27245. var s0;
  27246. var key = peg$currPos * 62 + 26,
  27247. cached = peg$resultsCache[key];
  27248. if (cached) {
  27249. peg$currPos = cached.nextPos;
  27250. return cached.result;
  27251. }
  27252. s0 = peg$parsepseudoVariable();
  27253. if (s0 === peg$FAILED) {
  27254. s0 = peg$parsenumber();
  27255. if (s0 === peg$FAILED) {
  27256. s0 = peg$parseliteralArray();
  27257. if (s0 === peg$FAILED) {
  27258. s0 = peg$parsestring();
  27259. if (s0 === peg$FAILED) {
  27260. s0 = peg$parsesymbol();
  27261. if (s0 === peg$FAILED) {
  27262. s0 = peg$parsecharacter();
  27263. }
  27264. }
  27265. }
  27266. }
  27267. }
  27268. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27269. return s0;
  27270. }
  27271. function peg$parseruntimeLiteral() {
  27272. var s0;
  27273. var key = peg$currPos * 62 + 27,
  27274. cached = peg$resultsCache[key];
  27275. if (cached) {
  27276. peg$currPos = cached.nextPos;
  27277. return cached.result;
  27278. }
  27279. s0 = peg$parsedynamicDictionary();
  27280. if (s0 === peg$FAILED) {
  27281. s0 = peg$parsedynamicArray();
  27282. if (s0 === peg$FAILED) {
  27283. s0 = peg$parseblock();
  27284. }
  27285. }
  27286. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27287. return s0;
  27288. }
  27289. function peg$parseliteral() {
  27290. var s0;
  27291. var key = peg$currPos * 62 + 28,
  27292. cached = peg$resultsCache[key];
  27293. if (cached) {
  27294. peg$currPos = cached.nextPos;
  27295. return cached.result;
  27296. }
  27297. s0 = peg$parseruntimeLiteral();
  27298. if (s0 === peg$FAILED) {
  27299. s0 = peg$parseparseTimeLiteral();
  27300. }
  27301. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27302. return s0;
  27303. }
  27304. function peg$parsevariable() {
  27305. var s0, s1;
  27306. var key = peg$currPos * 62 + 29,
  27307. cached = peg$resultsCache[key];
  27308. if (cached) {
  27309. peg$currPos = cached.nextPos;
  27310. return cached.result;
  27311. }
  27312. s0 = peg$currPos;
  27313. s1 = peg$parseidentifier();
  27314. if (s1 !== peg$FAILED) {
  27315. peg$savedPos = s0;
  27316. s1 = peg$c72(s1);
  27317. }
  27318. s0 = s1;
  27319. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27320. return s0;
  27321. }
  27322. function peg$parsebinarySelector() {
  27323. var s0, s1, s2;
  27324. var key = peg$currPos * 62 + 30,
  27325. cached = peg$resultsCache[key];
  27326. if (cached) {
  27327. peg$currPos = cached.nextPos;
  27328. return cached.result;
  27329. }
  27330. s0 = peg$currPos;
  27331. s1 = [];
  27332. if (peg$c73.test(input.charAt(peg$currPos))) {
  27333. s2 = input.charAt(peg$currPos);
  27334. peg$currPos++;
  27335. } else {
  27336. s2 = peg$FAILED;
  27337. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  27338. }
  27339. if (s2 !== peg$FAILED) {
  27340. while (s2 !== peg$FAILED) {
  27341. s1.push(s2);
  27342. if (peg$c73.test(input.charAt(peg$currPos))) {
  27343. s2 = input.charAt(peg$currPos);
  27344. peg$currPos++;
  27345. } else {
  27346. s2 = peg$FAILED;
  27347. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  27348. }
  27349. }
  27350. } else {
  27351. s1 = peg$FAILED;
  27352. }
  27353. if (s1 !== peg$FAILED) {
  27354. s0 = input.substring(s0, peg$currPos);
  27355. } else {
  27356. s0 = s1;
  27357. }
  27358. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27359. return s0;
  27360. }
  27361. function peg$parsewsKeywordPattern() {
  27362. var s0, s1, s2, s3, s4, s5, s6;
  27363. var key = peg$currPos * 62 + 31,
  27364. cached = peg$resultsCache[key];
  27365. if (cached) {
  27366. peg$currPos = cached.nextPos;
  27367. return cached.result;
  27368. }
  27369. s0 = peg$currPos;
  27370. s1 = [];
  27371. s2 = peg$currPos;
  27372. s3 = peg$parsews();
  27373. if (s3 !== peg$FAILED) {
  27374. s4 = peg$parsekeyword();
  27375. if (s4 !== peg$FAILED) {
  27376. s5 = peg$parsews();
  27377. if (s5 !== peg$FAILED) {
  27378. s6 = peg$parseidentifier();
  27379. if (s6 !== peg$FAILED) {
  27380. peg$savedPos = s2;
  27381. s3 = peg$c75(s4, s6);
  27382. s2 = s3;
  27383. } else {
  27384. peg$currPos = s2;
  27385. s2 = peg$FAILED;
  27386. }
  27387. } else {
  27388. peg$currPos = s2;
  27389. s2 = peg$FAILED;
  27390. }
  27391. } else {
  27392. peg$currPos = s2;
  27393. s2 = peg$FAILED;
  27394. }
  27395. } else {
  27396. peg$currPos = s2;
  27397. s2 = peg$FAILED;
  27398. }
  27399. if (s2 !== peg$FAILED) {
  27400. while (s2 !== peg$FAILED) {
  27401. s1.push(s2);
  27402. s2 = peg$currPos;
  27403. s3 = peg$parsews();
  27404. if (s3 !== peg$FAILED) {
  27405. s4 = peg$parsekeyword();
  27406. if (s4 !== peg$FAILED) {
  27407. s5 = peg$parsews();
  27408. if (s5 !== peg$FAILED) {
  27409. s6 = peg$parseidentifier();
  27410. if (s6 !== peg$FAILED) {
  27411. peg$savedPos = s2;
  27412. s3 = peg$c75(s4, s6);
  27413. s2 = s3;
  27414. } else {
  27415. peg$currPos = s2;
  27416. s2 = peg$FAILED;
  27417. }
  27418. } else {
  27419. peg$currPos = s2;
  27420. s2 = peg$FAILED;
  27421. }
  27422. } else {
  27423. peg$currPos = s2;
  27424. s2 = peg$FAILED;
  27425. }
  27426. } else {
  27427. peg$currPos = s2;
  27428. s2 = peg$FAILED;
  27429. }
  27430. }
  27431. } else {
  27432. s1 = peg$FAILED;
  27433. }
  27434. if (s1 !== peg$FAILED) {
  27435. peg$savedPos = s0;
  27436. s1 = peg$c76(s1);
  27437. }
  27438. s0 = s1;
  27439. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27440. return s0;
  27441. }
  27442. function peg$parsewsBinaryPattern() {
  27443. var s0, s1, s2, s3, s4;
  27444. var key = peg$currPos * 62 + 32,
  27445. cached = peg$resultsCache[key];
  27446. if (cached) {
  27447. peg$currPos = cached.nextPos;
  27448. return cached.result;
  27449. }
  27450. s0 = peg$currPos;
  27451. s1 = peg$parsews();
  27452. if (s1 !== peg$FAILED) {
  27453. s2 = peg$parsebinarySelector();
  27454. if (s2 !== peg$FAILED) {
  27455. s3 = peg$parsews();
  27456. if (s3 !== peg$FAILED) {
  27457. s4 = peg$parseidentifier();
  27458. if (s4 !== peg$FAILED) {
  27459. peg$savedPos = s0;
  27460. s1 = peg$c77(s2, s4);
  27461. s0 = s1;
  27462. } else {
  27463. peg$currPos = s0;
  27464. s0 = peg$FAILED;
  27465. }
  27466. } else {
  27467. peg$currPos = s0;
  27468. s0 = peg$FAILED;
  27469. }
  27470. } else {
  27471. peg$currPos = s0;
  27472. s0 = peg$FAILED;
  27473. }
  27474. } else {
  27475. peg$currPos = s0;
  27476. s0 = peg$FAILED;
  27477. }
  27478. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27479. return s0;
  27480. }
  27481. function peg$parsewsUnaryPattern() {
  27482. var s0, s1, s2;
  27483. var key = peg$currPos * 62 + 33,
  27484. cached = peg$resultsCache[key];
  27485. if (cached) {
  27486. peg$currPos = cached.nextPos;
  27487. return cached.result;
  27488. }
  27489. s0 = peg$currPos;
  27490. s1 = peg$parsews();
  27491. if (s1 !== peg$FAILED) {
  27492. s2 = peg$parseidentifier();
  27493. if (s2 !== peg$FAILED) {
  27494. peg$savedPos = s0;
  27495. s1 = peg$c78(s2);
  27496. s0 = s1;
  27497. } else {
  27498. peg$currPos = s0;
  27499. s0 = peg$FAILED;
  27500. }
  27501. } else {
  27502. peg$currPos = s0;
  27503. s0 = peg$FAILED;
  27504. }
  27505. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27506. return s0;
  27507. }
  27508. function peg$parseexpression() {
  27509. var s0;
  27510. var key = peg$currPos * 62 + 34,
  27511. cached = peg$resultsCache[key];
  27512. if (cached) {
  27513. peg$currPos = cached.nextPos;
  27514. return cached.result;
  27515. }
  27516. s0 = peg$parseassignment();
  27517. if (s0 === peg$FAILED) {
  27518. s0 = peg$parsecascade();
  27519. if (s0 === peg$FAILED) {
  27520. s0 = peg$parsekeywordSend();
  27521. }
  27522. }
  27523. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27524. return s0;
  27525. }
  27526. function peg$parsewsExpressionsRest() {
  27527. var s0, s1, s2, s3, s4;
  27528. var key = peg$currPos * 62 + 35,
  27529. cached = peg$resultsCache[key];
  27530. if (cached) {
  27531. peg$currPos = cached.nextPos;
  27532. return cached.result;
  27533. }
  27534. s0 = peg$currPos;
  27535. s1 = peg$parsews();
  27536. if (s1 !== peg$FAILED) {
  27537. if (input.charCodeAt(peg$currPos) === 46) {
  27538. s2 = peg$c6;
  27539. peg$currPos++;
  27540. } else {
  27541. s2 = peg$FAILED;
  27542. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27543. }
  27544. if (s2 !== peg$FAILED) {
  27545. s3 = peg$parsemaybeDotsWs();
  27546. if (s3 !== peg$FAILED) {
  27547. s4 = peg$parseexpression();
  27548. if (s4 !== peg$FAILED) {
  27549. peg$savedPos = s0;
  27550. s1 = peg$c79(s4);
  27551. s0 = s1;
  27552. } else {
  27553. peg$currPos = s0;
  27554. s0 = peg$FAILED;
  27555. }
  27556. } else {
  27557. peg$currPos = s0;
  27558. s0 = peg$FAILED;
  27559. }
  27560. } else {
  27561. peg$currPos = s0;
  27562. s0 = peg$FAILED;
  27563. }
  27564. } else {
  27565. peg$currPos = s0;
  27566. s0 = peg$FAILED;
  27567. }
  27568. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27569. return s0;
  27570. }
  27571. function peg$parsewsExpressions() {
  27572. var s0, s1, s2, s3, s4;
  27573. var key = peg$currPos * 62 + 36,
  27574. cached = peg$resultsCache[key];
  27575. if (cached) {
  27576. peg$currPos = cached.nextPos;
  27577. return cached.result;
  27578. }
  27579. s0 = peg$currPos;
  27580. s1 = peg$parsemaybeDotsWs();
  27581. if (s1 !== peg$FAILED) {
  27582. s2 = peg$parseexpression();
  27583. if (s2 !== peg$FAILED) {
  27584. s3 = [];
  27585. s4 = peg$parsewsExpressionsRest();
  27586. while (s4 !== peg$FAILED) {
  27587. s3.push(s4);
  27588. s4 = peg$parsewsExpressionsRest();
  27589. }
  27590. if (s3 !== peg$FAILED) {
  27591. peg$savedPos = s0;
  27592. s1 = peg$c80(s2, s3);
  27593. s0 = s1;
  27594. } else {
  27595. peg$currPos = s0;
  27596. s0 = peg$FAILED;
  27597. }
  27598. } else {
  27599. peg$currPos = s0;
  27600. s0 = peg$FAILED;
  27601. }
  27602. } else {
  27603. peg$currPos = s0;
  27604. s0 = peg$FAILED;
  27605. }
  27606. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27607. return s0;
  27608. }
  27609. function peg$parseassignment() {
  27610. var s0, s1, s2, s3, s4, s5;
  27611. var key = peg$currPos * 62 + 37,
  27612. cached = peg$resultsCache[key];
  27613. if (cached) {
  27614. peg$currPos = cached.nextPos;
  27615. return cached.result;
  27616. }
  27617. s0 = peg$currPos;
  27618. s1 = peg$parsevariable();
  27619. if (s1 !== peg$FAILED) {
  27620. s2 = peg$parsews();
  27621. if (s2 !== peg$FAILED) {
  27622. if (input.substr(peg$currPos, 2) === peg$c81) {
  27623. s3 = peg$c81;
  27624. peg$currPos += 2;
  27625. } else {
  27626. s3 = peg$FAILED;
  27627. if (peg$silentFails === 0) { peg$fail(peg$c82); }
  27628. }
  27629. if (s3 !== peg$FAILED) {
  27630. s4 = peg$parsews();
  27631. if (s4 !== peg$FAILED) {
  27632. s5 = peg$parseexpression();
  27633. if (s5 !== peg$FAILED) {
  27634. peg$savedPos = s0;
  27635. s1 = peg$c83(s1, s5);
  27636. s0 = s1;
  27637. } else {
  27638. peg$currPos = s0;
  27639. s0 = peg$FAILED;
  27640. }
  27641. } else {
  27642. peg$currPos = s0;
  27643. s0 = peg$FAILED;
  27644. }
  27645. } else {
  27646. peg$currPos = s0;
  27647. s0 = peg$FAILED;
  27648. }
  27649. } else {
  27650. peg$currPos = s0;
  27651. s0 = peg$FAILED;
  27652. }
  27653. } else {
  27654. peg$currPos = s0;
  27655. s0 = peg$FAILED;
  27656. }
  27657. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27658. return s0;
  27659. }
  27660. function peg$parseret() {
  27661. var s0, s1, s2, s3;
  27662. var key = peg$currPos * 62 + 38,
  27663. cached = peg$resultsCache[key];
  27664. if (cached) {
  27665. peg$currPos = cached.nextPos;
  27666. return cached.result;
  27667. }
  27668. s0 = peg$currPos;
  27669. if (input.charCodeAt(peg$currPos) === 94) {
  27670. s1 = peg$c84;
  27671. peg$currPos++;
  27672. } else {
  27673. s1 = peg$FAILED;
  27674. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  27675. }
  27676. if (s1 !== peg$FAILED) {
  27677. s2 = peg$parsews();
  27678. if (s2 !== peg$FAILED) {
  27679. s3 = peg$parseexpression();
  27680. if (s3 !== peg$FAILED) {
  27681. peg$savedPos = s0;
  27682. s1 = peg$c86(s3);
  27683. s0 = s1;
  27684. } else {
  27685. peg$currPos = s0;
  27686. s0 = peg$FAILED;
  27687. }
  27688. } else {
  27689. peg$currPos = s0;
  27690. s0 = peg$FAILED;
  27691. }
  27692. } else {
  27693. peg$currPos = s0;
  27694. s0 = peg$FAILED;
  27695. }
  27696. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27697. return s0;
  27698. }
  27699. function peg$parsetemps() {
  27700. var s0, s1, s2, s3, s4, s5;
  27701. var key = peg$currPos * 62 + 39,
  27702. cached = peg$resultsCache[key];
  27703. if (cached) {
  27704. peg$currPos = cached.nextPos;
  27705. return cached.result;
  27706. }
  27707. s0 = peg$currPos;
  27708. if (input.charCodeAt(peg$currPos) === 124) {
  27709. s1 = peg$c87;
  27710. peg$currPos++;
  27711. } else {
  27712. s1 = peg$FAILED;
  27713. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  27714. }
  27715. if (s1 !== peg$FAILED) {
  27716. s2 = [];
  27717. s3 = peg$currPos;
  27718. s4 = peg$parsews();
  27719. if (s4 !== peg$FAILED) {
  27720. s5 = peg$parseidentifier();
  27721. if (s5 !== peg$FAILED) {
  27722. peg$savedPos = s3;
  27723. s4 = peg$c89(s5);
  27724. s3 = s4;
  27725. } else {
  27726. peg$currPos = s3;
  27727. s3 = peg$FAILED;
  27728. }
  27729. } else {
  27730. peg$currPos = s3;
  27731. s3 = peg$FAILED;
  27732. }
  27733. while (s3 !== peg$FAILED) {
  27734. s2.push(s3);
  27735. s3 = peg$currPos;
  27736. s4 = peg$parsews();
  27737. if (s4 !== peg$FAILED) {
  27738. s5 = peg$parseidentifier();
  27739. if (s5 !== peg$FAILED) {
  27740. peg$savedPos = s3;
  27741. s4 = peg$c89(s5);
  27742. s3 = s4;
  27743. } else {
  27744. peg$currPos = s3;
  27745. s3 = peg$FAILED;
  27746. }
  27747. } else {
  27748. peg$currPos = s3;
  27749. s3 = peg$FAILED;
  27750. }
  27751. }
  27752. if (s2 !== peg$FAILED) {
  27753. s3 = peg$parsews();
  27754. if (s3 !== peg$FAILED) {
  27755. if (input.charCodeAt(peg$currPos) === 124) {
  27756. s4 = peg$c87;
  27757. peg$currPos++;
  27758. } else {
  27759. s4 = peg$FAILED;
  27760. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  27761. }
  27762. if (s4 !== peg$FAILED) {
  27763. peg$savedPos = s0;
  27764. s1 = peg$c90(s2);
  27765. s0 = s1;
  27766. } else {
  27767. peg$currPos = s0;
  27768. s0 = peg$FAILED;
  27769. }
  27770. } else {
  27771. peg$currPos = s0;
  27772. s0 = peg$FAILED;
  27773. }
  27774. } else {
  27775. peg$currPos = s0;
  27776. s0 = peg$FAILED;
  27777. }
  27778. } else {
  27779. peg$currPos = s0;
  27780. s0 = peg$FAILED;
  27781. }
  27782. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27783. return s0;
  27784. }
  27785. function peg$parsewsBlockParamList() {
  27786. var s0, s1, s2, s3, s4, s5, s6;
  27787. var key = peg$currPos * 62 + 40,
  27788. cached = peg$resultsCache[key];
  27789. if (cached) {
  27790. peg$currPos = cached.nextPos;
  27791. return cached.result;
  27792. }
  27793. s0 = peg$currPos;
  27794. s1 = [];
  27795. s2 = peg$currPos;
  27796. s3 = peg$parsews();
  27797. if (s3 !== peg$FAILED) {
  27798. if (input.charCodeAt(peg$currPos) === 58) {
  27799. s4 = peg$c12;
  27800. peg$currPos++;
  27801. } else {
  27802. s4 = peg$FAILED;
  27803. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27804. }
  27805. if (s4 !== peg$FAILED) {
  27806. s5 = peg$parsews();
  27807. if (s5 !== peg$FAILED) {
  27808. s6 = peg$parseidentifier();
  27809. if (s6 !== peg$FAILED) {
  27810. peg$savedPos = s2;
  27811. s3 = peg$c91(s6);
  27812. s2 = s3;
  27813. } else {
  27814. peg$currPos = s2;
  27815. s2 = peg$FAILED;
  27816. }
  27817. } else {
  27818. peg$currPos = s2;
  27819. s2 = peg$FAILED;
  27820. }
  27821. } else {
  27822. peg$currPos = s2;
  27823. s2 = peg$FAILED;
  27824. }
  27825. } else {
  27826. peg$currPos = s2;
  27827. s2 = peg$FAILED;
  27828. }
  27829. if (s2 !== peg$FAILED) {
  27830. while (s2 !== peg$FAILED) {
  27831. s1.push(s2);
  27832. s2 = peg$currPos;
  27833. s3 = peg$parsews();
  27834. if (s3 !== peg$FAILED) {
  27835. if (input.charCodeAt(peg$currPos) === 58) {
  27836. s4 = peg$c12;
  27837. peg$currPos++;
  27838. } else {
  27839. s4 = peg$FAILED;
  27840. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27841. }
  27842. if (s4 !== peg$FAILED) {
  27843. s5 = peg$parsews();
  27844. if (s5 !== peg$FAILED) {
  27845. s6 = peg$parseidentifier();
  27846. if (s6 !== peg$FAILED) {
  27847. peg$savedPos = s2;
  27848. s3 = peg$c91(s6);
  27849. s2 = s3;
  27850. } else {
  27851. peg$currPos = s2;
  27852. s2 = peg$FAILED;
  27853. }
  27854. } else {
  27855. peg$currPos = s2;
  27856. s2 = peg$FAILED;
  27857. }
  27858. } else {
  27859. peg$currPos = s2;
  27860. s2 = peg$FAILED;
  27861. }
  27862. } else {
  27863. peg$currPos = s2;
  27864. s2 = peg$FAILED;
  27865. }
  27866. }
  27867. } else {
  27868. s1 = peg$FAILED;
  27869. }
  27870. if (s1 !== peg$FAILED) {
  27871. s2 = peg$parsews();
  27872. if (s2 !== peg$FAILED) {
  27873. if (input.charCodeAt(peg$currPos) === 124) {
  27874. s3 = peg$c87;
  27875. peg$currPos++;
  27876. } else {
  27877. s3 = peg$FAILED;
  27878. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  27879. }
  27880. if (s3 !== peg$FAILED) {
  27881. peg$savedPos = s0;
  27882. s1 = peg$c92(s1);
  27883. s0 = s1;
  27884. } else {
  27885. peg$currPos = s0;
  27886. s0 = peg$FAILED;
  27887. }
  27888. } else {
  27889. peg$currPos = s0;
  27890. s0 = peg$FAILED;
  27891. }
  27892. } else {
  27893. peg$currPos = s0;
  27894. s0 = peg$FAILED;
  27895. }
  27896. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27897. return s0;
  27898. }
  27899. function peg$parsesubexpression() {
  27900. var s0, s1, s2, s3, s4, s5;
  27901. var key = peg$currPos * 62 + 41,
  27902. cached = peg$resultsCache[key];
  27903. if (cached) {
  27904. peg$currPos = cached.nextPos;
  27905. return cached.result;
  27906. }
  27907. s0 = peg$currPos;
  27908. if (input.charCodeAt(peg$currPos) === 40) {
  27909. s1 = peg$c51;
  27910. peg$currPos++;
  27911. } else {
  27912. s1 = peg$FAILED;
  27913. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  27914. }
  27915. if (s1 !== peg$FAILED) {
  27916. s2 = peg$parsews();
  27917. if (s2 !== peg$FAILED) {
  27918. s3 = peg$parseexpression();
  27919. if (s3 !== peg$FAILED) {
  27920. s4 = peg$parsews();
  27921. if (s4 !== peg$FAILED) {
  27922. if (input.charCodeAt(peg$currPos) === 41) {
  27923. s5 = peg$c48;
  27924. peg$currPos++;
  27925. } else {
  27926. s5 = peg$FAILED;
  27927. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  27928. }
  27929. if (s5 !== peg$FAILED) {
  27930. peg$savedPos = s0;
  27931. s1 = peg$c79(s3);
  27932. s0 = s1;
  27933. } else {
  27934. peg$currPos = s0;
  27935. s0 = peg$FAILED;
  27936. }
  27937. } else {
  27938. peg$currPos = s0;
  27939. s0 = peg$FAILED;
  27940. }
  27941. } else {
  27942. peg$currPos = s0;
  27943. s0 = peg$FAILED;
  27944. }
  27945. } else {
  27946. peg$currPos = s0;
  27947. s0 = peg$FAILED;
  27948. }
  27949. } else {
  27950. peg$currPos = s0;
  27951. s0 = peg$FAILED;
  27952. }
  27953. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27954. return s0;
  27955. }
  27956. function peg$parsewsStatementsWs() {
  27957. var s0, s1, s2, s3, s4, s5, s6;
  27958. var key = peg$currPos * 62 + 42,
  27959. cached = peg$resultsCache[key];
  27960. if (cached) {
  27961. peg$currPos = cached.nextPos;
  27962. return cached.result;
  27963. }
  27964. s0 = peg$currPos;
  27965. s1 = peg$parsemaybeDotsWs();
  27966. if (s1 !== peg$FAILED) {
  27967. s2 = peg$parseret();
  27968. if (s2 !== peg$FAILED) {
  27969. s3 = peg$parsemaybeDotsWs();
  27970. if (s3 !== peg$FAILED) {
  27971. peg$savedPos = s0;
  27972. s1 = peg$c93(s2);
  27973. s0 = s1;
  27974. } else {
  27975. peg$currPos = s0;
  27976. s0 = peg$FAILED;
  27977. }
  27978. } else {
  27979. peg$currPos = s0;
  27980. s0 = peg$FAILED;
  27981. }
  27982. } else {
  27983. peg$currPos = s0;
  27984. s0 = peg$FAILED;
  27985. }
  27986. if (s0 === peg$FAILED) {
  27987. s0 = peg$currPos;
  27988. s1 = peg$parsewsExpressions();
  27989. if (s1 !== peg$FAILED) {
  27990. s2 = peg$parsews();
  27991. if (s2 !== peg$FAILED) {
  27992. if (input.charCodeAt(peg$currPos) === 46) {
  27993. s3 = peg$c6;
  27994. peg$currPos++;
  27995. } else {
  27996. s3 = peg$FAILED;
  27997. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27998. }
  27999. if (s3 !== peg$FAILED) {
  28000. s4 = peg$parsemaybeDotsWs();
  28001. if (s4 !== peg$FAILED) {
  28002. s5 = peg$parseret();
  28003. if (s5 !== peg$FAILED) {
  28004. s6 = peg$parsemaybeDotsWs();
  28005. if (s6 !== peg$FAILED) {
  28006. peg$savedPos = s0;
  28007. s1 = peg$c94(s1, s5);
  28008. s0 = s1;
  28009. } else {
  28010. peg$currPos = s0;
  28011. s0 = peg$FAILED;
  28012. }
  28013. } else {
  28014. peg$currPos = s0;
  28015. s0 = peg$FAILED;
  28016. }
  28017. } else {
  28018. peg$currPos = s0;
  28019. s0 = peg$FAILED;
  28020. }
  28021. } else {
  28022. peg$currPos = s0;
  28023. s0 = peg$FAILED;
  28024. }
  28025. } else {
  28026. peg$currPos = s0;
  28027. s0 = peg$FAILED;
  28028. }
  28029. } else {
  28030. peg$currPos = s0;
  28031. s0 = peg$FAILED;
  28032. }
  28033. if (s0 === peg$FAILED) {
  28034. s0 = peg$currPos;
  28035. s1 = peg$parsewsExpressions();
  28036. if (s1 === peg$FAILED) {
  28037. s1 = null;
  28038. }
  28039. if (s1 !== peg$FAILED) {
  28040. s2 = peg$parsemaybeDotsWs();
  28041. if (s2 !== peg$FAILED) {
  28042. peg$savedPos = s0;
  28043. s1 = peg$c95(s1);
  28044. s0 = s1;
  28045. } else {
  28046. peg$currPos = s0;
  28047. s0 = peg$FAILED;
  28048. }
  28049. } else {
  28050. peg$currPos = s0;
  28051. s0 = peg$FAILED;
  28052. }
  28053. }
  28054. }
  28055. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28056. return s0;
  28057. }
  28058. function peg$parsewsSequenceWs() {
  28059. var s0, s1, s2, s3;
  28060. var key = peg$currPos * 62 + 43,
  28061. cached = peg$resultsCache[key];
  28062. if (cached) {
  28063. peg$currPos = cached.nextPos;
  28064. return cached.result;
  28065. }
  28066. s0 = peg$currPos;
  28067. s1 = peg$parsews();
  28068. if (s1 !== peg$FAILED) {
  28069. s2 = peg$parsejsStatement();
  28070. if (s2 !== peg$FAILED) {
  28071. s3 = peg$parsews();
  28072. if (s3 !== peg$FAILED) {
  28073. peg$savedPos = s0;
  28074. s1 = peg$c96(s2);
  28075. s0 = s1;
  28076. } else {
  28077. peg$currPos = s0;
  28078. s0 = peg$FAILED;
  28079. }
  28080. } else {
  28081. peg$currPos = s0;
  28082. s0 = peg$FAILED;
  28083. }
  28084. } else {
  28085. peg$currPos = s0;
  28086. s0 = peg$FAILED;
  28087. }
  28088. if (s0 === peg$FAILED) {
  28089. s0 = peg$parsewsStSequenceWs();
  28090. }
  28091. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28092. return s0;
  28093. }
  28094. function peg$parsewsStSequenceWs() {
  28095. var s0, s1, s2, s3;
  28096. var key = peg$currPos * 62 + 44,
  28097. cached = peg$resultsCache[key];
  28098. if (cached) {
  28099. peg$currPos = cached.nextPos;
  28100. return cached.result;
  28101. }
  28102. s0 = peg$currPos;
  28103. s1 = peg$parsews();
  28104. if (s1 !== peg$FAILED) {
  28105. s2 = peg$parsetemps();
  28106. if (s2 === peg$FAILED) {
  28107. s2 = null;
  28108. }
  28109. if (s2 !== peg$FAILED) {
  28110. s3 = peg$parsewsStatementsWs();
  28111. if (s3 === peg$FAILED) {
  28112. s3 = null;
  28113. }
  28114. if (s3 !== peg$FAILED) {
  28115. peg$savedPos = s0;
  28116. s1 = peg$c97(s2, s3);
  28117. s0 = s1;
  28118. } else {
  28119. peg$currPos = s0;
  28120. s0 = peg$FAILED;
  28121. }
  28122. } else {
  28123. peg$currPos = s0;
  28124. s0 = peg$FAILED;
  28125. }
  28126. } else {
  28127. peg$currPos = s0;
  28128. s0 = peg$FAILED;
  28129. }
  28130. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28131. return s0;
  28132. }
  28133. function peg$parseblock() {
  28134. var s0, s1, s2, s3, s4;
  28135. var key = peg$currPos * 62 + 45,
  28136. cached = peg$resultsCache[key];
  28137. if (cached) {
  28138. peg$currPos = cached.nextPos;
  28139. return cached.result;
  28140. }
  28141. s0 = peg$currPos;
  28142. if (input.charCodeAt(peg$currPos) === 91) {
  28143. s1 = peg$c98;
  28144. peg$currPos++;
  28145. } else {
  28146. s1 = peg$FAILED;
  28147. if (peg$silentFails === 0) { peg$fail(peg$c99); }
  28148. }
  28149. if (s1 !== peg$FAILED) {
  28150. s2 = peg$parsewsBlockParamList();
  28151. if (s2 === peg$FAILED) {
  28152. s2 = null;
  28153. }
  28154. if (s2 !== peg$FAILED) {
  28155. s3 = peg$parsewsSequenceWs();
  28156. if (s3 === peg$FAILED) {
  28157. s3 = null;
  28158. }
  28159. if (s3 !== peg$FAILED) {
  28160. if (input.charCodeAt(peg$currPos) === 93) {
  28161. s4 = peg$c100;
  28162. peg$currPos++;
  28163. } else {
  28164. s4 = peg$FAILED;
  28165. if (peg$silentFails === 0) { peg$fail(peg$c101); }
  28166. }
  28167. if (s4 !== peg$FAILED) {
  28168. peg$savedPos = s0;
  28169. s1 = peg$c102(s2, s3);
  28170. s0 = s1;
  28171. } else {
  28172. peg$currPos = s0;
  28173. s0 = peg$FAILED;
  28174. }
  28175. } else {
  28176. peg$currPos = s0;
  28177. s0 = peg$FAILED;
  28178. }
  28179. } else {
  28180. peg$currPos = s0;
  28181. s0 = peg$FAILED;
  28182. }
  28183. } else {
  28184. peg$currPos = s0;
  28185. s0 = peg$FAILED;
  28186. }
  28187. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28188. return s0;
  28189. }
  28190. function peg$parseoperand() {
  28191. var s0;
  28192. var key = peg$currPos * 62 + 46,
  28193. cached = peg$resultsCache[key];
  28194. if (cached) {
  28195. peg$currPos = cached.nextPos;
  28196. return cached.result;
  28197. }
  28198. s0 = peg$parseliteral();
  28199. if (s0 === peg$FAILED) {
  28200. s0 = peg$parsevariable();
  28201. if (s0 === peg$FAILED) {
  28202. s0 = peg$parsesubexpression();
  28203. }
  28204. }
  28205. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28206. return s0;
  28207. }
  28208. function peg$parsewsUnaryMessage() {
  28209. var s0, s1, s2, s3, s4;
  28210. var key = peg$currPos * 62 + 47,
  28211. cached = peg$resultsCache[key];
  28212. if (cached) {
  28213. peg$currPos = cached.nextPos;
  28214. return cached.result;
  28215. }
  28216. s0 = peg$currPos;
  28217. s1 = peg$parsews();
  28218. if (s1 !== peg$FAILED) {
  28219. s2 = peg$parseidentifier();
  28220. if (s2 !== peg$FAILED) {
  28221. s3 = peg$currPos;
  28222. peg$silentFails++;
  28223. if (input.charCodeAt(peg$currPos) === 58) {
  28224. s4 = peg$c12;
  28225. peg$currPos++;
  28226. } else {
  28227. s4 = peg$FAILED;
  28228. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28229. }
  28230. peg$silentFails--;
  28231. if (s4 === peg$FAILED) {
  28232. s3 = void 0;
  28233. } else {
  28234. peg$currPos = s3;
  28235. s3 = peg$FAILED;
  28236. }
  28237. if (s3 !== peg$FAILED) {
  28238. peg$savedPos = s0;
  28239. s1 = peg$c103(s2);
  28240. s0 = s1;
  28241. } else {
  28242. peg$currPos = s0;
  28243. s0 = peg$FAILED;
  28244. }
  28245. } else {
  28246. peg$currPos = s0;
  28247. s0 = peg$FAILED;
  28248. }
  28249. } else {
  28250. peg$currPos = s0;
  28251. s0 = peg$FAILED;
  28252. }
  28253. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28254. return s0;
  28255. }
  28256. function peg$parseunarySend() {
  28257. var s0, s1, s2, s3;
  28258. var key = peg$currPos * 62 + 48,
  28259. cached = peg$resultsCache[key];
  28260. if (cached) {
  28261. peg$currPos = cached.nextPos;
  28262. return cached.result;
  28263. }
  28264. s0 = peg$currPos;
  28265. s1 = peg$parseoperand();
  28266. if (s1 !== peg$FAILED) {
  28267. s2 = [];
  28268. s3 = peg$parsewsUnaryMessage();
  28269. while (s3 !== peg$FAILED) {
  28270. s2.push(s3);
  28271. s3 = peg$parsewsUnaryMessage();
  28272. }
  28273. if (s2 !== peg$FAILED) {
  28274. peg$savedPos = s0;
  28275. s1 = peg$c104(s1, s2);
  28276. s0 = s1;
  28277. } else {
  28278. peg$currPos = s0;
  28279. s0 = peg$FAILED;
  28280. }
  28281. } else {
  28282. peg$currPos = s0;
  28283. s0 = peg$FAILED;
  28284. }
  28285. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28286. return s0;
  28287. }
  28288. function peg$parsewsBinaryMessage() {
  28289. var s0, s1, s2, s3, s4;
  28290. var key = peg$currPos * 62 + 49,
  28291. cached = peg$resultsCache[key];
  28292. if (cached) {
  28293. peg$currPos = cached.nextPos;
  28294. return cached.result;
  28295. }
  28296. s0 = peg$currPos;
  28297. s1 = peg$parsews();
  28298. if (s1 !== peg$FAILED) {
  28299. s2 = peg$parsebinarySelector();
  28300. if (s2 !== peg$FAILED) {
  28301. s3 = peg$parsews();
  28302. if (s3 !== peg$FAILED) {
  28303. s4 = peg$parseunarySend();
  28304. if (s4 !== peg$FAILED) {
  28305. peg$savedPos = s0;
  28306. s1 = peg$c105(s2, s4);
  28307. s0 = s1;
  28308. } else {
  28309. peg$currPos = s0;
  28310. s0 = peg$FAILED;
  28311. }
  28312. } else {
  28313. peg$currPos = s0;
  28314. s0 = peg$FAILED;
  28315. }
  28316. } else {
  28317. peg$currPos = s0;
  28318. s0 = peg$FAILED;
  28319. }
  28320. } else {
  28321. peg$currPos = s0;
  28322. s0 = peg$FAILED;
  28323. }
  28324. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28325. return s0;
  28326. }
  28327. function peg$parsebinarySend() {
  28328. var s0, s1, s2, s3;
  28329. var key = peg$currPos * 62 + 50,
  28330. cached = peg$resultsCache[key];
  28331. if (cached) {
  28332. peg$currPos = cached.nextPos;
  28333. return cached.result;
  28334. }
  28335. s0 = peg$currPos;
  28336. s1 = peg$parseunarySend();
  28337. if (s1 !== peg$FAILED) {
  28338. s2 = [];
  28339. s3 = peg$parsewsBinaryMessage();
  28340. while (s3 !== peg$FAILED) {
  28341. s2.push(s3);
  28342. s3 = peg$parsewsBinaryMessage();
  28343. }
  28344. if (s2 !== peg$FAILED) {
  28345. peg$savedPos = s0;
  28346. s1 = peg$c104(s1, s2);
  28347. s0 = s1;
  28348. } else {
  28349. peg$currPos = s0;
  28350. s0 = peg$FAILED;
  28351. }
  28352. } else {
  28353. peg$currPos = s0;
  28354. s0 = peg$FAILED;
  28355. }
  28356. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28357. return s0;
  28358. }
  28359. function peg$parsewsKeywordMessage() {
  28360. var s0, s1, s2, s3, s4, s5, s6;
  28361. var key = peg$currPos * 62 + 51,
  28362. cached = peg$resultsCache[key];
  28363. if (cached) {
  28364. peg$currPos = cached.nextPos;
  28365. return cached.result;
  28366. }
  28367. s0 = peg$currPos;
  28368. s1 = [];
  28369. s2 = peg$currPos;
  28370. s3 = peg$parsews();
  28371. if (s3 !== peg$FAILED) {
  28372. s4 = peg$parsekeyword();
  28373. if (s4 !== peg$FAILED) {
  28374. s5 = peg$parsews();
  28375. if (s5 !== peg$FAILED) {
  28376. s6 = peg$parsebinarySend();
  28377. if (s6 !== peg$FAILED) {
  28378. peg$savedPos = s2;
  28379. s3 = peg$c75(s4, s6);
  28380. s2 = s3;
  28381. } else {
  28382. peg$currPos = s2;
  28383. s2 = peg$FAILED;
  28384. }
  28385. } else {
  28386. peg$currPos = s2;
  28387. s2 = peg$FAILED;
  28388. }
  28389. } else {
  28390. peg$currPos = s2;
  28391. s2 = peg$FAILED;
  28392. }
  28393. } else {
  28394. peg$currPos = s2;
  28395. s2 = peg$FAILED;
  28396. }
  28397. if (s2 !== peg$FAILED) {
  28398. while (s2 !== peg$FAILED) {
  28399. s1.push(s2);
  28400. s2 = peg$currPos;
  28401. s3 = peg$parsews();
  28402. if (s3 !== peg$FAILED) {
  28403. s4 = peg$parsekeyword();
  28404. if (s4 !== peg$FAILED) {
  28405. s5 = peg$parsews();
  28406. if (s5 !== peg$FAILED) {
  28407. s6 = peg$parsebinarySend();
  28408. if (s6 !== peg$FAILED) {
  28409. peg$savedPos = s2;
  28410. s3 = peg$c75(s4, s6);
  28411. s2 = s3;
  28412. } else {
  28413. peg$currPos = s2;
  28414. s2 = peg$FAILED;
  28415. }
  28416. } else {
  28417. peg$currPos = s2;
  28418. s2 = peg$FAILED;
  28419. }
  28420. } else {
  28421. peg$currPos = s2;
  28422. s2 = peg$FAILED;
  28423. }
  28424. } else {
  28425. peg$currPos = s2;
  28426. s2 = peg$FAILED;
  28427. }
  28428. }
  28429. } else {
  28430. s1 = peg$FAILED;
  28431. }
  28432. if (s1 !== peg$FAILED) {
  28433. peg$savedPos = s0;
  28434. s1 = peg$c106(s1);
  28435. }
  28436. s0 = s1;
  28437. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28438. return s0;
  28439. }
  28440. function peg$parsekeywordSend() {
  28441. var s0, s1, s2;
  28442. var key = peg$currPos * 62 + 52,
  28443. cached = peg$resultsCache[key];
  28444. if (cached) {
  28445. peg$currPos = cached.nextPos;
  28446. return cached.result;
  28447. }
  28448. s0 = peg$currPos;
  28449. s1 = peg$parsebinarySend();
  28450. if (s1 !== peg$FAILED) {
  28451. s2 = peg$parsewsKeywordMessage();
  28452. if (s2 === peg$FAILED) {
  28453. s2 = null;
  28454. }
  28455. if (s2 !== peg$FAILED) {
  28456. peg$savedPos = s0;
  28457. s1 = peg$c107(s1, s2);
  28458. s0 = s1;
  28459. } else {
  28460. peg$currPos = s0;
  28461. s0 = peg$FAILED;
  28462. }
  28463. } else {
  28464. peg$currPos = s0;
  28465. s0 = peg$FAILED;
  28466. }
  28467. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28468. return s0;
  28469. }
  28470. function peg$parsewsMessage() {
  28471. var s0;
  28472. var key = peg$currPos * 62 + 53,
  28473. cached = peg$resultsCache[key];
  28474. if (cached) {
  28475. peg$currPos = cached.nextPos;
  28476. return cached.result;
  28477. }
  28478. s0 = peg$parsewsBinaryMessage();
  28479. if (s0 === peg$FAILED) {
  28480. s0 = peg$parsewsUnaryMessage();
  28481. if (s0 === peg$FAILED) {
  28482. s0 = peg$parsewsKeywordMessage();
  28483. }
  28484. }
  28485. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28486. return s0;
  28487. }
  28488. function peg$parsecascade() {
  28489. var s0, s1, s2, s3, s4, s5, s6, s7;
  28490. var key = peg$currPos * 62 + 54,
  28491. cached = peg$resultsCache[key];
  28492. if (cached) {
  28493. peg$currPos = cached.nextPos;
  28494. return cached.result;
  28495. }
  28496. s0 = peg$currPos;
  28497. s1 = peg$parsekeywordSend();
  28498. if (s1 !== peg$FAILED) {
  28499. peg$savedPos = peg$currPos;
  28500. s2 = peg$c108(s1);
  28501. if (s2) {
  28502. s2 = void 0;
  28503. } else {
  28504. s2 = peg$FAILED;
  28505. }
  28506. if (s2 !== peg$FAILED) {
  28507. s3 = [];
  28508. s4 = peg$currPos;
  28509. s5 = peg$parsews();
  28510. if (s5 !== peg$FAILED) {
  28511. if (input.charCodeAt(peg$currPos) === 59) {
  28512. s6 = peg$c109;
  28513. peg$currPos++;
  28514. } else {
  28515. s6 = peg$FAILED;
  28516. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  28517. }
  28518. if (s6 !== peg$FAILED) {
  28519. s7 = peg$parsewsMessage();
  28520. if (s7 !== peg$FAILED) {
  28521. peg$savedPos = s4;
  28522. s5 = peg$c111(s1, s7);
  28523. s4 = s5;
  28524. } else {
  28525. peg$currPos = s4;
  28526. s4 = peg$FAILED;
  28527. }
  28528. } else {
  28529. peg$currPos = s4;
  28530. s4 = peg$FAILED;
  28531. }
  28532. } else {
  28533. peg$currPos = s4;
  28534. s4 = peg$FAILED;
  28535. }
  28536. if (s4 !== peg$FAILED) {
  28537. while (s4 !== peg$FAILED) {
  28538. s3.push(s4);
  28539. s4 = peg$currPos;
  28540. s5 = peg$parsews();
  28541. if (s5 !== peg$FAILED) {
  28542. if (input.charCodeAt(peg$currPos) === 59) {
  28543. s6 = peg$c109;
  28544. peg$currPos++;
  28545. } else {
  28546. s6 = peg$FAILED;
  28547. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  28548. }
  28549. if (s6 !== peg$FAILED) {
  28550. s7 = peg$parsewsMessage();
  28551. if (s7 !== peg$FAILED) {
  28552. peg$savedPos = s4;
  28553. s5 = peg$c111(s1, s7);
  28554. s4 = s5;
  28555. } else {
  28556. peg$currPos = s4;
  28557. s4 = peg$FAILED;
  28558. }
  28559. } else {
  28560. peg$currPos = s4;
  28561. s4 = peg$FAILED;
  28562. }
  28563. } else {
  28564. peg$currPos = s4;
  28565. s4 = peg$FAILED;
  28566. }
  28567. }
  28568. } else {
  28569. s3 = peg$FAILED;
  28570. }
  28571. if (s3 !== peg$FAILED) {
  28572. peg$savedPos = s0;
  28573. s1 = peg$c112(s1, s3);
  28574. s0 = s1;
  28575. } else {
  28576. peg$currPos = s0;
  28577. s0 = peg$FAILED;
  28578. }
  28579. } else {
  28580. peg$currPos = s0;
  28581. s0 = peg$FAILED;
  28582. }
  28583. } else {
  28584. peg$currPos = s0;
  28585. s0 = peg$FAILED;
  28586. }
  28587. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28588. return s0;
  28589. }
  28590. function peg$parsejsStatement() {
  28591. var s0;
  28592. var key = peg$currPos * 62 + 55,
  28593. cached = peg$resultsCache[key];
  28594. if (cached) {
  28595. peg$currPos = cached.nextPos;
  28596. return cached.result;
  28597. }
  28598. s0 = peg$parsepragmaJsStatement();
  28599. if (s0 === peg$FAILED) {
  28600. s0 = peg$parselegacyJsStatement();
  28601. }
  28602. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28603. return s0;
  28604. }
  28605. function peg$parselegacyJsStatement() {
  28606. var s0, s1, s2, s3, s4;
  28607. var key = peg$currPos * 62 + 56,
  28608. cached = peg$resultsCache[key];
  28609. if (cached) {
  28610. peg$currPos = cached.nextPos;
  28611. return cached.result;
  28612. }
  28613. s0 = peg$currPos;
  28614. if (input.charCodeAt(peg$currPos) === 60) {
  28615. s1 = peg$c113;
  28616. peg$currPos++;
  28617. } else {
  28618. s1 = peg$FAILED;
  28619. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  28620. }
  28621. if (s1 !== peg$FAILED) {
  28622. s2 = [];
  28623. s3 = peg$currPos;
  28624. if (input.substr(peg$currPos, 2) === peg$c115) {
  28625. s4 = peg$c115;
  28626. peg$currPos += 2;
  28627. } else {
  28628. s4 = peg$FAILED;
  28629. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  28630. }
  28631. if (s4 !== peg$FAILED) {
  28632. peg$savedPos = s3;
  28633. s4 = peg$c117();
  28634. }
  28635. s3 = s4;
  28636. if (s3 === peg$FAILED) {
  28637. if (peg$c118.test(input.charAt(peg$currPos))) {
  28638. s3 = input.charAt(peg$currPos);
  28639. peg$currPos++;
  28640. } else {
  28641. s3 = peg$FAILED;
  28642. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  28643. }
  28644. }
  28645. while (s3 !== peg$FAILED) {
  28646. s2.push(s3);
  28647. s3 = peg$currPos;
  28648. if (input.substr(peg$currPos, 2) === peg$c115) {
  28649. s4 = peg$c115;
  28650. peg$currPos += 2;
  28651. } else {
  28652. s4 = peg$FAILED;
  28653. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  28654. }
  28655. if (s4 !== peg$FAILED) {
  28656. peg$savedPos = s3;
  28657. s4 = peg$c117();
  28658. }
  28659. s3 = s4;
  28660. if (s3 === peg$FAILED) {
  28661. if (peg$c118.test(input.charAt(peg$currPos))) {
  28662. s3 = input.charAt(peg$currPos);
  28663. peg$currPos++;
  28664. } else {
  28665. s3 = peg$FAILED;
  28666. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  28667. }
  28668. }
  28669. }
  28670. if (s2 !== peg$FAILED) {
  28671. if (input.charCodeAt(peg$currPos) === 62) {
  28672. s3 = peg$c120;
  28673. peg$currPos++;
  28674. } else {
  28675. s3 = peg$FAILED;
  28676. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  28677. }
  28678. if (s3 !== peg$FAILED) {
  28679. peg$savedPos = peg$currPos;
  28680. s4 = peg$c122(s2);
  28681. if (s4) {
  28682. s4 = void 0;
  28683. } else {
  28684. s4 = peg$FAILED;
  28685. }
  28686. if (s4 !== peg$FAILED) {
  28687. peg$savedPos = s0;
  28688. s1 = peg$c123(s2);
  28689. s0 = s1;
  28690. } else {
  28691. peg$currPos = s0;
  28692. s0 = peg$FAILED;
  28693. }
  28694. } else {
  28695. peg$currPos = s0;
  28696. s0 = peg$FAILED;
  28697. }
  28698. } else {
  28699. peg$currPos = s0;
  28700. s0 = peg$FAILED;
  28701. }
  28702. } else {
  28703. peg$currPos = s0;
  28704. s0 = peg$FAILED;
  28705. }
  28706. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28707. return s0;
  28708. }
  28709. function peg$parsepragmaJsStatement() {
  28710. var s0, s1, s2, s3, s4, s5, s6, s7;
  28711. var key = peg$currPos * 62 + 57,
  28712. cached = peg$resultsCache[key];
  28713. if (cached) {
  28714. peg$currPos = cached.nextPos;
  28715. return cached.result;
  28716. }
  28717. s0 = peg$currPos;
  28718. if (input.charCodeAt(peg$currPos) === 60) {
  28719. s1 = peg$c113;
  28720. peg$currPos++;
  28721. } else {
  28722. s1 = peg$FAILED;
  28723. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  28724. }
  28725. if (s1 !== peg$FAILED) {
  28726. s2 = peg$parsews();
  28727. if (s2 !== peg$FAILED) {
  28728. if (input.substr(peg$currPos, 9) === peg$c124) {
  28729. s3 = peg$c124;
  28730. peg$currPos += 9;
  28731. } else {
  28732. s3 = peg$FAILED;
  28733. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  28734. }
  28735. if (s3 !== peg$FAILED) {
  28736. s4 = peg$parsews();
  28737. if (s4 !== peg$FAILED) {
  28738. s5 = peg$parserawString();
  28739. if (s5 !== peg$FAILED) {
  28740. s6 = peg$parsews();
  28741. if (s6 !== peg$FAILED) {
  28742. if (input.charCodeAt(peg$currPos) === 62) {
  28743. s7 = peg$c120;
  28744. peg$currPos++;
  28745. } else {
  28746. s7 = peg$FAILED;
  28747. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  28748. }
  28749. if (s7 !== peg$FAILED) {
  28750. peg$savedPos = s0;
  28751. s1 = peg$c126(s5);
  28752. s0 = s1;
  28753. } else {
  28754. peg$currPos = s0;
  28755. s0 = peg$FAILED;
  28756. }
  28757. } else {
  28758. peg$currPos = s0;
  28759. s0 = peg$FAILED;
  28760. }
  28761. } else {
  28762. peg$currPos = s0;
  28763. s0 = peg$FAILED;
  28764. }
  28765. } else {
  28766. peg$currPos = s0;
  28767. s0 = peg$FAILED;
  28768. }
  28769. } else {
  28770. peg$currPos = s0;
  28771. s0 = peg$FAILED;
  28772. }
  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$parsemethod() {
  28785. var s0, s1, s2;
  28786. var key = peg$currPos * 62 + 58,
  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$parsewsKeywordPattern();
  28794. if (s1 === peg$FAILED) {
  28795. s1 = peg$parsewsBinaryPattern();
  28796. if (s1 === peg$FAILED) {
  28797. s1 = peg$parsewsUnaryPattern();
  28798. }
  28799. }
  28800. if (s1 !== peg$FAILED) {
  28801. s2 = peg$parsewsSequenceWs();
  28802. if (s2 === peg$FAILED) {
  28803. s2 = null;
  28804. }
  28805. if (s2 !== peg$FAILED) {
  28806. peg$savedPos = s0;
  28807. s1 = peg$c127(s1, s2);
  28808. s0 = s1;
  28809. } else {
  28810. peg$currPos = s0;
  28811. s0 = peg$FAILED;
  28812. }
  28813. } else {
  28814. peg$currPos = s0;
  28815. s0 = peg$FAILED;
  28816. }
  28817. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28818. return s0;
  28819. }
  28820. function peg$parseassociationSend() {
  28821. var s0, s1, s2;
  28822. var key = peg$currPos * 62 + 59,
  28823. cached = peg$resultsCache[key];
  28824. if (cached) {
  28825. peg$currPos = cached.nextPos;
  28826. return cached.result;
  28827. }
  28828. s0 = peg$currPos;
  28829. s1 = peg$parsebinarySend();
  28830. if (s1 !== peg$FAILED) {
  28831. peg$savedPos = peg$currPos;
  28832. s2 = peg$c128(s1);
  28833. if (s2) {
  28834. s2 = void 0;
  28835. } else {
  28836. s2 = peg$FAILED;
  28837. }
  28838. if (s2 !== peg$FAILED) {
  28839. peg$savedPos = s0;
  28840. s1 = peg$c129(s1);
  28841. s0 = s1;
  28842. } else {
  28843. peg$currPos = s0;
  28844. s0 = peg$FAILED;
  28845. }
  28846. } else {
  28847. peg$currPos = s0;
  28848. s0 = peg$FAILED;
  28849. }
  28850. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28851. return s0;
  28852. }
  28853. function peg$parsewsAssociationsRest() {
  28854. var s0, s1, s2, s3, s4;
  28855. var key = peg$currPos * 62 + 60,
  28856. cached = peg$resultsCache[key];
  28857. if (cached) {
  28858. peg$currPos = cached.nextPos;
  28859. return cached.result;
  28860. }
  28861. s0 = peg$currPos;
  28862. s1 = peg$parsews();
  28863. if (s1 !== peg$FAILED) {
  28864. if (input.charCodeAt(peg$currPos) === 46) {
  28865. s2 = peg$c6;
  28866. peg$currPos++;
  28867. } else {
  28868. s2 = peg$FAILED;
  28869. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28870. }
  28871. if (s2 !== peg$FAILED) {
  28872. s3 = peg$parsemaybeDotsWs();
  28873. if (s3 !== peg$FAILED) {
  28874. s4 = peg$parseassociationSend();
  28875. if (s4 !== peg$FAILED) {
  28876. peg$savedPos = s0;
  28877. s1 = peg$c79(s4);
  28878. s0 = s1;
  28879. } else {
  28880. peg$currPos = s0;
  28881. s0 = peg$FAILED;
  28882. }
  28883. } else {
  28884. peg$currPos = s0;
  28885. s0 = peg$FAILED;
  28886. }
  28887. } else {
  28888. peg$currPos = s0;
  28889. s0 = peg$FAILED;
  28890. }
  28891. } else {
  28892. peg$currPos = s0;
  28893. s0 = peg$FAILED;
  28894. }
  28895. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28896. return s0;
  28897. }
  28898. function peg$parsewsAssociations() {
  28899. var s0, s1, s2, s3, s4;
  28900. var key = peg$currPos * 62 + 61,
  28901. cached = peg$resultsCache[key];
  28902. if (cached) {
  28903. peg$currPos = cached.nextPos;
  28904. return cached.result;
  28905. }
  28906. s0 = peg$currPos;
  28907. s1 = peg$parsemaybeDotsWs();
  28908. if (s1 !== peg$FAILED) {
  28909. s2 = peg$parseassociationSend();
  28910. if (s2 !== peg$FAILED) {
  28911. s3 = [];
  28912. s4 = peg$parsewsAssociationsRest();
  28913. while (s4 !== peg$FAILED) {
  28914. s3.push(s4);
  28915. s4 = peg$parsewsAssociationsRest();
  28916. }
  28917. if (s3 !== peg$FAILED) {
  28918. peg$savedPos = s0;
  28919. s1 = peg$c130(s2, s3);
  28920. s0 = s1;
  28921. } else {
  28922. peg$currPos = s0;
  28923. s0 = peg$FAILED;
  28924. }
  28925. } else {
  28926. peg$currPos = s0;
  28927. s0 = peg$FAILED;
  28928. }
  28929. } else {
  28930. peg$currPos = s0;
  28931. s0 = peg$FAILED;
  28932. }
  28933. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28934. return s0;
  28935. }
  28936. peg$result = peg$startRuleFunction();
  28937. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  28938. return peg$result;
  28939. } else {
  28940. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  28941. peg$fail({ type: "end", description: "end of input" });
  28942. }
  28943. throw peg$buildException(
  28944. null,
  28945. peg$maxFailExpected,
  28946. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  28947. peg$maxFailPos < input.length
  28948. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  28949. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  28950. );
  28951. }
  28952. }
  28953. return {
  28954. SyntaxError: peg$SyntaxError,
  28955. parse: peg$parse
  28956. };
  28957. })();
  28958. });
  28959. 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";
  28960. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  28961. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  28962. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  28963. $core.addPackage("Platform-ImportExport");
  28964. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  28965. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  28966. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  28967. $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.";
  28968. $core.addMethod(
  28969. $core.method({
  28970. selector: "exportPackage:on:",
  28971. protocol: "output",
  28972. fn: function (aPackage,aStream){
  28973. var self=this;
  28974. return $core.withContext(function($ctx1) {
  28975. self._subclassResponsibility();
  28976. return self;
  28977. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  28978. },
  28979. args: ["aPackage", "aStream"],
  28980. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  28981. referencedClasses: [],
  28982. messageSends: ["subclassResponsibility"]
  28983. }),
  28984. $globals.AbstractExporter);
  28985. $core.addMethod(
  28986. $core.method({
  28987. selector: "extensionMethodsOfPackage:",
  28988. protocol: "accessing",
  28989. fn: function (aPackage){
  28990. var self=this;
  28991. var result;
  28992. return $core.withContext(function($ctx1) {
  28993. result=$recv($globals.OrderedCollection)._new();
  28994. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  28995. return $core.withContext(function($ctx2) {
  28996. return $recv(result)._addAll_($recv(each)._ownMethods());
  28997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28998. }));
  28999. return result;
  29000. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  29001. },
  29002. args: ["aPackage"],
  29003. 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",
  29004. referencedClasses: ["OrderedCollection"],
  29005. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  29006. }),
  29007. $globals.AbstractExporter);
  29008. $core.addMethod(
  29009. $core.method({
  29010. selector: "extensionProtocolsOfPackage:",
  29011. protocol: "accessing",
  29012. fn: function (aPackage){
  29013. var self=this;
  29014. var extensionName,result;
  29015. return $core.withContext(function($ctx1) {
  29016. var $1,$2,$3;
  29017. $1=$recv(aPackage)._name();
  29018. $ctx1.sendIdx["name"]=1;
  29019. extensionName="*".__comma($1);
  29020. result=$recv($globals.OrderedCollection)._new();
  29021. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  29022. return $core.withContext(function($ctx2) {
  29023. $2=$recv(a)._name();
  29024. $ctx2.sendIdx["name"]=2;
  29025. return $recv($2).__lt($recv(b)._name());
  29026. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  29027. })))._do_((function(each){
  29028. return $core.withContext(function($ctx2) {
  29029. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  29030. return $core.withContext(function($ctx3) {
  29031. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  29032. if($core.assert($3)){
  29033. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  29034. }
  29035. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  29036. }));
  29037. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  29038. }));
  29039. $ctx1.sendIdx["do:"]=1;
  29040. return result;
  29041. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  29042. },
  29043. args: ["aPackage"],
  29044. 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",
  29045. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  29046. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  29047. }),
  29048. $globals.AbstractExporter);
  29049. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  29050. $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.";
  29051. $core.addMethod(
  29052. $core.method({
  29053. selector: "chunkEscape:",
  29054. protocol: "convenience",
  29055. fn: function (aString){
  29056. var self=this;
  29057. return $core.withContext(function($ctx1) {
  29058. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  29059. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  29060. },
  29061. args: ["aString"],
  29062. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  29063. referencedClasses: [],
  29064. messageSends: ["trimBoth", "replace:with:"]
  29065. }),
  29066. $globals.ChunkExporter);
  29067. $core.addMethod(
  29068. $core.method({
  29069. selector: "exportBehavior:on:",
  29070. protocol: "output",
  29071. fn: function (aBehavior,aStream){
  29072. var self=this;
  29073. return $core.withContext(function($ctx1) {
  29074. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  29075. self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  29076. return self;
  29077. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  29078. },
  29079. args: ["aBehavior", "aStream"],
  29080. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  29081. referencedClasses: [],
  29082. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  29083. }),
  29084. $globals.ChunkExporter);
  29085. $core.addMethod(
  29086. $core.method({
  29087. selector: "exportCategoryEpilogueOf:on:",
  29088. protocol: "output",
  29089. fn: function (aCategory,aStream){
  29090. var self=this;
  29091. return $core.withContext(function($ctx1) {
  29092. $recv(aStream)._write_(" !");
  29093. $recv(aStream)._lf();
  29094. $ctx1.sendIdx["lf"]=1;
  29095. $recv(aStream)._lf();
  29096. return self;
  29097. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  29098. },
  29099. args: ["aCategory", "aStream"],
  29100. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  29101. referencedClasses: [],
  29102. messageSends: ["write:", "lf"]
  29103. }),
  29104. $globals.ChunkExporter);
  29105. $core.addMethod(
  29106. $core.method({
  29107. selector: "exportCategoryPrologueOf:on:",
  29108. protocol: "output",
  29109. fn: function (aCategory,aStream){
  29110. var self=this;
  29111. return $core.withContext(function($ctx1) {
  29112. $recv(aStream)._write_("!");
  29113. $ctx1.sendIdx["write:"]=1;
  29114. $recv(aStream)._print_($recv(aCategory)._theClass());
  29115. $ctx1.sendIdx["print:"]=1;
  29116. $recv(aStream)._write_(" methodsFor: ");
  29117. $ctx1.sendIdx["write:"]=2;
  29118. $recv(aStream)._print_(aCategory);
  29119. $recv(aStream)._write_("!");
  29120. return self;
  29121. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  29122. },
  29123. args: ["aCategory", "aStream"],
  29124. 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: '!'",
  29125. referencedClasses: [],
  29126. messageSends: ["write:", "print:", "theClass"]
  29127. }),
  29128. $globals.ChunkExporter);
  29129. $core.addMethod(
  29130. $core.method({
  29131. selector: "exportDefinitionOf:on:",
  29132. protocol: "output",
  29133. fn: function (aClass,aStream){
  29134. var self=this;
  29135. return $core.withContext(function($ctx1) {
  29136. var $1,$2,$3,$4;
  29137. $recv(aStream)._print_($recv(aClass)._superclass());
  29138. $ctx1.sendIdx["print:"]=1;
  29139. $recv(aStream)._write_(" subclass: ");
  29140. $ctx1.sendIdx["write:"]=1;
  29141. $recv(aStream)._printSymbol_($recv(aClass)._name());
  29142. $1=$recv(aStream)._lf();
  29143. $ctx1.sendIdx["lf"]=1;
  29144. $recv(aStream)._tab();
  29145. $ctx1.sendIdx["tab"]=1;
  29146. $recv(aStream)._write_("instanceVariableNames: ");
  29147. $ctx1.sendIdx["write:"]=2;
  29148. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  29149. $ctx1.sendIdx["print:"]=2;
  29150. $recv(aStream)._lf();
  29151. $ctx1.sendIdx["lf"]=2;
  29152. $recv(aStream)._tab();
  29153. $recv(aStream)._write_("package: ");
  29154. $ctx1.sendIdx["write:"]=3;
  29155. $recv(aStream)._print_($recv(aClass)._category());
  29156. $ctx1.sendIdx["print:"]=3;
  29157. $recv(aStream)._write_("!");
  29158. $ctx1.sendIdx["write:"]=4;
  29159. $2=$recv(aStream)._lf();
  29160. $ctx1.sendIdx["lf"]=3;
  29161. $3=$recv(aClass)._comment();
  29162. $ctx1.sendIdx["comment"]=1;
  29163. $recv($3)._ifNotEmpty_((function(){
  29164. return $core.withContext(function($ctx2) {
  29165. $recv(aStream)._write_("!");
  29166. $ctx2.sendIdx["write:"]=5;
  29167. $recv(aStream)._print_(aClass);
  29168. $recv(aStream)._write_(" commentStamp!");
  29169. $ctx2.sendIdx["write:"]=6;
  29170. $recv(aStream)._lf();
  29171. $ctx2.sendIdx["lf"]=4;
  29172. $recv(aStream)._write_([self._chunkEscape_($recv(aClass)._comment()),"!"]);
  29173. $4=$recv(aStream)._lf();
  29174. $ctx2.sendIdx["lf"]=5;
  29175. return $4;
  29176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29177. }));
  29178. $recv(aStream)._lf();
  29179. return self;
  29180. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  29181. },
  29182. args: ["aClass", "aStream"],
  29183. 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",
  29184. referencedClasses: [],
  29185. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  29186. }),
  29187. $globals.ChunkExporter);
  29188. $core.addMethod(
  29189. $core.method({
  29190. selector: "exportMetaDefinitionOf:on:",
  29191. protocol: "output",
  29192. fn: function (aClass,aStream){
  29193. var self=this;
  29194. var classIvars,classTraitComposition;
  29195. return $core.withContext(function($ctx1) {
  29196. var $1,$2;
  29197. $1=$recv(aClass)._class();
  29198. $ctx1.sendIdx["class"]=1;
  29199. classIvars=$recv($1)._instanceVariableNames();
  29200. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  29201. $2=$recv(classIvars)._notEmpty();
  29202. if($core.assert($2)){
  29203. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  29204. $ctx1.sendIdx["print:"]=1;
  29205. $recv(aStream)._space();
  29206. $recv(aStream)._write_("instanceVariableNames: ");
  29207. $ctx1.sendIdx["write:"]=1;
  29208. $recv(aStream)._print_(" "._join_(classIvars));
  29209. $recv(aStream)._write_("!");
  29210. $recv(aStream)._lf();
  29211. $ctx1.sendIdx["lf"]=1;
  29212. $recv(aStream)._lf();
  29213. }
  29214. return self;
  29215. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  29216. },
  29217. args: ["aClass", "aStream"],
  29218. 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 ]",
  29219. referencedClasses: [],
  29220. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  29221. }),
  29222. $globals.ChunkExporter);
  29223. $core.addMethod(
  29224. $core.method({
  29225. selector: "exportMethod:on:",
  29226. protocol: "output",
  29227. fn: function (aMethod,aStream){
  29228. var self=this;
  29229. return $core.withContext(function($ctx1) {
  29230. $recv(aStream)._lf();
  29231. $ctx1.sendIdx["lf"]=1;
  29232. $recv(aStream)._lf();
  29233. $ctx1.sendIdx["lf"]=2;
  29234. $recv(aStream)._write_(self._chunkEscape_($recv(aMethod)._source()));
  29235. $ctx1.sendIdx["write:"]=1;
  29236. $recv(aStream)._lf();
  29237. $recv(aStream)._write_("!");
  29238. return self;
  29239. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  29240. },
  29241. args: ["aMethod", "aStream"],
  29242. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  29243. referencedClasses: [],
  29244. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  29245. }),
  29246. $globals.ChunkExporter);
  29247. $core.addMethod(
  29248. $core.method({
  29249. selector: "exportPackage:on:",
  29250. protocol: "output",
  29251. fn: function (aPackage,aStream){
  29252. var self=this;
  29253. return $core.withContext(function($ctx1) {
  29254. var $1,$receiver;
  29255. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  29256. self._exportPackageImportsOf_on_(aPackage,aStream);
  29257. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  29258. return $core.withContext(function($ctx2) {
  29259. self._exportBehavior_on_(each,aStream);
  29260. $ctx2.sendIdx["exportBehavior:on:"]=1;
  29261. $1=$recv(each)._theMetaClass();
  29262. if(($receiver = $1) == null || $receiver.isNil){
  29263. return $1;
  29264. } else {
  29265. var meta;
  29266. meta=$receiver;
  29267. return self._exportBehavior_on_(meta,aStream);
  29268. }
  29269. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29270. }));
  29271. self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  29272. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  29273. return self;
  29274. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  29275. },
  29276. args: ["aPackage", "aStream"],
  29277. 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",
  29278. referencedClasses: [],
  29279. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  29280. }),
  29281. $globals.ChunkExporter);
  29282. $core.addMethod(
  29283. $core.method({
  29284. selector: "exportPackageDefinitionOf:on:",
  29285. protocol: "output",
  29286. fn: function (aPackage,aStream){
  29287. var self=this;
  29288. return $core.withContext(function($ctx1) {
  29289. $recv(aStream)._write_("Smalltalk createPackage: ");
  29290. $ctx1.sendIdx["write:"]=1;
  29291. $recv(aStream)._print_($recv(aPackage)._name());
  29292. $recv(aStream)._write_("!");
  29293. $recv(aStream)._lf();
  29294. return self;
  29295. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  29296. },
  29297. args: ["aPackage", "aStream"],
  29298. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  29299. referencedClasses: [],
  29300. messageSends: ["write:", "print:", "name", "lf"]
  29301. }),
  29302. $globals.ChunkExporter);
  29303. $core.addMethod(
  29304. $core.method({
  29305. selector: "exportPackageImportsOf:on:",
  29306. protocol: "output",
  29307. fn: function (aPackage,aStream){
  29308. var self=this;
  29309. return $core.withContext(function($ctx1) {
  29310. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  29311. return $core.withContext(function($ctx2) {
  29312. $recv(aStream)._write_("(Smalltalk packageAt: ");
  29313. $ctx2.sendIdx["write:"]=1;
  29314. $recv(aStream)._print_($recv(aPackage)._name());
  29315. $recv(aStream)._write_([") imports: ",self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  29316. return $recv(aStream)._lf();
  29317. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  29318. }));
  29319. return self;
  29320. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  29321. },
  29322. args: ["aPackage", "aStream"],
  29323. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports | aStream\x0a\x09\x09write: '(Smalltalk packageAt: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: { ') imports: '. self chunkEscape: aPackage importsDefinition. '!' };\x0a\x09\x09lf ]",
  29324. referencedClasses: [],
  29325. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", "chunkEscape:", "importsDefinition", "lf"]
  29326. }),
  29327. $globals.ChunkExporter);
  29328. $core.addMethod(
  29329. $core.method({
  29330. selector: "exportPackageTraitCompositionsOf:on:",
  29331. protocol: "output",
  29332. fn: function (aPackage,aStream){
  29333. var self=this;
  29334. return $core.withContext(function($ctx1) {
  29335. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  29336. return $core.withContext(function($ctx2) {
  29337. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  29338. return $core.withContext(function($ctx3) {
  29339. return self._exportTraitComposition_of_on_(value,key,aStream);
  29340. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  29341. }));
  29342. $recv(aStream)._write_("! !");
  29343. $recv(aStream)._lf();
  29344. $ctx2.sendIdx["lf"]=1;
  29345. return $recv(aStream)._lf();
  29346. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  29347. }));
  29348. return self;
  29349. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  29350. },
  29351. args: ["aPackage", "aStream"],
  29352. 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 ]",
  29353. referencedClasses: [],
  29354. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  29355. }),
  29356. $globals.ChunkExporter);
  29357. $core.addMethod(
  29358. $core.method({
  29359. selector: "exportProtocol:on:",
  29360. protocol: "output",
  29361. fn: function (aProtocol,aStream){
  29362. var self=this;
  29363. return $core.withContext(function($ctx1) {
  29364. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  29365. return $core.withContext(function($ctx2) {
  29366. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  29367. $recv(methods)._do_((function(method){
  29368. return $core.withContext(function($ctx3) {
  29369. return self._exportMethod_on_(method,aStream);
  29370. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  29371. }));
  29372. return self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  29373. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  29374. }));
  29375. return self;
  29376. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  29377. },
  29378. args: ["aProtocol", "aStream"],
  29379. 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 ]",
  29380. referencedClasses: [],
  29381. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  29382. }),
  29383. $globals.ChunkExporter);
  29384. $core.addMethod(
  29385. $core.method({
  29386. selector: "exportProtocolEpilogueOf:on:",
  29387. protocol: "output",
  29388. fn: function (aProtocol,aStream){
  29389. var self=this;
  29390. return $core.withContext(function($ctx1) {
  29391. $recv(aStream)._write_(" !");
  29392. $recv(aStream)._lf();
  29393. $ctx1.sendIdx["lf"]=1;
  29394. $recv(aStream)._lf();
  29395. return self;
  29396. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  29397. },
  29398. args: ["aProtocol", "aStream"],
  29399. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  29400. referencedClasses: [],
  29401. messageSends: ["write:", "lf"]
  29402. }),
  29403. $globals.ChunkExporter);
  29404. $core.addMethod(
  29405. $core.method({
  29406. selector: "exportProtocolPrologueOf:on:",
  29407. protocol: "output",
  29408. fn: function (aProtocol,aStream){
  29409. var self=this;
  29410. return $core.withContext(function($ctx1) {
  29411. $recv(aStream)._write_("!");
  29412. $ctx1.sendIdx["write:"]=1;
  29413. $recv(aStream)._print_($recv(aProtocol)._theClass());
  29414. $ctx1.sendIdx["print:"]=1;
  29415. $recv(aStream)._write_(" methodsFor: ");
  29416. $ctx1.sendIdx["write:"]=2;
  29417. $recv(aStream)._print_($recv(aProtocol)._name());
  29418. $recv(aStream)._write_("!");
  29419. return self;
  29420. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  29421. },
  29422. args: ["aProtocol", "aStream"],
  29423. 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: '!'",
  29424. referencedClasses: [],
  29425. messageSends: ["write:", "print:", "theClass", "name"]
  29426. }),
  29427. $globals.ChunkExporter);
  29428. $core.addMethod(
  29429. $core.method({
  29430. selector: "exportProtocols:on:",
  29431. protocol: "output",
  29432. fn: function (aCollection,aStream){
  29433. var self=this;
  29434. return $core.withContext(function($ctx1) {
  29435. $recv(aCollection)._do_((function(each){
  29436. return $core.withContext(function($ctx2) {
  29437. return self._exportProtocol_on_(each,aStream);
  29438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29439. }));
  29440. return self;
  29441. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  29442. },
  29443. args: ["aCollection", "aStream"],
  29444. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  29445. referencedClasses: [],
  29446. messageSends: ["do:", "exportProtocol:on:"]
  29447. }),
  29448. $globals.ChunkExporter);
  29449. $core.addMethod(
  29450. $core.method({
  29451. selector: "exportTraitComposition:of:on:",
  29452. protocol: "output",
  29453. fn: function (aTraitComposition,aBehavior,aStream){
  29454. var self=this;
  29455. return $core.withContext(function($ctx1) {
  29456. $recv(aStream)._print_(aBehavior);
  29457. $recv(aStream)._write_(" setTraitComposition: ");
  29458. $ctx1.sendIdx["write:"]=1;
  29459. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  29460. $ctx1.sendIdx["write:"]=2;
  29461. $recv(aStream)._write_(" asTraitComposition!");
  29462. $recv(aStream)._lf();
  29463. return self;
  29464. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  29465. },
  29466. args: ["aTraitComposition", "aBehavior", "aStream"],
  29467. 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",
  29468. referencedClasses: [],
  29469. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  29470. }),
  29471. $globals.ChunkExporter);
  29472. $core.addMethod(
  29473. $core.method({
  29474. selector: "exportTraitDefinitionOf:on:",
  29475. protocol: "output",
  29476. fn: function (aClass,aStream){
  29477. var self=this;
  29478. return $core.withContext(function($ctx1) {
  29479. var $1,$2,$3,$4;
  29480. $recv(aStream)._write_("Trait named: ");
  29481. $ctx1.sendIdx["write:"]=1;
  29482. $recv(aStream)._printSymbol_($recv(aClass)._name());
  29483. $1=$recv(aStream)._lf();
  29484. $ctx1.sendIdx["lf"]=1;
  29485. $recv(aStream)._tab();
  29486. $recv(aStream)._write_("package: ");
  29487. $ctx1.sendIdx["write:"]=2;
  29488. $recv(aStream)._print_($recv(aClass)._category());
  29489. $ctx1.sendIdx["print:"]=1;
  29490. $recv(aStream)._write_("!");
  29491. $ctx1.sendIdx["write:"]=3;
  29492. $2=$recv(aStream)._lf();
  29493. $ctx1.sendIdx["lf"]=2;
  29494. $3=$recv(aClass)._comment();
  29495. $ctx1.sendIdx["comment"]=1;
  29496. $recv($3)._ifNotEmpty_((function(){
  29497. return $core.withContext(function($ctx2) {
  29498. $recv(aStream)._write_("!");
  29499. $ctx2.sendIdx["write:"]=4;
  29500. $recv(aStream)._print_(aClass);
  29501. $recv(aStream)._write_(" commentStamp!");
  29502. $ctx2.sendIdx["write:"]=5;
  29503. $recv(aStream)._lf();
  29504. $ctx2.sendIdx["lf"]=3;
  29505. $recv(aStream)._write_([self._chunkEscape_($recv(aClass)._comment()),"!"]);
  29506. $4=$recv(aStream)._lf();
  29507. $ctx2.sendIdx["lf"]=4;
  29508. return $4;
  29509. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29510. }));
  29511. $recv(aStream)._lf();
  29512. return self;
  29513. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  29514. },
  29515. args: ["aClass", "aStream"],
  29516. 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",
  29517. referencedClasses: [],
  29518. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  29519. }),
  29520. $globals.ChunkExporter);
  29521. $core.addMethod(
  29522. $core.method({
  29523. selector: "extensionCategoriesOfPackage:",
  29524. protocol: "accessing",
  29525. fn: function (aPackage){
  29526. var self=this;
  29527. var name,map,result;
  29528. return $core.withContext(function($ctx1) {
  29529. var $1;
  29530. name=$recv(aPackage)._name();
  29531. result=$recv($globals.OrderedCollection)._new();
  29532. $ctx1.sendIdx["new"]=1;
  29533. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  29534. return $core.withContext(function($ctx2) {
  29535. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  29536. return $core.withContext(function($ctx3) {
  29537. map=$recv($globals.Dictionary)._new();
  29538. map;
  29539. $recv(aClass)._protocolsDo_((function(category,methods){
  29540. return $core.withContext(function($ctx4) {
  29541. $1=$recv(category).__eq("*".__comma(name));
  29542. if($core.assert($1)){
  29543. return $recv(map)._at_put_(category,methods);
  29544. }
  29545. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  29546. }));
  29547. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  29548. return $core.withContext(function($ctx4) {
  29549. return $recv(a).__lt_eq(b);
  29550. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  29551. })))._collect_((function(category){
  29552. return $core.withContext(function($ctx4) {
  29553. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  29554. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  29555. })));
  29556. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  29557. }));
  29558. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29559. }));
  29560. $ctx1.sendIdx["do:"]=1;
  29561. return result;
  29562. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  29563. },
  29564. args: ["aPackage"],
  29565. 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",
  29566. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  29567. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  29568. }),
  29569. $globals.ChunkExporter);
  29570. $core.addMethod(
  29571. $core.method({
  29572. selector: "ownCategoriesOfClass:",
  29573. protocol: "accessing",
  29574. fn: function (aClass){
  29575. var self=this;
  29576. var map;
  29577. return $core.withContext(function($ctx1) {
  29578. var $1;
  29579. map=$recv($globals.Dictionary)._new();
  29580. $recv(aClass)._protocolsDo_((function(each,methods){
  29581. return $core.withContext(function($ctx2) {
  29582. $1=$recv(each)._match_("^\x5c*");
  29583. if(!$core.assert($1)){
  29584. return $recv(map)._at_put_(each,methods);
  29585. }
  29586. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  29587. }));
  29588. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  29589. return $core.withContext(function($ctx2) {
  29590. return $recv(a).__lt_eq(b);
  29591. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  29592. })))._collect_((function(each){
  29593. return $core.withContext(function($ctx2) {
  29594. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  29595. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  29596. }));
  29597. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  29598. },
  29599. args: ["aClass"],
  29600. 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) ]",
  29601. referencedClasses: ["Dictionary", "MethodCategory"],
  29602. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  29603. }),
  29604. $globals.ChunkExporter);
  29605. $core.addMethod(
  29606. $core.method({
  29607. selector: "ownCategoriesOfMetaClass:",
  29608. protocol: "accessing",
  29609. fn: function (aClass){
  29610. var self=this;
  29611. return $core.withContext(function($ctx1) {
  29612. return self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  29613. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  29614. },
  29615. args: ["aClass"],
  29616. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  29617. referencedClasses: [],
  29618. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  29619. }),
  29620. $globals.ChunkExporter);
  29621. $core.addMethod(
  29622. $core.method({
  29623. selector: "ownMethodProtocolsOfClass:",
  29624. protocol: "accessing",
  29625. fn: function (aClass){
  29626. var self=this;
  29627. return $core.withContext(function($ctx1) {
  29628. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  29629. return $core.withContext(function($ctx2) {
  29630. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  29631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29632. }));
  29633. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  29634. },
  29635. args: ["aClass"],
  29636. 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 ]",
  29637. referencedClasses: ["ExportMethodProtocol"],
  29638. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  29639. }),
  29640. $globals.ChunkExporter);
  29641. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  29642. $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.).";
  29643. $core.addMethod(
  29644. $core.method({
  29645. selector: "exportBehavior:on:",
  29646. protocol: "output",
  29647. fn: function (aBehavior,aStream){
  29648. var self=this;
  29649. return $core.withContext(function($ctx1) {
  29650. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  29651. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  29652. return $core.withContext(function($ctx2) {
  29653. return self._exportMethod_on_(method,aStream);
  29654. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  29655. }));
  29656. return self;
  29657. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  29658. },
  29659. args: ["aBehavior", "aStream"],
  29660. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  29661. referencedClasses: [],
  29662. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  29663. }),
  29664. $globals.Exporter);
  29665. $core.addMethod(
  29666. $core.method({
  29667. selector: "exportDefinitionOf:on:",
  29668. protocol: "output",
  29669. fn: function (aClass,aStream){
  29670. var self=this;
  29671. return $core.withContext(function($ctx1) {
  29672. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  29673. $recv(aStream)._lf();
  29674. $ctx1.sendIdx["lf"]=1;
  29675. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  29676. $ctx1.sendIdx["asJavaScriptSource"]=1;
  29677. $5=$recv(aClass)._superclass();
  29678. if(($receiver = $5) == null || $receiver.isNil){
  29679. $4="null";
  29680. } else {
  29681. var superclass;
  29682. superclass=$receiver;
  29683. $4=$recv(superclass)._asJavaScriptSource();
  29684. $ctx1.sendIdx["asJavaScriptSource"]=2;
  29685. }
  29686. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  29687. $ctx1.sendIdx["asJavaScriptSource"]=3;
  29688. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  29689. $ctx1.sendIdx["asJavaScriptSource"]=4;
  29690. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  29691. $1=$recv(aStream)._write_($2);
  29692. $ctx1.sendIdx["write:"]=1;
  29693. $8=$recv(aClass)._comment();
  29694. $ctx1.sendIdx["comment"]=1;
  29695. $recv($8)._ifNotEmpty_((function(){
  29696. return $core.withContext(function($ctx2) {
  29697. $recv(aStream)._lf();
  29698. $ctx2.sendIdx["lf"]=2;
  29699. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  29700. $ctx2.sendIdx["write:"]=2;
  29701. $recv(aStream)._lf();
  29702. $ctx2.sendIdx["lf"]=3;
  29703. $10=$recv(aClass)._asJavaScriptSource();
  29704. $ctx2.sendIdx["asJavaScriptSource"]=5;
  29705. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  29706. $recv(aStream)._write_($9);
  29707. $ctx2.sendIdx["write:"]=3;
  29708. $recv(aStream)._lf();
  29709. $ctx2.sendIdx["lf"]=4;
  29710. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  29711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  29712. }));
  29713. $recv(aStream)._lf();
  29714. return self;
  29715. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  29716. },
  29717. args: ["aClass", "aStream"],
  29718. 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",
  29719. referencedClasses: [],
  29720. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  29721. }),
  29722. $globals.Exporter);
  29723. $core.addMethod(
  29724. $core.method({
  29725. selector: "exportMetaDefinitionOf:on:",
  29726. protocol: "output",
  29727. fn: function (aClass,aStream){
  29728. var self=this;
  29729. return $core.withContext(function($ctx1) {
  29730. var $2,$1,$4,$3;
  29731. $recv(aStream)._lf();
  29732. $ctx1.sendIdx["lf"]=1;
  29733. $2=$recv(aClass)._theMetaClass();
  29734. $ctx1.sendIdx["theMetaClass"]=1;
  29735. $1=$recv($2)._instanceVariableNames();
  29736. $recv($1)._ifNotEmpty_((function(classIvars){
  29737. return $core.withContext(function($ctx2) {
  29738. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  29739. $ctx2.sendIdx["asJavaScriptSource"]=1;
  29740. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  29741. $recv(aStream)._write_($3);
  29742. return $recv(aStream)._lf();
  29743. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  29744. }));
  29745. return self;
  29746. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  29747. },
  29748. args: ["aClass", "aStream"],
  29749. 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 ]",
  29750. referencedClasses: [],
  29751. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  29752. }),
  29753. $globals.Exporter);
  29754. $core.addMethod(
  29755. $core.method({
  29756. selector: "exportMethod:on:",
  29757. protocol: "output",
  29758. fn: function (aMethod,aStream){
  29759. var self=this;
  29760. return $core.withContext(function($ctx1) {
  29761. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  29762. $recv(aStream)._write_("$core.addMethod(");
  29763. $ctx1.sendIdx["write:"]=1;
  29764. $recv(aStream)._lf();
  29765. $ctx1.sendIdx["lf"]=1;
  29766. $recv(aStream)._write_("$core.method({");
  29767. $ctx1.sendIdx["write:"]=2;
  29768. $recv(aStream)._lf();
  29769. $ctx1.sendIdx["lf"]=2;
  29770. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  29771. $ctx1.sendIdx["asJavaScriptSource"]=1;
  29772. $1=["selector: ",$2,","];
  29773. $recv(aStream)._write_($1);
  29774. $ctx1.sendIdx["write:"]=3;
  29775. $recv(aStream)._lf();
  29776. $ctx1.sendIdx["lf"]=3;
  29777. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  29778. $ctx1.sendIdx["asJavaScriptSource"]=2;
  29779. $3=["protocol: ",$4,","];
  29780. $recv(aStream)._write_($3);
  29781. $ctx1.sendIdx["write:"]=4;
  29782. $recv(aStream)._lf();
  29783. $ctx1.sendIdx["lf"]=4;
  29784. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  29785. $ctx1.sendIdx["write:"]=5;
  29786. $recv(aStream)._lf();
  29787. $ctx1.sendIdx["lf"]=5;
  29788. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  29789. $ctx1.sendIdx["write:"]=6;
  29790. $recv(aStream)._lf();
  29791. $ctx1.sendIdx["lf"]=6;
  29792. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  29793. $ctx1.sendIdx["asJavaScriptSource"]=3;
  29794. $5=["args: ",$6,","];
  29795. $recv(aStream)._write_($5);
  29796. $ctx1.sendIdx["write:"]=7;
  29797. $recv(aStream)._lf();
  29798. $ctx1.sendIdx["lf"]=7;
  29799. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  29800. $ctx1.sendIdx["asJavaScriptSource"]=4;
  29801. $7=["source: ",$8,","];
  29802. $recv(aStream)._write_($7);
  29803. $ctx1.sendIdx["write:"]=8;
  29804. $recv(aStream)._lf();
  29805. $ctx1.sendIdx["lf"]=8;
  29806. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  29807. $ctx1.sendIdx["asJavaScriptSource"]=5;
  29808. $9=["referencedClasses: ",$10,","];
  29809. $recv(aStream)._write_($9);
  29810. $ctx1.sendIdx["write:"]=9;
  29811. $recv(aStream)._lf();
  29812. $ctx1.sendIdx["lf"]=9;
  29813. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  29814. $ctx1.sendIdx["write:"]=10;
  29815. $recv(aStream)._lf();
  29816. $ctx1.sendIdx["lf"]=10;
  29817. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  29818. $ctx1.sendIdx["asJavaScriptSource"]=6;
  29819. $11=["messageSends: ",$12];
  29820. $recv(aStream)._write_($11);
  29821. $ctx1.sendIdx["write:"]=11;
  29822. $recv(aStream)._lf();
  29823. $ctx1.sendIdx["lf"]=11;
  29824. $recv(aStream)._write_("}),");
  29825. $ctx1.sendIdx["write:"]=12;
  29826. $recv(aStream)._lf();
  29827. $ctx1.sendIdx["lf"]=12;
  29828. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  29829. $recv(aStream)._lf();
  29830. $ctx1.sendIdx["lf"]=13;
  29831. $recv(aStream)._lf();
  29832. return self;
  29833. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  29834. },
  29835. args: ["aMethod", "aStream"],
  29836. 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",
  29837. referencedClasses: [],
  29838. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  29839. }),
  29840. $globals.Exporter);
  29841. $core.addMethod(
  29842. $core.method({
  29843. selector: "exportPackage:on:",
  29844. protocol: "output",
  29845. fn: function (aPackage,aStream){
  29846. var self=this;
  29847. return $core.withContext(function($ctx1) {
  29848. var $1,$receiver;
  29849. self._exportPackagePrologueOf_on_(aPackage,aStream);
  29850. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  29851. self._exportPackageContextOf_on_(aPackage,aStream);
  29852. self._exportPackageImportsOf_on_(aPackage,aStream);
  29853. self._exportPackageTransportOf_on_(aPackage,aStream);
  29854. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  29855. return $core.withContext(function($ctx2) {
  29856. self._exportBehavior_on_(each,aStream);
  29857. $ctx2.sendIdx["exportBehavior:on:"]=1;
  29858. $1=$recv(each)._theMetaClass();
  29859. if(($receiver = $1) == null || $receiver.isNil){
  29860. return $1;
  29861. } else {
  29862. var meta;
  29863. meta=$receiver;
  29864. return self._exportBehavior_on_(meta,aStream);
  29865. }
  29866. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29867. }));
  29868. $ctx1.sendIdx["do:"]=1;
  29869. self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  29870. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  29871. return $core.withContext(function($ctx2) {
  29872. return self._exportMethod_on_(each,aStream);
  29873. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  29874. }));
  29875. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  29876. return self;
  29877. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29878. },
  29879. args: ["aPackage", "aStream"],
  29880. 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",
  29881. referencedClasses: [],
  29882. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  29883. }),
  29884. $globals.Exporter);
  29885. $core.addMethod(
  29886. $core.method({
  29887. selector: "exportPackageBodyBlockPrologueOf:on:",
  29888. protocol: "output",
  29889. fn: function (aPackage,aStream){
  29890. var self=this;
  29891. return $core.withContext(function($ctx1) {
  29892. $recv(aStream)._write_("if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;");
  29893. $ctx1.sendIdx["write:"]=1;
  29894. $recv(aStream)._lf();
  29895. $ctx1.sendIdx["lf"]=1;
  29896. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  29897. $ctx1.sendIdx["write:"]=2;
  29898. $recv(aStream)._lf();
  29899. $ctx1.sendIdx["lf"]=2;
  29900. $recv(aStream)._write_("if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;");
  29901. $recv(aStream)._lf();
  29902. return self;
  29903. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29904. },
  29905. args: ["aPackage", "aStream"],
  29906. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;'; lf;\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf;\x0a\x09\x09write: 'if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;'; lf",
  29907. referencedClasses: [],
  29908. messageSends: ["write:", "lf"]
  29909. }),
  29910. $globals.Exporter);
  29911. $core.addMethod(
  29912. $core.method({
  29913. selector: "exportPackageContextOf:on:",
  29914. protocol: "output",
  29915. fn: function (aPackage,aStream){
  29916. var self=this;
  29917. return $core.withContext(function($ctx1) {
  29918. $recv(aStream)._write_(["$core.packages[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  29919. $recv(aStream)._lf();
  29920. return self;
  29921. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29922. },
  29923. args: ["aPackage", "aStream"],
  29924. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.packages['.\x0a\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09'].innerEval = '.\x0a\x09\x09\x09'function (expr) { return eval(expr); }'.\x0a\x09\x09\x09';' };\x0a\x09\x09lf",
  29925. referencedClasses: [],
  29926. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  29927. }),
  29928. $globals.Exporter);
  29929. $core.addMethod(
  29930. $core.method({
  29931. selector: "exportPackageDefinitionOf:on:",
  29932. protocol: "output",
  29933. fn: function (aPackage,aStream){
  29934. var self=this;
  29935. return $core.withContext(function($ctx1) {
  29936. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  29937. $recv(aStream)._lf();
  29938. return self;
  29939. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29940. },
  29941. args: ["aPackage", "aStream"],
  29942. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  29943. referencedClasses: [],
  29944. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  29945. }),
  29946. $globals.Exporter);
  29947. $core.addMethod(
  29948. $core.method({
  29949. selector: "exportPackageEpilogueOf:on:",
  29950. protocol: "output",
  29951. fn: function (aPackage,aStream){
  29952. var self=this;
  29953. return $core.withContext(function($ctx1) {
  29954. self._subclassResponsibility();
  29955. return self;
  29956. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29957. },
  29958. args: ["aPackage", "aStream"],
  29959. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  29960. referencedClasses: [],
  29961. messageSends: ["subclassResponsibility"]
  29962. }),
  29963. $globals.Exporter);
  29964. $core.addMethod(
  29965. $core.method({
  29966. selector: "exportPackageImportsOf:on:",
  29967. protocol: "output",
  29968. fn: function (aPackage,aStream){
  29969. var self=this;
  29970. return $core.withContext(function($ctx1) {
  29971. var $2,$1;
  29972. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  29973. return $core.withContext(function($ctx2) {
  29974. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  29975. $ctx2.sendIdx["asJavaScriptSource"]=1;
  29976. $1=["$core.packages[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  29977. $recv(aStream)._write_($1);
  29978. return $recv(aStream)._lf();
  29979. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  29980. }));
  29981. return self;
  29982. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  29983. },
  29984. args: ["aPackage", "aStream"],
  29985. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: {\x0a\x09\x09\x09\x09'$core.packages['.\x0a\x09\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09\x09'].imports = '.\x0a\x09\x09\x09\x09imports asJavaScriptSource.\x0a\x09\x09\x09\x09';' };\x0a\x09\x09\x09lf ]",
  29986. referencedClasses: [],
  29987. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  29988. }),
  29989. $globals.Exporter);
  29990. $core.addMethod(
  29991. $core.method({
  29992. selector: "exportPackagePrologueOf:on:",
  29993. protocol: "output",
  29994. fn: function (aPackage,aStream){
  29995. var self=this;
  29996. return $core.withContext(function($ctx1) {
  29997. self._subclassResponsibility();
  29998. return self;
  29999. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  30000. },
  30001. args: ["aPackage", "aStream"],
  30002. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30003. referencedClasses: [],
  30004. messageSends: ["subclassResponsibility"]
  30005. }),
  30006. $globals.Exporter);
  30007. $core.addMethod(
  30008. $core.method({
  30009. selector: "exportPackageTraitCompositionsOf:on:",
  30010. protocol: "output",
  30011. fn: function (aPackage,aStream){
  30012. var self=this;
  30013. return $core.withContext(function($ctx1) {
  30014. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30015. return $core.withContext(function($ctx2) {
  30016. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30017. return $core.withContext(function($ctx3) {
  30018. return self._exportTraitComposition_of_on_(value,key,aStream);
  30019. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30020. }));
  30021. return $recv(aStream)._lf();
  30022. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30023. }));
  30024. return self;
  30025. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  30026. },
  30027. args: ["aPackage", "aStream"],
  30028. 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 ]",
  30029. referencedClasses: [],
  30030. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  30031. }),
  30032. $globals.Exporter);
  30033. $core.addMethod(
  30034. $core.method({
  30035. selector: "exportPackageTransportOf:on:",
  30036. protocol: "output",
  30037. fn: function (aPackage,aStream){
  30038. var self=this;
  30039. return $core.withContext(function($ctx1) {
  30040. $recv(aStream)._write_(["$core.packages[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  30041. $recv(aStream)._lf();
  30042. return self;
  30043. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  30044. },
  30045. args: ["aPackage", "aStream"],
  30046. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.packages['.\x0a\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09'].transport = '.\x0a\x09\x09\x09aPackage transport asJSONString.\x0a\x09\x09\x09';' };\x0a\x09\x09lf",
  30047. referencedClasses: [],
  30048. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  30049. }),
  30050. $globals.Exporter);
  30051. $core.addMethod(
  30052. $core.method({
  30053. selector: "exportTraitComposition:of:on:",
  30054. protocol: "output",
  30055. fn: function (aTraitComposition,aBehavior,aStream){
  30056. var self=this;
  30057. return $core.withContext(function($ctx1) {
  30058. var $2,$1;
  30059. $2=$recv(aTraitComposition)._asJavaScriptSource();
  30060. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30061. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  30062. $recv(aStream)._write_($1);
  30063. $recv(aStream)._lf();
  30064. return self;
  30065. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30066. },
  30067. args: ["aTraitComposition", "aBehavior", "aStream"],
  30068. 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",
  30069. referencedClasses: [],
  30070. messageSends: ["write:", "asJavaScriptSource", "lf"]
  30071. }),
  30072. $globals.Exporter);
  30073. $core.addMethod(
  30074. $core.method({
  30075. selector: "exportTraitDefinitionOf:on:",
  30076. protocol: "output",
  30077. fn: function (aClass,aStream){
  30078. var self=this;
  30079. return $core.withContext(function($ctx1) {
  30080. var $3,$4,$2,$1,$5,$7,$6;
  30081. $recv(aStream)._lf();
  30082. $ctx1.sendIdx["lf"]=1;
  30083. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30084. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30085. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  30086. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30087. $2=["$core.addTrait(",$3,", ",$4,");"];
  30088. $1=$recv(aStream)._write_($2);
  30089. $ctx1.sendIdx["write:"]=1;
  30090. $5=$recv(aClass)._comment();
  30091. $ctx1.sendIdx["comment"]=1;
  30092. $recv($5)._ifNotEmpty_((function(){
  30093. return $core.withContext(function($ctx2) {
  30094. $recv(aStream)._lf();
  30095. $ctx2.sendIdx["lf"]=2;
  30096. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30097. $ctx2.sendIdx["write:"]=2;
  30098. $recv(aStream)._lf();
  30099. $ctx2.sendIdx["lf"]=3;
  30100. $7=$recv(aClass)._asJavaScriptSource();
  30101. $ctx2.sendIdx["asJavaScriptSource"]=3;
  30102. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30103. $recv(aStream)._write_($6);
  30104. $ctx2.sendIdx["write:"]=3;
  30105. $recv(aStream)._lf();
  30106. $ctx2.sendIdx["lf"]=4;
  30107. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30109. }));
  30110. $recv(aStream)._lf();
  30111. return self;
  30112. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30113. },
  30114. args: ["aClass", "aStream"],
  30115. 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",
  30116. referencedClasses: [],
  30117. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30118. }),
  30119. $globals.Exporter);
  30120. $core.addMethod(
  30121. $core.method({
  30122. selector: "ownMethodsOfClass:",
  30123. protocol: "accessing",
  30124. fn: function (aClass){
  30125. var self=this;
  30126. return $core.withContext(function($ctx1) {
  30127. var $1;
  30128. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  30129. return $core.withContext(function($ctx2) {
  30130. $1=$recv(a)._selector();
  30131. $ctx2.sendIdx["selector"]=1;
  30132. return $recv($1).__lt_eq($recv(b)._selector());
  30133. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30134. })))._reject_((function(each){
  30135. return $core.withContext(function($ctx2) {
  30136. return $recv($recv(each)._protocol())._match_("^\x5c*");
  30137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30138. }));
  30139. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  30140. },
  30141. args: ["aClass"],
  30142. 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*') ]",
  30143. referencedClasses: [],
  30144. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  30145. }),
  30146. $globals.Exporter);
  30147. $core.addMethod(
  30148. $core.method({
  30149. selector: "ownMethodsOfMetaClass:",
  30150. protocol: "accessing",
  30151. fn: function (aClass){
  30152. var self=this;
  30153. return $core.withContext(function($ctx1) {
  30154. return self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  30155. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  30156. },
  30157. args: ["aClass"],
  30158. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  30159. referencedClasses: [],
  30160. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  30161. }),
  30162. $globals.Exporter);
  30163. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  30164. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  30165. $core.addMethod(
  30166. $core.method({
  30167. selector: "amdNamesOfPackages:",
  30168. protocol: "private",
  30169. fn: function (anArray){
  30170. var self=this;
  30171. return $core.withContext(function($ctx1) {
  30172. var $1;
  30173. return $recv($recv(anArray)._select_((function(each){
  30174. return $core.withContext(function($ctx2) {
  30175. $1=self._amdNamespaceOfPackage_(each);
  30176. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  30177. return $recv($1)._notNil();
  30178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30179. })))._collect_((function(each){
  30180. return $core.withContext(function($ctx2) {
  30181. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  30182. $ctx2.sendIdx[","]=1;
  30183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30184. }));
  30185. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  30186. },
  30187. args: ["anArray"],
  30188. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  30189. referencedClasses: [],
  30190. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  30191. }),
  30192. $globals.AmdExporter);
  30193. $core.addMethod(
  30194. $core.method({
  30195. selector: "amdNamespaceOfPackage:",
  30196. protocol: "private",
  30197. fn: function (aPackage){
  30198. var self=this;
  30199. return $core.withContext(function($ctx1) {
  30200. var $3,$2,$1;
  30201. $3=$recv(aPackage)._transport();
  30202. $ctx1.sendIdx["transport"]=1;
  30203. $2=$recv($3)._type();
  30204. $1=$recv($2).__eq("amd");
  30205. if($core.assert($1)){
  30206. return $recv($recv(aPackage)._transport())._namespace();
  30207. } else {
  30208. return nil;
  30209. }
  30210. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  30211. },
  30212. args: ["aPackage"],
  30213. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  30214. referencedClasses: [],
  30215. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  30216. }),
  30217. $globals.AmdExporter);
  30218. $core.addMethod(
  30219. $core.method({
  30220. selector: "exportPackageEpilogueOf:on:",
  30221. protocol: "output",
  30222. fn: function (aPackage,aStream){
  30223. var self=this;
  30224. return $core.withContext(function($ctx1) {
  30225. $recv(aStream)._write_("});");
  30226. $recv(aStream)._lf();
  30227. return self;
  30228. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  30229. },
  30230. args: ["aPackage", "aStream"],
  30231. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  30232. referencedClasses: [],
  30233. messageSends: ["write:", "lf"]
  30234. }),
  30235. $globals.AmdExporter);
  30236. $core.addMethod(
  30237. $core.method({
  30238. selector: "exportPackagePrologueOf:on:",
  30239. protocol: "output",
  30240. fn: function (aPackage,aStream){
  30241. var self=this;
  30242. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  30243. return $core.withContext(function($ctx1) {
  30244. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  30245. pragmaStart="";
  30246. pragmaEnd="";
  30247. importsForOutput=self._importsForOutput_(aPackage);
  30248. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  30249. $1=$recv(importsForOutput)._value();
  30250. $ctx1.sendIdx["value"]=1;
  30251. $recv($1)._ifNotEmpty_((function(){
  30252. return $core.withContext(function($ctx2) {
  30253. $3=$recv($globals.String)._lf();
  30254. $ctx2.sendIdx["lf"]=1;
  30255. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  30256. $ctx2.sendIdx[","]=2;
  30257. $4=$recv($globals.String)._lf();
  30258. $ctx2.sendIdx["lf"]=2;
  30259. pragmaStart=$recv($2).__comma($4);
  30260. $ctx2.sendIdx[","]=1;
  30261. pragmaStart;
  30262. $6=$recv($globals.String)._lf();
  30263. $ctx2.sendIdx["lf"]=3;
  30264. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  30265. $ctx2.sendIdx[","]=4;
  30266. $7=$recv($globals.String)._lf();
  30267. $ctx2.sendIdx["lf"]=4;
  30268. pragmaEnd=$recv($5).__comma($7);
  30269. $ctx2.sendIdx[","]=3;
  30270. return pragmaEnd;
  30271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30272. }));
  30273. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  30274. $ctx1.sendIdx[","]=7;
  30275. $13=$recv($14).__comma([":2:"]);
  30276. $ctx1.sendIdx[","]=6;
  30277. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  30278. $ctx1.sendIdx[","]=5;
  30279. $11=$recv($12)._asJavaScriptSource();
  30280. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  30281. $ctx1.sendIdx["replace:with:"]=2;
  30282. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  30283. $ctx1.sendIdx["replace:with:"]=1;
  30284. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  30285. $ctx1.sendIdx[","]=8;
  30286. $17=$recv($18)._join_(",");
  30287. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  30288. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  30289. $ctx1.sendIdx["replace:with:"]=3;
  30290. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  30291. $recv(aStream)._write_($8);
  30292. $recv(aStream)._lf();
  30293. self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  30294. return self;
  30295. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  30296. },
  30297. args: ["aPackage", "aStream"],
  30298. 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",
  30299. referencedClasses: ["String"],
  30300. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  30301. }),
  30302. $globals.AmdExporter);
  30303. $core.addMethod(
  30304. $core.method({
  30305. selector: "importsForOutput:",
  30306. protocol: "private",
  30307. fn: function (aPackage){
  30308. var self=this;
  30309. var namedImports,anonImports,importVarNames;
  30310. return $core.withContext(function($ctx1) {
  30311. var $1;
  30312. namedImports=[];
  30313. anonImports=[];
  30314. importVarNames=[];
  30315. $recv($recv(aPackage)._imports())._do_((function(each){
  30316. return $core.withContext(function($ctx2) {
  30317. $1=$recv(each)._isString();
  30318. if($core.assert($1)){
  30319. return $recv(anonImports)._add_(each);
  30320. $ctx2.sendIdx["add:"]=1;
  30321. } else {
  30322. $recv(namedImports)._add_($recv(each)._value());
  30323. $ctx2.sendIdx["add:"]=2;
  30324. return $recv(importVarNames)._add_($recv(each)._key());
  30325. }
  30326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30327. }));
  30328. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  30329. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  30330. },
  30331. args: ["aPackage"],
  30332. 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)",
  30333. referencedClasses: [],
  30334. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  30335. }),
  30336. $globals.AmdExporter);
  30337. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  30338. $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";
  30339. $core.addMethod(
  30340. $core.method({
  30341. selector: "last",
  30342. protocol: "accessing",
  30343. fn: function (){
  30344. var self=this;
  30345. return self["@last"];
  30346. },
  30347. args: [],
  30348. source: "last\x0a\x09^ last",
  30349. referencedClasses: [],
  30350. messageSends: []
  30351. }),
  30352. $globals.ChunkParser);
  30353. $core.addMethod(
  30354. $core.method({
  30355. selector: "nextChunk",
  30356. protocol: "reading",
  30357. fn: function (){
  30358. var self=this;
  30359. var char,result,chunk;
  30360. return $core.withContext(function($ctx1) {
  30361. var $1,$2,$3,$4;
  30362. var $early={};
  30363. try {
  30364. result=""._writeStream();
  30365. $recv((function(){
  30366. return $core.withContext(function($ctx2) {
  30367. char=$recv(self["@stream"])._next();
  30368. $ctx2.sendIdx["next"]=1;
  30369. char;
  30370. return $recv(char)._notNil();
  30371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30372. }))._whileTrue_((function(){
  30373. return $core.withContext(function($ctx2) {
  30374. $1=$recv(char).__eq("!");
  30375. $ctx2.sendIdx["="]=1;
  30376. if($core.assert($1)){
  30377. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  30378. if($core.assert($2)){
  30379. $recv(self["@stream"])._next();
  30380. } else {
  30381. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  30382. $3=self["@last"];
  30383. throw $early=[$3];
  30384. }
  30385. }
  30386. return $recv(result)._nextPut_(char);
  30387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  30388. }));
  30389. self["@last"]=nil;
  30390. $4=self["@last"];
  30391. return $4;
  30392. }
  30393. catch(e) {if(e===$early)return e[0]; throw e}
  30394. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  30395. },
  30396. args: [],
  30397. 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",
  30398. referencedClasses: [],
  30399. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  30400. }),
  30401. $globals.ChunkParser);
  30402. $core.addMethod(
  30403. $core.method({
  30404. selector: "stream:",
  30405. protocol: "accessing",
  30406. fn: function (aStream){
  30407. var self=this;
  30408. self["@stream"]=aStream;
  30409. return self;
  30410. },
  30411. args: ["aStream"],
  30412. source: "stream: aStream\x0a\x09stream := aStream",
  30413. referencedClasses: [],
  30414. messageSends: []
  30415. }),
  30416. $globals.ChunkParser);
  30417. $core.addMethod(
  30418. $core.method({
  30419. selector: "on:",
  30420. protocol: "instance creation",
  30421. fn: function (aStream){
  30422. var self=this;
  30423. return $core.withContext(function($ctx1) {
  30424. return $recv(self._new())._stream_(aStream);
  30425. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  30426. },
  30427. args: ["aStream"],
  30428. source: "on: aStream\x0a\x09^ self new stream: aStream",
  30429. referencedClasses: [],
  30430. messageSends: ["stream:", "new"]
  30431. }),
  30432. $globals.ChunkParser.klass);
  30433. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  30434. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  30435. $core.addMethod(
  30436. $core.method({
  30437. selector: "class:",
  30438. protocol: "accessing",
  30439. fn: function (aClass){
  30440. var self=this;
  30441. self["@class"]=aClass;
  30442. return self;
  30443. },
  30444. args: ["aClass"],
  30445. source: "class: aClass\x0a\x09class := aClass",
  30446. referencedClasses: [],
  30447. messageSends: []
  30448. }),
  30449. $globals.ClassCommentReader);
  30450. $core.addMethod(
  30451. $core.method({
  30452. selector: "initialize",
  30453. protocol: "initialization",
  30454. fn: function (){
  30455. var self=this;
  30456. return $core.withContext(function($ctx1) {
  30457. (
  30458. $ctx1.supercall = true,
  30459. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  30460. $ctx1.supercall = false;
  30461. return self;
  30462. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  30463. },
  30464. args: [],
  30465. source: "initialize\x0a\x09super initialize.",
  30466. referencedClasses: [],
  30467. messageSends: ["initialize"]
  30468. }),
  30469. $globals.ClassCommentReader);
  30470. $core.addMethod(
  30471. $core.method({
  30472. selector: "scanFrom:",
  30473. protocol: "fileIn",
  30474. fn: function (aChunkParser){
  30475. var self=this;
  30476. var chunk;
  30477. return $core.withContext(function($ctx1) {
  30478. chunk=$recv(aChunkParser)._nextChunk();
  30479. $recv(chunk)._ifNotEmpty_((function(){
  30480. return $core.withContext(function($ctx2) {
  30481. return self._setComment_(chunk);
  30482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30483. }));
  30484. return self;
  30485. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  30486. },
  30487. args: ["aChunkParser"],
  30488. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  30489. referencedClasses: [],
  30490. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  30491. }),
  30492. $globals.ClassCommentReader);
  30493. $core.addMethod(
  30494. $core.method({
  30495. selector: "setComment:",
  30496. protocol: "private",
  30497. fn: function (aString){
  30498. var self=this;
  30499. return $core.withContext(function($ctx1) {
  30500. $recv(self["@class"])._comment_(aString);
  30501. return self;
  30502. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  30503. },
  30504. args: ["aString"],
  30505. source: "setComment: aString\x0a\x09class comment: aString",
  30506. referencedClasses: [],
  30507. messageSends: ["comment:"]
  30508. }),
  30509. $globals.ClassCommentReader);
  30510. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  30511. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  30512. $core.addMethod(
  30513. $core.method({
  30514. selector: "class:category:",
  30515. protocol: "accessing",
  30516. fn: function (aClass,aString){
  30517. var self=this;
  30518. self["@class"]=aClass;
  30519. self["@category"]=aString;
  30520. return self;
  30521. },
  30522. args: ["aClass", "aString"],
  30523. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  30524. referencedClasses: [],
  30525. messageSends: []
  30526. }),
  30527. $globals.ClassProtocolReader);
  30528. $core.addMethod(
  30529. $core.method({
  30530. selector: "compileMethod:",
  30531. protocol: "private",
  30532. fn: function (aString){
  30533. var self=this;
  30534. return $core.withContext(function($ctx1) {
  30535. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  30536. return self;
  30537. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  30538. },
  30539. args: ["aString"],
  30540. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  30541. referencedClasses: ["Compiler"],
  30542. messageSends: ["install:forClass:protocol:", "new"]
  30543. }),
  30544. $globals.ClassProtocolReader);
  30545. $core.addMethod(
  30546. $core.method({
  30547. selector: "initialize",
  30548. protocol: "initialization",
  30549. fn: function (){
  30550. var self=this;
  30551. return $core.withContext(function($ctx1) {
  30552. (
  30553. $ctx1.supercall = true,
  30554. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  30555. $ctx1.supercall = false;
  30556. return self;
  30557. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  30558. },
  30559. args: [],
  30560. source: "initialize\x0a\x09super initialize.",
  30561. referencedClasses: [],
  30562. messageSends: ["initialize"]
  30563. }),
  30564. $globals.ClassProtocolReader);
  30565. $core.addMethod(
  30566. $core.method({
  30567. selector: "scanFrom:",
  30568. protocol: "fileIn",
  30569. fn: function (aChunkParser){
  30570. var self=this;
  30571. var chunk;
  30572. return $core.withContext(function($ctx1) {
  30573. $recv((function(){
  30574. return $core.withContext(function($ctx2) {
  30575. chunk=$recv(aChunkParser)._nextChunk();
  30576. chunk;
  30577. return $recv(chunk)._isEmpty();
  30578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30579. }))._whileFalse_((function(){
  30580. return $core.withContext(function($ctx2) {
  30581. return self._compileMethod_(chunk);
  30582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  30583. }));
  30584. return self;
  30585. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  30586. },
  30587. args: ["aChunkParser"],
  30588. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  30589. referencedClasses: [],
  30590. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  30591. }),
  30592. $globals.ClassProtocolReader);
  30593. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  30594. $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.";
  30595. $core.addMethod(
  30596. $core.method({
  30597. selector: "methods",
  30598. protocol: "accessing",
  30599. fn: function (){
  30600. var self=this;
  30601. return $core.withContext(function($ctx1) {
  30602. var $1;
  30603. return $recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  30604. return $core.withContext(function($ctx2) {
  30605. $1=$recv(a)._selector();
  30606. $ctx2.sendIdx["selector"]=1;
  30607. return $recv($1).__lt_eq($recv(b)._selector());
  30608. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30609. }));
  30610. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  30611. },
  30612. args: [],
  30613. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  30614. referencedClasses: [],
  30615. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  30616. }),
  30617. $globals.ExportMethodProtocol);
  30618. $core.addMethod(
  30619. $core.method({
  30620. selector: "name",
  30621. protocol: "accessing",
  30622. fn: function (){
  30623. var self=this;
  30624. return self["@name"];
  30625. },
  30626. args: [],
  30627. source: "name\x0a\x09^ name",
  30628. referencedClasses: [],
  30629. messageSends: []
  30630. }),
  30631. $globals.ExportMethodProtocol);
  30632. $core.addMethod(
  30633. $core.method({
  30634. selector: "name:",
  30635. protocol: "accessing",
  30636. fn: function (aString){
  30637. var self=this;
  30638. self["@name"]=aString;
  30639. return self;
  30640. },
  30641. args: ["aString"],
  30642. source: "name: aString\x0a\x09name := aString",
  30643. referencedClasses: [],
  30644. messageSends: []
  30645. }),
  30646. $globals.ExportMethodProtocol);
  30647. $core.addMethod(
  30648. $core.method({
  30649. selector: "ownMethods",
  30650. protocol: "accessing",
  30651. fn: function (){
  30652. var self=this;
  30653. return $core.withContext(function($ctx1) {
  30654. var $1;
  30655. return $recv($recv(self._theClass())._ownMethodsInProtocol_(self._name()))._sorted_((function(a,b){
  30656. return $core.withContext(function($ctx2) {
  30657. $1=$recv(a)._selector();
  30658. $ctx2.sendIdx["selector"]=1;
  30659. return $recv($1).__lt_eq($recv(b)._selector());
  30660. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30661. }));
  30662. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  30663. },
  30664. args: [],
  30665. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  30666. referencedClasses: [],
  30667. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  30668. }),
  30669. $globals.ExportMethodProtocol);
  30670. $core.addMethod(
  30671. $core.method({
  30672. selector: "theClass",
  30673. protocol: "accessing",
  30674. fn: function (){
  30675. var self=this;
  30676. return self["@theClass"];
  30677. },
  30678. args: [],
  30679. source: "theClass\x0a\x09^ theClass",
  30680. referencedClasses: [],
  30681. messageSends: []
  30682. }),
  30683. $globals.ExportMethodProtocol);
  30684. $core.addMethod(
  30685. $core.method({
  30686. selector: "theClass:",
  30687. protocol: "accessing",
  30688. fn: function (aClass){
  30689. var self=this;
  30690. self["@theClass"]=aClass;
  30691. return self;
  30692. },
  30693. args: ["aClass"],
  30694. source: "theClass: aClass\x0a\x09theClass := aClass",
  30695. referencedClasses: [],
  30696. messageSends: []
  30697. }),
  30698. $globals.ExportMethodProtocol);
  30699. $core.addMethod(
  30700. $core.method({
  30701. selector: "name:theClass:",
  30702. protocol: "instance creation",
  30703. fn: function (aString,aClass){
  30704. var self=this;
  30705. return $core.withContext(function($ctx1) {
  30706. var $1;
  30707. $1=self._new();
  30708. $recv($1)._name_(aString);
  30709. $recv($1)._theClass_(aClass);
  30710. return $recv($1)._yourself();
  30711. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  30712. },
  30713. args: ["aString", "aClass"],
  30714. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  30715. referencedClasses: [],
  30716. messageSends: ["name:", "new", "theClass:", "yourself"]
  30717. }),
  30718. $globals.ExportMethodProtocol.klass);
  30719. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  30720. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  30721. $core.addMethod(
  30722. $core.method({
  30723. selector: "import:",
  30724. protocol: "fileIn",
  30725. fn: function (aStream){
  30726. var self=this;
  30727. var chunk,result,parser,lastEmpty;
  30728. return $core.withContext(function($ctx1) {
  30729. var $1;
  30730. parser=$recv($globals.ChunkParser)._on_(aStream);
  30731. lastEmpty=false;
  30732. self["@lastSection"]="n/a, not started";
  30733. self["@lastChunk"]=nil;
  30734. $recv((function(){
  30735. return $core.withContext(function($ctx2) {
  30736. $recv((function(){
  30737. return $core.withContext(function($ctx3) {
  30738. chunk=$recv(parser)._nextChunk();
  30739. chunk;
  30740. return $recv(chunk)._isNil();
  30741. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  30742. }))._whileFalse_((function(){
  30743. return $core.withContext(function($ctx3) {
  30744. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  30745. lastEmpty=true;
  30746. return lastEmpty;
  30747. }),(function(){
  30748. return $core.withContext(function($ctx4) {
  30749. self["@lastSection"]=chunk;
  30750. self["@lastSection"];
  30751. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  30752. result;
  30753. $1=lastEmpty;
  30754. if($core.assert($1)){
  30755. lastEmpty=false;
  30756. lastEmpty;
  30757. return $recv(result)._scanFrom_(parser);
  30758. }
  30759. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  30760. }));
  30761. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  30762. }));
  30763. self["@lastSection"]="n/a, finished";
  30764. return self["@lastSection"];
  30765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30766. }))._on_do_($globals.Error,(function(e){
  30767. return $core.withContext(function($ctx2) {
  30768. self["@lastChunk"]=$recv(parser)._last();
  30769. self["@lastChunk"];
  30770. return $recv(e)._resignal();
  30771. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  30772. }));
  30773. return self;
  30774. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  30775. },
  30776. args: ["aStream"],
  30777. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].",
  30778. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  30779. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  30780. }),
  30781. $globals.Importer);
  30782. $core.addMethod(
  30783. $core.method({
  30784. selector: "lastChunk",
  30785. protocol: "accessing",
  30786. fn: function (){
  30787. var self=this;
  30788. return self["@lastChunk"];
  30789. },
  30790. args: [],
  30791. source: "lastChunk\x0a\x09^ lastChunk",
  30792. referencedClasses: [],
  30793. messageSends: []
  30794. }),
  30795. $globals.Importer);
  30796. $core.addMethod(
  30797. $core.method({
  30798. selector: "lastSection",
  30799. protocol: "accessing",
  30800. fn: function (){
  30801. var self=this;
  30802. return self["@lastSection"];
  30803. },
  30804. args: [],
  30805. source: "lastSection\x0a\x09^ lastSection",
  30806. referencedClasses: [],
  30807. messageSends: []
  30808. }),
  30809. $globals.Importer);
  30810. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  30811. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  30812. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  30813. $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.";
  30814. $core.addMethod(
  30815. $core.method({
  30816. selector: "ajaxPutAt:data:onSuccess:onError:",
  30817. protocol: "private",
  30818. fn: function (aURL,aString,aBlock,anotherBlock){
  30819. var self=this;
  30820. var xhr;
  30821. return $core.withContext(function($ctx1) {
  30822. var $1,$4,$3,$2;
  30823. xhr=$recv($globals.Platform)._newXhr();
  30824. $recv(xhr)._open_url_async_("PUT",aURL,true);
  30825. $recv(xhr)._onreadystatechange_((function(){
  30826. return $core.withContext(function($ctx2) {
  30827. $1=$recv($recv(xhr)._readyState()).__eq((4));
  30828. if($core.assert($1)){
  30829. $4=$recv(xhr)._status();
  30830. $ctx2.sendIdx["status"]=1;
  30831. $3=$recv($4).__gt_eq((200));
  30832. $2=$recv($3)._and_((function(){
  30833. return $core.withContext(function($ctx3) {
  30834. return $recv($recv(xhr)._status()).__lt((300));
  30835. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  30836. }));
  30837. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  30838. }
  30839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30840. }));
  30841. $recv(xhr)._send_(aString);
  30842. return self;
  30843. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  30844. },
  30845. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  30846. 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",
  30847. referencedClasses: ["Platform"],
  30848. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  30849. }),
  30850. $globals.PackageHandler);
  30851. $core.addMethod(
  30852. $core.method({
  30853. selector: "chunkContentsFor:",
  30854. protocol: "accessing",
  30855. fn: function (aPackage){
  30856. var self=this;
  30857. return $core.withContext(function($ctx1) {
  30858. return $recv($globals.String)._streamContents_((function(str){
  30859. return $core.withContext(function($ctx2) {
  30860. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  30861. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  30862. }));
  30863. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  30864. },
  30865. args: ["aPackage"],
  30866. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  30867. referencedClasses: ["String"],
  30868. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  30869. }),
  30870. $globals.PackageHandler);
  30871. $core.addMethod(
  30872. $core.method({
  30873. selector: "chunkExporter",
  30874. protocol: "factory",
  30875. fn: function (){
  30876. var self=this;
  30877. return $core.withContext(function($ctx1) {
  30878. return $recv(self._chunkExporterClass())._new();
  30879. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  30880. },
  30881. args: [],
  30882. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  30883. referencedClasses: [],
  30884. messageSends: ["new", "chunkExporterClass"]
  30885. }),
  30886. $globals.PackageHandler);
  30887. $core.addMethod(
  30888. $core.method({
  30889. selector: "chunkExporterClass",
  30890. protocol: "accessing",
  30891. fn: function (){
  30892. var self=this;
  30893. return $globals.ChunkExporter;
  30894. },
  30895. args: [],
  30896. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  30897. referencedClasses: ["ChunkExporter"],
  30898. messageSends: []
  30899. }),
  30900. $globals.PackageHandler);
  30901. $core.addMethod(
  30902. $core.method({
  30903. selector: "commit:",
  30904. protocol: "committing",
  30905. fn: function (aPackage){
  30906. var self=this;
  30907. return $core.withContext(function($ctx1) {
  30908. var $1,$2;
  30909. self._commit_onSuccess_onError_(aPackage,(function(){
  30910. }),(function(error){
  30911. return $core.withContext(function($ctx2) {
  30912. $1=$recv($globals.PackageCommitError)._new();
  30913. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  30914. $ctx2.sendIdx[","]=1;
  30915. $recv($1)._messageText_($2);
  30916. return $recv($1)._signal();
  30917. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  30918. }));
  30919. return self;
  30920. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  30921. },
  30922. args: ["aPackage"],
  30923. 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 ]",
  30924. referencedClasses: ["PackageCommitError"],
  30925. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  30926. }),
  30927. $globals.PackageHandler);
  30928. $core.addMethod(
  30929. $core.method({
  30930. selector: "commit:onSuccess:onError:",
  30931. protocol: "committing",
  30932. fn: function (aPackage,aBlock,anotherBlock){
  30933. var self=this;
  30934. return $core.withContext(function($ctx1) {
  30935. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  30936. return $core.withContext(function($ctx2) {
  30937. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  30938. return $core.withContext(function($ctx3) {
  30939. $recv(aPackage)._beClean();
  30940. return $recv(aBlock)._value();
  30941. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  30942. }),anotherBlock);
  30943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30944. }),anotherBlock);
  30945. return self;
  30946. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  30947. },
  30948. args: ["aPackage", "aBlock", "anotherBlock"],
  30949. 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",
  30950. referencedClasses: [],
  30951. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  30952. }),
  30953. $globals.PackageHandler);
  30954. $core.addMethod(
  30955. $core.method({
  30956. selector: "commitJsFileFor:onSuccess:onError:",
  30957. protocol: "committing",
  30958. fn: function (aPackage,aBlock,anotherBlock){
  30959. var self=this;
  30960. return $core.withContext(function($ctx1) {
  30961. var $2,$1;
  30962. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  30963. $ctx1.sendIdx[","]=2;
  30964. $1=$recv($2).__comma(".js");
  30965. $ctx1.sendIdx[","]=1;
  30966. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  30967. return self;
  30968. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  30969. },
  30970. args: ["aPackage", "aBlock", "anotherBlock"],
  30971. 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",
  30972. referencedClasses: [],
  30973. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  30974. }),
  30975. $globals.PackageHandler);
  30976. $core.addMethod(
  30977. $core.method({
  30978. selector: "commitPathJsFor:",
  30979. protocol: "accessing",
  30980. fn: function (aPackage){
  30981. var self=this;
  30982. return $core.withContext(function($ctx1) {
  30983. self._subclassResponsibility();
  30984. return self;
  30985. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  30986. },
  30987. args: ["aPackage"],
  30988. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  30989. referencedClasses: [],
  30990. messageSends: ["subclassResponsibility"]
  30991. }),
  30992. $globals.PackageHandler);
  30993. $core.addMethod(
  30994. $core.method({
  30995. selector: "commitPathStFor:",
  30996. protocol: "accessing",
  30997. fn: function (aPackage){
  30998. var self=this;
  30999. return $core.withContext(function($ctx1) {
  31000. self._subclassResponsibility();
  31001. return self;
  31002. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  31003. },
  31004. args: ["aPackage"],
  31005. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  31006. referencedClasses: [],
  31007. messageSends: ["subclassResponsibility"]
  31008. }),
  31009. $globals.PackageHandler);
  31010. $core.addMethod(
  31011. $core.method({
  31012. selector: "commitStFileFor:onSuccess:onError:",
  31013. protocol: "committing",
  31014. fn: function (aPackage,aBlock,anotherBlock){
  31015. var self=this;
  31016. return $core.withContext(function($ctx1) {
  31017. var $2,$1;
  31018. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  31019. $ctx1.sendIdx[","]=2;
  31020. $1=$recv($2).__comma(".st");
  31021. $ctx1.sendIdx[","]=1;
  31022. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  31023. return self;
  31024. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  31025. },
  31026. args: ["aPackage", "aBlock", "anotherBlock"],
  31027. 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",
  31028. referencedClasses: [],
  31029. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  31030. }),
  31031. $globals.PackageHandler);
  31032. $core.addMethod(
  31033. $core.method({
  31034. selector: "contentsFor:",
  31035. protocol: "accessing",
  31036. fn: function (aPackage){
  31037. var self=this;
  31038. return $core.withContext(function($ctx1) {
  31039. return $recv($globals.String)._streamContents_((function(str){
  31040. return $core.withContext(function($ctx2) {
  31041. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  31042. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  31043. }));
  31044. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  31045. },
  31046. args: ["aPackage"],
  31047. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  31048. referencedClasses: ["String"],
  31049. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  31050. }),
  31051. $globals.PackageHandler);
  31052. $core.addMethod(
  31053. $core.method({
  31054. selector: "exporter",
  31055. protocol: "factory",
  31056. fn: function (){
  31057. var self=this;
  31058. return $core.withContext(function($ctx1) {
  31059. return $recv(self._exporterClass())._new();
  31060. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  31061. },
  31062. args: [],
  31063. source: "exporter\x0a\x09^ self exporterClass new",
  31064. referencedClasses: [],
  31065. messageSends: ["new", "exporterClass"]
  31066. }),
  31067. $globals.PackageHandler);
  31068. $core.addMethod(
  31069. $core.method({
  31070. selector: "exporterClass",
  31071. protocol: "accessing",
  31072. fn: function (){
  31073. var self=this;
  31074. return $core.withContext(function($ctx1) {
  31075. self._subclassResponsibility();
  31076. return self;
  31077. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  31078. },
  31079. args: [],
  31080. source: "exporterClass\x0a\x09self subclassResponsibility",
  31081. referencedClasses: [],
  31082. messageSends: ["subclassResponsibility"]
  31083. }),
  31084. $globals.PackageHandler);
  31085. $core.addMethod(
  31086. $core.method({
  31087. selector: "load:",
  31088. protocol: "loading",
  31089. fn: function (aPackage){
  31090. var self=this;
  31091. return $core.withContext(function($ctx1) {
  31092. self._subclassResponsibility();
  31093. return self;
  31094. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  31095. },
  31096. args: ["aPackage"],
  31097. source: "load: aPackage\x0a\x09self subclassResponsibility",
  31098. referencedClasses: [],
  31099. messageSends: ["subclassResponsibility"]
  31100. }),
  31101. $globals.PackageHandler);
  31102. $core.addMethod(
  31103. $core.method({
  31104. selector: "onCommitError:",
  31105. protocol: "error handling",
  31106. fn: function (anError){
  31107. var self=this;
  31108. return $core.withContext(function($ctx1) {
  31109. var $1,$2;
  31110. $1=$recv($globals.PackageCommitError)._new();
  31111. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  31112. $ctx1.sendIdx[","]=1;
  31113. $recv($1)._messageText_($2);
  31114. $recv($1)._signal();
  31115. return self;
  31116. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  31117. },
  31118. args: ["anError"],
  31119. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  31120. referencedClasses: ["PackageCommitError"],
  31121. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  31122. }),
  31123. $globals.PackageHandler);
  31124. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  31125. $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.";
  31126. $core.addMethod(
  31127. $core.method({
  31128. selector: "commitPathJsFor:",
  31129. protocol: "accessing",
  31130. fn: function (aPackage){
  31131. var self=this;
  31132. return $core.withContext(function($ctx1) {
  31133. return self._toUrl_(self._namespaceFor_(aPackage));
  31134. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  31135. },
  31136. args: ["aPackage"],
  31137. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  31138. referencedClasses: [],
  31139. messageSends: ["toUrl:", "namespaceFor:"]
  31140. }),
  31141. $globals.AmdPackageHandler);
  31142. $core.addMethod(
  31143. $core.method({
  31144. selector: "commitPathStFor:",
  31145. protocol: "accessing",
  31146. fn: function (aPackage){
  31147. var self=this;
  31148. var path,pathWithout;
  31149. return $core.withContext(function($ctx1) {
  31150. var $1,$2;
  31151. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  31152. $ctx1.sendIdx[","]=1;
  31153. path=self._toUrl_($1);
  31154. pathWithout=self._commitPathJsFor_(aPackage);
  31155. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  31156. if($core.assert($2)){
  31157. return pathWithout;
  31158. } else {
  31159. return path;
  31160. }
  31161. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  31162. },
  31163. args: ["aPackage"],
  31164. 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 ]",
  31165. referencedClasses: [],
  31166. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  31167. }),
  31168. $globals.AmdPackageHandler);
  31169. $core.addMethod(
  31170. $core.method({
  31171. selector: "exporterClass",
  31172. protocol: "accessing",
  31173. fn: function (){
  31174. var self=this;
  31175. return $globals.AmdExporter;
  31176. },
  31177. args: [],
  31178. source: "exporterClass\x0a\x09^ AmdExporter",
  31179. referencedClasses: ["AmdExporter"],
  31180. messageSends: []
  31181. }),
  31182. $globals.AmdPackageHandler);
  31183. $core.addMethod(
  31184. $core.method({
  31185. selector: "load:",
  31186. protocol: "loading",
  31187. fn: function (aPackage){
  31188. var self=this;
  31189. return $core.withContext(function($ctx1) {
  31190. var $1,$3,$2,$receiver;
  31191. $1=$recv($globals.Smalltalk)._amdRequire();
  31192. if(($receiver = $1) == null || $receiver.isNil){
  31193. self._error_("AMD loader not present");
  31194. } else {
  31195. var require;
  31196. require=$receiver;
  31197. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  31198. $ctx1.sendIdx[","]=1;
  31199. $2=$recv($globals.Array)._with_($3);
  31200. $recv(require)._value_($2);
  31201. }
  31202. return self;
  31203. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  31204. },
  31205. args: ["aPackage"],
  31206. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  31207. referencedClasses: ["Smalltalk", "Array"],
  31208. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  31209. }),
  31210. $globals.AmdPackageHandler);
  31211. $core.addMethod(
  31212. $core.method({
  31213. selector: "namespaceFor:",
  31214. protocol: "committing",
  31215. fn: function (aPackage){
  31216. var self=this;
  31217. return $core.withContext(function($ctx1) {
  31218. return $recv($recv(aPackage)._transport())._namespace();
  31219. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  31220. },
  31221. args: ["aPackage"],
  31222. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  31223. referencedClasses: [],
  31224. messageSends: ["namespace", "transport"]
  31225. }),
  31226. $globals.AmdPackageHandler);
  31227. $core.addMethod(
  31228. $core.method({
  31229. selector: "toUrl:",
  31230. protocol: "private",
  31231. fn: function (aString){
  31232. var self=this;
  31233. return $core.withContext(function($ctx1) {
  31234. var $1,$receiver;
  31235. $1=$recv($globals.Smalltalk)._amdRequire();
  31236. if(($receiver = $1) == null || $receiver.isNil){
  31237. return self._error_("AMD loader not present");
  31238. } else {
  31239. var require;
  31240. require=$receiver;
  31241. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  31242. }
  31243. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  31244. },
  31245. args: ["aString"],
  31246. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  31247. referencedClasses: ["Smalltalk"],
  31248. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  31249. }),
  31250. $globals.AmdPackageHandler);
  31251. $core.addMethod(
  31252. $core.method({
  31253. selector: "defaultNamespace",
  31254. protocol: "commit paths",
  31255. fn: function (){
  31256. var self=this;
  31257. return $core.withContext(function($ctx1) {
  31258. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  31259. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  31260. },
  31261. args: [],
  31262. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  31263. referencedClasses: ["Smalltalk"],
  31264. messageSends: ["defaultAmdNamespace"]
  31265. }),
  31266. $globals.AmdPackageHandler.klass);
  31267. $core.addMethod(
  31268. $core.method({
  31269. selector: "defaultNamespace:",
  31270. protocol: "commit paths",
  31271. fn: function (aString){
  31272. var self=this;
  31273. return $core.withContext(function($ctx1) {
  31274. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  31275. return self;
  31276. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  31277. },
  31278. args: ["aString"],
  31279. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  31280. referencedClasses: ["Smalltalk"],
  31281. messageSends: ["defaultAmdNamespace:"]
  31282. }),
  31283. $globals.AmdPackageHandler.klass);
  31284. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  31285. $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.";
  31286. $core.addMethod(
  31287. $core.method({
  31288. selector: "asJavaScriptObject",
  31289. protocol: "converting",
  31290. fn: function (){
  31291. var self=this;
  31292. return $core.withContext(function($ctx1) {
  31293. return $globals.HashedCollection._newFromPairs_(["type",self._type()]);
  31294. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  31295. },
  31296. args: [],
  31297. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  31298. referencedClasses: [],
  31299. messageSends: ["type"]
  31300. }),
  31301. $globals.PackageTransport);
  31302. $core.addMethod(
  31303. $core.method({
  31304. selector: "commit",
  31305. protocol: "committing",
  31306. fn: function (){
  31307. var self=this;
  31308. return $core.withContext(function($ctx1) {
  31309. $recv(self._commitHandler())._commit_(self._package());
  31310. return self;
  31311. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  31312. },
  31313. args: [],
  31314. source: "commit\x0a\x09self commitHandler commit: self package",
  31315. referencedClasses: [],
  31316. messageSends: ["commit:", "commitHandler", "package"]
  31317. }),
  31318. $globals.PackageTransport);
  31319. $core.addMethod(
  31320. $core.method({
  31321. selector: "commitHandler",
  31322. protocol: "factory",
  31323. fn: function (){
  31324. var self=this;
  31325. return $core.withContext(function($ctx1) {
  31326. return $recv(self._commitHandlerClass())._new();
  31327. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  31328. },
  31329. args: [],
  31330. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  31331. referencedClasses: [],
  31332. messageSends: ["new", "commitHandlerClass"]
  31333. }),
  31334. $globals.PackageTransport);
  31335. $core.addMethod(
  31336. $core.method({
  31337. selector: "commitHandlerClass",
  31338. protocol: "accessing",
  31339. fn: function (){
  31340. var self=this;
  31341. return $core.withContext(function($ctx1) {
  31342. self._subclassResponsibility();
  31343. return self;
  31344. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  31345. },
  31346. args: [],
  31347. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  31348. referencedClasses: [],
  31349. messageSends: ["subclassResponsibility"]
  31350. }),
  31351. $globals.PackageTransport);
  31352. $core.addMethod(
  31353. $core.method({
  31354. selector: "commitOnSuccess:onError:",
  31355. protocol: "committing",
  31356. fn: function (aBlock,anotherBlock){
  31357. var self=this;
  31358. return $core.withContext(function($ctx1) {
  31359. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  31360. return self;
  31361. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  31362. },
  31363. args: ["aBlock", "anotherBlock"],
  31364. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  31365. referencedClasses: [],
  31366. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  31367. }),
  31368. $globals.PackageTransport);
  31369. $core.addMethod(
  31370. $core.method({
  31371. selector: "definition",
  31372. protocol: "accessing",
  31373. fn: function (){
  31374. var self=this;
  31375. return "";
  31376. },
  31377. args: [],
  31378. source: "definition\x0a\x09^ ''",
  31379. referencedClasses: [],
  31380. messageSends: []
  31381. }),
  31382. $globals.PackageTransport);
  31383. $core.addMethod(
  31384. $core.method({
  31385. selector: "load",
  31386. protocol: "loading",
  31387. fn: function (){
  31388. var self=this;
  31389. return $core.withContext(function($ctx1) {
  31390. $recv(self._commitHandler())._load_(self._package());
  31391. return self;
  31392. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  31393. },
  31394. args: [],
  31395. source: "load\x0a\x09self commitHandler load: self package",
  31396. referencedClasses: [],
  31397. messageSends: ["load:", "commitHandler", "package"]
  31398. }),
  31399. $globals.PackageTransport);
  31400. $core.addMethod(
  31401. $core.method({
  31402. selector: "package",
  31403. protocol: "accessing",
  31404. fn: function (){
  31405. var self=this;
  31406. return self["@package"];
  31407. },
  31408. args: [],
  31409. source: "package\x0a\x09^ package",
  31410. referencedClasses: [],
  31411. messageSends: []
  31412. }),
  31413. $globals.PackageTransport);
  31414. $core.addMethod(
  31415. $core.method({
  31416. selector: "package:",
  31417. protocol: "accessing",
  31418. fn: function (aPackage){
  31419. var self=this;
  31420. self["@package"]=aPackage;
  31421. return self;
  31422. },
  31423. args: ["aPackage"],
  31424. source: "package: aPackage\x0a\x09package := aPackage",
  31425. referencedClasses: [],
  31426. messageSends: []
  31427. }),
  31428. $globals.PackageTransport);
  31429. $core.addMethod(
  31430. $core.method({
  31431. selector: "setupFromJson:",
  31432. protocol: "initialization",
  31433. fn: function (anObject){
  31434. var self=this;
  31435. return self;
  31436. },
  31437. args: ["anObject"],
  31438. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  31439. referencedClasses: [],
  31440. messageSends: []
  31441. }),
  31442. $globals.PackageTransport);
  31443. $core.addMethod(
  31444. $core.method({
  31445. selector: "type",
  31446. protocol: "accessing",
  31447. fn: function (){
  31448. var self=this;
  31449. return $core.withContext(function($ctx1) {
  31450. return $recv(self._class())._type();
  31451. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  31452. },
  31453. args: [],
  31454. source: "type\x0a\x09^ self class type",
  31455. referencedClasses: [],
  31456. messageSends: ["type", "class"]
  31457. }),
  31458. $globals.PackageTransport);
  31459. $globals.PackageTransport.klass.iVarNames = ["registry"];
  31460. $core.addMethod(
  31461. $core.method({
  31462. selector: "classRegisteredFor:",
  31463. protocol: "accessing",
  31464. fn: function (aString){
  31465. var self=this;
  31466. return $core.withContext(function($ctx1) {
  31467. return $recv(self["@registry"])._at_(aString);
  31468. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  31469. },
  31470. args: ["aString"],
  31471. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  31472. referencedClasses: [],
  31473. messageSends: ["at:"]
  31474. }),
  31475. $globals.PackageTransport.klass);
  31476. $core.addMethod(
  31477. $core.method({
  31478. selector: "defaultType",
  31479. protocol: "accessing",
  31480. fn: function (){
  31481. var self=this;
  31482. return $core.withContext(function($ctx1) {
  31483. return $recv($globals.AmdPackageTransport)._type();
  31484. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  31485. },
  31486. args: [],
  31487. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  31488. referencedClasses: ["AmdPackageTransport"],
  31489. messageSends: ["type"]
  31490. }),
  31491. $globals.PackageTransport.klass);
  31492. $core.addMethod(
  31493. $core.method({
  31494. selector: "for:",
  31495. protocol: "instance creation",
  31496. fn: function (aString){
  31497. var self=this;
  31498. return $core.withContext(function($ctx1) {
  31499. return $recv(self._classRegisteredFor_(aString))._new();
  31500. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  31501. },
  31502. args: ["aString"],
  31503. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  31504. referencedClasses: [],
  31505. messageSends: ["new", "classRegisteredFor:"]
  31506. }),
  31507. $globals.PackageTransport.klass);
  31508. $core.addMethod(
  31509. $core.method({
  31510. selector: "fromJson:",
  31511. protocol: "instance creation",
  31512. fn: function (anObject){
  31513. var self=this;
  31514. return $core.withContext(function($ctx1) {
  31515. var $1,$2,$receiver;
  31516. if(($receiver = anObject) == null || $receiver.isNil){
  31517. $1=self._for_(self._defaultType());
  31518. $ctx1.sendIdx["for:"]=1;
  31519. return $1;
  31520. } else {
  31521. anObject;
  31522. }
  31523. $2=self._for_($recv(anObject)._type());
  31524. $recv($2)._setupFromJson_(anObject);
  31525. return $recv($2)._yourself();
  31526. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  31527. },
  31528. args: ["anObject"],
  31529. 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",
  31530. referencedClasses: [],
  31531. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  31532. }),
  31533. $globals.PackageTransport.klass);
  31534. $core.addMethod(
  31535. $core.method({
  31536. selector: "initialize",
  31537. protocol: "initialization",
  31538. fn: function (){
  31539. var self=this;
  31540. return $core.withContext(function($ctx1) {
  31541. var $1;
  31542. (
  31543. $ctx1.supercall = true,
  31544. ($globals.PackageTransport.klass.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  31545. $ctx1.supercall = false;
  31546. $1=self.__eq_eq($globals.PackageTransport);
  31547. if($core.assert($1)){
  31548. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  31549. self["@registry"];
  31550. } else {
  31551. self._register();
  31552. }
  31553. return self;
  31554. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  31555. },
  31556. args: [],
  31557. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  31558. referencedClasses: ["PackageTransport"],
  31559. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  31560. }),
  31561. $globals.PackageTransport.klass);
  31562. $core.addMethod(
  31563. $core.method({
  31564. selector: "register",
  31565. protocol: "registration",
  31566. fn: function (){
  31567. var self=this;
  31568. return $core.withContext(function($ctx1) {
  31569. $recv($globals.PackageTransport)._register_(self);
  31570. return self;
  31571. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  31572. },
  31573. args: [],
  31574. source: "register\x0a\x09PackageTransport register: self",
  31575. referencedClasses: ["PackageTransport"],
  31576. messageSends: ["register:"]
  31577. }),
  31578. $globals.PackageTransport.klass);
  31579. $core.addMethod(
  31580. $core.method({
  31581. selector: "register:",
  31582. protocol: "registration",
  31583. fn: function (aClass){
  31584. var self=this;
  31585. return $core.withContext(function($ctx1) {
  31586. var $1,$receiver;
  31587. $1=$recv(aClass)._type();
  31588. $ctx1.sendIdx["type"]=1;
  31589. if(($receiver = $1) == null || $receiver.isNil){
  31590. $1;
  31591. } else {
  31592. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  31593. }
  31594. return self;
  31595. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  31596. },
  31597. args: ["aClass"],
  31598. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  31599. referencedClasses: [],
  31600. messageSends: ["ifNotNil:", "type", "at:put:"]
  31601. }),
  31602. $globals.PackageTransport.klass);
  31603. $core.addMethod(
  31604. $core.method({
  31605. selector: "type",
  31606. protocol: "accessing",
  31607. fn: function (){
  31608. var self=this;
  31609. return nil;
  31610. },
  31611. args: [],
  31612. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  31613. referencedClasses: [],
  31614. messageSends: []
  31615. }),
  31616. $globals.PackageTransport.klass);
  31617. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  31618. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  31619. $core.addMethod(
  31620. $core.method({
  31621. selector: "asJavaScriptObject",
  31622. protocol: "converting",
  31623. fn: function (){
  31624. var self=this;
  31625. return $core.withContext(function($ctx1) {
  31626. var $1;
  31627. $1=(
  31628. $ctx1.supercall = true,
  31629. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($recv(self), []));
  31630. $ctx1.supercall = false;
  31631. $recv($1)._at_put_("amdNamespace",self._namespace());
  31632. return $recv($1)._yourself();
  31633. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  31634. },
  31635. args: [],
  31636. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  31637. referencedClasses: [],
  31638. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  31639. }),
  31640. $globals.AmdPackageTransport);
  31641. $core.addMethod(
  31642. $core.method({
  31643. selector: "commitHandlerClass",
  31644. protocol: "accessing",
  31645. fn: function (){
  31646. var self=this;
  31647. return $globals.AmdPackageHandler;
  31648. },
  31649. args: [],
  31650. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  31651. referencedClasses: ["AmdPackageHandler"],
  31652. messageSends: []
  31653. }),
  31654. $globals.AmdPackageTransport);
  31655. $core.addMethod(
  31656. $core.method({
  31657. selector: "defaultNamespace",
  31658. protocol: "defaults",
  31659. fn: function (){
  31660. var self=this;
  31661. return $core.withContext(function($ctx1) {
  31662. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  31663. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  31664. },
  31665. args: [],
  31666. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  31667. referencedClasses: ["Smalltalk"],
  31668. messageSends: ["defaultAmdNamespace"]
  31669. }),
  31670. $globals.AmdPackageTransport);
  31671. $core.addMethod(
  31672. $core.method({
  31673. selector: "definition",
  31674. protocol: "accessing",
  31675. fn: function (){
  31676. var self=this;
  31677. return $core.withContext(function($ctx1) {
  31678. return $recv($globals.String)._streamContents_((function(stream){
  31679. return $core.withContext(function($ctx2) {
  31680. $recv(stream)._write_([$recv(self._class())._name()," namespace: "]);
  31681. return $recv(stream)._print_(self._namespace());
  31682. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  31683. }));
  31684. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  31685. },
  31686. args: [],
  31687. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  31688. referencedClasses: ["String"],
  31689. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  31690. }),
  31691. $globals.AmdPackageTransport);
  31692. $core.addMethod(
  31693. $core.method({
  31694. selector: "namespace",
  31695. protocol: "accessing",
  31696. fn: function (){
  31697. var self=this;
  31698. return $core.withContext(function($ctx1) {
  31699. var $1,$receiver;
  31700. $1=self["@namespace"];
  31701. if(($receiver = $1) == null || $receiver.isNil){
  31702. return self._defaultNamespace();
  31703. } else {
  31704. return $1;
  31705. }
  31706. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  31707. },
  31708. args: [],
  31709. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  31710. referencedClasses: [],
  31711. messageSends: ["ifNil:", "defaultNamespace"]
  31712. }),
  31713. $globals.AmdPackageTransport);
  31714. $core.addMethod(
  31715. $core.method({
  31716. selector: "namespace:",
  31717. protocol: "accessing",
  31718. fn: function (aString){
  31719. var self=this;
  31720. self["@namespace"]=aString;
  31721. return self;
  31722. },
  31723. args: ["aString"],
  31724. source: "namespace: aString\x0a\x09namespace := aString",
  31725. referencedClasses: [],
  31726. messageSends: []
  31727. }),
  31728. $globals.AmdPackageTransport);
  31729. $core.addMethod(
  31730. $core.method({
  31731. selector: "printOn:",
  31732. protocol: "printing",
  31733. fn: function (aStream){
  31734. var self=this;
  31735. return $core.withContext(function($ctx1) {
  31736. (
  31737. $ctx1.supercall = true,
  31738. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  31739. $ctx1.supercall = false;
  31740. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  31741. $ctx1.sendIdx["nextPutAll:"]=1;
  31742. $recv(aStream)._nextPutAll_(self._namespace());
  31743. $ctx1.sendIdx["nextPutAll:"]=2;
  31744. $recv(aStream)._nextPutAll_(")");
  31745. return self;
  31746. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  31747. },
  31748. args: ["aStream"],
  31749. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  31750. referencedClasses: [],
  31751. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  31752. }),
  31753. $globals.AmdPackageTransport);
  31754. $core.addMethod(
  31755. $core.method({
  31756. selector: "setPath:",
  31757. protocol: "actions",
  31758. fn: function (aString){
  31759. var self=this;
  31760. return $core.withContext(function($ctx1) {
  31761. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  31762. return self;
  31763. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  31764. },
  31765. args: ["aString"],
  31766. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  31767. referencedClasses: [],
  31768. messageSends: ["value:", "basicAt:", "namespace"]
  31769. }),
  31770. $globals.AmdPackageTransport);
  31771. $core.addMethod(
  31772. $core.method({
  31773. selector: "setupFromJson:",
  31774. protocol: "initialization",
  31775. fn: function (anObject){
  31776. var self=this;
  31777. return $core.withContext(function($ctx1) {
  31778. self._namespace_($recv(anObject)._at_("amdNamespace"));
  31779. return self;
  31780. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  31781. },
  31782. args: ["anObject"],
  31783. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  31784. referencedClasses: [],
  31785. messageSends: ["namespace:", "at:"]
  31786. }),
  31787. $globals.AmdPackageTransport);
  31788. $core.addMethod(
  31789. $core.method({
  31790. selector: "namespace:",
  31791. protocol: "instance creation",
  31792. fn: function (aString){
  31793. var self=this;
  31794. return $core.withContext(function($ctx1) {
  31795. var $1;
  31796. $1=self._new();
  31797. $recv($1)._namespace_(aString);
  31798. return $recv($1)._yourself();
  31799. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  31800. },
  31801. args: ["aString"],
  31802. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  31803. referencedClasses: [],
  31804. messageSends: ["namespace:", "new", "yourself"]
  31805. }),
  31806. $globals.AmdPackageTransport.klass);
  31807. $core.addMethod(
  31808. $core.method({
  31809. selector: "type",
  31810. protocol: "accessing",
  31811. fn: function (){
  31812. var self=this;
  31813. return "amd";
  31814. },
  31815. args: [],
  31816. source: "type\x0a\x09^ 'amd'",
  31817. referencedClasses: [],
  31818. messageSends: []
  31819. }),
  31820. $globals.AmdPackageTransport.klass);
  31821. $core.addMethod(
  31822. $core.method({
  31823. selector: "commentStamp",
  31824. protocol: "*Platform-ImportExport",
  31825. fn: function (){
  31826. var self=this;
  31827. return $core.withContext(function($ctx1) {
  31828. var $1;
  31829. $1=$recv($globals.ClassCommentReader)._new();
  31830. $recv($1)._class_(self);
  31831. return $recv($1)._yourself();
  31832. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.BehaviorBody)});
  31833. },
  31834. args: [],
  31835. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  31836. referencedClasses: ["ClassCommentReader"],
  31837. messageSends: ["class:", "new", "yourself"]
  31838. }),
  31839. $globals.BehaviorBody);
  31840. $core.addMethod(
  31841. $core.method({
  31842. selector: "commentStamp:prior:",
  31843. protocol: "*Platform-ImportExport",
  31844. fn: function (aStamp,prior){
  31845. var self=this;
  31846. return $core.withContext(function($ctx1) {
  31847. return self._commentStamp();
  31848. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.BehaviorBody)});
  31849. },
  31850. args: ["aStamp", "prior"],
  31851. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  31852. referencedClasses: [],
  31853. messageSends: ["commentStamp"]
  31854. }),
  31855. $globals.BehaviorBody);
  31856. $core.addMethod(
  31857. $core.method({
  31858. selector: "exportBehaviorDefinitionTo:using:",
  31859. protocol: "*Platform-ImportExport",
  31860. fn: function (aStream,anExporter){
  31861. var self=this;
  31862. return $core.withContext(function($ctx1) {
  31863. self._subclassResponsibility();
  31864. return self;
  31865. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.BehaviorBody)});
  31866. },
  31867. args: ["aStream", "anExporter"],
  31868. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09self subclassResponsibility",
  31869. referencedClasses: [],
  31870. messageSends: ["subclassResponsibility"]
  31871. }),
  31872. $globals.BehaviorBody);
  31873. $core.addMethod(
  31874. $core.method({
  31875. selector: "methodsFor:",
  31876. protocol: "*Platform-ImportExport",
  31877. fn: function (aString){
  31878. var self=this;
  31879. return $core.withContext(function($ctx1) {
  31880. var $1;
  31881. $1=$recv($globals.ClassProtocolReader)._new();
  31882. $recv($1)._class_category_(self,aString);
  31883. return $recv($1)._yourself();
  31884. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.BehaviorBody)});
  31885. },
  31886. args: ["aString"],
  31887. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  31888. referencedClasses: ["ClassProtocolReader"],
  31889. messageSends: ["class:category:", "new", "yourself"]
  31890. }),
  31891. $globals.BehaviorBody);
  31892. $core.addMethod(
  31893. $core.method({
  31894. selector: "methodsFor:stamp:",
  31895. protocol: "*Platform-ImportExport",
  31896. fn: function (aString,aStamp){
  31897. var self=this;
  31898. return $core.withContext(function($ctx1) {
  31899. return self._methodsFor_(aString);
  31900. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.BehaviorBody)});
  31901. },
  31902. args: ["aString", "aStamp"],
  31903. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  31904. referencedClasses: [],
  31905. messageSends: ["methodsFor:"]
  31906. }),
  31907. $globals.BehaviorBody);
  31908. $core.addMethod(
  31909. $core.method({
  31910. selector: "exportBehaviorDefinitionTo:using:",
  31911. protocol: "*Platform-ImportExport",
  31912. fn: function (aStream,anExporter){
  31913. var self=this;
  31914. return $core.withContext(function($ctx1) {
  31915. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  31916. return self;
  31917. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  31918. },
  31919. args: ["aStream", "anExporter"],
  31920. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  31921. referencedClasses: [],
  31922. messageSends: ["exportDefinitionOf:on:"]
  31923. }),
  31924. $globals.Class);
  31925. $core.addMethod(
  31926. $core.method({
  31927. selector: "exportBehaviorDefinitionTo:using:",
  31928. protocol: "*Platform-ImportExport",
  31929. fn: function (aStream,anExporter){
  31930. var self=this;
  31931. return $core.withContext(function($ctx1) {
  31932. $recv(anExporter)._exportMetaDefinitionOf_on_(self._instanceClass(),aStream);
  31933. return self;
  31934. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  31935. },
  31936. args: ["aStream", "anExporter"],
  31937. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  31938. referencedClasses: [],
  31939. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  31940. }),
  31941. $globals.Metaclass);
  31942. $core.addMethod(
  31943. $core.method({
  31944. selector: "commit",
  31945. protocol: "*Platform-ImportExport",
  31946. fn: function (){
  31947. var self=this;
  31948. return $core.withContext(function($ctx1) {
  31949. return $recv(self._transport())._commit();
  31950. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  31951. },
  31952. args: [],
  31953. source: "commit\x0a\x09^ self transport commit",
  31954. referencedClasses: [],
  31955. messageSends: ["commit", "transport"]
  31956. }),
  31957. $globals.Package);
  31958. $core.addMethod(
  31959. $core.method({
  31960. selector: "load",
  31961. protocol: "*Platform-ImportExport",
  31962. fn: function (){
  31963. var self=this;
  31964. return $core.withContext(function($ctx1) {
  31965. return $recv(self._transport())._load();
  31966. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  31967. },
  31968. args: [],
  31969. source: "load\x0a\x09^ self transport load",
  31970. referencedClasses: [],
  31971. messageSends: ["load", "transport"]
  31972. }),
  31973. $globals.Package);
  31974. $core.addMethod(
  31975. $core.method({
  31976. selector: "loadFromNamespace:",
  31977. protocol: "*Platform-ImportExport",
  31978. fn: function (aString){
  31979. var self=this;
  31980. return $core.withContext(function($ctx1) {
  31981. var $1;
  31982. $1=self._transport();
  31983. $recv($1)._namespace_(aString);
  31984. return $recv($1)._load();
  31985. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  31986. },
  31987. args: ["aString"],
  31988. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  31989. referencedClasses: [],
  31990. messageSends: ["namespace:", "transport", "load"]
  31991. }),
  31992. $globals.Package);
  31993. $core.addMethod(
  31994. $core.method({
  31995. selector: "load:",
  31996. protocol: "*Platform-ImportExport",
  31997. fn: function (aPackageName){
  31998. var self=this;
  31999. return $core.withContext(function($ctx1) {
  32000. $recv(self._named_(aPackageName))._load();
  32001. return self;
  32002. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  32003. },
  32004. args: ["aPackageName"],
  32005. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  32006. referencedClasses: [],
  32007. messageSends: ["load", "named:"]
  32008. }),
  32009. $globals.Package.klass);
  32010. $core.addMethod(
  32011. $core.method({
  32012. selector: "load:fromNamespace:",
  32013. protocol: "*Platform-ImportExport",
  32014. fn: function (aPackageName,aString){
  32015. var self=this;
  32016. return $core.withContext(function($ctx1) {
  32017. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  32018. return self;
  32019. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  32020. },
  32021. args: ["aPackageName", "aString"],
  32022. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  32023. referencedClasses: [],
  32024. messageSends: ["loadFromNamespace:", "named:"]
  32025. }),
  32026. $globals.Package.klass);
  32027. $core.addMethod(
  32028. $core.method({
  32029. selector: "exportBehaviorDefinitionTo:using:",
  32030. protocol: "*Platform-ImportExport",
  32031. fn: function (aStream,anExporter){
  32032. var self=this;
  32033. return $core.withContext(function($ctx1) {
  32034. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  32035. return self;
  32036. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  32037. },
  32038. args: ["aStream", "anExporter"],
  32039. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  32040. referencedClasses: [],
  32041. messageSends: ["exportTraitDefinitionOf:on:"]
  32042. }),
  32043. $globals.Trait);
  32044. });
  32045. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  32046. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  32047. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  32048. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  32049. $core.addPackage("Compiler-Core");
  32050. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  32051. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  32052. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  32053. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  32054. $core.addMethod(
  32055. $core.method({
  32056. selector: "compileNode:",
  32057. protocol: "compiling",
  32058. fn: function (aNode){
  32059. var self=this;
  32060. return $core.withContext(function($ctx1) {
  32061. return $recv(self._transformers())._inject_into_(aNode,(function(input,transformer){
  32062. return $core.withContext(function($ctx2) {
  32063. return $recv(transformer)._value_(input);
  32064. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  32065. }));
  32066. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  32067. },
  32068. args: ["aNode"],
  32069. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  32070. referencedClasses: [],
  32071. messageSends: ["inject:into:", "transformers", "value:"]
  32072. }),
  32073. $globals.AbstractCodeGenerator);
  32074. $core.addMethod(
  32075. $core.method({
  32076. selector: "currentClass",
  32077. protocol: "accessing",
  32078. fn: function (){
  32079. var self=this;
  32080. return self["@currentClass"];
  32081. },
  32082. args: [],
  32083. source: "currentClass\x0a\x09^ currentClass",
  32084. referencedClasses: [],
  32085. messageSends: []
  32086. }),
  32087. $globals.AbstractCodeGenerator);
  32088. $core.addMethod(
  32089. $core.method({
  32090. selector: "currentClass:",
  32091. protocol: "accessing",
  32092. fn: function (aClass){
  32093. var self=this;
  32094. self["@currentClass"]=aClass;
  32095. return self;
  32096. },
  32097. args: ["aClass"],
  32098. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  32099. referencedClasses: [],
  32100. messageSends: []
  32101. }),
  32102. $globals.AbstractCodeGenerator);
  32103. $core.addMethod(
  32104. $core.method({
  32105. selector: "currentPackage",
  32106. protocol: "accessing",
  32107. fn: function (){
  32108. var self=this;
  32109. return self["@currentPackage"];
  32110. },
  32111. args: [],
  32112. source: "currentPackage\x0a\x09^ currentPackage",
  32113. referencedClasses: [],
  32114. messageSends: []
  32115. }),
  32116. $globals.AbstractCodeGenerator);
  32117. $core.addMethod(
  32118. $core.method({
  32119. selector: "currentPackage:",
  32120. protocol: "accessing",
  32121. fn: function (anObject){
  32122. var self=this;
  32123. self["@currentPackage"]=anObject;
  32124. return self;
  32125. },
  32126. args: ["anObject"],
  32127. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  32128. referencedClasses: [],
  32129. messageSends: []
  32130. }),
  32131. $globals.AbstractCodeGenerator);
  32132. $core.addMethod(
  32133. $core.method({
  32134. selector: "pseudoVariables",
  32135. protocol: "accessing",
  32136. fn: function (){
  32137. var self=this;
  32138. return $core.withContext(function($ctx1) {
  32139. return $recv($globals.Smalltalk)._pseudoVariableNames();
  32140. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  32141. },
  32142. args: [],
  32143. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  32144. referencedClasses: ["Smalltalk"],
  32145. messageSends: ["pseudoVariableNames"]
  32146. }),
  32147. $globals.AbstractCodeGenerator);
  32148. $core.addMethod(
  32149. $core.method({
  32150. selector: "source",
  32151. protocol: "accessing",
  32152. fn: function (){
  32153. var self=this;
  32154. return $core.withContext(function($ctx1) {
  32155. var $1,$receiver;
  32156. $1=self["@source"];
  32157. if(($receiver = $1) == null || $receiver.isNil){
  32158. return "";
  32159. } else {
  32160. return $1;
  32161. }
  32162. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  32163. },
  32164. args: [],
  32165. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32166. referencedClasses: [],
  32167. messageSends: ["ifNil:"]
  32168. }),
  32169. $globals.AbstractCodeGenerator);
  32170. $core.addMethod(
  32171. $core.method({
  32172. selector: "source:",
  32173. protocol: "accessing",
  32174. fn: function (aString){
  32175. var self=this;
  32176. self["@source"]=aString;
  32177. return self;
  32178. },
  32179. args: ["aString"],
  32180. source: "source: aString\x0a\x09source := aString",
  32181. referencedClasses: [],
  32182. messageSends: []
  32183. }),
  32184. $globals.AbstractCodeGenerator);
  32185. $core.addMethod(
  32186. $core.method({
  32187. selector: "transformers",
  32188. protocol: "compiling",
  32189. fn: function (){
  32190. var self=this;
  32191. var dict;
  32192. return $core.withContext(function($ctx1) {
  32193. dict=self._transformersDictionary();
  32194. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  32195. return $core.withContext(function($ctx2) {
  32196. return $recv(dict)._at_(each);
  32197. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32198. }));
  32199. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  32200. },
  32201. args: [],
  32202. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  32203. referencedClasses: [],
  32204. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  32205. }),
  32206. $globals.AbstractCodeGenerator);
  32207. $core.addMethod(
  32208. $core.method({
  32209. selector: "transformersDictionary",
  32210. protocol: "compiling",
  32211. fn: function (){
  32212. var self=this;
  32213. return $core.withContext(function($ctx1) {
  32214. self._subclassResponsibility();
  32215. return self;
  32216. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  32217. },
  32218. args: [],
  32219. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  32220. referencedClasses: [],
  32221. messageSends: ["subclassResponsibility"]
  32222. }),
  32223. $globals.AbstractCodeGenerator);
  32224. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  32225. $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.";
  32226. $core.addMethod(
  32227. $core.method({
  32228. selector: "irTranslator",
  32229. protocol: "compiling",
  32230. fn: function (){
  32231. var self=this;
  32232. return $core.withContext(function($ctx1) {
  32233. var $1;
  32234. $1=$recv(self._irTranslatorClass())._new();
  32235. $recv($1)._currentClass_(self._currentClass());
  32236. return $recv($1)._yourself();
  32237. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  32238. },
  32239. args: [],
  32240. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  32241. referencedClasses: [],
  32242. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  32243. }),
  32244. $globals.CodeGenerator);
  32245. $core.addMethod(
  32246. $core.method({
  32247. selector: "irTranslatorClass",
  32248. protocol: "compiling",
  32249. fn: function (){
  32250. var self=this;
  32251. return $globals.IRJSTranslator;
  32252. },
  32253. args: [],
  32254. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  32255. referencedClasses: ["IRJSTranslator"],
  32256. messageSends: []
  32257. }),
  32258. $globals.CodeGenerator);
  32259. $core.addMethod(
  32260. $core.method({
  32261. selector: "semanticAnalyzer",
  32262. protocol: "compiling",
  32263. fn: function (){
  32264. var self=this;
  32265. return $core.withContext(function($ctx1) {
  32266. var $1;
  32267. $1=$recv($globals.SemanticAnalyzer)._on_(self._currentClass());
  32268. $recv($1)._thePackage_(self._currentPackage());
  32269. return $recv($1)._yourself();
  32270. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  32271. },
  32272. args: [],
  32273. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  32274. referencedClasses: ["SemanticAnalyzer"],
  32275. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  32276. }),
  32277. $globals.CodeGenerator);
  32278. $core.addMethod(
  32279. $core.method({
  32280. selector: "transformersDictionary",
  32281. protocol: "compiling",
  32282. fn: function (){
  32283. var self=this;
  32284. return $core.withContext(function($ctx1) {
  32285. var $1,$2,$receiver;
  32286. $1=self["@transformersDictionary"];
  32287. if(($receiver = $1) == null || $receiver.isNil){
  32288. $2=$recv($globals.Dictionary)._new();
  32289. $recv($2)._at_put_("2000-semantic",self._semanticAnalyzer());
  32290. $ctx1.sendIdx["at:put:"]=1;
  32291. $recv($2)._at_put_("5000-astToIr",self._translator());
  32292. $ctx1.sendIdx["at:put:"]=2;
  32293. $recv($2)._at_put_("8000-irToJs",self._irTranslator());
  32294. self["@transformersDictionary"]=$recv($2)._yourself();
  32295. return self["@transformersDictionary"];
  32296. } else {
  32297. return $1;
  32298. }
  32299. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  32300. },
  32301. args: [],
  32302. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  32303. referencedClasses: ["Dictionary"],
  32304. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  32305. }),
  32306. $globals.CodeGenerator);
  32307. $core.addMethod(
  32308. $core.method({
  32309. selector: "translator",
  32310. protocol: "compiling",
  32311. fn: function (){
  32312. var self=this;
  32313. return $core.withContext(function($ctx1) {
  32314. var $1;
  32315. $1=$recv($globals.IRASTTranslator)._new();
  32316. $recv($1)._source_(self._source());
  32317. $recv($1)._theClass_(self._currentClass());
  32318. return $recv($1)._yourself();
  32319. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  32320. },
  32321. args: [],
  32322. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  32323. referencedClasses: ["IRASTTranslator"],
  32324. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  32325. }),
  32326. $globals.CodeGenerator);
  32327. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "unknownVariables", "codeGeneratorClass"], "Compiler-Core");
  32328. $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`";
  32329. $core.addMethod(
  32330. $core.method({
  32331. selector: "codeGeneratorClass",
  32332. protocol: "accessing",
  32333. fn: function (){
  32334. var self=this;
  32335. return $core.withContext(function($ctx1) {
  32336. var $1,$receiver;
  32337. $1=self["@codeGeneratorClass"];
  32338. if(($receiver = $1) == null || $receiver.isNil){
  32339. return $globals.InliningCodeGenerator;
  32340. } else {
  32341. return $1;
  32342. }
  32343. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  32344. },
  32345. args: [],
  32346. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  32347. referencedClasses: ["InliningCodeGenerator"],
  32348. messageSends: ["ifNil:"]
  32349. }),
  32350. $globals.Compiler);
  32351. $core.addMethod(
  32352. $core.method({
  32353. selector: "codeGeneratorClass:",
  32354. protocol: "accessing",
  32355. fn: function (aClass){
  32356. var self=this;
  32357. self["@codeGeneratorClass"]=aClass;
  32358. return self;
  32359. },
  32360. args: ["aClass"],
  32361. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  32362. referencedClasses: [],
  32363. messageSends: []
  32364. }),
  32365. $globals.Compiler);
  32366. $core.addMethod(
  32367. $core.method({
  32368. selector: "compile:forClass:protocol:",
  32369. protocol: "compiling",
  32370. fn: function (aString,aClass,anotherString){
  32371. var self=this;
  32372. return $core.withContext(function($ctx1) {
  32373. self._source_(aString);
  32374. return self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  32375. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  32376. },
  32377. args: ["aString", "aClass", "anotherString"],
  32378. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)",
  32379. referencedClasses: [],
  32380. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  32381. }),
  32382. $globals.Compiler);
  32383. $core.addMethod(
  32384. $core.method({
  32385. selector: "compileExpression:on:",
  32386. protocol: "compiling",
  32387. fn: function (aString,anObject){
  32388. var self=this;
  32389. return $core.withContext(function($ctx1) {
  32390. var $1;
  32391. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  32392. $ctx1.sendIdx[","]=1;
  32393. return self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  32394. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  32395. },
  32396. args: ["aString", "anObject"],
  32397. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  32398. referencedClasses: [],
  32399. messageSends: ["compile:forClass:protocol:", ",", "class"]
  32400. }),
  32401. $globals.Compiler);
  32402. $core.addMethod(
  32403. $core.method({
  32404. selector: "compileNode:",
  32405. protocol: "compiling",
  32406. fn: function (aNode){
  32407. var self=this;
  32408. var generator,result;
  32409. return $core.withContext(function($ctx1) {
  32410. var $1;
  32411. generator=$recv(self._codeGeneratorClass())._new();
  32412. $1=generator;
  32413. $recv($1)._source_(self._source());
  32414. $recv($1)._currentClass_(self._currentClass());
  32415. $recv($1)._currentPackage_(self._currentPackage());
  32416. result=$recv(generator)._compileNode_(aNode);
  32417. self._unknownVariables_([]);
  32418. return result;
  32419. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  32420. },
  32421. args: ["aNode"],
  32422. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result",
  32423. referencedClasses: [],
  32424. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  32425. }),
  32426. $globals.Compiler);
  32427. $core.addMethod(
  32428. $core.method({
  32429. selector: "compileNode:forClass:package:",
  32430. protocol: "compiling",
  32431. fn: function (aNode,aClass,aPackage){
  32432. var self=this;
  32433. return $core.withContext(function($ctx1) {
  32434. self._currentClass_(aClass);
  32435. self._currentPackage_(aPackage);
  32436. return self._compileNode_(aNode);
  32437. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  32438. },
  32439. args: ["aNode", "aClass", "aPackage"],
  32440. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  32441. referencedClasses: [],
  32442. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  32443. }),
  32444. $globals.Compiler);
  32445. $core.addMethod(
  32446. $core.method({
  32447. selector: "currentClass",
  32448. protocol: "accessing",
  32449. fn: function (){
  32450. var self=this;
  32451. return self["@currentClass"];
  32452. },
  32453. args: [],
  32454. source: "currentClass\x0a\x09^ currentClass",
  32455. referencedClasses: [],
  32456. messageSends: []
  32457. }),
  32458. $globals.Compiler);
  32459. $core.addMethod(
  32460. $core.method({
  32461. selector: "currentClass:",
  32462. protocol: "accessing",
  32463. fn: function (aClass){
  32464. var self=this;
  32465. self["@currentClass"]=aClass;
  32466. return self;
  32467. },
  32468. args: ["aClass"],
  32469. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  32470. referencedClasses: [],
  32471. messageSends: []
  32472. }),
  32473. $globals.Compiler);
  32474. $core.addMethod(
  32475. $core.method({
  32476. selector: "currentPackage",
  32477. protocol: "accessing",
  32478. fn: function (){
  32479. var self=this;
  32480. return self["@currentPackage"];
  32481. },
  32482. args: [],
  32483. source: "currentPackage\x0a\x09^ currentPackage",
  32484. referencedClasses: [],
  32485. messageSends: []
  32486. }),
  32487. $globals.Compiler);
  32488. $core.addMethod(
  32489. $core.method({
  32490. selector: "currentPackage:",
  32491. protocol: "accessing",
  32492. fn: function (anObject){
  32493. var self=this;
  32494. self["@currentPackage"]=anObject;
  32495. return self;
  32496. },
  32497. args: ["anObject"],
  32498. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  32499. referencedClasses: [],
  32500. messageSends: []
  32501. }),
  32502. $globals.Compiler);
  32503. $core.addMethod(
  32504. $core.method({
  32505. selector: "eval:",
  32506. protocol: "compiling",
  32507. fn: function (aString){
  32508. var self=this;
  32509. return $core.withContext(function($ctx1) {
  32510. return eval(aString);
  32511. return self;
  32512. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  32513. },
  32514. args: ["aString"],
  32515. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  32516. referencedClasses: [],
  32517. messageSends: []
  32518. }),
  32519. $globals.Compiler);
  32520. $core.addMethod(
  32521. $core.method({
  32522. selector: "eval:forPackage:",
  32523. protocol: "compiling",
  32524. fn: function (aString,aPackage){
  32525. var self=this;
  32526. return $core.withContext(function($ctx1) {
  32527. return aPackage && aPackage.innerEval
  32528. ? aPackage.innerEval(aString)
  32529. : eval(aString);
  32530. return self;
  32531. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  32532. },
  32533. args: ["aString", "aPackage"],
  32534. source: "eval: aString forPackage: aPackage\x0a\x09<inlineJS: 'return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)'>",
  32535. referencedClasses: [],
  32536. messageSends: []
  32537. }),
  32538. $globals.Compiler);
  32539. $core.addMethod(
  32540. $core.method({
  32541. selector: "evaluateExpression:",
  32542. protocol: "compiling",
  32543. fn: function (aString){
  32544. var self=this;
  32545. return $core.withContext(function($ctx1) {
  32546. return self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  32547. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  32548. },
  32549. args: ["aString"],
  32550. 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",
  32551. referencedClasses: ["DoIt"],
  32552. messageSends: ["evaluateExpression:on:", "new"]
  32553. }),
  32554. $globals.Compiler);
  32555. $core.addMethod(
  32556. $core.method({
  32557. selector: "evaluateExpression:on:",
  32558. protocol: "compiling",
  32559. fn: function (aString,anObject){
  32560. var self=this;
  32561. var result,method;
  32562. return $core.withContext(function($ctx1) {
  32563. var $1;
  32564. method=self._eval_(self._compileExpression_on_(aString,anObject));
  32565. $recv(method)._protocol_("**xxxDoIt");
  32566. $1=$recv(anObject)._class();
  32567. $ctx1.sendIdx["class"]=1;
  32568. $recv($1)._addCompiledMethod_(method);
  32569. result=$recv(anObject)._xxxDoIt();
  32570. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  32571. return result;
  32572. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  32573. },
  32574. args: ["aString", "anObject"],
  32575. 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",
  32576. referencedClasses: [],
  32577. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  32578. }),
  32579. $globals.Compiler);
  32580. $core.addMethod(
  32581. $core.method({
  32582. selector: "install:forClass:protocol:",
  32583. protocol: "compiling",
  32584. fn: function (aString,aBehavior,anotherString){
  32585. var self=this;
  32586. var compiledMethod;
  32587. return $core.withContext(function($ctx1) {
  32588. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  32589. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  32590. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  32591. },
  32592. args: ["aString", "aBehavior", "anotherString"],
  32593. 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",
  32594. referencedClasses: ["ClassBuilder"],
  32595. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  32596. }),
  32597. $globals.Compiler);
  32598. $core.addMethod(
  32599. $core.method({
  32600. selector: "parse:",
  32601. protocol: "compiling",
  32602. fn: function (aString){
  32603. var self=this;
  32604. return $core.withContext(function($ctx1) {
  32605. return $recv($globals.Smalltalk)._parse_(aString);
  32606. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  32607. },
  32608. args: ["aString"],
  32609. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  32610. referencedClasses: ["Smalltalk"],
  32611. messageSends: ["parse:"]
  32612. }),
  32613. $globals.Compiler);
  32614. $core.addMethod(
  32615. $core.method({
  32616. selector: "parseExpression:",
  32617. protocol: "compiling",
  32618. fn: function (aString){
  32619. var self=this;
  32620. return $core.withContext(function($ctx1) {
  32621. var $1;
  32622. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  32623. $ctx1.sendIdx[","]=1;
  32624. return self._parse_($1);
  32625. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  32626. },
  32627. args: ["aString"],
  32628. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  32629. referencedClasses: [],
  32630. messageSends: ["parse:", ","]
  32631. }),
  32632. $globals.Compiler);
  32633. $core.addMethod(
  32634. $core.method({
  32635. selector: "recompile:",
  32636. protocol: "compiling",
  32637. fn: function (aClass){
  32638. var self=this;
  32639. return $core.withContext(function($ctx1) {
  32640. var $1,$2,$3,$receiver;
  32641. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  32642. return $core.withContext(function($ctx2) {
  32643. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  32644. $ctx2.sendIdx["="]=1;
  32645. if($core.assert($1)){
  32646. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  32647. }
  32648. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32649. }),"Recompiling ".__comma($recv(aClass)._name()));
  32650. $2=$recv(aClass)._theMetaClass();
  32651. if(($receiver = $2) == null || $receiver.isNil){
  32652. $2;
  32653. } else {
  32654. var meta;
  32655. meta=$receiver;
  32656. $3=$recv(meta).__eq(aClass);
  32657. if(!$core.assert($3)){
  32658. self._recompile_(meta);
  32659. }
  32660. }
  32661. return self;
  32662. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  32663. },
  32664. args: ["aClass"],
  32665. 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 ] ]",
  32666. referencedClasses: [],
  32667. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  32668. }),
  32669. $globals.Compiler);
  32670. $core.addMethod(
  32671. $core.method({
  32672. selector: "recompileAll",
  32673. protocol: "compiling",
  32674. fn: function (){
  32675. var self=this;
  32676. return $core.withContext(function($ctx1) {
  32677. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  32678. return $core.withContext(function($ctx2) {
  32679. return self._recompile_(each);
  32680. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32681. }),"Compiling all classes...");
  32682. return self;
  32683. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  32684. },
  32685. args: [],
  32686. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  32687. referencedClasses: ["Smalltalk"],
  32688. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  32689. }),
  32690. $globals.Compiler);
  32691. $core.addMethod(
  32692. $core.method({
  32693. selector: "source",
  32694. protocol: "accessing",
  32695. fn: function (){
  32696. var self=this;
  32697. return $core.withContext(function($ctx1) {
  32698. var $1,$receiver;
  32699. $1=self["@source"];
  32700. if(($receiver = $1) == null || $receiver.isNil){
  32701. return "";
  32702. } else {
  32703. return $1;
  32704. }
  32705. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  32706. },
  32707. args: [],
  32708. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32709. referencedClasses: [],
  32710. messageSends: ["ifNil:"]
  32711. }),
  32712. $globals.Compiler);
  32713. $core.addMethod(
  32714. $core.method({
  32715. selector: "source:",
  32716. protocol: "accessing",
  32717. fn: function (aString){
  32718. var self=this;
  32719. self["@source"]=aString;
  32720. return self;
  32721. },
  32722. args: ["aString"],
  32723. source: "source: aString\x0a\x09source := aString",
  32724. referencedClasses: [],
  32725. messageSends: []
  32726. }),
  32727. $globals.Compiler);
  32728. $core.addMethod(
  32729. $core.method({
  32730. selector: "unknownVariables",
  32731. protocol: "accessing",
  32732. fn: function (){
  32733. var self=this;
  32734. return self["@unknownVariables"];
  32735. },
  32736. args: [],
  32737. source: "unknownVariables\x0a\x09^ unknownVariables",
  32738. referencedClasses: [],
  32739. messageSends: []
  32740. }),
  32741. $globals.Compiler);
  32742. $core.addMethod(
  32743. $core.method({
  32744. selector: "unknownVariables:",
  32745. protocol: "accessing",
  32746. fn: function (aCollection){
  32747. var self=this;
  32748. self["@unknownVariables"]=aCollection;
  32749. return self;
  32750. },
  32751. args: ["aCollection"],
  32752. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  32753. referencedClasses: [],
  32754. messageSends: []
  32755. }),
  32756. $globals.Compiler);
  32757. $core.addMethod(
  32758. $core.method({
  32759. selector: "recompile:",
  32760. protocol: "compiling",
  32761. fn: function (aClass){
  32762. var self=this;
  32763. return $core.withContext(function($ctx1) {
  32764. $recv(self._new())._recompile_(aClass);
  32765. return self;
  32766. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  32767. },
  32768. args: ["aClass"],
  32769. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  32770. referencedClasses: [],
  32771. messageSends: ["recompile:", "new"]
  32772. }),
  32773. $globals.Compiler.klass);
  32774. $core.addMethod(
  32775. $core.method({
  32776. selector: "recompileAll",
  32777. protocol: "compiling",
  32778. fn: function (){
  32779. var self=this;
  32780. return $core.withContext(function($ctx1) {
  32781. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  32782. return $core.withContext(function($ctx2) {
  32783. return self._recompile_(each);
  32784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32785. }));
  32786. return self;
  32787. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  32788. },
  32789. args: [],
  32790. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  32791. referencedClasses: ["Smalltalk"],
  32792. messageSends: ["do:", "classes", "recompile:"]
  32793. }),
  32794. $globals.Compiler.klass);
  32795. $core.addClass("CompilerError", $globals.Error, [], "Compiler-Core");
  32796. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  32797. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  32798. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  32799. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  32800. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  32801. $core.addMethod(
  32802. $core.method({
  32803. selector: "evaluate:context:",
  32804. protocol: "evaluating",
  32805. fn: function (aString,aContext){
  32806. var self=this;
  32807. var compiler,ast;
  32808. return $core.withContext(function($ctx1) {
  32809. var $1;
  32810. var $early={};
  32811. try {
  32812. compiler=$recv($globals.Compiler)._new();
  32813. $recv((function(){
  32814. return $core.withContext(function($ctx2) {
  32815. ast=$recv(compiler)._parseExpression_(aString);
  32816. return ast;
  32817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32818. }))._on_do_($globals.Error,(function(ex){
  32819. return $core.withContext(function($ctx2) {
  32820. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  32821. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  32822. }));
  32823. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  32824. $recv($1)._context_(aContext);
  32825. $recv($1)._visit_(ast);
  32826. return $recv(aContext)._evaluateNode_(ast);
  32827. }
  32828. catch(e) {if(e===$early)return e[0]; throw e}
  32829. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  32830. },
  32831. args: ["aString", "aContext"],
  32832. 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",
  32833. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  32834. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  32835. }),
  32836. $globals.Evaluator);
  32837. $core.addMethod(
  32838. $core.method({
  32839. selector: "evaluate:for:",
  32840. protocol: "evaluating",
  32841. fn: function (aString,anObject){
  32842. var self=this;
  32843. return $core.withContext(function($ctx1) {
  32844. return $recv(anObject)._evaluate_on_(aString,self);
  32845. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  32846. },
  32847. args: ["aString", "anObject"],
  32848. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  32849. referencedClasses: [],
  32850. messageSends: ["evaluate:on:"]
  32851. }),
  32852. $globals.Evaluator);
  32853. $core.addMethod(
  32854. $core.method({
  32855. selector: "evaluate:receiver:",
  32856. protocol: "evaluating",
  32857. fn: function (aString,anObject){
  32858. var self=this;
  32859. var compiler;
  32860. return $core.withContext(function($ctx1) {
  32861. var $early={};
  32862. try {
  32863. compiler=$recv($globals.Compiler)._new();
  32864. $recv((function(){
  32865. return $core.withContext(function($ctx2) {
  32866. return $recv(compiler)._parseExpression_(aString);
  32867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32868. }))._on_do_($globals.Error,(function(ex){
  32869. return $core.withContext(function($ctx2) {
  32870. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  32871. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  32872. }));
  32873. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  32874. }
  32875. catch(e) {if(e===$early)return e[0]; throw e}
  32876. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  32877. },
  32878. args: ["aString", "anObject"],
  32879. 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",
  32880. referencedClasses: ["Compiler", "Error", "Terminal"],
  32881. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  32882. }),
  32883. $globals.Evaluator);
  32884. $core.addMethod(
  32885. $core.method({
  32886. selector: "evaluate:for:",
  32887. protocol: "instance creation",
  32888. fn: function (aString,anObject){
  32889. var self=this;
  32890. return $core.withContext(function($ctx1) {
  32891. return $recv(self._new())._evaluate_for_(aString,anObject);
  32892. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  32893. },
  32894. args: ["aString", "anObject"],
  32895. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  32896. referencedClasses: [],
  32897. messageSends: ["evaluate:for:", "new"]
  32898. }),
  32899. $globals.Evaluator.klass);
  32900. $core.addMethod(
  32901. $core.method({
  32902. selector: "asVariableName",
  32903. protocol: "*Compiler-Core",
  32904. fn: function (){
  32905. var self=this;
  32906. return $core.withContext(function($ctx1) {
  32907. var $1;
  32908. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  32909. if($core.assert($1)){
  32910. return self.__comma("_");
  32911. } else {
  32912. return self;
  32913. }
  32914. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  32915. },
  32916. args: [],
  32917. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  32918. referencedClasses: ["Smalltalk"],
  32919. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  32920. }),
  32921. $globals.String);
  32922. });
  32923. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods"], function($boot){"use strict";
  32924. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  32925. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  32926. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  32927. $core.addPackage("Compiler-AST");
  32928. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  32929. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  32930. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  32931. $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.";
  32932. $core.addMethod(
  32933. $core.method({
  32934. selector: "inPosition:",
  32935. protocol: "testing",
  32936. fn: function (aPoint){
  32937. var self=this;
  32938. return $core.withContext(function($ctx1) {
  32939. return $recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  32940. return $core.withContext(function($ctx2) {
  32941. return $recv(self._positionEnd()).__gt_eq(aPoint);
  32942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32943. }));
  32944. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  32945. },
  32946. args: ["aPoint"],
  32947. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  32948. referencedClasses: [],
  32949. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  32950. }),
  32951. $globals.ASTNode);
  32952. $core.addMethod(
  32953. $core.method({
  32954. selector: "isAssignmentNode",
  32955. protocol: "testing",
  32956. fn: function (){
  32957. var self=this;
  32958. return false;
  32959. },
  32960. args: [],
  32961. source: "isAssignmentNode\x0a\x09^ false",
  32962. referencedClasses: [],
  32963. messageSends: []
  32964. }),
  32965. $globals.ASTNode);
  32966. $core.addMethod(
  32967. $core.method({
  32968. selector: "isBlockNode",
  32969. protocol: "testing",
  32970. fn: function (){
  32971. var self=this;
  32972. return false;
  32973. },
  32974. args: [],
  32975. source: "isBlockNode\x0a\x09^ false",
  32976. referencedClasses: [],
  32977. messageSends: []
  32978. }),
  32979. $globals.ASTNode);
  32980. $core.addMethod(
  32981. $core.method({
  32982. selector: "isBlockSequenceNode",
  32983. protocol: "testing",
  32984. fn: function (){
  32985. var self=this;
  32986. return false;
  32987. },
  32988. args: [],
  32989. source: "isBlockSequenceNode\x0a\x09^ false",
  32990. referencedClasses: [],
  32991. messageSends: []
  32992. }),
  32993. $globals.ASTNode);
  32994. $core.addMethod(
  32995. $core.method({
  32996. selector: "isCascadeNode",
  32997. protocol: "testing",
  32998. fn: function (){
  32999. var self=this;
  33000. return false;
  33001. },
  33002. args: [],
  33003. source: "isCascadeNode\x0a\x09^ false",
  33004. referencedClasses: [],
  33005. messageSends: []
  33006. }),
  33007. $globals.ASTNode);
  33008. $core.addMethod(
  33009. $core.method({
  33010. selector: "isImmutable",
  33011. protocol: "testing",
  33012. fn: function (){
  33013. var self=this;
  33014. return false;
  33015. },
  33016. args: [],
  33017. source: "isImmutable\x0a\x09^ false",
  33018. referencedClasses: [],
  33019. messageSends: []
  33020. }),
  33021. $globals.ASTNode);
  33022. $core.addMethod(
  33023. $core.method({
  33024. selector: "isJSStatementNode",
  33025. protocol: "testing",
  33026. fn: function (){
  33027. var self=this;
  33028. return false;
  33029. },
  33030. args: [],
  33031. source: "isJSStatementNode\x0a\x09^ false",
  33032. referencedClasses: [],
  33033. messageSends: []
  33034. }),
  33035. $globals.ASTNode);
  33036. $core.addMethod(
  33037. $core.method({
  33038. selector: "isNavigationNode",
  33039. protocol: "testing",
  33040. fn: function (){
  33041. var self=this;
  33042. return false;
  33043. },
  33044. args: [],
  33045. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  33046. referencedClasses: [],
  33047. messageSends: []
  33048. }),
  33049. $globals.ASTNode);
  33050. $core.addMethod(
  33051. $core.method({
  33052. selector: "isReturnNode",
  33053. protocol: "testing",
  33054. fn: function (){
  33055. var self=this;
  33056. return false;
  33057. },
  33058. args: [],
  33059. source: "isReturnNode\x0a\x09^ false",
  33060. referencedClasses: [],
  33061. messageSends: []
  33062. }),
  33063. $globals.ASTNode);
  33064. $core.addMethod(
  33065. $core.method({
  33066. selector: "isSendNode",
  33067. protocol: "testing",
  33068. fn: function (){
  33069. var self=this;
  33070. return false;
  33071. },
  33072. args: [],
  33073. source: "isSendNode\x0a\x09^ false",
  33074. referencedClasses: [],
  33075. messageSends: []
  33076. }),
  33077. $globals.ASTNode);
  33078. $core.addMethod(
  33079. $core.method({
  33080. selector: "isSequenceNode",
  33081. protocol: "testing",
  33082. fn: function (){
  33083. var self=this;
  33084. return false;
  33085. },
  33086. args: [],
  33087. source: "isSequenceNode\x0a\x09^ false",
  33088. referencedClasses: [],
  33089. messageSends: []
  33090. }),
  33091. $globals.ASTNode);
  33092. $core.addMethod(
  33093. $core.method({
  33094. selector: "isSuperKeyword",
  33095. protocol: "testing",
  33096. fn: function (){
  33097. var self=this;
  33098. return false;
  33099. },
  33100. args: [],
  33101. source: "isSuperKeyword\x0a\x09^ false",
  33102. referencedClasses: [],
  33103. messageSends: []
  33104. }),
  33105. $globals.ASTNode);
  33106. $core.addMethod(
  33107. $core.method({
  33108. selector: "isValueNode",
  33109. protocol: "testing",
  33110. fn: function (){
  33111. var self=this;
  33112. return false;
  33113. },
  33114. args: [],
  33115. source: "isValueNode\x0a\x09^ false",
  33116. referencedClasses: [],
  33117. messageSends: []
  33118. }),
  33119. $globals.ASTNode);
  33120. $core.addMethod(
  33121. $core.method({
  33122. selector: "isVariableNode",
  33123. protocol: "testing",
  33124. fn: function (){
  33125. var self=this;
  33126. return false;
  33127. },
  33128. args: [],
  33129. source: "isVariableNode\x0a\x09^ false",
  33130. referencedClasses: [],
  33131. messageSends: []
  33132. }),
  33133. $globals.ASTNode);
  33134. $core.addMethod(
  33135. $core.method({
  33136. selector: "location:",
  33137. protocol: "accessing",
  33138. fn: function (aLocation){
  33139. var self=this;
  33140. return $core.withContext(function($ctx1) {
  33141. var $3,$2,$1;
  33142. $3=$recv(aLocation)._start();
  33143. $ctx1.sendIdx["start"]=1;
  33144. $2=$recv($3)._line();
  33145. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33146. self._position_($1);
  33147. return self;
  33148. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33149. },
  33150. args: ["aLocation"],
  33151. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33152. referencedClasses: [],
  33153. messageSends: ["position:", "@", "line", "start", "column"]
  33154. }),
  33155. $globals.ASTNode);
  33156. $core.addMethod(
  33157. $core.method({
  33158. selector: "method",
  33159. protocol: "accessing",
  33160. fn: function (){
  33161. var self=this;
  33162. return $core.withContext(function($ctx1) {
  33163. var $1,$receiver;
  33164. $1=self._parent();
  33165. if(($receiver = $1) == null || $receiver.isNil){
  33166. return $1;
  33167. } else {
  33168. var node;
  33169. node=$receiver;
  33170. return $recv(node)._method();
  33171. }
  33172. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33173. },
  33174. args: [],
  33175. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33176. referencedClasses: [],
  33177. messageSends: ["ifNotNil:", "parent", "method"]
  33178. }),
  33179. $globals.ASTNode);
  33180. $core.addMethod(
  33181. $core.method({
  33182. selector: "navigationNodeAt:ifAbsent:",
  33183. protocol: "accessing",
  33184. fn: function (aPoint,aBlock){
  33185. var self=this;
  33186. var children;
  33187. return $core.withContext(function($ctx1) {
  33188. var $2,$1;
  33189. var $early={};
  33190. try {
  33191. children=$recv(self._allDagChildren())._select_((function(each){
  33192. return $core.withContext(function($ctx2) {
  33193. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33194. return $core.withContext(function($ctx3) {
  33195. return $recv(each)._inPosition_(aPoint);
  33196. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33197. }));
  33198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33199. }));
  33200. $recv(children)._ifEmpty_((function(){
  33201. return $core.withContext(function($ctx2) {
  33202. throw $early=[$recv(aBlock)._value()];
  33203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33204. }));
  33205. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33206. return $core.withContext(function($ctx2) {
  33207. $2=$recv(a)._positionStart();
  33208. $ctx2.sendIdx["positionStart"]=1;
  33209. $1=$recv($2)._dist_(aPoint);
  33210. $ctx2.sendIdx["dist:"]=1;
  33211. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33212. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33213. })))._first();
  33214. }
  33215. catch(e) {if(e===$early)return e[0]; throw e}
  33216. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33217. },
  33218. args: ["aPoint", "aBlock"],
  33219. 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",
  33220. referencedClasses: [],
  33221. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33222. }),
  33223. $globals.ASTNode);
  33224. $core.addMethod(
  33225. $core.method({
  33226. selector: "parent",
  33227. protocol: "accessing",
  33228. fn: function (){
  33229. var self=this;
  33230. return self["@parent"];
  33231. },
  33232. args: [],
  33233. source: "parent\x0a\x09^ parent",
  33234. referencedClasses: [],
  33235. messageSends: []
  33236. }),
  33237. $globals.ASTNode);
  33238. $core.addMethod(
  33239. $core.method({
  33240. selector: "parent:",
  33241. protocol: "accessing",
  33242. fn: function (aNode){
  33243. var self=this;
  33244. self["@parent"]=aNode;
  33245. return self;
  33246. },
  33247. args: ["aNode"],
  33248. source: "parent: aNode\x0a\x09parent := aNode",
  33249. referencedClasses: [],
  33250. messageSends: []
  33251. }),
  33252. $globals.ASTNode);
  33253. $core.addMethod(
  33254. $core.method({
  33255. selector: "position",
  33256. protocol: "accessing",
  33257. fn: function (){
  33258. var self=this;
  33259. return $core.withContext(function($ctx1) {
  33260. var $1,$2,$receiver;
  33261. $1=self["@position"];
  33262. if(($receiver = $1) == null || $receiver.isNil){
  33263. $2=self._parent();
  33264. if(($receiver = $2) == null || $receiver.isNil){
  33265. return $2;
  33266. } else {
  33267. var node;
  33268. node=$receiver;
  33269. return $recv(node)._position();
  33270. }
  33271. } else {
  33272. return $1;
  33273. }
  33274. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33275. },
  33276. args: [],
  33277. 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 ] ]",
  33278. referencedClasses: [],
  33279. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33280. }),
  33281. $globals.ASTNode);
  33282. $core.addMethod(
  33283. $core.method({
  33284. selector: "position:",
  33285. protocol: "accessing",
  33286. fn: function (aPosition){
  33287. var self=this;
  33288. self["@position"]=aPosition;
  33289. return self;
  33290. },
  33291. args: ["aPosition"],
  33292. source: "position: aPosition\x0a\x09position := aPosition",
  33293. referencedClasses: [],
  33294. messageSends: []
  33295. }),
  33296. $globals.ASTNode);
  33297. $core.addMethod(
  33298. $core.method({
  33299. selector: "positionEnd",
  33300. protocol: "accessing",
  33301. fn: function (){
  33302. var self=this;
  33303. return $core.withContext(function($ctx1) {
  33304. var $1,$6,$5,$4,$3,$2;
  33305. $1=self._positionStart();
  33306. $6=self._source();
  33307. $ctx1.sendIdx["source"]=1;
  33308. $5=$recv($6)._lines();
  33309. $ctx1.sendIdx["lines"]=1;
  33310. $4=$recv($5)._size();
  33311. $ctx1.sendIdx["size"]=1;
  33312. $3=$recv($4).__minus((1));
  33313. $ctx1.sendIdx["-"]=1;
  33314. $2=$recv($3).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  33315. return $recv($1).__plus($2);
  33316. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33317. },
  33318. args: [],
  33319. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33320. referencedClasses: [],
  33321. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33322. }),
  33323. $globals.ASTNode);
  33324. $core.addMethod(
  33325. $core.method({
  33326. selector: "positionStart",
  33327. protocol: "accessing",
  33328. fn: function (){
  33329. var self=this;
  33330. return $core.withContext(function($ctx1) {
  33331. return self._position();
  33332. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33333. },
  33334. args: [],
  33335. source: "positionStart\x0a\x09^ self position",
  33336. referencedClasses: [],
  33337. messageSends: ["position"]
  33338. }),
  33339. $globals.ASTNode);
  33340. $core.addMethod(
  33341. $core.method({
  33342. selector: "requiresSmalltalkContext",
  33343. protocol: "testing",
  33344. fn: function (){
  33345. var self=this;
  33346. return $core.withContext(function($ctx1) {
  33347. return $recv($recv(self._dagChildren())._detect_ifNone_((function(each){
  33348. return $core.withContext(function($ctx2) {
  33349. return $recv(each)._requiresSmalltalkContext();
  33350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33351. }),(function(){
  33352. return nil;
  33353. })))._notNil();
  33354. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33355. },
  33356. args: [],
  33357. 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",
  33358. referencedClasses: [],
  33359. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33360. }),
  33361. $globals.ASTNode);
  33362. $core.addMethod(
  33363. $core.method({
  33364. selector: "shouldBeAliased",
  33365. protocol: "accessing",
  33366. fn: function (){
  33367. var self=this;
  33368. return $core.withContext(function($ctx1) {
  33369. var $1,$receiver;
  33370. $1=self["@shouldBeAliased"];
  33371. if(($receiver = $1) == null || $receiver.isNil){
  33372. return false;
  33373. } else {
  33374. return $1;
  33375. }
  33376. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33377. },
  33378. args: [],
  33379. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33380. referencedClasses: [],
  33381. messageSends: ["ifNil:"]
  33382. }),
  33383. $globals.ASTNode);
  33384. $core.addMethod(
  33385. $core.method({
  33386. selector: "shouldBeAliased:",
  33387. protocol: "accessing",
  33388. fn: function (aBoolean){
  33389. var self=this;
  33390. self["@shouldBeAliased"]=aBoolean;
  33391. return self;
  33392. },
  33393. args: ["aBoolean"],
  33394. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33395. referencedClasses: [],
  33396. messageSends: []
  33397. }),
  33398. $globals.ASTNode);
  33399. $core.addMethod(
  33400. $core.method({
  33401. selector: "size",
  33402. protocol: "accessing",
  33403. fn: function (){
  33404. var self=this;
  33405. return $core.withContext(function($ctx1) {
  33406. return $recv(self._source())._size();
  33407. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33408. },
  33409. args: [],
  33410. source: "size\x0a\x09^ self source size",
  33411. referencedClasses: [],
  33412. messageSends: ["size", "source"]
  33413. }),
  33414. $globals.ASTNode);
  33415. $core.addMethod(
  33416. $core.method({
  33417. selector: "source",
  33418. protocol: "accessing",
  33419. fn: function (){
  33420. var self=this;
  33421. return $core.withContext(function($ctx1) {
  33422. var $1,$receiver;
  33423. $1=self["@source"];
  33424. if(($receiver = $1) == null || $receiver.isNil){
  33425. return "";
  33426. } else {
  33427. return $1;
  33428. }
  33429. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33430. },
  33431. args: [],
  33432. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33433. referencedClasses: [],
  33434. messageSends: ["ifNil:"]
  33435. }),
  33436. $globals.ASTNode);
  33437. $core.addMethod(
  33438. $core.method({
  33439. selector: "source:",
  33440. protocol: "accessing",
  33441. fn: function (aString){
  33442. var self=this;
  33443. self["@source"]=aString;
  33444. return self;
  33445. },
  33446. args: ["aString"],
  33447. source: "source: aString\x0a\x09source := aString",
  33448. referencedClasses: [],
  33449. messageSends: []
  33450. }),
  33451. $globals.ASTNode);
  33452. $core.addMethod(
  33453. $core.method({
  33454. selector: "withTail:",
  33455. protocol: "building",
  33456. fn: function (aCollection){
  33457. var self=this;
  33458. return $core.withContext(function($ctx1) {
  33459. var $1;
  33460. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33461. return $core.withContext(function($ctx2) {
  33462. $1=$recv($globals.SendNode)._new();
  33463. $recv($1)._position_($recv(send)._position());
  33464. $recv($1)._source_($recv(send)._source());
  33465. $recv($1)._receiver_(receiver);
  33466. $recv($1)._selector_($recv(send)._selector());
  33467. $recv($1)._arguments_($recv(send)._arguments());
  33468. return $recv($1)._yourself();
  33469. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33470. }));
  33471. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33472. },
  33473. args: ["aCollection"],
  33474. 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 ]",
  33475. referencedClasses: ["SendNode"],
  33476. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33477. }),
  33478. $globals.ASTNode);
  33479. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33480. $globals.AssignmentNode.comment="I represent an assignment node.";
  33481. $core.addMethod(
  33482. $core.method({
  33483. selector: "acceptDagVisitor:",
  33484. protocol: "visiting",
  33485. fn: function (aVisitor){
  33486. var self=this;
  33487. return $core.withContext(function($ctx1) {
  33488. return $recv(aVisitor)._visitAssignmentNode_(self);
  33489. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33490. },
  33491. args: ["aVisitor"],
  33492. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33493. referencedClasses: [],
  33494. messageSends: ["visitAssignmentNode:"]
  33495. }),
  33496. $globals.AssignmentNode);
  33497. $core.addMethod(
  33498. $core.method({
  33499. selector: "dagChildren",
  33500. protocol: "accessing",
  33501. fn: function (){
  33502. var self=this;
  33503. return $core.withContext(function($ctx1) {
  33504. return $recv($globals.Array)._with_with_(self._left(),self._right());
  33505. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  33506. },
  33507. args: [],
  33508. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  33509. referencedClasses: ["Array"],
  33510. messageSends: ["with:with:", "left", "right"]
  33511. }),
  33512. $globals.AssignmentNode);
  33513. $core.addMethod(
  33514. $core.method({
  33515. selector: "isAssignmentNode",
  33516. protocol: "testing",
  33517. fn: function (){
  33518. var self=this;
  33519. return true;
  33520. },
  33521. args: [],
  33522. source: "isAssignmentNode\x0a\x09^ true",
  33523. referencedClasses: [],
  33524. messageSends: []
  33525. }),
  33526. $globals.AssignmentNode);
  33527. $core.addMethod(
  33528. $core.method({
  33529. selector: "left",
  33530. protocol: "accessing",
  33531. fn: function (){
  33532. var self=this;
  33533. return self["@left"];
  33534. },
  33535. args: [],
  33536. source: "left\x0a\x09^ left",
  33537. referencedClasses: [],
  33538. messageSends: []
  33539. }),
  33540. $globals.AssignmentNode);
  33541. $core.addMethod(
  33542. $core.method({
  33543. selector: "left:",
  33544. protocol: "accessing",
  33545. fn: function (aNode){
  33546. var self=this;
  33547. self["@left"]=aNode;
  33548. return self;
  33549. },
  33550. args: ["aNode"],
  33551. source: "left: aNode\x0a\x09left := aNode",
  33552. referencedClasses: [],
  33553. messageSends: []
  33554. }),
  33555. $globals.AssignmentNode);
  33556. $core.addMethod(
  33557. $core.method({
  33558. selector: "right",
  33559. protocol: "accessing",
  33560. fn: function (){
  33561. var self=this;
  33562. return self["@right"];
  33563. },
  33564. args: [],
  33565. source: "right\x0a\x09^ right",
  33566. referencedClasses: [],
  33567. messageSends: []
  33568. }),
  33569. $globals.AssignmentNode);
  33570. $core.addMethod(
  33571. $core.method({
  33572. selector: "right:",
  33573. protocol: "accessing",
  33574. fn: function (aNode){
  33575. var self=this;
  33576. self["@right"]=aNode;
  33577. return self;
  33578. },
  33579. args: ["aNode"],
  33580. source: "right: aNode\x0a\x09right := aNode",
  33581. referencedClasses: [],
  33582. messageSends: []
  33583. }),
  33584. $globals.AssignmentNode);
  33585. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  33586. $globals.BlockNode.comment="I represent an block closure node.";
  33587. $core.addMethod(
  33588. $core.method({
  33589. selector: "acceptDagVisitor:",
  33590. protocol: "visiting",
  33591. fn: function (aVisitor){
  33592. var self=this;
  33593. return $core.withContext(function($ctx1) {
  33594. return $recv(aVisitor)._visitBlockNode_(self);
  33595. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  33596. },
  33597. args: ["aVisitor"],
  33598. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  33599. referencedClasses: [],
  33600. messageSends: ["visitBlockNode:"]
  33601. }),
  33602. $globals.BlockNode);
  33603. $core.addMethod(
  33604. $core.method({
  33605. selector: "isBlockNode",
  33606. protocol: "testing",
  33607. fn: function (){
  33608. var self=this;
  33609. return true;
  33610. },
  33611. args: [],
  33612. source: "isBlockNode\x0a\x09^ true",
  33613. referencedClasses: [],
  33614. messageSends: []
  33615. }),
  33616. $globals.BlockNode);
  33617. $core.addMethod(
  33618. $core.method({
  33619. selector: "parameters",
  33620. protocol: "accessing",
  33621. fn: function (){
  33622. var self=this;
  33623. return $core.withContext(function($ctx1) {
  33624. var $1,$receiver;
  33625. $1=self["@parameters"];
  33626. if(($receiver = $1) == null || $receiver.isNil){
  33627. self["@parameters"]=$recv($globals.Array)._new();
  33628. return self["@parameters"];
  33629. } else {
  33630. return $1;
  33631. }
  33632. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  33633. },
  33634. args: [],
  33635. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  33636. referencedClasses: ["Array"],
  33637. messageSends: ["ifNil:", "new"]
  33638. }),
  33639. $globals.BlockNode);
  33640. $core.addMethod(
  33641. $core.method({
  33642. selector: "parameters:",
  33643. protocol: "accessing",
  33644. fn: function (aCollection){
  33645. var self=this;
  33646. self["@parameters"]=aCollection;
  33647. return self;
  33648. },
  33649. args: ["aCollection"],
  33650. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  33651. referencedClasses: [],
  33652. messageSends: []
  33653. }),
  33654. $globals.BlockNode);
  33655. $core.addMethod(
  33656. $core.method({
  33657. selector: "scope",
  33658. protocol: "accessing",
  33659. fn: function (){
  33660. var self=this;
  33661. return self["@scope"];
  33662. },
  33663. args: [],
  33664. source: "scope\x0a\x09^ scope",
  33665. referencedClasses: [],
  33666. messageSends: []
  33667. }),
  33668. $globals.BlockNode);
  33669. $core.addMethod(
  33670. $core.method({
  33671. selector: "scope:",
  33672. protocol: "accessing",
  33673. fn: function (aLexicalScope){
  33674. var self=this;
  33675. self["@scope"]=aLexicalScope;
  33676. return self;
  33677. },
  33678. args: ["aLexicalScope"],
  33679. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33680. referencedClasses: [],
  33681. messageSends: []
  33682. }),
  33683. $globals.BlockNode);
  33684. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  33685. $globals.CascadeNode.comment="I represent an cascade node.";
  33686. $core.addMethod(
  33687. $core.method({
  33688. selector: "acceptDagVisitor:",
  33689. protocol: "visiting",
  33690. fn: function (aVisitor){
  33691. var self=this;
  33692. return $core.withContext(function($ctx1) {
  33693. return $recv(aVisitor)._visitCascadeNode_(self);
  33694. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  33695. },
  33696. args: ["aVisitor"],
  33697. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  33698. referencedClasses: [],
  33699. messageSends: ["visitCascadeNode:"]
  33700. }),
  33701. $globals.CascadeNode);
  33702. $core.addMethod(
  33703. $core.method({
  33704. selector: "isCascadeNode",
  33705. protocol: "testing",
  33706. fn: function (){
  33707. var self=this;
  33708. return true;
  33709. },
  33710. args: [],
  33711. source: "isCascadeNode\x0a\x09^ true",
  33712. referencedClasses: [],
  33713. messageSends: []
  33714. }),
  33715. $globals.CascadeNode);
  33716. $core.addMethod(
  33717. $core.method({
  33718. selector: "receiver",
  33719. protocol: "accessing",
  33720. fn: function (){
  33721. var self=this;
  33722. return self["@receiver"];
  33723. },
  33724. args: [],
  33725. source: "receiver\x0a\x09^ receiver",
  33726. referencedClasses: [],
  33727. messageSends: []
  33728. }),
  33729. $globals.CascadeNode);
  33730. $core.addMethod(
  33731. $core.method({
  33732. selector: "receiver:",
  33733. protocol: "accessing",
  33734. fn: function (aNode){
  33735. var self=this;
  33736. self["@receiver"]=aNode;
  33737. return self;
  33738. },
  33739. args: ["aNode"],
  33740. source: "receiver: aNode\x0a\x09receiver := aNode",
  33741. referencedClasses: [],
  33742. messageSends: []
  33743. }),
  33744. $globals.CascadeNode);
  33745. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  33746. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  33747. $core.addMethod(
  33748. $core.method({
  33749. selector: "acceptDagVisitor:",
  33750. protocol: "visiting",
  33751. fn: function (aVisitor){
  33752. var self=this;
  33753. return $core.withContext(function($ctx1) {
  33754. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  33755. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  33756. },
  33757. args: ["aVisitor"],
  33758. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  33759. referencedClasses: [],
  33760. messageSends: ["visitDynamicArrayNode:"]
  33761. }),
  33762. $globals.DynamicArrayNode);
  33763. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  33764. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  33765. $core.addMethod(
  33766. $core.method({
  33767. selector: "acceptDagVisitor:",
  33768. protocol: "visiting",
  33769. fn: function (aVisitor){
  33770. var self=this;
  33771. return $core.withContext(function($ctx1) {
  33772. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  33773. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  33774. },
  33775. args: ["aVisitor"],
  33776. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  33777. referencedClasses: [],
  33778. messageSends: ["visitDynamicDictionaryNode:"]
  33779. }),
  33780. $globals.DynamicDictionaryNode);
  33781. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  33782. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  33783. $core.addMethod(
  33784. $core.method({
  33785. selector: "acceptDagVisitor:",
  33786. protocol: "visiting",
  33787. fn: function (aVisitor){
  33788. var self=this;
  33789. return $core.withContext(function($ctx1) {
  33790. return $recv(aVisitor)._visitJSStatementNode_(self);
  33791. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  33792. },
  33793. args: ["aVisitor"],
  33794. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  33795. referencedClasses: [],
  33796. messageSends: ["visitJSStatementNode:"]
  33797. }),
  33798. $globals.JSStatementNode);
  33799. $core.addMethod(
  33800. $core.method({
  33801. selector: "isJSStatementNode",
  33802. protocol: "testing",
  33803. fn: function (){
  33804. var self=this;
  33805. return true;
  33806. },
  33807. args: [],
  33808. source: "isJSStatementNode\x0a\x09^ true",
  33809. referencedClasses: [],
  33810. messageSends: []
  33811. }),
  33812. $globals.JSStatementNode);
  33813. $core.addMethod(
  33814. $core.method({
  33815. selector: "requiresSmalltalkContext",
  33816. protocol: "testing",
  33817. fn: function (){
  33818. var self=this;
  33819. return true;
  33820. },
  33821. args: [],
  33822. source: "requiresSmalltalkContext\x0a\x09^ true",
  33823. referencedClasses: [],
  33824. messageSends: []
  33825. }),
  33826. $globals.JSStatementNode);
  33827. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  33828. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  33829. $core.addMethod(
  33830. $core.method({
  33831. selector: "acceptDagVisitor:",
  33832. protocol: "visiting",
  33833. fn: function (aVisitor){
  33834. var self=this;
  33835. return $core.withContext(function($ctx1) {
  33836. return $recv(aVisitor)._visitMethodNode_(self);
  33837. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  33838. },
  33839. args: ["aVisitor"],
  33840. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  33841. referencedClasses: [],
  33842. messageSends: ["visitMethodNode:"]
  33843. }),
  33844. $globals.MethodNode);
  33845. $core.addMethod(
  33846. $core.method({
  33847. selector: "arguments",
  33848. protocol: "accessing",
  33849. fn: function (){
  33850. var self=this;
  33851. return $core.withContext(function($ctx1) {
  33852. var $1,$receiver;
  33853. $1=self["@arguments"];
  33854. if(($receiver = $1) == null || $receiver.isNil){
  33855. return [];
  33856. } else {
  33857. return $1;
  33858. }
  33859. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  33860. },
  33861. args: [],
  33862. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  33863. referencedClasses: [],
  33864. messageSends: ["ifNil:"]
  33865. }),
  33866. $globals.MethodNode);
  33867. $core.addMethod(
  33868. $core.method({
  33869. selector: "arguments:",
  33870. protocol: "accessing",
  33871. fn: function (aCollection){
  33872. var self=this;
  33873. self["@arguments"]=aCollection;
  33874. return self;
  33875. },
  33876. args: ["aCollection"],
  33877. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  33878. referencedClasses: [],
  33879. messageSends: []
  33880. }),
  33881. $globals.MethodNode);
  33882. $core.addMethod(
  33883. $core.method({
  33884. selector: "classReferences",
  33885. protocol: "accessing",
  33886. fn: function (){
  33887. var self=this;
  33888. return self["@classReferences"];
  33889. },
  33890. args: [],
  33891. source: "classReferences\x0a\x09^ classReferences",
  33892. referencedClasses: [],
  33893. messageSends: []
  33894. }),
  33895. $globals.MethodNode);
  33896. $core.addMethod(
  33897. $core.method({
  33898. selector: "classReferences:",
  33899. protocol: "accessing",
  33900. fn: function (aCollection){
  33901. var self=this;
  33902. self["@classReferences"]=aCollection;
  33903. return self;
  33904. },
  33905. args: ["aCollection"],
  33906. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  33907. referencedClasses: [],
  33908. messageSends: []
  33909. }),
  33910. $globals.MethodNode);
  33911. $core.addMethod(
  33912. $core.method({
  33913. selector: "messageSends",
  33914. protocol: "accessing",
  33915. fn: function (){
  33916. var self=this;
  33917. return $core.withContext(function($ctx1) {
  33918. return $recv(self._sendIndexes())._keys();
  33919. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  33920. },
  33921. args: [],
  33922. source: "messageSends\x0a\x09^ self sendIndexes keys",
  33923. referencedClasses: [],
  33924. messageSends: ["keys", "sendIndexes"]
  33925. }),
  33926. $globals.MethodNode);
  33927. $core.addMethod(
  33928. $core.method({
  33929. selector: "method",
  33930. protocol: "accessing",
  33931. fn: function (){
  33932. var self=this;
  33933. return self;
  33934. },
  33935. args: [],
  33936. source: "method\x0a\x09^ self",
  33937. referencedClasses: [],
  33938. messageSends: []
  33939. }),
  33940. $globals.MethodNode);
  33941. $core.addMethod(
  33942. $core.method({
  33943. selector: "scope",
  33944. protocol: "accessing",
  33945. fn: function (){
  33946. var self=this;
  33947. return self["@scope"];
  33948. },
  33949. args: [],
  33950. source: "scope\x0a\x09^ scope",
  33951. referencedClasses: [],
  33952. messageSends: []
  33953. }),
  33954. $globals.MethodNode);
  33955. $core.addMethod(
  33956. $core.method({
  33957. selector: "scope:",
  33958. protocol: "accessing",
  33959. fn: function (aMethodScope){
  33960. var self=this;
  33961. self["@scope"]=aMethodScope;
  33962. return self;
  33963. },
  33964. args: ["aMethodScope"],
  33965. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  33966. referencedClasses: [],
  33967. messageSends: []
  33968. }),
  33969. $globals.MethodNode);
  33970. $core.addMethod(
  33971. $core.method({
  33972. selector: "selector",
  33973. protocol: "accessing",
  33974. fn: function (){
  33975. var self=this;
  33976. return self["@selector"];
  33977. },
  33978. args: [],
  33979. source: "selector\x0a\x09^ selector",
  33980. referencedClasses: [],
  33981. messageSends: []
  33982. }),
  33983. $globals.MethodNode);
  33984. $core.addMethod(
  33985. $core.method({
  33986. selector: "selector:",
  33987. protocol: "accessing",
  33988. fn: function (aString){
  33989. var self=this;
  33990. self["@selector"]=aString;
  33991. return self;
  33992. },
  33993. args: ["aString"],
  33994. source: "selector: aString\x0a\x09selector := aString",
  33995. referencedClasses: [],
  33996. messageSends: []
  33997. }),
  33998. $globals.MethodNode);
  33999. $core.addMethod(
  34000. $core.method({
  34001. selector: "sendIndexes",
  34002. protocol: "accessing",
  34003. fn: function (){
  34004. var self=this;
  34005. return self["@sendIndexes"];
  34006. },
  34007. args: [],
  34008. source: "sendIndexes\x0a\x09^ sendIndexes",
  34009. referencedClasses: [],
  34010. messageSends: []
  34011. }),
  34012. $globals.MethodNode);
  34013. $core.addMethod(
  34014. $core.method({
  34015. selector: "sendIndexes:",
  34016. protocol: "accessing",
  34017. fn: function (aDictionary){
  34018. var self=this;
  34019. self["@sendIndexes"]=aDictionary;
  34020. return self;
  34021. },
  34022. args: ["aDictionary"],
  34023. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  34024. referencedClasses: [],
  34025. messageSends: []
  34026. }),
  34027. $globals.MethodNode);
  34028. $core.addMethod(
  34029. $core.method({
  34030. selector: "sequenceNode",
  34031. protocol: "accessing",
  34032. fn: function (){
  34033. var self=this;
  34034. return $core.withContext(function($ctx1) {
  34035. var $1;
  34036. var $early={};
  34037. try {
  34038. $recv(self._dagChildren())._do_((function(each){
  34039. return $core.withContext(function($ctx2) {
  34040. $1=$recv(each)._isSequenceNode();
  34041. if($core.assert($1)){
  34042. throw $early=[each];
  34043. }
  34044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34045. }));
  34046. return nil;
  34047. }
  34048. catch(e) {if(e===$early)return e[0]; throw e}
  34049. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  34050. },
  34051. args: [],
  34052. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  34053. referencedClasses: [],
  34054. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  34055. }),
  34056. $globals.MethodNode);
  34057. $core.addMethod(
  34058. $core.method({
  34059. selector: "source",
  34060. protocol: "accessing",
  34061. fn: function (){
  34062. var self=this;
  34063. return self["@source"];
  34064. },
  34065. args: [],
  34066. source: "source\x0a\x09^ source",
  34067. referencedClasses: [],
  34068. messageSends: []
  34069. }),
  34070. $globals.MethodNode);
  34071. $core.addMethod(
  34072. $core.method({
  34073. selector: "source:",
  34074. protocol: "accessing",
  34075. fn: function (aString){
  34076. var self=this;
  34077. self["@source"]=aString;
  34078. return self;
  34079. },
  34080. args: ["aString"],
  34081. source: "source: aString\x0a\x09source := aString",
  34082. referencedClasses: [],
  34083. messageSends: []
  34084. }),
  34085. $globals.MethodNode);
  34086. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34087. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34088. $core.addMethod(
  34089. $core.method({
  34090. selector: "acceptDagVisitor:",
  34091. protocol: "visiting",
  34092. fn: function (aVisitor){
  34093. var self=this;
  34094. return $core.withContext(function($ctx1) {
  34095. return $recv(aVisitor)._visitReturnNode_(self);
  34096. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34097. },
  34098. args: ["aVisitor"],
  34099. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34100. referencedClasses: [],
  34101. messageSends: ["visitReturnNode:"]
  34102. }),
  34103. $globals.ReturnNode);
  34104. $core.addMethod(
  34105. $core.method({
  34106. selector: "isReturnNode",
  34107. protocol: "testing",
  34108. fn: function (){
  34109. var self=this;
  34110. return true;
  34111. },
  34112. args: [],
  34113. source: "isReturnNode\x0a\x09^ true",
  34114. referencedClasses: [],
  34115. messageSends: []
  34116. }),
  34117. $globals.ReturnNode);
  34118. $core.addMethod(
  34119. $core.method({
  34120. selector: "nonLocalReturn",
  34121. protocol: "testing",
  34122. fn: function (){
  34123. var self=this;
  34124. return $core.withContext(function($ctx1) {
  34125. return $recv($recv(self._scope())._isMethodScope())._not();
  34126. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34127. },
  34128. args: [],
  34129. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34130. referencedClasses: [],
  34131. messageSends: ["not", "isMethodScope", "scope"]
  34132. }),
  34133. $globals.ReturnNode);
  34134. $core.addMethod(
  34135. $core.method({
  34136. selector: "scope",
  34137. protocol: "accessing",
  34138. fn: function (){
  34139. var self=this;
  34140. return self["@scope"];
  34141. },
  34142. args: [],
  34143. source: "scope\x0a\x09^ scope",
  34144. referencedClasses: [],
  34145. messageSends: []
  34146. }),
  34147. $globals.ReturnNode);
  34148. $core.addMethod(
  34149. $core.method({
  34150. selector: "scope:",
  34151. protocol: "accessing",
  34152. fn: function (aLexicalScope){
  34153. var self=this;
  34154. self["@scope"]=aLexicalScope;
  34155. return self;
  34156. },
  34157. args: ["aLexicalScope"],
  34158. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34159. referencedClasses: [],
  34160. messageSends: []
  34161. }),
  34162. $globals.ReturnNode);
  34163. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34164. $globals.SendNode.comment="I represent an message send node.";
  34165. $core.addMethod(
  34166. $core.method({
  34167. selector: "acceptDagVisitor:",
  34168. protocol: "visiting",
  34169. fn: function (aVisitor){
  34170. var self=this;
  34171. return $core.withContext(function($ctx1) {
  34172. return $recv(aVisitor)._visitSendNode_(self);
  34173. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34174. },
  34175. args: ["aVisitor"],
  34176. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34177. referencedClasses: [],
  34178. messageSends: ["visitSendNode:"]
  34179. }),
  34180. $globals.SendNode);
  34181. $core.addMethod(
  34182. $core.method({
  34183. selector: "arguments",
  34184. protocol: "accessing",
  34185. fn: function (){
  34186. var self=this;
  34187. return $core.withContext(function($ctx1) {
  34188. var $1,$receiver;
  34189. $1=self["@arguments"];
  34190. if(($receiver = $1) == null || $receiver.isNil){
  34191. self["@arguments"]=[];
  34192. return self["@arguments"];
  34193. } else {
  34194. return $1;
  34195. }
  34196. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34197. },
  34198. args: [],
  34199. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34200. referencedClasses: [],
  34201. messageSends: ["ifNil:"]
  34202. }),
  34203. $globals.SendNode);
  34204. $core.addMethod(
  34205. $core.method({
  34206. selector: "arguments:",
  34207. protocol: "accessing",
  34208. fn: function (aCollection){
  34209. var self=this;
  34210. self["@arguments"]=aCollection;
  34211. return self;
  34212. },
  34213. args: ["aCollection"],
  34214. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34215. referencedClasses: [],
  34216. messageSends: []
  34217. }),
  34218. $globals.SendNode);
  34219. $core.addMethod(
  34220. $core.method({
  34221. selector: "dagChildren",
  34222. protocol: "accessing",
  34223. fn: function (){
  34224. var self=this;
  34225. return $core.withContext(function($ctx1) {
  34226. var $1,$2,$3,$receiver;
  34227. $1=self._receiver();
  34228. $ctx1.sendIdx["receiver"]=1;
  34229. if(($receiver = $1) == null || $receiver.isNil){
  34230. $2=self._arguments();
  34231. $ctx1.sendIdx["arguments"]=1;
  34232. return $recv($2)._copy();
  34233. } else {
  34234. $1;
  34235. }
  34236. $3=$recv($globals.Array)._with_(self._receiver());
  34237. $recv($3)._addAll_(self._arguments());
  34238. return $recv($3)._yourself();
  34239. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34240. },
  34241. args: [],
  34242. 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",
  34243. referencedClasses: ["Array"],
  34244. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34245. }),
  34246. $globals.SendNode);
  34247. $core.addMethod(
  34248. $core.method({
  34249. selector: "index",
  34250. protocol: "accessing",
  34251. fn: function (){
  34252. var self=this;
  34253. return self["@index"];
  34254. },
  34255. args: [],
  34256. source: "index\x0a\x09^ index",
  34257. referencedClasses: [],
  34258. messageSends: []
  34259. }),
  34260. $globals.SendNode);
  34261. $core.addMethod(
  34262. $core.method({
  34263. selector: "index:",
  34264. protocol: "accessing",
  34265. fn: function (anInteger){
  34266. var self=this;
  34267. self["@index"]=anInteger;
  34268. return self;
  34269. },
  34270. args: ["anInteger"],
  34271. source: "index: anInteger\x0a\x09index := anInteger",
  34272. referencedClasses: [],
  34273. messageSends: []
  34274. }),
  34275. $globals.SendNode);
  34276. $core.addMethod(
  34277. $core.method({
  34278. selector: "isNavigationNode",
  34279. protocol: "testing",
  34280. fn: function (){
  34281. var self=this;
  34282. return true;
  34283. },
  34284. args: [],
  34285. source: "isNavigationNode\x0a\x09^ true",
  34286. referencedClasses: [],
  34287. messageSends: []
  34288. }),
  34289. $globals.SendNode);
  34290. $core.addMethod(
  34291. $core.method({
  34292. selector: "isSendNode",
  34293. protocol: "testing",
  34294. fn: function (){
  34295. var self=this;
  34296. return true;
  34297. },
  34298. args: [],
  34299. source: "isSendNode\x0a\x09^ true",
  34300. referencedClasses: [],
  34301. messageSends: []
  34302. }),
  34303. $globals.SendNode);
  34304. $core.addMethod(
  34305. $core.method({
  34306. selector: "navigationLink",
  34307. protocol: "accessing",
  34308. fn: function (){
  34309. var self=this;
  34310. return $core.withContext(function($ctx1) {
  34311. return self._selector();
  34312. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34313. },
  34314. args: [],
  34315. source: "navigationLink\x0a\x09^ self selector",
  34316. referencedClasses: [],
  34317. messageSends: ["selector"]
  34318. }),
  34319. $globals.SendNode);
  34320. $core.addMethod(
  34321. $core.method({
  34322. selector: "receiver",
  34323. protocol: "accessing",
  34324. fn: function (){
  34325. var self=this;
  34326. return self["@receiver"];
  34327. },
  34328. args: [],
  34329. source: "receiver\x0a\x09^ receiver",
  34330. referencedClasses: [],
  34331. messageSends: []
  34332. }),
  34333. $globals.SendNode);
  34334. $core.addMethod(
  34335. $core.method({
  34336. selector: "receiver:",
  34337. protocol: "accessing",
  34338. fn: function (aNode){
  34339. var self=this;
  34340. self["@receiver"]=aNode;
  34341. return self;
  34342. },
  34343. args: ["aNode"],
  34344. source: "receiver: aNode\x0a\x09receiver := aNode",
  34345. referencedClasses: [],
  34346. messageSends: []
  34347. }),
  34348. $globals.SendNode);
  34349. $core.addMethod(
  34350. $core.method({
  34351. selector: "requiresSmalltalkContext",
  34352. protocol: "testing",
  34353. fn: function (){
  34354. var self=this;
  34355. return true;
  34356. },
  34357. args: [],
  34358. source: "requiresSmalltalkContext\x0a\x09^ true",
  34359. referencedClasses: [],
  34360. messageSends: []
  34361. }),
  34362. $globals.SendNode);
  34363. $core.addMethod(
  34364. $core.method({
  34365. selector: "selector",
  34366. protocol: "accessing",
  34367. fn: function (){
  34368. var self=this;
  34369. return self["@selector"];
  34370. },
  34371. args: [],
  34372. source: "selector\x0a\x09^ selector",
  34373. referencedClasses: [],
  34374. messageSends: []
  34375. }),
  34376. $globals.SendNode);
  34377. $core.addMethod(
  34378. $core.method({
  34379. selector: "selector:",
  34380. protocol: "accessing",
  34381. fn: function (aString){
  34382. var self=this;
  34383. self["@selector"]=aString;
  34384. return self;
  34385. },
  34386. args: ["aString"],
  34387. source: "selector: aString\x0a\x09selector := aString",
  34388. referencedClasses: [],
  34389. messageSends: []
  34390. }),
  34391. $globals.SendNode);
  34392. $core.addMethod(
  34393. $core.method({
  34394. selector: "shouldBeInlined",
  34395. protocol: "accessing",
  34396. fn: function (){
  34397. var self=this;
  34398. return $core.withContext(function($ctx1) {
  34399. var $1,$receiver;
  34400. $1=self["@shouldBeInlined"];
  34401. if(($receiver = $1) == null || $receiver.isNil){
  34402. return false;
  34403. } else {
  34404. return $1;
  34405. }
  34406. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34407. },
  34408. args: [],
  34409. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34410. referencedClasses: [],
  34411. messageSends: ["ifNil:"]
  34412. }),
  34413. $globals.SendNode);
  34414. $core.addMethod(
  34415. $core.method({
  34416. selector: "shouldBeInlined:",
  34417. protocol: "accessing",
  34418. fn: function (aBoolean){
  34419. var self=this;
  34420. self["@shouldBeInlined"]=aBoolean;
  34421. return self;
  34422. },
  34423. args: ["aBoolean"],
  34424. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34425. referencedClasses: [],
  34426. messageSends: []
  34427. }),
  34428. $globals.SendNode);
  34429. $core.addMethod(
  34430. $core.method({
  34431. selector: "superSend",
  34432. protocol: "accessing",
  34433. fn: function (){
  34434. var self=this;
  34435. return $core.withContext(function($ctx1) {
  34436. var $2,$1;
  34437. $2=self._receiver();
  34438. $ctx1.sendIdx["receiver"]=1;
  34439. $1=$recv($2)._notNil();
  34440. return $recv($1)._and_((function(){
  34441. return $core.withContext(function($ctx2) {
  34442. return $recv(self._receiver())._isSuperKeyword();
  34443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34444. }));
  34445. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34446. },
  34447. args: [],
  34448. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34449. referencedClasses: [],
  34450. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34451. }),
  34452. $globals.SendNode);
  34453. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "scope"], "Compiler-AST");
  34454. $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).";
  34455. $core.addMethod(
  34456. $core.method({
  34457. selector: "acceptDagVisitor:",
  34458. protocol: "visiting",
  34459. fn: function (aVisitor){
  34460. var self=this;
  34461. return $core.withContext(function($ctx1) {
  34462. return $recv(aVisitor)._visitSequenceNode_(self);
  34463. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34464. },
  34465. args: ["aVisitor"],
  34466. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34467. referencedClasses: [],
  34468. messageSends: ["visitSequenceNode:"]
  34469. }),
  34470. $globals.SequenceNode);
  34471. $core.addMethod(
  34472. $core.method({
  34473. selector: "asBlockSequenceNode",
  34474. protocol: "building",
  34475. fn: function (){
  34476. var self=this;
  34477. return $core.withContext(function($ctx1) {
  34478. var $1;
  34479. $1=$recv($globals.BlockSequenceNode)._new();
  34480. $recv($1)._position_(self._position());
  34481. $recv($1)._source_(self._source());
  34482. $recv($1)._dagChildren_(self._dagChildren());
  34483. $recv($1)._temps_(self._temps());
  34484. return $recv($1)._yourself();
  34485. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34486. },
  34487. args: [],
  34488. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  34489. referencedClasses: ["BlockSequenceNode"],
  34490. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "yourself"]
  34491. }),
  34492. $globals.SequenceNode);
  34493. $core.addMethod(
  34494. $core.method({
  34495. selector: "isSequenceNode",
  34496. protocol: "testing",
  34497. fn: function (){
  34498. var self=this;
  34499. return true;
  34500. },
  34501. args: [],
  34502. source: "isSequenceNode\x0a\x09^ true",
  34503. referencedClasses: [],
  34504. messageSends: []
  34505. }),
  34506. $globals.SequenceNode);
  34507. $core.addMethod(
  34508. $core.method({
  34509. selector: "scope",
  34510. protocol: "accessing",
  34511. fn: function (){
  34512. var self=this;
  34513. return self["@scope"];
  34514. },
  34515. args: [],
  34516. source: "scope\x0a\x09^ scope",
  34517. referencedClasses: [],
  34518. messageSends: []
  34519. }),
  34520. $globals.SequenceNode);
  34521. $core.addMethod(
  34522. $core.method({
  34523. selector: "scope:",
  34524. protocol: "accessing",
  34525. fn: function (aLexicalScope){
  34526. var self=this;
  34527. self["@scope"]=aLexicalScope;
  34528. return self;
  34529. },
  34530. args: ["aLexicalScope"],
  34531. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34532. referencedClasses: [],
  34533. messageSends: []
  34534. }),
  34535. $globals.SequenceNode);
  34536. $core.addMethod(
  34537. $core.method({
  34538. selector: "temps",
  34539. protocol: "accessing",
  34540. fn: function (){
  34541. var self=this;
  34542. return $core.withContext(function($ctx1) {
  34543. var $1,$receiver;
  34544. $1=self["@temps"];
  34545. if(($receiver = $1) == null || $receiver.isNil){
  34546. return [];
  34547. } else {
  34548. return $1;
  34549. }
  34550. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  34551. },
  34552. args: [],
  34553. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  34554. referencedClasses: [],
  34555. messageSends: ["ifNil:"]
  34556. }),
  34557. $globals.SequenceNode);
  34558. $core.addMethod(
  34559. $core.method({
  34560. selector: "temps:",
  34561. protocol: "accessing",
  34562. fn: function (aCollection){
  34563. var self=this;
  34564. self["@temps"]=aCollection;
  34565. return self;
  34566. },
  34567. args: ["aCollection"],
  34568. source: "temps: aCollection\x0a\x09temps := aCollection",
  34569. referencedClasses: [],
  34570. messageSends: []
  34571. }),
  34572. $globals.SequenceNode);
  34573. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  34574. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  34575. $core.addMethod(
  34576. $core.method({
  34577. selector: "acceptDagVisitor:",
  34578. protocol: "visiting",
  34579. fn: function (aVisitor){
  34580. var self=this;
  34581. return $core.withContext(function($ctx1) {
  34582. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  34583. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  34584. },
  34585. args: ["aVisitor"],
  34586. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  34587. referencedClasses: [],
  34588. messageSends: ["visitBlockSequenceNode:"]
  34589. }),
  34590. $globals.BlockSequenceNode);
  34591. $core.addMethod(
  34592. $core.method({
  34593. selector: "isBlockSequenceNode",
  34594. protocol: "testing",
  34595. fn: function (){
  34596. var self=this;
  34597. return true;
  34598. },
  34599. args: [],
  34600. source: "isBlockSequenceNode\x0a\x09^ true",
  34601. referencedClasses: [],
  34602. messageSends: []
  34603. }),
  34604. $globals.BlockSequenceNode);
  34605. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  34606. $globals.ValueNode.comment="I represent a value node.";
  34607. $core.addMethod(
  34608. $core.method({
  34609. selector: "acceptDagVisitor:",
  34610. protocol: "visiting",
  34611. fn: function (aVisitor){
  34612. var self=this;
  34613. return $core.withContext(function($ctx1) {
  34614. return $recv(aVisitor)._visitValueNode_(self);
  34615. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  34616. },
  34617. args: ["aVisitor"],
  34618. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  34619. referencedClasses: [],
  34620. messageSends: ["visitValueNode:"]
  34621. }),
  34622. $globals.ValueNode);
  34623. $core.addMethod(
  34624. $core.method({
  34625. selector: "isImmutable",
  34626. protocol: "testing",
  34627. fn: function (){
  34628. var self=this;
  34629. return $core.withContext(function($ctx1) {
  34630. return $recv(self._value())._isImmutable();
  34631. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  34632. },
  34633. args: [],
  34634. source: "isImmutable\x0a\x09^ self value isImmutable",
  34635. referencedClasses: [],
  34636. messageSends: ["isImmutable", "value"]
  34637. }),
  34638. $globals.ValueNode);
  34639. $core.addMethod(
  34640. $core.method({
  34641. selector: "isValueNode",
  34642. protocol: "testing",
  34643. fn: function (){
  34644. var self=this;
  34645. return true;
  34646. },
  34647. args: [],
  34648. source: "isValueNode\x0a\x09^ true",
  34649. referencedClasses: [],
  34650. messageSends: []
  34651. }),
  34652. $globals.ValueNode);
  34653. $core.addMethod(
  34654. $core.method({
  34655. selector: "value",
  34656. protocol: "accessing",
  34657. fn: function (){
  34658. var self=this;
  34659. return self["@value"];
  34660. },
  34661. args: [],
  34662. source: "value\x0a\x09^ value",
  34663. referencedClasses: [],
  34664. messageSends: []
  34665. }),
  34666. $globals.ValueNode);
  34667. $core.addMethod(
  34668. $core.method({
  34669. selector: "value:",
  34670. protocol: "accessing",
  34671. fn: function (anObject){
  34672. var self=this;
  34673. self["@value"]=anObject;
  34674. return self;
  34675. },
  34676. args: ["anObject"],
  34677. source: "value: anObject\x0a\x09value := anObject",
  34678. referencedClasses: [],
  34679. messageSends: []
  34680. }),
  34681. $globals.ValueNode);
  34682. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  34683. $globals.VariableNode.comment="I represent an variable node.";
  34684. $core.addMethod(
  34685. $core.method({
  34686. selector: "acceptDagVisitor:",
  34687. protocol: "visiting",
  34688. fn: function (aVisitor){
  34689. var self=this;
  34690. return $core.withContext(function($ctx1) {
  34691. return $recv(aVisitor)._visitVariableNode_(self);
  34692. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  34693. },
  34694. args: ["aVisitor"],
  34695. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  34696. referencedClasses: [],
  34697. messageSends: ["visitVariableNode:"]
  34698. }),
  34699. $globals.VariableNode);
  34700. $core.addMethod(
  34701. $core.method({
  34702. selector: "alias",
  34703. protocol: "accessing",
  34704. fn: function (){
  34705. var self=this;
  34706. return $core.withContext(function($ctx1) {
  34707. return $recv(self._binding())._alias();
  34708. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  34709. },
  34710. args: [],
  34711. source: "alias\x0a\x09^ self binding alias",
  34712. referencedClasses: [],
  34713. messageSends: ["alias", "binding"]
  34714. }),
  34715. $globals.VariableNode);
  34716. $core.addMethod(
  34717. $core.method({
  34718. selector: "assigned",
  34719. protocol: "accessing",
  34720. fn: function (){
  34721. var self=this;
  34722. return $core.withContext(function($ctx1) {
  34723. var $1,$receiver;
  34724. $1=self["@assigned"];
  34725. if(($receiver = $1) == null || $receiver.isNil){
  34726. return false;
  34727. } else {
  34728. return $1;
  34729. }
  34730. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  34731. },
  34732. args: [],
  34733. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  34734. referencedClasses: [],
  34735. messageSends: ["ifNil:"]
  34736. }),
  34737. $globals.VariableNode);
  34738. $core.addMethod(
  34739. $core.method({
  34740. selector: "assigned:",
  34741. protocol: "accessing",
  34742. fn: function (aBoolean){
  34743. var self=this;
  34744. self["@assigned"]=aBoolean;
  34745. return self;
  34746. },
  34747. args: ["aBoolean"],
  34748. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  34749. referencedClasses: [],
  34750. messageSends: []
  34751. }),
  34752. $globals.VariableNode);
  34753. $core.addMethod(
  34754. $core.method({
  34755. selector: "beAssigned",
  34756. protocol: "accessing",
  34757. fn: function (){
  34758. var self=this;
  34759. return $core.withContext(function($ctx1) {
  34760. $recv(self._binding())._validateAssignment();
  34761. self["@assigned"]=true;
  34762. return self;
  34763. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  34764. },
  34765. args: [],
  34766. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  34767. referencedClasses: [],
  34768. messageSends: ["validateAssignment", "binding"]
  34769. }),
  34770. $globals.VariableNode);
  34771. $core.addMethod(
  34772. $core.method({
  34773. selector: "binding",
  34774. protocol: "accessing",
  34775. fn: function (){
  34776. var self=this;
  34777. return self["@binding"];
  34778. },
  34779. args: [],
  34780. source: "binding\x0a\x09^ binding",
  34781. referencedClasses: [],
  34782. messageSends: []
  34783. }),
  34784. $globals.VariableNode);
  34785. $core.addMethod(
  34786. $core.method({
  34787. selector: "binding:",
  34788. protocol: "accessing",
  34789. fn: function (aScopeVar){
  34790. var self=this;
  34791. self["@binding"]=aScopeVar;
  34792. return self;
  34793. },
  34794. args: ["aScopeVar"],
  34795. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  34796. referencedClasses: [],
  34797. messageSends: []
  34798. }),
  34799. $globals.VariableNode);
  34800. $core.addMethod(
  34801. $core.method({
  34802. selector: "isArgument",
  34803. protocol: "testing",
  34804. fn: function (){
  34805. var self=this;
  34806. return $core.withContext(function($ctx1) {
  34807. return $recv(self._binding())._isArgVar();
  34808. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  34809. },
  34810. args: [],
  34811. source: "isArgument\x0a\x09^ self binding isArgVar",
  34812. referencedClasses: [],
  34813. messageSends: ["isArgVar", "binding"]
  34814. }),
  34815. $globals.VariableNode);
  34816. $core.addMethod(
  34817. $core.method({
  34818. selector: "isImmutable",
  34819. protocol: "testing",
  34820. fn: function (){
  34821. var self=this;
  34822. return $core.withContext(function($ctx1) {
  34823. return $recv(self._binding())._isImmutable();
  34824. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  34825. },
  34826. args: [],
  34827. source: "isImmutable\x0a\x09^ self binding isImmutable",
  34828. referencedClasses: [],
  34829. messageSends: ["isImmutable", "binding"]
  34830. }),
  34831. $globals.VariableNode);
  34832. $core.addMethod(
  34833. $core.method({
  34834. selector: "isNavigationNode",
  34835. protocol: "testing",
  34836. fn: function (){
  34837. var self=this;
  34838. return true;
  34839. },
  34840. args: [],
  34841. source: "isNavigationNode\x0a\x09^ true",
  34842. referencedClasses: [],
  34843. messageSends: []
  34844. }),
  34845. $globals.VariableNode);
  34846. $core.addMethod(
  34847. $core.method({
  34848. selector: "isSuperKeyword",
  34849. protocol: "testing",
  34850. fn: function (){
  34851. var self=this;
  34852. return $core.withContext(function($ctx1) {
  34853. return $recv(self._value()).__eq("super");
  34854. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  34855. },
  34856. args: [],
  34857. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  34858. referencedClasses: [],
  34859. messageSends: ["=", "value"]
  34860. }),
  34861. $globals.VariableNode);
  34862. $core.addMethod(
  34863. $core.method({
  34864. selector: "isVariableNode",
  34865. protocol: "testing",
  34866. fn: function (){
  34867. var self=this;
  34868. return true;
  34869. },
  34870. args: [],
  34871. source: "isVariableNode\x0a\x09^ true",
  34872. referencedClasses: [],
  34873. messageSends: []
  34874. }),
  34875. $globals.VariableNode);
  34876. $core.addMethod(
  34877. $core.method({
  34878. selector: "navigationLink",
  34879. protocol: "accessing",
  34880. fn: function (){
  34881. var self=this;
  34882. return $core.withContext(function($ctx1) {
  34883. return self._value();
  34884. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  34885. },
  34886. args: [],
  34887. source: "navigationLink\x0a\x09^ self value",
  34888. referencedClasses: [],
  34889. messageSends: ["value"]
  34890. }),
  34891. $globals.VariableNode);
  34892. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  34893. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  34894. $core.addMethod(
  34895. $core.method({
  34896. selector: "visit:",
  34897. protocol: "visiting",
  34898. fn: function (aNode){
  34899. var self=this;
  34900. return $core.withContext(function($ctx1) {
  34901. var $1;
  34902. $recv(self._path())._ifNotEmpty_((function(p){
  34903. return $core.withContext(function($ctx2) {
  34904. return $recv(aNode)._parent_($recv(p)._last());
  34905. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  34906. }));
  34907. $1=(
  34908. $ctx1.supercall = true,
  34909. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  34910. $ctx1.supercall = false;
  34911. return $1;
  34912. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  34913. },
  34914. args: ["aNode"],
  34915. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  34916. referencedClasses: [],
  34917. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  34918. }),
  34919. $globals.ParentFakingPathDagVisitor);
  34920. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  34921. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  34922. $core.addMethod(
  34923. $core.method({
  34924. selector: "visitAssignmentNode:",
  34925. protocol: "visiting",
  34926. fn: function (aNode){
  34927. var self=this;
  34928. return $core.withContext(function($ctx1) {
  34929. return self._visitDagNode_(aNode);
  34930. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  34931. },
  34932. args: ["aNode"],
  34933. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34934. referencedClasses: [],
  34935. messageSends: ["visitDagNode:"]
  34936. }),
  34937. $globals.NodeVisitor);
  34938. $core.addMethod(
  34939. $core.method({
  34940. selector: "visitBlockNode:",
  34941. protocol: "visiting",
  34942. fn: function (aNode){
  34943. var self=this;
  34944. return $core.withContext(function($ctx1) {
  34945. return self._visitDagNode_(aNode);
  34946. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  34947. },
  34948. args: ["aNode"],
  34949. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34950. referencedClasses: [],
  34951. messageSends: ["visitDagNode:"]
  34952. }),
  34953. $globals.NodeVisitor);
  34954. $core.addMethod(
  34955. $core.method({
  34956. selector: "visitBlockSequenceNode:",
  34957. protocol: "visiting",
  34958. fn: function (aNode){
  34959. var self=this;
  34960. return $core.withContext(function($ctx1) {
  34961. return self._visitSequenceNode_(aNode);
  34962. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  34963. },
  34964. args: ["aNode"],
  34965. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  34966. referencedClasses: [],
  34967. messageSends: ["visitSequenceNode:"]
  34968. }),
  34969. $globals.NodeVisitor);
  34970. $core.addMethod(
  34971. $core.method({
  34972. selector: "visitCascadeNode:",
  34973. protocol: "visiting",
  34974. fn: function (aNode){
  34975. var self=this;
  34976. return $core.withContext(function($ctx1) {
  34977. return self._visitDagNode_(aNode);
  34978. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  34979. },
  34980. args: ["aNode"],
  34981. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  34982. referencedClasses: [],
  34983. messageSends: ["visitDagNode:"]
  34984. }),
  34985. $globals.NodeVisitor);
  34986. $core.addMethod(
  34987. $core.method({
  34988. selector: "visitDagNode:",
  34989. protocol: "visiting",
  34990. fn: function (aNode){
  34991. var self=this;
  34992. return $core.withContext(function($ctx1) {
  34993. return self._visitDagNodeVariantSimple_(aNode);
  34994. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  34995. },
  34996. args: ["aNode"],
  34997. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  34998. referencedClasses: [],
  34999. messageSends: ["visitDagNodeVariantSimple:"]
  35000. }),
  35001. $globals.NodeVisitor);
  35002. $core.addMethod(
  35003. $core.method({
  35004. selector: "visitDynamicArrayNode:",
  35005. protocol: "visiting",
  35006. fn: function (aNode){
  35007. var self=this;
  35008. return $core.withContext(function($ctx1) {
  35009. return self._visitDagNode_(aNode);
  35010. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  35011. },
  35012. args: ["aNode"],
  35013. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35014. referencedClasses: [],
  35015. messageSends: ["visitDagNode:"]
  35016. }),
  35017. $globals.NodeVisitor);
  35018. $core.addMethod(
  35019. $core.method({
  35020. selector: "visitDynamicDictionaryNode:",
  35021. protocol: "visiting",
  35022. fn: function (aNode){
  35023. var self=this;
  35024. return $core.withContext(function($ctx1) {
  35025. return self._visitDagNode_(aNode);
  35026. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  35027. },
  35028. args: ["aNode"],
  35029. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35030. referencedClasses: [],
  35031. messageSends: ["visitDagNode:"]
  35032. }),
  35033. $globals.NodeVisitor);
  35034. $core.addMethod(
  35035. $core.method({
  35036. selector: "visitJSStatementNode:",
  35037. protocol: "visiting",
  35038. fn: function (aNode){
  35039. var self=this;
  35040. return $core.withContext(function($ctx1) {
  35041. return self._visitDagNode_(aNode);
  35042. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  35043. },
  35044. args: ["aNode"],
  35045. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35046. referencedClasses: [],
  35047. messageSends: ["visitDagNode:"]
  35048. }),
  35049. $globals.NodeVisitor);
  35050. $core.addMethod(
  35051. $core.method({
  35052. selector: "visitMethodNode:",
  35053. protocol: "visiting",
  35054. fn: function (aNode){
  35055. var self=this;
  35056. return $core.withContext(function($ctx1) {
  35057. return self._visitDagNode_(aNode);
  35058. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35059. },
  35060. args: ["aNode"],
  35061. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35062. referencedClasses: [],
  35063. messageSends: ["visitDagNode:"]
  35064. }),
  35065. $globals.NodeVisitor);
  35066. $core.addMethod(
  35067. $core.method({
  35068. selector: "visitReturnNode:",
  35069. protocol: "visiting",
  35070. fn: function (aNode){
  35071. var self=this;
  35072. return $core.withContext(function($ctx1) {
  35073. return self._visitDagNode_(aNode);
  35074. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35075. },
  35076. args: ["aNode"],
  35077. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35078. referencedClasses: [],
  35079. messageSends: ["visitDagNode:"]
  35080. }),
  35081. $globals.NodeVisitor);
  35082. $core.addMethod(
  35083. $core.method({
  35084. selector: "visitSendNode:",
  35085. protocol: "visiting",
  35086. fn: function (aNode){
  35087. var self=this;
  35088. return $core.withContext(function($ctx1) {
  35089. return self._visitDagNode_(aNode);
  35090. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35091. },
  35092. args: ["aNode"],
  35093. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35094. referencedClasses: [],
  35095. messageSends: ["visitDagNode:"]
  35096. }),
  35097. $globals.NodeVisitor);
  35098. $core.addMethod(
  35099. $core.method({
  35100. selector: "visitSequenceNode:",
  35101. protocol: "visiting",
  35102. fn: function (aNode){
  35103. var self=this;
  35104. return $core.withContext(function($ctx1) {
  35105. return self._visitDagNode_(aNode);
  35106. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35107. },
  35108. args: ["aNode"],
  35109. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35110. referencedClasses: [],
  35111. messageSends: ["visitDagNode:"]
  35112. }),
  35113. $globals.NodeVisitor);
  35114. $core.addMethod(
  35115. $core.method({
  35116. selector: "visitValueNode:",
  35117. protocol: "visiting",
  35118. fn: function (aNode){
  35119. var self=this;
  35120. return $core.withContext(function($ctx1) {
  35121. return self._visitDagNode_(aNode);
  35122. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35123. },
  35124. args: ["aNode"],
  35125. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35126. referencedClasses: [],
  35127. messageSends: ["visitDagNode:"]
  35128. }),
  35129. $globals.NodeVisitor);
  35130. $core.addMethod(
  35131. $core.method({
  35132. selector: "visitVariableNode:",
  35133. protocol: "visiting",
  35134. fn: function (aNode){
  35135. var self=this;
  35136. return $core.withContext(function($ctx1) {
  35137. return self._visitDagNode_(aNode);
  35138. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35139. },
  35140. args: ["aNode"],
  35141. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35142. referencedClasses: [],
  35143. messageSends: ["visitDagNode:"]
  35144. }),
  35145. $globals.NodeVisitor);
  35146. $core.addMethod(
  35147. $core.method({
  35148. selector: "ast",
  35149. protocol: "*Compiler-AST",
  35150. fn: function (){
  35151. var self=this;
  35152. return $core.withContext(function($ctx1) {
  35153. var $1;
  35154. $1=self._source();
  35155. $ctx1.sendIdx["source"]=1;
  35156. $recv($1)._ifEmpty_((function(){
  35157. return $core.withContext(function($ctx2) {
  35158. return self._error_("Method source is empty");
  35159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35160. }));
  35161. return $recv($globals.Smalltalk)._parse_(self._source());
  35162. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35163. },
  35164. args: [],
  35165. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  35166. referencedClasses: ["Smalltalk"],
  35167. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  35168. }),
  35169. $globals.CompiledMethod);
  35170. });
  35171. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35172. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  35173. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35174. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  35175. $core.addPackage("Compiler-Semantic");
  35176. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  35177. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35178. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  35179. $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.";
  35180. $core.addMethod(
  35181. $core.method({
  35182. selector: "addArg:",
  35183. protocol: "adding",
  35184. fn: function (aString){
  35185. var self=this;
  35186. return $core.withContext(function($ctx1) {
  35187. var $1;
  35188. $1=self._args();
  35189. $ctx1.sendIdx["args"]=1;
  35190. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  35191. $recv($recv(self._args())._at_(aString))._scope_(self);
  35192. return self;
  35193. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  35194. },
  35195. args: ["aString"],
  35196. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  35197. referencedClasses: ["ArgVar"],
  35198. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  35199. }),
  35200. $globals.LexicalScope);
  35201. $core.addMethod(
  35202. $core.method({
  35203. selector: "addTemp:",
  35204. protocol: "adding",
  35205. fn: function (aString){
  35206. var self=this;
  35207. return $core.withContext(function($ctx1) {
  35208. var $1;
  35209. $1=self._temps();
  35210. $ctx1.sendIdx["temps"]=1;
  35211. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  35212. $recv($recv(self._temps())._at_(aString))._scope_(self);
  35213. return self;
  35214. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  35215. },
  35216. args: ["aString"],
  35217. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  35218. referencedClasses: ["TempVar"],
  35219. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  35220. }),
  35221. $globals.LexicalScope);
  35222. $core.addMethod(
  35223. $core.method({
  35224. selector: "alias",
  35225. protocol: "accessing",
  35226. fn: function (){
  35227. var self=this;
  35228. return $core.withContext(function($ctx1) {
  35229. return "$ctx".__comma($recv(self._scopeLevel())._asString());
  35230. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  35231. },
  35232. args: [],
  35233. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  35234. referencedClasses: [],
  35235. messageSends: [",", "asString", "scopeLevel"]
  35236. }),
  35237. $globals.LexicalScope);
  35238. $core.addMethod(
  35239. $core.method({
  35240. selector: "allVariableNames",
  35241. protocol: "accessing",
  35242. fn: function (){
  35243. var self=this;
  35244. return $core.withContext(function($ctx1) {
  35245. var $1;
  35246. $1=$recv(self._args())._keys();
  35247. $ctx1.sendIdx["keys"]=1;
  35248. return $recv($1).__comma($recv(self._temps())._keys());
  35249. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  35250. },
  35251. args: [],
  35252. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  35253. referencedClasses: [],
  35254. messageSends: [",", "keys", "args", "temps"]
  35255. }),
  35256. $globals.LexicalScope);
  35257. $core.addMethod(
  35258. $core.method({
  35259. selector: "args",
  35260. protocol: "accessing",
  35261. fn: function (){
  35262. var self=this;
  35263. return $core.withContext(function($ctx1) {
  35264. var $1,$receiver;
  35265. $1=self["@args"];
  35266. if(($receiver = $1) == null || $receiver.isNil){
  35267. self["@args"]=$recv($globals.Dictionary)._new();
  35268. return self["@args"];
  35269. } else {
  35270. return $1;
  35271. }
  35272. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  35273. },
  35274. args: [],
  35275. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  35276. referencedClasses: ["Dictionary"],
  35277. messageSends: ["ifNil:", "new"]
  35278. }),
  35279. $globals.LexicalScope);
  35280. $core.addMethod(
  35281. $core.method({
  35282. selector: "bindingFor:",
  35283. protocol: "accessing",
  35284. fn: function (aStringOrNode){
  35285. var self=this;
  35286. return $core.withContext(function($ctx1) {
  35287. var $2,$3,$4,$5,$1;
  35288. $2=self._pseudoVars();
  35289. $3=$recv(aStringOrNode)._value();
  35290. $ctx1.sendIdx["value"]=1;
  35291. $1=$recv($2)._at_ifAbsent_($3,(function(){
  35292. return $core.withContext(function($ctx2) {
  35293. $4=self._args();
  35294. $5=$recv(aStringOrNode)._value();
  35295. $ctx2.sendIdx["value"]=2;
  35296. return $recv($4)._at_ifAbsent_($5,(function(){
  35297. return $core.withContext(function($ctx3) {
  35298. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  35299. return nil;
  35300. }));
  35301. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35302. }));
  35303. $ctx2.sendIdx["at:ifAbsent:"]=2;
  35304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35305. }));
  35306. $ctx1.sendIdx["at:ifAbsent:"]=1;
  35307. return $1;
  35308. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  35309. },
  35310. args: ["aStringOrNode"],
  35311. 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 ]]]",
  35312. referencedClasses: [],
  35313. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  35314. }),
  35315. $globals.LexicalScope);
  35316. $core.addMethod(
  35317. $core.method({
  35318. selector: "blockIndex",
  35319. protocol: "accessing",
  35320. fn: function (){
  35321. var self=this;
  35322. return $core.withContext(function($ctx1) {
  35323. var $1,$receiver;
  35324. $1=self["@blockIndex"];
  35325. if(($receiver = $1) == null || $receiver.isNil){
  35326. return (0);
  35327. } else {
  35328. return $1;
  35329. }
  35330. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  35331. },
  35332. args: [],
  35333. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  35334. referencedClasses: [],
  35335. messageSends: ["ifNil:"]
  35336. }),
  35337. $globals.LexicalScope);
  35338. $core.addMethod(
  35339. $core.method({
  35340. selector: "blockIndex:",
  35341. protocol: "accessing",
  35342. fn: function (anInteger){
  35343. var self=this;
  35344. self["@blockIndex"]=anInteger;
  35345. return self;
  35346. },
  35347. args: ["anInteger"],
  35348. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  35349. referencedClasses: [],
  35350. messageSends: []
  35351. }),
  35352. $globals.LexicalScope);
  35353. $core.addMethod(
  35354. $core.method({
  35355. selector: "canInlineNonLocalReturns",
  35356. protocol: "testing",
  35357. fn: function (){
  35358. var self=this;
  35359. return $core.withContext(function($ctx1) {
  35360. return $recv(self._isInlined())._and_((function(){
  35361. return $core.withContext(function($ctx2) {
  35362. return $recv(self._outerScope())._canInlineNonLocalReturns();
  35363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35364. }));
  35365. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  35366. },
  35367. args: [],
  35368. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  35369. referencedClasses: [],
  35370. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  35371. }),
  35372. $globals.LexicalScope);
  35373. $core.addMethod(
  35374. $core.method({
  35375. selector: "instruction",
  35376. protocol: "accessing",
  35377. fn: function (){
  35378. var self=this;
  35379. return self["@instruction"];
  35380. },
  35381. args: [],
  35382. source: "instruction\x0a\x09^ instruction",
  35383. referencedClasses: [],
  35384. messageSends: []
  35385. }),
  35386. $globals.LexicalScope);
  35387. $core.addMethod(
  35388. $core.method({
  35389. selector: "instruction:",
  35390. protocol: "accessing",
  35391. fn: function (anIRInstruction){
  35392. var self=this;
  35393. self["@instruction"]=anIRInstruction;
  35394. return self;
  35395. },
  35396. args: ["anIRInstruction"],
  35397. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  35398. referencedClasses: [],
  35399. messageSends: []
  35400. }),
  35401. $globals.LexicalScope);
  35402. $core.addMethod(
  35403. $core.method({
  35404. selector: "isBlockScope",
  35405. protocol: "testing",
  35406. fn: function (){
  35407. var self=this;
  35408. return $core.withContext(function($ctx1) {
  35409. return $recv(self._isMethodScope())._not();
  35410. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  35411. },
  35412. args: [],
  35413. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  35414. referencedClasses: [],
  35415. messageSends: ["not", "isMethodScope"]
  35416. }),
  35417. $globals.LexicalScope);
  35418. $core.addMethod(
  35419. $core.method({
  35420. selector: "isInlined",
  35421. protocol: "testing",
  35422. fn: function (){
  35423. var self=this;
  35424. return $core.withContext(function($ctx1) {
  35425. var $2,$1;
  35426. $2=self._instruction();
  35427. $ctx1.sendIdx["instruction"]=1;
  35428. $1=$recv($2)._notNil();
  35429. return $recv($1)._and_((function(){
  35430. return $core.withContext(function($ctx2) {
  35431. return $recv(self._instruction())._isInlined();
  35432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35433. }));
  35434. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  35435. },
  35436. args: [],
  35437. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  35438. referencedClasses: [],
  35439. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  35440. }),
  35441. $globals.LexicalScope);
  35442. $core.addMethod(
  35443. $core.method({
  35444. selector: "isMethodScope",
  35445. protocol: "testing",
  35446. fn: function (){
  35447. var self=this;
  35448. return false;
  35449. },
  35450. args: [],
  35451. source: "isMethodScope\x0a\x09^ false",
  35452. referencedClasses: [],
  35453. messageSends: []
  35454. }),
  35455. $globals.LexicalScope);
  35456. $core.addMethod(
  35457. $core.method({
  35458. selector: "lookupVariable:",
  35459. protocol: "accessing",
  35460. fn: function (aNode){
  35461. var self=this;
  35462. var lookup;
  35463. return $core.withContext(function($ctx1) {
  35464. var $1,$2,$receiver;
  35465. lookup=self._bindingFor_(aNode);
  35466. $1=lookup;
  35467. if(($receiver = $1) == null || $receiver.isNil){
  35468. $2=self._outerScope();
  35469. $ctx1.sendIdx["outerScope"]=1;
  35470. if(($receiver = $2) == null || $receiver.isNil){
  35471. lookup=$2;
  35472. } else {
  35473. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  35474. }
  35475. lookup;
  35476. } else {
  35477. $1;
  35478. }
  35479. return lookup;
  35480. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  35481. },
  35482. args: ["aNode"],
  35483. 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",
  35484. referencedClasses: [],
  35485. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  35486. }),
  35487. $globals.LexicalScope);
  35488. $core.addMethod(
  35489. $core.method({
  35490. selector: "methodScope",
  35491. protocol: "accessing",
  35492. fn: function (){
  35493. var self=this;
  35494. return $core.withContext(function($ctx1) {
  35495. var $1,$receiver;
  35496. $1=self._outerScope();
  35497. $ctx1.sendIdx["outerScope"]=1;
  35498. if(($receiver = $1) == null || $receiver.isNil){
  35499. return $1;
  35500. } else {
  35501. return $recv(self._outerScope())._methodScope();
  35502. }
  35503. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  35504. },
  35505. args: [],
  35506. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  35507. referencedClasses: [],
  35508. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  35509. }),
  35510. $globals.LexicalScope);
  35511. $core.addMethod(
  35512. $core.method({
  35513. selector: "node",
  35514. protocol: "accessing",
  35515. fn: function (){
  35516. var self=this;
  35517. return self["@node"];
  35518. },
  35519. args: [],
  35520. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  35521. referencedClasses: [],
  35522. messageSends: []
  35523. }),
  35524. $globals.LexicalScope);
  35525. $core.addMethod(
  35526. $core.method({
  35527. selector: "node:",
  35528. protocol: "accessing",
  35529. fn: function (aNode){
  35530. var self=this;
  35531. self["@node"]=aNode;
  35532. return self;
  35533. },
  35534. args: ["aNode"],
  35535. source: "node: aNode\x0a\x09node := aNode",
  35536. referencedClasses: [],
  35537. messageSends: []
  35538. }),
  35539. $globals.LexicalScope);
  35540. $core.addMethod(
  35541. $core.method({
  35542. selector: "outerScope",
  35543. protocol: "accessing",
  35544. fn: function (){
  35545. var self=this;
  35546. return self["@outerScope"];
  35547. },
  35548. args: [],
  35549. source: "outerScope\x0a\x09^ outerScope",
  35550. referencedClasses: [],
  35551. messageSends: []
  35552. }),
  35553. $globals.LexicalScope);
  35554. $core.addMethod(
  35555. $core.method({
  35556. selector: "outerScope:",
  35557. protocol: "accessing",
  35558. fn: function (aLexicalScope){
  35559. var self=this;
  35560. self["@outerScope"]=aLexicalScope;
  35561. return self;
  35562. },
  35563. args: ["aLexicalScope"],
  35564. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  35565. referencedClasses: [],
  35566. messageSends: []
  35567. }),
  35568. $globals.LexicalScope);
  35569. $core.addMethod(
  35570. $core.method({
  35571. selector: "pseudoVars",
  35572. protocol: "accessing",
  35573. fn: function (){
  35574. var self=this;
  35575. return $core.withContext(function($ctx1) {
  35576. return $recv(self._methodScope())._pseudoVars();
  35577. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  35578. },
  35579. args: [],
  35580. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  35581. referencedClasses: [],
  35582. messageSends: ["pseudoVars", "methodScope"]
  35583. }),
  35584. $globals.LexicalScope);
  35585. $core.addMethod(
  35586. $core.method({
  35587. selector: "scopeLevel",
  35588. protocol: "accessing",
  35589. fn: function (){
  35590. var self=this;
  35591. return $core.withContext(function($ctx1) {
  35592. var $1,$2,$4,$3,$receiver;
  35593. $1=self._outerScope();
  35594. $ctx1.sendIdx["outerScope"]=1;
  35595. if(($receiver = $1) == null || $receiver.isNil){
  35596. return (1);
  35597. } else {
  35598. $1;
  35599. }
  35600. $2=self._isInlined();
  35601. if($core.assert($2)){
  35602. $4=self._outerScope();
  35603. $ctx1.sendIdx["outerScope"]=2;
  35604. $3=$recv($4)._scopeLevel();
  35605. $ctx1.sendIdx["scopeLevel"]=1;
  35606. return $3;
  35607. }
  35608. return $recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  35609. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  35610. },
  35611. args: [],
  35612. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  35613. referencedClasses: [],
  35614. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  35615. }),
  35616. $globals.LexicalScope);
  35617. $core.addMethod(
  35618. $core.method({
  35619. selector: "temps",
  35620. protocol: "accessing",
  35621. fn: function (){
  35622. var self=this;
  35623. return $core.withContext(function($ctx1) {
  35624. var $1,$receiver;
  35625. $1=self["@temps"];
  35626. if(($receiver = $1) == null || $receiver.isNil){
  35627. self["@temps"]=$recv($globals.Dictionary)._new();
  35628. return self["@temps"];
  35629. } else {
  35630. return $1;
  35631. }
  35632. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  35633. },
  35634. args: [],
  35635. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  35636. referencedClasses: ["Dictionary"],
  35637. messageSends: ["ifNil:", "new"]
  35638. }),
  35639. $globals.LexicalScope);
  35640. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  35641. $globals.MethodLexicalScope.comment="I represent a method scope.";
  35642. $core.addMethod(
  35643. $core.method({
  35644. selector: "addIVar:",
  35645. protocol: "adding",
  35646. fn: function (aString){
  35647. var self=this;
  35648. return $core.withContext(function($ctx1) {
  35649. var $1;
  35650. $1=self._iVars();
  35651. $ctx1.sendIdx["iVars"]=1;
  35652. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  35653. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  35654. return self;
  35655. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  35656. },
  35657. args: ["aString"],
  35658. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  35659. referencedClasses: ["InstanceVar"],
  35660. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  35661. }),
  35662. $globals.MethodLexicalScope);
  35663. $core.addMethod(
  35664. $core.method({
  35665. selector: "addNonLocalReturn:",
  35666. protocol: "adding",
  35667. fn: function (aScope){
  35668. var self=this;
  35669. return $core.withContext(function($ctx1) {
  35670. $recv(self._nonLocalReturns())._add_(aScope);
  35671. return self;
  35672. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  35673. },
  35674. args: ["aScope"],
  35675. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  35676. referencedClasses: [],
  35677. messageSends: ["add:", "nonLocalReturns"]
  35678. }),
  35679. $globals.MethodLexicalScope);
  35680. $core.addMethod(
  35681. $core.method({
  35682. selector: "allVariableNames",
  35683. protocol: "accessing",
  35684. fn: function (){
  35685. var self=this;
  35686. return $core.withContext(function($ctx1) {
  35687. var $1;
  35688. $1=(
  35689. $ctx1.supercall = true,
  35690. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($recv(self), []));
  35691. $ctx1.supercall = false;
  35692. return $recv($1).__comma($recv(self._iVars())._keys());
  35693. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  35694. },
  35695. args: [],
  35696. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  35697. referencedClasses: [],
  35698. messageSends: [",", "allVariableNames", "keys", "iVars"]
  35699. }),
  35700. $globals.MethodLexicalScope);
  35701. $core.addMethod(
  35702. $core.method({
  35703. selector: "bindingFor:",
  35704. protocol: "accessing",
  35705. fn: function (aNode){
  35706. var self=this;
  35707. return $core.withContext(function($ctx1) {
  35708. var $1,$receiver;
  35709. $1=(
  35710. $ctx1.supercall = true,
  35711. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  35712. $ctx1.supercall = false;
  35713. if(($receiver = $1) == null || $receiver.isNil){
  35714. return $recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  35715. return nil;
  35716. }));
  35717. } else {
  35718. return $1;
  35719. }
  35720. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  35721. },
  35722. args: ["aNode"],
  35723. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  35724. referencedClasses: [],
  35725. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  35726. }),
  35727. $globals.MethodLexicalScope);
  35728. $core.addMethod(
  35729. $core.method({
  35730. selector: "canInlineNonLocalReturns",
  35731. protocol: "testing",
  35732. fn: function (){
  35733. var self=this;
  35734. return true;
  35735. },
  35736. args: [],
  35737. source: "canInlineNonLocalReturns\x0a\x09^ true",
  35738. referencedClasses: [],
  35739. messageSends: []
  35740. }),
  35741. $globals.MethodLexicalScope);
  35742. $core.addMethod(
  35743. $core.method({
  35744. selector: "hasLocalReturn",
  35745. protocol: "testing",
  35746. fn: function (){
  35747. var self=this;
  35748. return $core.withContext(function($ctx1) {
  35749. return self._localReturn();
  35750. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  35751. },
  35752. args: [],
  35753. source: "hasLocalReturn\x0a\x09^ self localReturn",
  35754. referencedClasses: [],
  35755. messageSends: ["localReturn"]
  35756. }),
  35757. $globals.MethodLexicalScope);
  35758. $core.addMethod(
  35759. $core.method({
  35760. selector: "hasNonLocalReturn",
  35761. protocol: "testing",
  35762. fn: function (){
  35763. var self=this;
  35764. return $core.withContext(function($ctx1) {
  35765. return $recv(self._nonLocalReturns())._notEmpty();
  35766. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  35767. },
  35768. args: [],
  35769. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  35770. referencedClasses: [],
  35771. messageSends: ["notEmpty", "nonLocalReturns"]
  35772. }),
  35773. $globals.MethodLexicalScope);
  35774. $core.addMethod(
  35775. $core.method({
  35776. selector: "iVars",
  35777. protocol: "accessing",
  35778. fn: function (){
  35779. var self=this;
  35780. return $core.withContext(function($ctx1) {
  35781. var $1,$receiver;
  35782. $1=self["@iVars"];
  35783. if(($receiver = $1) == null || $receiver.isNil){
  35784. self["@iVars"]=$recv($globals.Dictionary)._new();
  35785. return self["@iVars"];
  35786. } else {
  35787. return $1;
  35788. }
  35789. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  35790. },
  35791. args: [],
  35792. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  35793. referencedClasses: ["Dictionary"],
  35794. messageSends: ["ifNil:", "new"]
  35795. }),
  35796. $globals.MethodLexicalScope);
  35797. $core.addMethod(
  35798. $core.method({
  35799. selector: "isMethodScope",
  35800. protocol: "testing",
  35801. fn: function (){
  35802. var self=this;
  35803. return true;
  35804. },
  35805. args: [],
  35806. source: "isMethodScope\x0a\x09^ true",
  35807. referencedClasses: [],
  35808. messageSends: []
  35809. }),
  35810. $globals.MethodLexicalScope);
  35811. $core.addMethod(
  35812. $core.method({
  35813. selector: "localReturn",
  35814. protocol: "accessing",
  35815. fn: function (){
  35816. var self=this;
  35817. return $core.withContext(function($ctx1) {
  35818. var $1,$receiver;
  35819. $1=self["@localReturn"];
  35820. if(($receiver = $1) == null || $receiver.isNil){
  35821. return false;
  35822. } else {
  35823. return $1;
  35824. }
  35825. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  35826. },
  35827. args: [],
  35828. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  35829. referencedClasses: [],
  35830. messageSends: ["ifNil:"]
  35831. }),
  35832. $globals.MethodLexicalScope);
  35833. $core.addMethod(
  35834. $core.method({
  35835. selector: "localReturn:",
  35836. protocol: "accessing",
  35837. fn: function (aBoolean){
  35838. var self=this;
  35839. self["@localReturn"]=aBoolean;
  35840. return self;
  35841. },
  35842. args: ["aBoolean"],
  35843. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  35844. referencedClasses: [],
  35845. messageSends: []
  35846. }),
  35847. $globals.MethodLexicalScope);
  35848. $core.addMethod(
  35849. $core.method({
  35850. selector: "methodScope",
  35851. protocol: "accessing",
  35852. fn: function (){
  35853. var self=this;
  35854. return self;
  35855. },
  35856. args: [],
  35857. source: "methodScope\x0a\x09^ self",
  35858. referencedClasses: [],
  35859. messageSends: []
  35860. }),
  35861. $globals.MethodLexicalScope);
  35862. $core.addMethod(
  35863. $core.method({
  35864. selector: "nonLocalReturns",
  35865. protocol: "accessing",
  35866. fn: function (){
  35867. var self=this;
  35868. return $core.withContext(function($ctx1) {
  35869. var $1,$receiver;
  35870. $1=self["@nonLocalReturns"];
  35871. if(($receiver = $1) == null || $receiver.isNil){
  35872. self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  35873. return self["@nonLocalReturns"];
  35874. } else {
  35875. return $1;
  35876. }
  35877. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  35878. },
  35879. args: [],
  35880. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  35881. referencedClasses: ["OrderedCollection"],
  35882. messageSends: ["ifNil:", "new"]
  35883. }),
  35884. $globals.MethodLexicalScope);
  35885. $core.addMethod(
  35886. $core.method({
  35887. selector: "pseudoVars",
  35888. protocol: "accessing",
  35889. fn: function (){
  35890. var self=this;
  35891. return $core.withContext(function($ctx1) {
  35892. var $1,$2,$4,$3,$receiver;
  35893. $1=self["@pseudoVars"];
  35894. if(($receiver = $1) == null || $receiver.isNil){
  35895. self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  35896. self["@pseudoVars"];
  35897. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  35898. return $core.withContext(function($ctx2) {
  35899. $2=self["@pseudoVars"];
  35900. $4=$recv($globals.PseudoVar)._on_(each);
  35901. $recv($4)._scope_(self._methodScope());
  35902. $3=$recv($4)._yourself();
  35903. return $recv($2)._at_put_(each,$3);
  35904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35905. }));
  35906. } else {
  35907. $1;
  35908. }
  35909. return self["@pseudoVars"];
  35910. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  35911. },
  35912. args: [],
  35913. 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",
  35914. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  35915. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  35916. }),
  35917. $globals.MethodLexicalScope);
  35918. $core.addMethod(
  35919. $core.method({
  35920. selector: "removeNonLocalReturn:",
  35921. protocol: "adding",
  35922. fn: function (aScope){
  35923. var self=this;
  35924. return $core.withContext(function($ctx1) {
  35925. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  35926. }));
  35927. return self;
  35928. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  35929. },
  35930. args: ["aScope"],
  35931. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  35932. referencedClasses: [],
  35933. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  35934. }),
  35935. $globals.MethodLexicalScope);
  35936. $core.addMethod(
  35937. $core.method({
  35938. selector: "unknownVariables",
  35939. protocol: "accessing",
  35940. fn: function (){
  35941. var self=this;
  35942. return $core.withContext(function($ctx1) {
  35943. var $1,$receiver;
  35944. $1=self["@unknownVariables"];
  35945. if(($receiver = $1) == null || $receiver.isNil){
  35946. self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  35947. return self["@unknownVariables"];
  35948. } else {
  35949. return $1;
  35950. }
  35951. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  35952. },
  35953. args: [],
  35954. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  35955. referencedClasses: ["OrderedCollection"],
  35956. messageSends: ["ifNil:", "new"]
  35957. }),
  35958. $globals.MethodLexicalScope);
  35959. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  35960. $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.";
  35961. $core.addMethod(
  35962. $core.method({
  35963. selector: "alias",
  35964. protocol: "accessing",
  35965. fn: function (){
  35966. var self=this;
  35967. return $core.withContext(function($ctx1) {
  35968. return $recv(self._name())._asVariableName();
  35969. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  35970. },
  35971. args: [],
  35972. source: "alias\x0a\x09^ self name asVariableName",
  35973. referencedClasses: [],
  35974. messageSends: ["asVariableName", "name"]
  35975. }),
  35976. $globals.ScopeVar);
  35977. $core.addMethod(
  35978. $core.method({
  35979. selector: "isArgVar",
  35980. protocol: "testing",
  35981. fn: function (){
  35982. var self=this;
  35983. return false;
  35984. },
  35985. args: [],
  35986. source: "isArgVar\x0a\x09^ false",
  35987. referencedClasses: [],
  35988. messageSends: []
  35989. }),
  35990. $globals.ScopeVar);
  35991. $core.addMethod(
  35992. $core.method({
  35993. selector: "isClassRefVar",
  35994. protocol: "testing",
  35995. fn: function (){
  35996. var self=this;
  35997. return false;
  35998. },
  35999. args: [],
  36000. source: "isClassRefVar\x0a\x09^ false",
  36001. referencedClasses: [],
  36002. messageSends: []
  36003. }),
  36004. $globals.ScopeVar);
  36005. $core.addMethod(
  36006. $core.method({
  36007. selector: "isImmutable",
  36008. protocol: "testing",
  36009. fn: function (){
  36010. var self=this;
  36011. return false;
  36012. },
  36013. args: [],
  36014. source: "isImmutable\x0a\x09^ false",
  36015. referencedClasses: [],
  36016. messageSends: []
  36017. }),
  36018. $globals.ScopeVar);
  36019. $core.addMethod(
  36020. $core.method({
  36021. selector: "isInstanceVar",
  36022. protocol: "testing",
  36023. fn: function (){
  36024. var self=this;
  36025. return false;
  36026. },
  36027. args: [],
  36028. source: "isInstanceVar\x0a\x09^ false",
  36029. referencedClasses: [],
  36030. messageSends: []
  36031. }),
  36032. $globals.ScopeVar);
  36033. $core.addMethod(
  36034. $core.method({
  36035. selector: "isPseudoVar",
  36036. protocol: "testing",
  36037. fn: function (){
  36038. var self=this;
  36039. return false;
  36040. },
  36041. args: [],
  36042. source: "isPseudoVar\x0a\x09^ false",
  36043. referencedClasses: [],
  36044. messageSends: []
  36045. }),
  36046. $globals.ScopeVar);
  36047. $core.addMethod(
  36048. $core.method({
  36049. selector: "isTempVar",
  36050. protocol: "testing",
  36051. fn: function (){
  36052. var self=this;
  36053. return false;
  36054. },
  36055. args: [],
  36056. source: "isTempVar\x0a\x09^ false",
  36057. referencedClasses: [],
  36058. messageSends: []
  36059. }),
  36060. $globals.ScopeVar);
  36061. $core.addMethod(
  36062. $core.method({
  36063. selector: "isUnknownVar",
  36064. protocol: "testing",
  36065. fn: function (){
  36066. var self=this;
  36067. return false;
  36068. },
  36069. args: [],
  36070. source: "isUnknownVar\x0a\x09^ false",
  36071. referencedClasses: [],
  36072. messageSends: []
  36073. }),
  36074. $globals.ScopeVar);
  36075. $core.addMethod(
  36076. $core.method({
  36077. selector: "name",
  36078. protocol: "accessing",
  36079. fn: function (){
  36080. var self=this;
  36081. return self["@name"];
  36082. },
  36083. args: [],
  36084. source: "name\x0a\x09^ name",
  36085. referencedClasses: [],
  36086. messageSends: []
  36087. }),
  36088. $globals.ScopeVar);
  36089. $core.addMethod(
  36090. $core.method({
  36091. selector: "name:",
  36092. protocol: "accessing",
  36093. fn: function (aString){
  36094. var self=this;
  36095. self["@name"]=aString;
  36096. return self;
  36097. },
  36098. args: ["aString"],
  36099. source: "name: aString\x0a\x09name := aString",
  36100. referencedClasses: [],
  36101. messageSends: []
  36102. }),
  36103. $globals.ScopeVar);
  36104. $core.addMethod(
  36105. $core.method({
  36106. selector: "scope",
  36107. protocol: "accessing",
  36108. fn: function (){
  36109. var self=this;
  36110. return self["@scope"];
  36111. },
  36112. args: [],
  36113. source: "scope\x0a\x09^ scope",
  36114. referencedClasses: [],
  36115. messageSends: []
  36116. }),
  36117. $globals.ScopeVar);
  36118. $core.addMethod(
  36119. $core.method({
  36120. selector: "scope:",
  36121. protocol: "accessing",
  36122. fn: function (aScope){
  36123. var self=this;
  36124. self["@scope"]=aScope;
  36125. return self;
  36126. },
  36127. args: ["aScope"],
  36128. source: "scope: aScope\x0a\x09scope := aScope",
  36129. referencedClasses: [],
  36130. messageSends: []
  36131. }),
  36132. $globals.ScopeVar);
  36133. $core.addMethod(
  36134. $core.method({
  36135. selector: "validateAssignment",
  36136. protocol: "testing",
  36137. fn: function (){
  36138. var self=this;
  36139. return $core.withContext(function($ctx1) {
  36140. var $1,$2;
  36141. $1=$recv(self._isArgVar())._or_((function(){
  36142. return $core.withContext(function($ctx2) {
  36143. return self._isPseudoVar();
  36144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36145. }));
  36146. if($core.assert($1)){
  36147. $2=$recv($globals.InvalidAssignmentError)._new();
  36148. $recv($2)._variableName_(self._name());
  36149. $recv($2)._signal();
  36150. }
  36151. return self;
  36152. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  36153. },
  36154. args: [],
  36155. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  36156. referencedClasses: ["InvalidAssignmentError"],
  36157. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  36158. }),
  36159. $globals.ScopeVar);
  36160. $core.addMethod(
  36161. $core.method({
  36162. selector: "on:",
  36163. protocol: "instance creation",
  36164. fn: function (aString){
  36165. var self=this;
  36166. return $core.withContext(function($ctx1) {
  36167. var $1;
  36168. $1=self._new();
  36169. $recv($1)._name_(aString);
  36170. return $recv($1)._yourself();
  36171. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  36172. },
  36173. args: ["aString"],
  36174. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  36175. referencedClasses: [],
  36176. messageSends: ["name:", "new", "yourself"]
  36177. }),
  36178. $globals.ScopeVar.klass);
  36179. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  36180. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  36181. $core.addMethod(
  36182. $core.method({
  36183. selector: "isImmutable",
  36184. protocol: "testing",
  36185. fn: function (){
  36186. var self=this;
  36187. return true;
  36188. },
  36189. args: [],
  36190. source: "isImmutable\x0a\x09^ true",
  36191. referencedClasses: [],
  36192. messageSends: []
  36193. }),
  36194. $globals.AliasVar);
  36195. $core.addMethod(
  36196. $core.method({
  36197. selector: "node",
  36198. protocol: "accessing",
  36199. fn: function (){
  36200. var self=this;
  36201. return self["@node"];
  36202. },
  36203. args: [],
  36204. source: "node\x0a\x09^ node",
  36205. referencedClasses: [],
  36206. messageSends: []
  36207. }),
  36208. $globals.AliasVar);
  36209. $core.addMethod(
  36210. $core.method({
  36211. selector: "node:",
  36212. protocol: "accessing",
  36213. fn: function (aNode){
  36214. var self=this;
  36215. self["@node"]=aNode;
  36216. return self;
  36217. },
  36218. args: ["aNode"],
  36219. source: "node: aNode\x0a\x09node := aNode",
  36220. referencedClasses: [],
  36221. messageSends: []
  36222. }),
  36223. $globals.AliasVar);
  36224. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36225. $globals.ArgVar.comment="I am an argument of a method or block.";
  36226. $core.addMethod(
  36227. $core.method({
  36228. selector: "isArgVar",
  36229. protocol: "testing",
  36230. fn: function (){
  36231. var self=this;
  36232. return true;
  36233. },
  36234. args: [],
  36235. source: "isArgVar\x0a\x09^ true",
  36236. referencedClasses: [],
  36237. messageSends: []
  36238. }),
  36239. $globals.ArgVar);
  36240. $core.addMethod(
  36241. $core.method({
  36242. selector: "isImmutable",
  36243. protocol: "testing",
  36244. fn: function (){
  36245. var self=this;
  36246. return true;
  36247. },
  36248. args: [],
  36249. source: "isImmutable\x0a\x09^ true",
  36250. referencedClasses: [],
  36251. messageSends: []
  36252. }),
  36253. $globals.ArgVar);
  36254. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36255. $globals.ClassRefVar.comment="I am an class reference variable";
  36256. $core.addMethod(
  36257. $core.method({
  36258. selector: "alias",
  36259. protocol: "accessing",
  36260. fn: function (){
  36261. var self=this;
  36262. return $core.withContext(function($ctx1) {
  36263. return "$globals.".__comma(self._name());
  36264. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  36265. },
  36266. args: [],
  36267. 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",
  36268. referencedClasses: [],
  36269. messageSends: [",", "name"]
  36270. }),
  36271. $globals.ClassRefVar);
  36272. $core.addMethod(
  36273. $core.method({
  36274. selector: "isClassRefVar",
  36275. protocol: "testing",
  36276. fn: function (){
  36277. var self=this;
  36278. return true;
  36279. },
  36280. args: [],
  36281. source: "isClassRefVar\x0a\x09^ true",
  36282. referencedClasses: [],
  36283. messageSends: []
  36284. }),
  36285. $globals.ClassRefVar);
  36286. $core.addMethod(
  36287. $core.method({
  36288. selector: "isImmutable",
  36289. protocol: "testing",
  36290. fn: function (){
  36291. var self=this;
  36292. return true;
  36293. },
  36294. args: [],
  36295. source: "isImmutable\x0a\x09^ true",
  36296. referencedClasses: [],
  36297. messageSends: []
  36298. }),
  36299. $globals.ClassRefVar);
  36300. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36301. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  36302. $core.addMethod(
  36303. $core.method({
  36304. selector: "alias",
  36305. protocol: "testing",
  36306. fn: function (){
  36307. var self=this;
  36308. return $core.withContext(function($ctx1) {
  36309. var $1;
  36310. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  36311. $ctx1.sendIdx[","]=1;
  36312. return $1;
  36313. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  36314. },
  36315. args: [],
  36316. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  36317. referencedClasses: [],
  36318. messageSends: [",", "name"]
  36319. }),
  36320. $globals.InstanceVar);
  36321. $core.addMethod(
  36322. $core.method({
  36323. selector: "isInstanceVar",
  36324. protocol: "testing",
  36325. fn: function (){
  36326. var self=this;
  36327. return true;
  36328. },
  36329. args: [],
  36330. source: "isInstanceVar\x0a\x09^ true",
  36331. referencedClasses: [],
  36332. messageSends: []
  36333. }),
  36334. $globals.InstanceVar);
  36335. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36336. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  36337. $core.addMethod(
  36338. $core.method({
  36339. selector: "alias",
  36340. protocol: "accessing",
  36341. fn: function (){
  36342. var self=this;
  36343. return $core.withContext(function($ctx1) {
  36344. return self._name();
  36345. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  36346. },
  36347. args: [],
  36348. source: "alias\x0a\x09^ self name",
  36349. referencedClasses: [],
  36350. messageSends: ["name"]
  36351. }),
  36352. $globals.PseudoVar);
  36353. $core.addMethod(
  36354. $core.method({
  36355. selector: "isImmutable",
  36356. protocol: "testing",
  36357. fn: function (){
  36358. var self=this;
  36359. return true;
  36360. },
  36361. args: [],
  36362. source: "isImmutable\x0a\x09^ true",
  36363. referencedClasses: [],
  36364. messageSends: []
  36365. }),
  36366. $globals.PseudoVar);
  36367. $core.addMethod(
  36368. $core.method({
  36369. selector: "isPseudoVar",
  36370. protocol: "testing",
  36371. fn: function (){
  36372. var self=this;
  36373. return true;
  36374. },
  36375. args: [],
  36376. source: "isPseudoVar\x0a\x09^ true",
  36377. referencedClasses: [],
  36378. messageSends: []
  36379. }),
  36380. $globals.PseudoVar);
  36381. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36382. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  36383. $core.addMethod(
  36384. $core.method({
  36385. selector: "isTempVar",
  36386. protocol: "testing",
  36387. fn: function (){
  36388. var self=this;
  36389. return true;
  36390. },
  36391. args: [],
  36392. source: "isTempVar\x0a\x09^ true",
  36393. referencedClasses: [],
  36394. messageSends: []
  36395. }),
  36396. $globals.TempVar);
  36397. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  36398. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  36399. $core.addMethod(
  36400. $core.method({
  36401. selector: "isUnknownVar",
  36402. protocol: "testing",
  36403. fn: function (){
  36404. var self=this;
  36405. return true;
  36406. },
  36407. args: [],
  36408. source: "isUnknownVar\x0a\x09^ true",
  36409. referencedClasses: [],
  36410. messageSends: []
  36411. }),
  36412. $globals.UnknownVar);
  36413. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  36414. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  36415. $core.addMethod(
  36416. $core.method({
  36417. selector: "classReferences",
  36418. protocol: "accessing",
  36419. fn: function (){
  36420. var self=this;
  36421. return $core.withContext(function($ctx1) {
  36422. var $1,$receiver;
  36423. $1=self["@classReferences"];
  36424. if(($receiver = $1) == null || $receiver.isNil){
  36425. self["@classReferences"]=$recv($globals.Set)._new();
  36426. return self["@classReferences"];
  36427. } else {
  36428. return $1;
  36429. }
  36430. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  36431. },
  36432. args: [],
  36433. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  36434. referencedClasses: ["Set"],
  36435. messageSends: ["ifNil:", "new"]
  36436. }),
  36437. $globals.SemanticAnalyzer);
  36438. $core.addMethod(
  36439. $core.method({
  36440. selector: "errorShadowingVariable:",
  36441. protocol: "error handling",
  36442. fn: function (aString){
  36443. var self=this;
  36444. return $core.withContext(function($ctx1) {
  36445. var $1;
  36446. $1=$recv($globals.ShadowingVariableError)._new();
  36447. $recv($1)._variableName_(aString);
  36448. $recv($1)._signal();
  36449. return self;
  36450. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  36451. },
  36452. args: ["aString"],
  36453. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  36454. referencedClasses: ["ShadowingVariableError"],
  36455. messageSends: ["variableName:", "new", "signal"]
  36456. }),
  36457. $globals.SemanticAnalyzer);
  36458. $core.addMethod(
  36459. $core.method({
  36460. selector: "errorUnknownVariable:",
  36461. protocol: "error handling",
  36462. fn: function (aNode){
  36463. var self=this;
  36464. var identifier;
  36465. return $core.withContext(function($ctx1) {
  36466. var $1,$2,$3;
  36467. identifier=$recv(aNode)._value();
  36468. $ctx1.sendIdx["value"]=1;
  36469. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  36470. return $core.withContext(function($ctx2) {
  36471. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  36472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36473. }));
  36474. if($core.assert($1)){
  36475. $2=$recv($globals.UnknownVariableError)._new();
  36476. $3=$recv(aNode)._value();
  36477. $ctx1.sendIdx["value"]=2;
  36478. $recv($2)._variableName_($3);
  36479. $recv($2)._signal();
  36480. } else {
  36481. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  36482. }
  36483. return self;
  36484. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  36485. },
  36486. args: ["aNode"],
  36487. 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 ]",
  36488. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  36489. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  36490. }),
  36491. $globals.SemanticAnalyzer);
  36492. $core.addMethod(
  36493. $core.method({
  36494. selector: "isVariableUndefined:inPackage:",
  36495. protocol: "testing",
  36496. fn: function (aString,aPackage){
  36497. var self=this;
  36498. return $core.withContext(function($ctx1) {
  36499. var $1,$2,$3,$receiver;
  36500. if(($receiver = aPackage) == null || $receiver.isNil){
  36501. aPackage;
  36502. } else {
  36503. var packageKnownVars;
  36504. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  36505. packageKnownVars;
  36506. $1=$recv(packageKnownVars)._includes_(aString);
  36507. if($core.assert($1)){
  36508. return false;
  36509. }
  36510. }
  36511. $2=$recv($globals.Compiler)._new();
  36512. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  36513. $ctx1.sendIdx[","]=1;
  36514. return $recv($2)._eval_($3);
  36515. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  36516. },
  36517. args: ["aString", "aPackage"],
  36518. source: "isVariableUndefined: aString inPackage: aPackage\x0a\x09aPackage ifNotNil: [\x0a\x09\x09| packageKnownVars |\x0a\x09\x09packageKnownVars := (aPackage imports\x0a\x09\x09\x09reject: #isString)\x0a\x09\x09\x09collect: #key.\x0a\x09\x09(packageKnownVars includes: aString) ifTrue: [ ^ false ]].\x0a\x09^ Compiler new\x0a\x09\x09eval: 'typeof ', aString, ' == \x22undefined\x22'",
  36519. referencedClasses: ["Compiler"],
  36520. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  36521. }),
  36522. $globals.SemanticAnalyzer);
  36523. $core.addMethod(
  36524. $core.method({
  36525. selector: "messageSends",
  36526. protocol: "accessing",
  36527. fn: function (){
  36528. var self=this;
  36529. return $core.withContext(function($ctx1) {
  36530. var $1,$receiver;
  36531. $1=self["@messageSends"];
  36532. if(($receiver = $1) == null || $receiver.isNil){
  36533. self["@messageSends"]=$recv($globals.Dictionary)._new();
  36534. return self["@messageSends"];
  36535. } else {
  36536. return $1;
  36537. }
  36538. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  36539. },
  36540. args: [],
  36541. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  36542. referencedClasses: ["Dictionary"],
  36543. messageSends: ["ifNil:", "new"]
  36544. }),
  36545. $globals.SemanticAnalyzer);
  36546. $core.addMethod(
  36547. $core.method({
  36548. selector: "newBlockScope",
  36549. protocol: "factory",
  36550. fn: function (){
  36551. var self=this;
  36552. return $core.withContext(function($ctx1) {
  36553. return self._newScopeOfClass_($globals.LexicalScope);
  36554. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  36555. },
  36556. args: [],
  36557. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  36558. referencedClasses: ["LexicalScope"],
  36559. messageSends: ["newScopeOfClass:"]
  36560. }),
  36561. $globals.SemanticAnalyzer);
  36562. $core.addMethod(
  36563. $core.method({
  36564. selector: "newMethodScope",
  36565. protocol: "factory",
  36566. fn: function (){
  36567. var self=this;
  36568. return $core.withContext(function($ctx1) {
  36569. return self._newScopeOfClass_($globals.MethodLexicalScope);
  36570. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  36571. },
  36572. args: [],
  36573. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  36574. referencedClasses: ["MethodLexicalScope"],
  36575. messageSends: ["newScopeOfClass:"]
  36576. }),
  36577. $globals.SemanticAnalyzer);
  36578. $core.addMethod(
  36579. $core.method({
  36580. selector: "newScopeOfClass:",
  36581. protocol: "factory",
  36582. fn: function (aLexicalScopeClass){
  36583. var self=this;
  36584. return $core.withContext(function($ctx1) {
  36585. var $1;
  36586. $1=$recv(aLexicalScopeClass)._new();
  36587. $recv($1)._outerScope_(self["@currentScope"]);
  36588. return $recv($1)._yourself();
  36589. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  36590. },
  36591. args: ["aLexicalScopeClass"],
  36592. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  36593. referencedClasses: [],
  36594. messageSends: ["outerScope:", "new", "yourself"]
  36595. }),
  36596. $globals.SemanticAnalyzer);
  36597. $core.addMethod(
  36598. $core.method({
  36599. selector: "nextBlockIndex",
  36600. protocol: "private",
  36601. fn: function (){
  36602. var self=this;
  36603. return $core.withContext(function($ctx1) {
  36604. var $1,$receiver;
  36605. $1=self["@blockIndex"];
  36606. if(($receiver = $1) == null || $receiver.isNil){
  36607. self["@blockIndex"]=(0);
  36608. self["@blockIndex"];
  36609. } else {
  36610. $1;
  36611. }
  36612. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  36613. return self["@blockIndex"];
  36614. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  36615. },
  36616. args: [],
  36617. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  36618. referencedClasses: [],
  36619. messageSends: ["ifNil:", "+"]
  36620. }),
  36621. $globals.SemanticAnalyzer);
  36622. $core.addMethod(
  36623. $core.method({
  36624. selector: "popScope",
  36625. protocol: "scope",
  36626. fn: function (){
  36627. var self=this;
  36628. return $core.withContext(function($ctx1) {
  36629. var $1,$receiver;
  36630. $1=self["@currentScope"];
  36631. if(($receiver = $1) == null || $receiver.isNil){
  36632. $1;
  36633. } else {
  36634. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  36635. self["@currentScope"];
  36636. }
  36637. return self;
  36638. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  36639. },
  36640. args: [],
  36641. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  36642. referencedClasses: [],
  36643. messageSends: ["ifNotNil:", "outerScope"]
  36644. }),
  36645. $globals.SemanticAnalyzer);
  36646. $core.addMethod(
  36647. $core.method({
  36648. selector: "pushScope:",
  36649. protocol: "scope",
  36650. fn: function (aScope){
  36651. var self=this;
  36652. return $core.withContext(function($ctx1) {
  36653. $recv(aScope)._outerScope_(self["@currentScope"]);
  36654. self["@currentScope"]=aScope;
  36655. return self;
  36656. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  36657. },
  36658. args: ["aScope"],
  36659. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  36660. referencedClasses: [],
  36661. messageSends: ["outerScope:"]
  36662. }),
  36663. $globals.SemanticAnalyzer);
  36664. $core.addMethod(
  36665. $core.method({
  36666. selector: "theClass",
  36667. protocol: "accessing",
  36668. fn: function (){
  36669. var self=this;
  36670. return self["@theClass"];
  36671. },
  36672. args: [],
  36673. source: "theClass\x0a\x09^ theClass",
  36674. referencedClasses: [],
  36675. messageSends: []
  36676. }),
  36677. $globals.SemanticAnalyzer);
  36678. $core.addMethod(
  36679. $core.method({
  36680. selector: "theClass:",
  36681. protocol: "accessing",
  36682. fn: function (aClass){
  36683. var self=this;
  36684. self["@theClass"]=aClass;
  36685. return self;
  36686. },
  36687. args: ["aClass"],
  36688. source: "theClass: aClass\x0a\x09theClass := aClass",
  36689. referencedClasses: [],
  36690. messageSends: []
  36691. }),
  36692. $globals.SemanticAnalyzer);
  36693. $core.addMethod(
  36694. $core.method({
  36695. selector: "thePackage",
  36696. protocol: "accessing",
  36697. fn: function (){
  36698. var self=this;
  36699. return self["@thePackage"];
  36700. },
  36701. args: [],
  36702. source: "thePackage\x0a\x09^ thePackage",
  36703. referencedClasses: [],
  36704. messageSends: []
  36705. }),
  36706. $globals.SemanticAnalyzer);
  36707. $core.addMethod(
  36708. $core.method({
  36709. selector: "thePackage:",
  36710. protocol: "accessing",
  36711. fn: function (aPackage){
  36712. var self=this;
  36713. self["@thePackage"]=aPackage;
  36714. return self;
  36715. },
  36716. args: ["aPackage"],
  36717. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  36718. referencedClasses: [],
  36719. messageSends: []
  36720. }),
  36721. $globals.SemanticAnalyzer);
  36722. $core.addMethod(
  36723. $core.method({
  36724. selector: "validateVariableScope:",
  36725. protocol: "scope",
  36726. fn: function (aString){
  36727. var self=this;
  36728. return $core.withContext(function($ctx1) {
  36729. var $1,$receiver;
  36730. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  36731. if(($receiver = $1) == null || $receiver.isNil){
  36732. $1;
  36733. } else {
  36734. self._errorShadowingVariable_(aString);
  36735. }
  36736. return self;
  36737. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  36738. },
  36739. args: ["aString"],
  36740. 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 ]",
  36741. referencedClasses: [],
  36742. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  36743. }),
  36744. $globals.SemanticAnalyzer);
  36745. $core.addMethod(
  36746. $core.method({
  36747. selector: "visitAssignmentNode:",
  36748. protocol: "visiting",
  36749. fn: function (aNode){
  36750. var self=this;
  36751. return $core.withContext(function($ctx1) {
  36752. (
  36753. $ctx1.supercall = true,
  36754. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  36755. $ctx1.supercall = false;
  36756. $recv($recv(aNode)._left())._beAssigned();
  36757. return self;
  36758. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36759. },
  36760. args: ["aNode"],
  36761. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  36762. referencedClasses: [],
  36763. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  36764. }),
  36765. $globals.SemanticAnalyzer);
  36766. $core.addMethod(
  36767. $core.method({
  36768. selector: "visitBlockNode:",
  36769. protocol: "visiting",
  36770. fn: function (aNode){
  36771. var self=this;
  36772. return $core.withContext(function($ctx1) {
  36773. self._pushScope_(self._newBlockScope());
  36774. $recv(aNode)._scope_(self["@currentScope"]);
  36775. $recv(self["@currentScope"])._node_(aNode);
  36776. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  36777. $recv($recv(aNode)._parameters())._do_((function(each){
  36778. return $core.withContext(function($ctx2) {
  36779. self._validateVariableScope_(each);
  36780. return $recv(self["@currentScope"])._addArg_(each);
  36781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36782. }));
  36783. (
  36784. $ctx1.supercall = true,
  36785. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  36786. $ctx1.supercall = false;
  36787. self._popScope();
  36788. return self;
  36789. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36790. },
  36791. args: ["aNode"],
  36792. 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",
  36793. referencedClasses: [],
  36794. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  36795. }),
  36796. $globals.SemanticAnalyzer);
  36797. $core.addMethod(
  36798. $core.method({
  36799. selector: "visitCascadeNode:",
  36800. protocol: "visiting",
  36801. fn: function (aNode){
  36802. var self=this;
  36803. return $core.withContext(function($ctx1) {
  36804. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  36805. (
  36806. $ctx1.supercall = true,
  36807. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  36808. $ctx1.supercall = false;
  36809. return self;
  36810. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36811. },
  36812. args: ["aNode"],
  36813. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  36814. referencedClasses: [],
  36815. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  36816. }),
  36817. $globals.SemanticAnalyzer);
  36818. $core.addMethod(
  36819. $core.method({
  36820. selector: "visitMethodNode:",
  36821. protocol: "visiting",
  36822. fn: function (aNode){
  36823. var self=this;
  36824. return $core.withContext(function($ctx1) {
  36825. self._pushScope_(self._newMethodScope());
  36826. $recv(aNode)._scope_(self["@currentScope"]);
  36827. $recv(self["@currentScope"])._node_(aNode);
  36828. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  36829. return $core.withContext(function($ctx2) {
  36830. return $recv(self["@currentScope"])._addIVar_(each);
  36831. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36832. }));
  36833. $ctx1.sendIdx["do:"]=1;
  36834. $recv($recv(aNode)._arguments())._do_((function(each){
  36835. return $core.withContext(function($ctx2) {
  36836. self._validateVariableScope_(each);
  36837. return $recv(self["@currentScope"])._addArg_(each);
  36838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36839. }));
  36840. (
  36841. $ctx1.supercall = true,
  36842. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  36843. $ctx1.supercall = false;
  36844. $recv(aNode)._classReferences_(self._classReferences());
  36845. $recv(aNode)._sendIndexes_(self._messageSends());
  36846. self._popScope();
  36847. return aNode;
  36848. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36849. },
  36850. args: ["aNode"],
  36851. 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",
  36852. referencedClasses: [],
  36853. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  36854. }),
  36855. $globals.SemanticAnalyzer);
  36856. $core.addMethod(
  36857. $core.method({
  36858. selector: "visitReturnNode:",
  36859. protocol: "visiting",
  36860. fn: function (aNode){
  36861. var self=this;
  36862. return $core.withContext(function($ctx1) {
  36863. var $1;
  36864. $recv(aNode)._scope_(self["@currentScope"]);
  36865. $1=$recv(self["@currentScope"])._isMethodScope();
  36866. if($core.assert($1)){
  36867. $recv(self["@currentScope"])._localReturn_(true);
  36868. } else {
  36869. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  36870. }
  36871. (
  36872. $ctx1.supercall = true,
  36873. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  36874. $ctx1.supercall = false;
  36875. return self;
  36876. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36877. },
  36878. args: ["aNode"],
  36879. 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",
  36880. referencedClasses: [],
  36881. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  36882. }),
  36883. $globals.SemanticAnalyzer);
  36884. $core.addMethod(
  36885. $core.method({
  36886. selector: "visitSendNode:",
  36887. protocol: "visiting",
  36888. fn: function (aNode){
  36889. var self=this;
  36890. var sends;
  36891. return $core.withContext(function($ctx1) {
  36892. sends=$recv(self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  36893. return $core.withContext(function($ctx2) {
  36894. return $recv($globals.OrderedCollection)._new();
  36895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36896. }));
  36897. $recv(sends)._add_(aNode);
  36898. $recv(aNode)._index_($recv(sends)._size());
  36899. (
  36900. $ctx1.supercall = true,
  36901. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  36902. $ctx1.supercall = false;
  36903. return self;
  36904. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  36905. },
  36906. args: ["aNode"],
  36907. 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",
  36908. referencedClasses: ["OrderedCollection"],
  36909. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  36910. }),
  36911. $globals.SemanticAnalyzer);
  36912. $core.addMethod(
  36913. $core.method({
  36914. selector: "visitSequenceNode:",
  36915. protocol: "visiting",
  36916. fn: function (aNode){
  36917. var self=this;
  36918. return $core.withContext(function($ctx1) {
  36919. $recv($recv(aNode)._temps())._do_((function(each){
  36920. return $core.withContext(function($ctx2) {
  36921. self._validateVariableScope_(each);
  36922. return $recv(self["@currentScope"])._addTemp_(each);
  36923. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36924. }));
  36925. (
  36926. $ctx1.supercall = true,
  36927. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  36928. $ctx1.supercall = false;
  36929. return self;
  36930. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  36931. },
  36932. args: ["aNode"],
  36933. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  36934. referencedClasses: [],
  36935. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  36936. }),
  36937. $globals.SemanticAnalyzer);
  36938. $core.addMethod(
  36939. $core.method({
  36940. selector: "visitVariableNode:",
  36941. protocol: "visiting",
  36942. fn: function (aNode){
  36943. var self=this;
  36944. var binding;
  36945. return $core.withContext(function($ctx1) {
  36946. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  36947. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  36948. $1=binding;
  36949. if(($receiver = $1) == null || $receiver.isNil){
  36950. $3=$recv(aNode)._value();
  36951. $ctx1.sendIdx["value"]=1;
  36952. $2=$recv($3)._isCapitalized();
  36953. if($core.assert($2)){
  36954. $4=$recv($globals.ClassRefVar)._new();
  36955. $ctx1.sendIdx["new"]=1;
  36956. $5=$recv(aNode)._value();
  36957. $ctx1.sendIdx["value"]=2;
  36958. $recv($4)._name_($5);
  36959. $ctx1.sendIdx["name:"]=1;
  36960. $6=$recv($4)._yourself();
  36961. $ctx1.sendIdx["yourself"]=1;
  36962. binding=$6;
  36963. binding;
  36964. $7=self._classReferences();
  36965. $8=$recv(aNode)._value();
  36966. $ctx1.sendIdx["value"]=3;
  36967. $recv($7)._add_($8);
  36968. } else {
  36969. self._errorUnknownVariable_(aNode);
  36970. $9=$recv($globals.UnknownVar)._new();
  36971. $recv($9)._name_($recv(aNode)._value());
  36972. binding=$recv($9)._yourself();
  36973. binding;
  36974. }
  36975. } else {
  36976. $1;
  36977. }
  36978. $recv(aNode)._binding_(binding);
  36979. return self;
  36980. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  36981. },
  36982. args: ["aNode"],
  36983. 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.",
  36984. referencedClasses: ["ClassRefVar", "UnknownVar"],
  36985. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  36986. }),
  36987. $globals.SemanticAnalyzer);
  36988. $core.addMethod(
  36989. $core.method({
  36990. selector: "on:",
  36991. protocol: "instance creation",
  36992. fn: function (aClass){
  36993. var self=this;
  36994. return $core.withContext(function($ctx1) {
  36995. var $1;
  36996. $1=self._new();
  36997. $recv($1)._theClass_(aClass);
  36998. return $recv($1)._yourself();
  36999. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  37000. },
  37001. args: ["aClass"],
  37002. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  37003. referencedClasses: [],
  37004. messageSends: ["theClass:", "new", "yourself"]
  37005. }),
  37006. $globals.SemanticAnalyzer.klass);
  37007. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  37008. $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";
  37009. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  37010. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  37011. $core.addMethod(
  37012. $core.method({
  37013. selector: "messageText",
  37014. protocol: "accessing",
  37015. fn: function (){
  37016. var self=this;
  37017. return $core.withContext(function($ctx1) {
  37018. return " Invalid assignment to variable: ".__comma(self._variableName());
  37019. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  37020. },
  37021. args: [],
  37022. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  37023. referencedClasses: [],
  37024. messageSends: [",", "variableName"]
  37025. }),
  37026. $globals.InvalidAssignmentError);
  37027. $core.addMethod(
  37028. $core.method({
  37029. selector: "variableName",
  37030. protocol: "accessing",
  37031. fn: function (){
  37032. var self=this;
  37033. return self["@variableName"];
  37034. },
  37035. args: [],
  37036. source: "variableName\x0a\x09^ variableName",
  37037. referencedClasses: [],
  37038. messageSends: []
  37039. }),
  37040. $globals.InvalidAssignmentError);
  37041. $core.addMethod(
  37042. $core.method({
  37043. selector: "variableName:",
  37044. protocol: "accessing",
  37045. fn: function (aString){
  37046. var self=this;
  37047. self["@variableName"]=aString;
  37048. return self;
  37049. },
  37050. args: ["aString"],
  37051. source: "variableName: aString\x0a\x09variableName := aString",
  37052. referencedClasses: [],
  37053. messageSends: []
  37054. }),
  37055. $globals.InvalidAssignmentError);
  37056. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  37057. $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.";
  37058. $core.addMethod(
  37059. $core.method({
  37060. selector: "messageText",
  37061. protocol: "accessing",
  37062. fn: function (){
  37063. var self=this;
  37064. return $core.withContext(function($ctx1) {
  37065. var $1;
  37066. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  37067. $ctx1.sendIdx[","]=1;
  37068. return $1;
  37069. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  37070. },
  37071. args: [],
  37072. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  37073. referencedClasses: [],
  37074. messageSends: [",", "variableName"]
  37075. }),
  37076. $globals.ShadowingVariableError);
  37077. $core.addMethod(
  37078. $core.method({
  37079. selector: "variableName",
  37080. protocol: "accessing",
  37081. fn: function (){
  37082. var self=this;
  37083. return self["@variableName"];
  37084. },
  37085. args: [],
  37086. source: "variableName\x0a\x09^ variableName",
  37087. referencedClasses: [],
  37088. messageSends: []
  37089. }),
  37090. $globals.ShadowingVariableError);
  37091. $core.addMethod(
  37092. $core.method({
  37093. selector: "variableName:",
  37094. protocol: "accessing",
  37095. fn: function (aString){
  37096. var self=this;
  37097. self["@variableName"]=aString;
  37098. return self;
  37099. },
  37100. args: ["aString"],
  37101. source: "variableName: aString\x0a\x09variableName := aString",
  37102. referencedClasses: [],
  37103. messageSends: []
  37104. }),
  37105. $globals.ShadowingVariableError);
  37106. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  37107. $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.";
  37108. $core.addMethod(
  37109. $core.method({
  37110. selector: "messageText",
  37111. protocol: "accessing",
  37112. fn: function (){
  37113. var self=this;
  37114. return $core.withContext(function($ctx1) {
  37115. var $1;
  37116. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  37117. $ctx1.sendIdx[","]=1;
  37118. return $1;
  37119. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  37120. },
  37121. args: [],
  37122. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  37123. referencedClasses: [],
  37124. messageSends: [",", "variableName"]
  37125. }),
  37126. $globals.UnknownVariableError);
  37127. $core.addMethod(
  37128. $core.method({
  37129. selector: "variableName",
  37130. protocol: "accessing",
  37131. fn: function (){
  37132. var self=this;
  37133. return self["@variableName"];
  37134. },
  37135. args: [],
  37136. source: "variableName\x0a\x09^ variableName",
  37137. referencedClasses: [],
  37138. messageSends: []
  37139. }),
  37140. $globals.UnknownVariableError);
  37141. $core.addMethod(
  37142. $core.method({
  37143. selector: "variableName:",
  37144. protocol: "accessing",
  37145. fn: function (aString){
  37146. var self=this;
  37147. self["@variableName"]=aString;
  37148. return self;
  37149. },
  37150. args: ["aString"],
  37151. source: "variableName: aString\x0a\x09variableName := aString",
  37152. referencedClasses: [],
  37153. messageSends: []
  37154. }),
  37155. $globals.UnknownVariableError);
  37156. });
  37157. 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";
  37158. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  37159. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  37160. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  37161. $core.addPackage("Compiler-IR");
  37162. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  37163. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  37164. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  37165. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  37166. $core.addMethod(
  37167. $core.method({
  37168. selector: "alias:",
  37169. protocol: "visiting",
  37170. fn: function (aNode){
  37171. var self=this;
  37172. var variable;
  37173. return $core.withContext(function($ctx1) {
  37174. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  37175. $1=$recv(aNode)._isImmutable();
  37176. if($core.assert($1)){
  37177. $2=self._visit_(aNode);
  37178. $ctx1.sendIdx["visit:"]=1;
  37179. return $2;
  37180. }
  37181. $3=$recv($globals.IRVariable)._new();
  37182. $ctx1.sendIdx["new"]=1;
  37183. $5=$recv($globals.AliasVar)._new();
  37184. $ctx1.sendIdx["new"]=2;
  37185. $4=$recv($5)._name_("$".__comma(self._nextAlias()));
  37186. $recv($3)._variable_($4);
  37187. $6=$recv($3)._yourself();
  37188. $ctx1.sendIdx["yourself"]=1;
  37189. variable=$6;
  37190. $7=self._sequence();
  37191. $9=$recv($globals.IRAssignment)._new();
  37192. $recv($9)._add_(variable);
  37193. $ctx1.sendIdx["add:"]=2;
  37194. $recv($9)._add_(self._visit_(aNode));
  37195. $ctx1.sendIdx["add:"]=3;
  37196. $8=$recv($9)._yourself();
  37197. $recv($7)._add_($8);
  37198. $ctx1.sendIdx["add:"]=1;
  37199. $recv($recv(self._method())._internalVariables())._add_(variable);
  37200. return variable;
  37201. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  37202. },
  37203. args: ["aNode"],
  37204. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  37205. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  37206. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  37207. }),
  37208. $globals.IRASTTranslator);
  37209. $core.addMethod(
  37210. $core.method({
  37211. selector: "aliasTemporally:",
  37212. protocol: "visiting",
  37213. fn: function (aCollection){
  37214. var self=this;
  37215. var threshold,result;
  37216. return $core.withContext(function($ctx1) {
  37217. var $1,$2,$4,$3;
  37218. threshold=(0);
  37219. $recv(aCollection)._withIndexDo_((function(each,i){
  37220. return $core.withContext(function($ctx2) {
  37221. $1=$recv(each)._subtreeNeedsAliasing();
  37222. if($core.assert($1)){
  37223. threshold=i;
  37224. return threshold;
  37225. }
  37226. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  37227. }));
  37228. $ctx1.sendIdx["withIndexDo:"]=1;
  37229. result=$recv($globals.OrderedCollection)._new();
  37230. $recv(aCollection)._withIndexDo_((function(each,i){
  37231. return $core.withContext(function($ctx2) {
  37232. $2=result;
  37233. $4=$recv(i).__lt_eq(threshold);
  37234. if($core.assert($4)){
  37235. $3=self._alias_(each);
  37236. } else {
  37237. $3=self._visit_(each);
  37238. }
  37239. return $recv($2)._add_($3);
  37240. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  37241. }));
  37242. return result;
  37243. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  37244. },
  37245. args: ["aCollection"],
  37246. 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",
  37247. referencedClasses: ["OrderedCollection"],
  37248. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  37249. }),
  37250. $globals.IRASTTranslator);
  37251. $core.addMethod(
  37252. $core.method({
  37253. selector: "method",
  37254. protocol: "accessing",
  37255. fn: function (){
  37256. var self=this;
  37257. return self["@method"];
  37258. },
  37259. args: [],
  37260. source: "method\x0a\x09^ method",
  37261. referencedClasses: [],
  37262. messageSends: []
  37263. }),
  37264. $globals.IRASTTranslator);
  37265. $core.addMethod(
  37266. $core.method({
  37267. selector: "method:",
  37268. protocol: "accessing",
  37269. fn: function (anIRMethod){
  37270. var self=this;
  37271. self["@method"]=anIRMethod;
  37272. return self;
  37273. },
  37274. args: ["anIRMethod"],
  37275. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  37276. referencedClasses: [],
  37277. messageSends: []
  37278. }),
  37279. $globals.IRASTTranslator);
  37280. $core.addMethod(
  37281. $core.method({
  37282. selector: "nextAlias",
  37283. protocol: "accessing",
  37284. fn: function (){
  37285. var self=this;
  37286. return $core.withContext(function($ctx1) {
  37287. var $1,$receiver;
  37288. $1=self["@nextAlias"];
  37289. if(($receiver = $1) == null || $receiver.isNil){
  37290. self["@nextAlias"]=(0);
  37291. self["@nextAlias"];
  37292. } else {
  37293. $1;
  37294. }
  37295. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  37296. return $recv(self["@nextAlias"])._asString();
  37297. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  37298. },
  37299. args: [],
  37300. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  37301. referencedClasses: [],
  37302. messageSends: ["ifNil:", "+", "asString"]
  37303. }),
  37304. $globals.IRASTTranslator);
  37305. $core.addMethod(
  37306. $core.method({
  37307. selector: "sequence",
  37308. protocol: "accessing",
  37309. fn: function (){
  37310. var self=this;
  37311. return self["@sequence"];
  37312. },
  37313. args: [],
  37314. source: "sequence\x0a\x09^ sequence",
  37315. referencedClasses: [],
  37316. messageSends: []
  37317. }),
  37318. $globals.IRASTTranslator);
  37319. $core.addMethod(
  37320. $core.method({
  37321. selector: "sequence:",
  37322. protocol: "accessing",
  37323. fn: function (anIRSequence){
  37324. var self=this;
  37325. self["@sequence"]=anIRSequence;
  37326. return self;
  37327. },
  37328. args: ["anIRSequence"],
  37329. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  37330. referencedClasses: [],
  37331. messageSends: []
  37332. }),
  37333. $globals.IRASTTranslator);
  37334. $core.addMethod(
  37335. $core.method({
  37336. selector: "source",
  37337. protocol: "accessing",
  37338. fn: function (){
  37339. var self=this;
  37340. return self["@source"];
  37341. },
  37342. args: [],
  37343. source: "source\x0a\x09^ source",
  37344. referencedClasses: [],
  37345. messageSends: []
  37346. }),
  37347. $globals.IRASTTranslator);
  37348. $core.addMethod(
  37349. $core.method({
  37350. selector: "source:",
  37351. protocol: "accessing",
  37352. fn: function (aString){
  37353. var self=this;
  37354. self["@source"]=aString;
  37355. return self;
  37356. },
  37357. args: ["aString"],
  37358. source: "source: aString\x0a\x09source := aString",
  37359. referencedClasses: [],
  37360. messageSends: []
  37361. }),
  37362. $globals.IRASTTranslator);
  37363. $core.addMethod(
  37364. $core.method({
  37365. selector: "theClass",
  37366. protocol: "accessing",
  37367. fn: function (){
  37368. var self=this;
  37369. return self["@theClass"];
  37370. },
  37371. args: [],
  37372. source: "theClass\x0a\x09^ theClass",
  37373. referencedClasses: [],
  37374. messageSends: []
  37375. }),
  37376. $globals.IRASTTranslator);
  37377. $core.addMethod(
  37378. $core.method({
  37379. selector: "theClass:",
  37380. protocol: "accessing",
  37381. fn: function (aClass){
  37382. var self=this;
  37383. self["@theClass"]=aClass;
  37384. return self;
  37385. },
  37386. args: ["aClass"],
  37387. source: "theClass: aClass\x0a\x09theClass := aClass",
  37388. referencedClasses: [],
  37389. messageSends: []
  37390. }),
  37391. $globals.IRASTTranslator);
  37392. $core.addMethod(
  37393. $core.method({
  37394. selector: "visitAssignmentNode:",
  37395. protocol: "visiting",
  37396. fn: function (aNode){
  37397. var self=this;
  37398. var left,right,assignment;
  37399. return $core.withContext(function($ctx1) {
  37400. var $1,$3,$2;
  37401. right=self._visit_($recv(aNode)._right());
  37402. $ctx1.sendIdx["visit:"]=1;
  37403. left=self._visit_($recv(aNode)._left());
  37404. $1=self._sequence();
  37405. $3=$recv($globals.IRAssignment)._new();
  37406. $recv($3)._add_(left);
  37407. $ctx1.sendIdx["add:"]=2;
  37408. $recv($3)._add_(right);
  37409. $2=$recv($3)._yourself();
  37410. $recv($1)._add_($2);
  37411. $ctx1.sendIdx["add:"]=1;
  37412. return left;
  37413. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  37414. },
  37415. args: ["aNode"],
  37416. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  37417. referencedClasses: ["IRAssignment"],
  37418. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  37419. }),
  37420. $globals.IRASTTranslator);
  37421. $core.addMethod(
  37422. $core.method({
  37423. selector: "visitBlockNode:",
  37424. protocol: "visiting",
  37425. fn: function (aNode){
  37426. var self=this;
  37427. var closure;
  37428. return $core.withContext(function($ctx1) {
  37429. var $1,$2,$3,$5,$4,$6,$8,$7;
  37430. $1=$recv($globals.IRClosure)._new();
  37431. $ctx1.sendIdx["new"]=1;
  37432. $recv($1)._arguments_($recv(aNode)._parameters());
  37433. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  37434. $2=$recv(aNode)._scope();
  37435. $ctx1.sendIdx["scope"]=1;
  37436. $recv($1)._scope_($2);
  37437. $ctx1.sendIdx["scope:"]=1;
  37438. $3=$recv($1)._yourself();
  37439. $ctx1.sendIdx["yourself"]=1;
  37440. closure=$3;
  37441. $5=$recv(aNode)._scope();
  37442. $ctx1.sendIdx["scope"]=2;
  37443. $4=$recv($5)._temps();
  37444. $recv($4)._do_((function(each){
  37445. return $core.withContext(function($ctx2) {
  37446. $6=closure;
  37447. $8=$recv($globals.IRTempDeclaration)._new();
  37448. $recv($8)._name_($recv(each)._name());
  37449. $recv($8)._scope_($recv(aNode)._scope());
  37450. $7=$recv($8)._yourself();
  37451. return $recv($6)._add_($7);
  37452. $ctx2.sendIdx["add:"]=1;
  37453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37454. }));
  37455. $ctx1.sendIdx["do:"]=1;
  37456. $recv($recv(aNode)._dagChildren())._do_((function(each){
  37457. return $core.withContext(function($ctx2) {
  37458. return $recv(closure)._add_(self._visit_(each));
  37459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37460. }));
  37461. return closure;
  37462. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  37463. },
  37464. args: ["aNode"],
  37465. 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",
  37466. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  37467. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  37468. }),
  37469. $globals.IRASTTranslator);
  37470. $core.addMethod(
  37471. $core.method({
  37472. selector: "visitBlockSequenceNode:",
  37473. protocol: "visiting",
  37474. fn: function (aNode){
  37475. var self=this;
  37476. return $core.withContext(function($ctx1) {
  37477. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  37478. $1=$recv($globals.IRBlockSequence)._new();
  37479. $ctx1.sendIdx["new"]=1;
  37480. return self._withSequence_do_($1,(function(){
  37481. return $core.withContext(function($ctx2) {
  37482. $2=$recv(aNode)._dagChildren();
  37483. $ctx2.sendIdx["dagChildren"]=1;
  37484. return $recv($2)._ifNotEmpty_((function(){
  37485. return $core.withContext(function($ctx3) {
  37486. $4=$recv(aNode)._dagChildren();
  37487. $ctx3.sendIdx["dagChildren"]=2;
  37488. $3=$recv($4)._allButLast();
  37489. $recv($3)._do_((function(each){
  37490. return $core.withContext(function($ctx4) {
  37491. $5=self._sequence();
  37492. $ctx4.sendIdx["sequence"]=1;
  37493. $6=self._visitOrAlias_(each);
  37494. $ctx4.sendIdx["visitOrAlias:"]=1;
  37495. return $recv($5)._add_($6);
  37496. $ctx4.sendIdx["add:"]=1;
  37497. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  37498. }));
  37499. $9=$recv(aNode)._dagChildren();
  37500. $ctx3.sendIdx["dagChildren"]=3;
  37501. $8=$recv($9)._last();
  37502. $ctx3.sendIdx["last"]=1;
  37503. $7=$recv($8)._isReturnNode();
  37504. if($core.assert($7)){
  37505. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  37506. } else {
  37507. $10=self._sequence();
  37508. $ctx3.sendIdx["sequence"]=2;
  37509. $12=$recv($globals.IRBlockReturn)._new();
  37510. $15=$recv(aNode)._dagChildren();
  37511. $ctx3.sendIdx["dagChildren"]=4;
  37512. $14=$recv($15)._last();
  37513. $ctx3.sendIdx["last"]=2;
  37514. $13=self._visitOrAlias_($14);
  37515. $ctx3.sendIdx["visitOrAlias:"]=2;
  37516. $recv($12)._add_($13);
  37517. $ctx3.sendIdx["add:"]=3;
  37518. $11=$recv($12)._yourself();
  37519. return $recv($10)._add_($11);
  37520. $ctx3.sendIdx["add:"]=2;
  37521. }
  37522. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  37523. }));
  37524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37525. }));
  37526. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37527. },
  37528. args: ["aNode"],
  37529. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode dagChildren last) ] ]]",
  37530. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  37531. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  37532. }),
  37533. $globals.IRASTTranslator);
  37534. $core.addMethod(
  37535. $core.method({
  37536. selector: "visitCascadeNode:",
  37537. protocol: "visiting",
  37538. fn: function (aNode){
  37539. var self=this;
  37540. var receiver;
  37541. return $core.withContext(function($ctx1) {
  37542. var $1,$2,$4,$3;
  37543. receiver=$recv(aNode)._receiver();
  37544. $1=$recv(receiver)._isImmutable();
  37545. if(!$core.assert($1)){
  37546. var alias;
  37547. alias=self._alias_(receiver);
  37548. alias;
  37549. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  37550. receiver;
  37551. }
  37552. $2=$recv(aNode)._dagChildren();
  37553. $ctx1.sendIdx["dagChildren"]=1;
  37554. $recv($2)._do_((function(each){
  37555. return $core.withContext(function($ctx2) {
  37556. return $recv(each)._receiver_(receiver);
  37557. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37558. }));
  37559. $ctx1.sendIdx["do:"]=1;
  37560. $4=$recv(aNode)._dagChildren();
  37561. $ctx1.sendIdx["dagChildren"]=2;
  37562. $3=$recv($4)._allButLast();
  37563. $recv($3)._do_((function(each){
  37564. return $core.withContext(function($ctx2) {
  37565. return $recv(self._sequence())._add_(self._visit_(each));
  37566. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  37567. }));
  37568. return self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  37569. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  37570. },
  37571. args: ["aNode"],
  37572. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  37573. referencedClasses: ["VariableNode"],
  37574. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  37575. }),
  37576. $globals.IRASTTranslator);
  37577. $core.addMethod(
  37578. $core.method({
  37579. selector: "visitDynamicArrayNode:",
  37580. protocol: "visiting",
  37581. fn: function (aNode){
  37582. var self=this;
  37583. var array;
  37584. return $core.withContext(function($ctx1) {
  37585. array=$recv($globals.IRDynamicArray)._new();
  37586. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  37587. return $core.withContext(function($ctx2) {
  37588. return $recv(array)._add_(each);
  37589. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37590. }));
  37591. return array;
  37592. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  37593. },
  37594. args: ["aNode"],
  37595. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  37596. referencedClasses: ["IRDynamicArray"],
  37597. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  37598. }),
  37599. $globals.IRASTTranslator);
  37600. $core.addMethod(
  37601. $core.method({
  37602. selector: "visitDynamicDictionaryNode:",
  37603. protocol: "visiting",
  37604. fn: function (aNode){
  37605. var self=this;
  37606. var dictionary;
  37607. return $core.withContext(function($ctx1) {
  37608. dictionary=$recv($globals.IRDynamicDictionary)._new();
  37609. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  37610. return $core.withContext(function($ctx2) {
  37611. return $recv(dictionary)._add_(each);
  37612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37613. }));
  37614. return dictionary;
  37615. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  37616. },
  37617. args: ["aNode"],
  37618. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  37619. referencedClasses: ["IRDynamicDictionary"],
  37620. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  37621. }),
  37622. $globals.IRASTTranslator);
  37623. $core.addMethod(
  37624. $core.method({
  37625. selector: "visitJSStatementNode:",
  37626. protocol: "visiting",
  37627. fn: function (aNode){
  37628. var self=this;
  37629. return $core.withContext(function($ctx1) {
  37630. var $1;
  37631. $1=$recv($globals.IRVerbatim)._new();
  37632. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  37633. return $recv($1)._yourself();
  37634. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37635. },
  37636. args: ["aNode"],
  37637. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  37638. referencedClasses: ["IRVerbatim"],
  37639. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  37640. }),
  37641. $globals.IRASTTranslator);
  37642. $core.addMethod(
  37643. $core.method({
  37644. selector: "visitMethodNode:",
  37645. protocol: "visiting",
  37646. fn: function (aNode){
  37647. var self=this;
  37648. return $core.withContext(function($ctx1) {
  37649. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  37650. $2=$recv($globals.IRMethod)._new();
  37651. $ctx1.sendIdx["new"]=1;
  37652. $recv($2)._source_($recv(self._source())._crlfSanitized());
  37653. $ctx1.sendIdx["source:"]=1;
  37654. $recv($2)._theClass_(self._theClass());
  37655. $recv($2)._arguments_($recv(aNode)._arguments());
  37656. $recv($2)._selector_($recv(aNode)._selector());
  37657. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  37658. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  37659. $recv($2)._classReferences_($recv(aNode)._classReferences());
  37660. $3=$recv(aNode)._scope();
  37661. $ctx1.sendIdx["scope"]=1;
  37662. $recv($2)._scope_($3);
  37663. $ctx1.sendIdx["scope:"]=1;
  37664. $4=$recv($2)._yourself();
  37665. $ctx1.sendIdx["yourself"]=1;
  37666. $1=$4;
  37667. self._method_($1);
  37668. $6=$recv(aNode)._scope();
  37669. $ctx1.sendIdx["scope"]=2;
  37670. $5=$recv($6)._temps();
  37671. $recv($5)._do_((function(each){
  37672. return $core.withContext(function($ctx2) {
  37673. $7=self._method();
  37674. $ctx2.sendIdx["method"]=1;
  37675. $9=$recv($globals.IRTempDeclaration)._new();
  37676. $ctx2.sendIdx["new"]=2;
  37677. $recv($9)._name_($recv(each)._name());
  37678. $10=$recv(aNode)._scope();
  37679. $ctx2.sendIdx["scope"]=3;
  37680. $recv($9)._scope_($10);
  37681. $11=$recv($9)._yourself();
  37682. $ctx2.sendIdx["yourself"]=2;
  37683. $8=$11;
  37684. return $recv($7)._add_($8);
  37685. $ctx2.sendIdx["add:"]=1;
  37686. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37687. }));
  37688. $ctx1.sendIdx["do:"]=1;
  37689. $recv($recv(aNode)._dagChildren())._do_((function(each){
  37690. return $core.withContext(function($ctx2) {
  37691. $12=self._method();
  37692. $ctx2.sendIdx["method"]=2;
  37693. return $recv($12)._add_(self._visit_(each));
  37694. $ctx2.sendIdx["add:"]=2;
  37695. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37696. }));
  37697. $14=$recv(aNode)._scope();
  37698. $ctx1.sendIdx["scope"]=4;
  37699. $13=$recv($14)._hasLocalReturn();
  37700. if(!$core.assert($13)){
  37701. $15=self._method();
  37702. $ctx1.sendIdx["method"]=3;
  37703. $17=$recv($globals.IRReturn)._new();
  37704. $ctx1.sendIdx["new"]=3;
  37705. $19=$recv($globals.IRVariable)._new();
  37706. $ctx1.sendIdx["new"]=4;
  37707. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  37708. $20=$recv($19)._yourself();
  37709. $ctx1.sendIdx["yourself"]=3;
  37710. $18=$20;
  37711. $recv($17)._add_($18);
  37712. $ctx1.sendIdx["add:"]=4;
  37713. $21=$recv($17)._yourself();
  37714. $ctx1.sendIdx["yourself"]=4;
  37715. $16=$21;
  37716. $recv($15)._add_($16);
  37717. $ctx1.sendIdx["add:"]=3;
  37718. $23=$recv($globals.IRVerbatim)._new();
  37719. $recv($23)._source_("");
  37720. $22=$recv($23)._yourself();
  37721. $recv($15)._add_($22);
  37722. }
  37723. return self._method();
  37724. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37725. },
  37726. args: ["aNode"],
  37727. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  37728. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  37729. 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"]
  37730. }),
  37731. $globals.IRASTTranslator);
  37732. $core.addMethod(
  37733. $core.method({
  37734. selector: "visitOrAlias:",
  37735. protocol: "visiting",
  37736. fn: function (aNode){
  37737. var self=this;
  37738. return $core.withContext(function($ctx1) {
  37739. var $1;
  37740. $1=$recv(aNode)._shouldBeAliased();
  37741. if($core.assert($1)){
  37742. return self._alias_(aNode);
  37743. } else {
  37744. return self._visit_(aNode);
  37745. }
  37746. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  37747. },
  37748. args: ["aNode"],
  37749. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  37750. referencedClasses: [],
  37751. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  37752. }),
  37753. $globals.IRASTTranslator);
  37754. $core.addMethod(
  37755. $core.method({
  37756. selector: "visitReturnNode:",
  37757. protocol: "visiting",
  37758. fn: function (aNode){
  37759. var self=this;
  37760. var return_;
  37761. return $core.withContext(function($ctx1) {
  37762. var $1;
  37763. $1=$recv(aNode)._nonLocalReturn();
  37764. if($core.assert($1)){
  37765. return_=$recv($globals.IRNonLocalReturn)._new();
  37766. $ctx1.sendIdx["new"]=1;
  37767. } else {
  37768. return_=$recv($globals.IRReturn)._new();
  37769. }
  37770. $recv(return_)._scope_($recv(aNode)._scope());
  37771. $recv($recv(aNode)._dagChildren())._do_((function(each){
  37772. return $core.withContext(function($ctx2) {
  37773. return $recv(return_)._add_(self._visitOrAlias_(each));
  37774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  37775. }));
  37776. return return_;
  37777. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  37778. },
  37779. args: ["aNode"],
  37780. 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",
  37781. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  37782. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  37783. }),
  37784. $globals.IRASTTranslator);
  37785. $core.addMethod(
  37786. $core.method({
  37787. selector: "visitSendNode:",
  37788. protocol: "visiting",
  37789. fn: function (aNode){
  37790. var self=this;
  37791. var send;
  37792. return $core.withContext(function($ctx1) {
  37793. var $1;
  37794. send=$recv($globals.IRSend)._new();
  37795. $1=send;
  37796. $recv($1)._selector_($recv(aNode)._selector());
  37797. $recv($1)._index_($recv(aNode)._index());
  37798. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  37799. return $core.withContext(function($ctx2) {
  37800. return $recv(send)._add_(each);
  37801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37802. }));
  37803. return send;
  37804. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  37805. },
  37806. args: ["aNode"],
  37807. 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",
  37808. referencedClasses: ["IRSend"],
  37809. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  37810. }),
  37811. $globals.IRASTTranslator);
  37812. $core.addMethod(
  37813. $core.method({
  37814. selector: "visitSequenceNode:",
  37815. protocol: "visiting",
  37816. fn: function (aNode){
  37817. var self=this;
  37818. return $core.withContext(function($ctx1) {
  37819. var $1;
  37820. return self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  37821. return $core.withContext(function($ctx2) {
  37822. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  37823. var instruction;
  37824. return $core.withContext(function($ctx3) {
  37825. instruction=self._visitOrAlias_(each);
  37826. instruction;
  37827. $1=$recv(instruction)._isVariable();
  37828. if(!$core.assert($1)){
  37829. return $recv(self._sequence())._add_(instruction);
  37830. }
  37831. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  37832. }));
  37833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37834. }));
  37835. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37836. },
  37837. args: ["aNode"],
  37838. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  37839. referencedClasses: ["IRSequence"],
  37840. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  37841. }),
  37842. $globals.IRASTTranslator);
  37843. $core.addMethod(
  37844. $core.method({
  37845. selector: "visitValueNode:",
  37846. protocol: "visiting",
  37847. fn: function (aNode){
  37848. var self=this;
  37849. return $core.withContext(function($ctx1) {
  37850. var $1;
  37851. $1=$recv($globals.IRValue)._new();
  37852. $recv($1)._value_($recv(aNode)._value());
  37853. return $recv($1)._yourself();
  37854. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37855. },
  37856. args: ["aNode"],
  37857. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  37858. referencedClasses: ["IRValue"],
  37859. messageSends: ["value:", "new", "value", "yourself"]
  37860. }),
  37861. $globals.IRASTTranslator);
  37862. $core.addMethod(
  37863. $core.method({
  37864. selector: "visitVariableNode:",
  37865. protocol: "visiting",
  37866. fn: function (aNode){
  37867. var self=this;
  37868. return $core.withContext(function($ctx1) {
  37869. var $1;
  37870. $1=$recv($globals.IRVariable)._new();
  37871. $recv($1)._variable_($recv(aNode)._binding());
  37872. return $recv($1)._yourself();
  37873. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  37874. },
  37875. args: ["aNode"],
  37876. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  37877. referencedClasses: ["IRVariable"],
  37878. messageSends: ["variable:", "new", "binding", "yourself"]
  37879. }),
  37880. $globals.IRASTTranslator);
  37881. $core.addMethod(
  37882. $core.method({
  37883. selector: "withSequence:do:",
  37884. protocol: "accessing",
  37885. fn: function (aSequence,aBlock){
  37886. var self=this;
  37887. var outerSequence;
  37888. return $core.withContext(function($ctx1) {
  37889. outerSequence=self._sequence();
  37890. self._sequence_(aSequence);
  37891. $ctx1.sendIdx["sequence:"]=1;
  37892. $recv(aBlock)._value();
  37893. self._sequence_(outerSequence);
  37894. return aSequence;
  37895. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  37896. },
  37897. args: ["aSequence", "aBlock"],
  37898. 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",
  37899. referencedClasses: [],
  37900. messageSends: ["sequence", "sequence:", "value"]
  37901. }),
  37902. $globals.IRASTTranslator);
  37903. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  37904. $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.";
  37905. $core.addMethod(
  37906. $core.method({
  37907. selector: "add:",
  37908. protocol: "building",
  37909. fn: function (anObject){
  37910. var self=this;
  37911. return $core.withContext(function($ctx1) {
  37912. $recv(anObject)._parent_(self);
  37913. return $recv(self._dagChildren())._add_(anObject);
  37914. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  37915. },
  37916. args: ["anObject"],
  37917. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  37918. referencedClasses: [],
  37919. messageSends: ["parent:", "add:", "dagChildren"]
  37920. }),
  37921. $globals.IRInstruction);
  37922. $core.addMethod(
  37923. $core.method({
  37924. selector: "isClosure",
  37925. protocol: "testing",
  37926. fn: function (){
  37927. var self=this;
  37928. return false;
  37929. },
  37930. args: [],
  37931. source: "isClosure\x0a\x09^ false",
  37932. referencedClasses: [],
  37933. messageSends: []
  37934. }),
  37935. $globals.IRInstruction);
  37936. $core.addMethod(
  37937. $core.method({
  37938. selector: "isInlined",
  37939. protocol: "testing",
  37940. fn: function (){
  37941. var self=this;
  37942. return false;
  37943. },
  37944. args: [],
  37945. source: "isInlined\x0a\x09^ false",
  37946. referencedClasses: [],
  37947. messageSends: []
  37948. }),
  37949. $globals.IRInstruction);
  37950. $core.addMethod(
  37951. $core.method({
  37952. selector: "isMethod",
  37953. protocol: "testing",
  37954. fn: function (){
  37955. var self=this;
  37956. return false;
  37957. },
  37958. args: [],
  37959. source: "isMethod\x0a\x09^ false",
  37960. referencedClasses: [],
  37961. messageSends: []
  37962. }),
  37963. $globals.IRInstruction);
  37964. $core.addMethod(
  37965. $core.method({
  37966. selector: "isSend",
  37967. protocol: "testing",
  37968. fn: function (){
  37969. var self=this;
  37970. return false;
  37971. },
  37972. args: [],
  37973. source: "isSend\x0a\x09^ false",
  37974. referencedClasses: [],
  37975. messageSends: []
  37976. }),
  37977. $globals.IRInstruction);
  37978. $core.addMethod(
  37979. $core.method({
  37980. selector: "isSequence",
  37981. protocol: "testing",
  37982. fn: function (){
  37983. var self=this;
  37984. return false;
  37985. },
  37986. args: [],
  37987. source: "isSequence\x0a\x09^ false",
  37988. referencedClasses: [],
  37989. messageSends: []
  37990. }),
  37991. $globals.IRInstruction);
  37992. $core.addMethod(
  37993. $core.method({
  37994. selector: "isTempDeclaration",
  37995. protocol: "testing",
  37996. fn: function (){
  37997. var self=this;
  37998. return false;
  37999. },
  38000. args: [],
  38001. source: "isTempDeclaration\x0a\x09^ false",
  38002. referencedClasses: [],
  38003. messageSends: []
  38004. }),
  38005. $globals.IRInstruction);
  38006. $core.addMethod(
  38007. $core.method({
  38008. selector: "isVariable",
  38009. protocol: "testing",
  38010. fn: function (){
  38011. var self=this;
  38012. return false;
  38013. },
  38014. args: [],
  38015. source: "isVariable\x0a\x09^ false",
  38016. referencedClasses: [],
  38017. messageSends: []
  38018. }),
  38019. $globals.IRInstruction);
  38020. $core.addMethod(
  38021. $core.method({
  38022. selector: "method",
  38023. protocol: "accessing",
  38024. fn: function (){
  38025. var self=this;
  38026. return $core.withContext(function($ctx1) {
  38027. return $recv(self._parent())._method();
  38028. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  38029. },
  38030. args: [],
  38031. source: "method\x0a\x09^ self parent method",
  38032. referencedClasses: [],
  38033. messageSends: ["method", "parent"]
  38034. }),
  38035. $globals.IRInstruction);
  38036. $core.addMethod(
  38037. $core.method({
  38038. selector: "needsBoxingAsReceiver",
  38039. protocol: "testing",
  38040. fn: function (){
  38041. var self=this;
  38042. return true;
  38043. },
  38044. args: [],
  38045. source: "needsBoxingAsReceiver\x0a\x09^ true",
  38046. referencedClasses: [],
  38047. messageSends: []
  38048. }),
  38049. $globals.IRInstruction);
  38050. $core.addMethod(
  38051. $core.method({
  38052. selector: "parent",
  38053. protocol: "accessing",
  38054. fn: function (){
  38055. var self=this;
  38056. return self["@parent"];
  38057. },
  38058. args: [],
  38059. source: "parent\x0a\x09^ parent",
  38060. referencedClasses: [],
  38061. messageSends: []
  38062. }),
  38063. $globals.IRInstruction);
  38064. $core.addMethod(
  38065. $core.method({
  38066. selector: "parent:",
  38067. protocol: "accessing",
  38068. fn: function (anIRInstruction){
  38069. var self=this;
  38070. self["@parent"]=anIRInstruction;
  38071. return self;
  38072. },
  38073. args: ["anIRInstruction"],
  38074. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  38075. referencedClasses: [],
  38076. messageSends: []
  38077. }),
  38078. $globals.IRInstruction);
  38079. $core.addMethod(
  38080. $core.method({
  38081. selector: "remove:",
  38082. protocol: "building",
  38083. fn: function (anIRInstruction){
  38084. var self=this;
  38085. return $core.withContext(function($ctx1) {
  38086. $recv(self._dagChildren())._remove_(anIRInstruction);
  38087. return self;
  38088. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  38089. },
  38090. args: ["anIRInstruction"],
  38091. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  38092. referencedClasses: [],
  38093. messageSends: ["remove:", "dagChildren"]
  38094. }),
  38095. $globals.IRInstruction);
  38096. $core.addMethod(
  38097. $core.method({
  38098. selector: "replace:with:",
  38099. protocol: "building",
  38100. fn: function (anIRInstruction,anotherIRInstruction){
  38101. var self=this;
  38102. return $core.withContext(function($ctx1) {
  38103. var $1;
  38104. $recv(anotherIRInstruction)._parent_(self);
  38105. $1=self._dagChildren();
  38106. $ctx1.sendIdx["dagChildren"]=1;
  38107. $recv($1)._at_put_($recv(self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  38108. return self;
  38109. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  38110. },
  38111. args: ["anIRInstruction", "anotherIRInstruction"],
  38112. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  38113. referencedClasses: [],
  38114. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  38115. }),
  38116. $globals.IRInstruction);
  38117. $core.addMethod(
  38118. $core.method({
  38119. selector: "replaceWith:",
  38120. protocol: "building",
  38121. fn: function (anIRInstruction){
  38122. var self=this;
  38123. return $core.withContext(function($ctx1) {
  38124. $recv(self._parent())._replace_with_(self,anIRInstruction);
  38125. return self;
  38126. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  38127. },
  38128. args: ["anIRInstruction"],
  38129. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  38130. referencedClasses: [],
  38131. messageSends: ["replace:with:", "parent"]
  38132. }),
  38133. $globals.IRInstruction);
  38134. $core.addMethod(
  38135. $core.method({
  38136. selector: "scope",
  38137. protocol: "accessing",
  38138. fn: function (){
  38139. var self=this;
  38140. return $core.withContext(function($ctx1) {
  38141. var $1,$receiver;
  38142. $1=self._parent();
  38143. if(($receiver = $1) == null || $receiver.isNil){
  38144. return $1;
  38145. } else {
  38146. var node;
  38147. node=$receiver;
  38148. return $recv(node)._scope();
  38149. }
  38150. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  38151. },
  38152. args: [],
  38153. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  38154. referencedClasses: [],
  38155. messageSends: ["ifNotNil:", "parent", "scope"]
  38156. }),
  38157. $globals.IRInstruction);
  38158. $core.addMethod(
  38159. $core.method({
  38160. selector: "yieldsValue",
  38161. protocol: "testing",
  38162. fn: function (){
  38163. var self=this;
  38164. return true;
  38165. },
  38166. args: [],
  38167. source: "yieldsValue\x0a\x09^ true",
  38168. referencedClasses: [],
  38169. messageSends: []
  38170. }),
  38171. $globals.IRInstruction);
  38172. $core.addMethod(
  38173. $core.method({
  38174. selector: "on:",
  38175. protocol: "instance creation",
  38176. fn: function (aBuilder){
  38177. var self=this;
  38178. return $core.withContext(function($ctx1) {
  38179. var $1;
  38180. $1=self._new();
  38181. $recv($1)._builder_(aBuilder);
  38182. return $recv($1)._yourself();
  38183. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  38184. },
  38185. args: ["aBuilder"],
  38186. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  38187. referencedClasses: [],
  38188. messageSends: ["builder:", "new", "yourself"]
  38189. }),
  38190. $globals.IRInstruction.klass);
  38191. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  38192. $core.addMethod(
  38193. $core.method({
  38194. selector: "acceptDagVisitor:",
  38195. protocol: "visiting",
  38196. fn: function (aVisitor){
  38197. var self=this;
  38198. return $core.withContext(function($ctx1) {
  38199. return $recv(aVisitor)._visitIRAssignment_(self);
  38200. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  38201. },
  38202. args: ["aVisitor"],
  38203. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  38204. referencedClasses: [],
  38205. messageSends: ["visitIRAssignment:"]
  38206. }),
  38207. $globals.IRAssignment);
  38208. $core.addMethod(
  38209. $core.method({
  38210. selector: "left",
  38211. protocol: "accessing",
  38212. fn: function (){
  38213. var self=this;
  38214. return $core.withContext(function($ctx1) {
  38215. return $recv(self._dagChildren())._first();
  38216. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  38217. },
  38218. args: [],
  38219. source: "left\x0a\x09^ self dagChildren first",
  38220. referencedClasses: [],
  38221. messageSends: ["first", "dagChildren"]
  38222. }),
  38223. $globals.IRAssignment);
  38224. $core.addMethod(
  38225. $core.method({
  38226. selector: "right",
  38227. protocol: "accessing",
  38228. fn: function (){
  38229. var self=this;
  38230. return $core.withContext(function($ctx1) {
  38231. return $recv(self._dagChildren())._last();
  38232. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  38233. },
  38234. args: [],
  38235. source: "right\x0a\x09^ self dagChildren last",
  38236. referencedClasses: [],
  38237. messageSends: ["last", "dagChildren"]
  38238. }),
  38239. $globals.IRAssignment);
  38240. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  38241. $core.addMethod(
  38242. $core.method({
  38243. selector: "acceptDagVisitor:",
  38244. protocol: "visiting",
  38245. fn: function (aVisitor){
  38246. var self=this;
  38247. return $core.withContext(function($ctx1) {
  38248. return $recv(aVisitor)._visitIRDynamicArray_(self);
  38249. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  38250. },
  38251. args: ["aVisitor"],
  38252. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  38253. referencedClasses: [],
  38254. messageSends: ["visitIRDynamicArray:"]
  38255. }),
  38256. $globals.IRDynamicArray);
  38257. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  38258. $core.addMethod(
  38259. $core.method({
  38260. selector: "acceptDagVisitor:",
  38261. protocol: "visiting",
  38262. fn: function (aVisitor){
  38263. var self=this;
  38264. return $core.withContext(function($ctx1) {
  38265. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  38266. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  38267. },
  38268. args: ["aVisitor"],
  38269. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  38270. referencedClasses: [],
  38271. messageSends: ["visitIRDynamicDictionary:"]
  38272. }),
  38273. $globals.IRDynamicDictionary);
  38274. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  38275. $core.addMethod(
  38276. $core.method({
  38277. selector: "scope",
  38278. protocol: "accessing",
  38279. fn: function (){
  38280. var self=this;
  38281. return self["@scope"];
  38282. },
  38283. args: [],
  38284. source: "scope\x0a\x09^ scope",
  38285. referencedClasses: [],
  38286. messageSends: []
  38287. }),
  38288. $globals.IRScopedInstruction);
  38289. $core.addMethod(
  38290. $core.method({
  38291. selector: "scope:",
  38292. protocol: "accessing",
  38293. fn: function (aScope){
  38294. var self=this;
  38295. self["@scope"]=aScope;
  38296. return self;
  38297. },
  38298. args: ["aScope"],
  38299. source: "scope: aScope\x0a\x09scope := aScope",
  38300. referencedClasses: [],
  38301. messageSends: []
  38302. }),
  38303. $globals.IRScopedInstruction);
  38304. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  38305. $core.addMethod(
  38306. $core.method({
  38307. selector: "arguments",
  38308. protocol: "accessing",
  38309. fn: function (){
  38310. var self=this;
  38311. return $core.withContext(function($ctx1) {
  38312. var $1,$receiver;
  38313. $1=self["@arguments"];
  38314. if(($receiver = $1) == null || $receiver.isNil){
  38315. return [];
  38316. } else {
  38317. return $1;
  38318. }
  38319. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  38320. },
  38321. args: [],
  38322. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  38323. referencedClasses: [],
  38324. messageSends: ["ifNil:"]
  38325. }),
  38326. $globals.IRClosureInstruction);
  38327. $core.addMethod(
  38328. $core.method({
  38329. selector: "arguments:",
  38330. protocol: "accessing",
  38331. fn: function (aCollection){
  38332. var self=this;
  38333. self["@arguments"]=aCollection;
  38334. return self;
  38335. },
  38336. args: ["aCollection"],
  38337. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  38338. referencedClasses: [],
  38339. messageSends: []
  38340. }),
  38341. $globals.IRClosureInstruction);
  38342. $core.addMethod(
  38343. $core.method({
  38344. selector: "locals",
  38345. protocol: "accessing",
  38346. fn: function (){
  38347. var self=this;
  38348. return $core.withContext(function($ctx1) {
  38349. var $1;
  38350. $1=$recv(self._arguments())._copy();
  38351. $recv($1)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  38352. return $core.withContext(function($ctx2) {
  38353. return $recv(each)._name();
  38354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38355. })));
  38356. return $recv($1)._yourself();
  38357. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  38358. },
  38359. args: [],
  38360. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  38361. referencedClasses: [],
  38362. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  38363. }),
  38364. $globals.IRClosureInstruction);
  38365. $core.addMethod(
  38366. $core.method({
  38367. selector: "requiresSmalltalkContext",
  38368. protocol: "accessing",
  38369. fn: function (){
  38370. var self=this;
  38371. return $core.withContext(function($ctx1) {
  38372. var $1,$receiver;
  38373. $1=self["@requiresSmalltalkContext"];
  38374. if(($receiver = $1) == null || $receiver.isNil){
  38375. return false;
  38376. } else {
  38377. return $1;
  38378. }
  38379. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  38380. },
  38381. args: [],
  38382. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  38383. referencedClasses: [],
  38384. messageSends: ["ifNil:"]
  38385. }),
  38386. $globals.IRClosureInstruction);
  38387. $core.addMethod(
  38388. $core.method({
  38389. selector: "requiresSmalltalkContext:",
  38390. protocol: "accessing",
  38391. fn: function (anObject){
  38392. var self=this;
  38393. self["@requiresSmalltalkContext"]=anObject;
  38394. return self;
  38395. },
  38396. args: ["anObject"],
  38397. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  38398. referencedClasses: [],
  38399. messageSends: []
  38400. }),
  38401. $globals.IRClosureInstruction);
  38402. $core.addMethod(
  38403. $core.method({
  38404. selector: "scope:",
  38405. protocol: "accessing",
  38406. fn: function (aScope){
  38407. var self=this;
  38408. return $core.withContext(function($ctx1) {
  38409. (
  38410. $ctx1.supercall = true,
  38411. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($recv(self), [aScope]));
  38412. $ctx1.supercall = false;
  38413. $recv(aScope)._instruction_(self);
  38414. return self;
  38415. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  38416. },
  38417. args: ["aScope"],
  38418. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  38419. referencedClasses: [],
  38420. messageSends: ["scope:", "instruction:"]
  38421. }),
  38422. $globals.IRClosureInstruction);
  38423. $core.addMethod(
  38424. $core.method({
  38425. selector: "tempDeclarations",
  38426. protocol: "accessing",
  38427. fn: function (){
  38428. var self=this;
  38429. return $core.withContext(function($ctx1) {
  38430. return $recv(self._dagChildren())._select_((function(each){
  38431. return $core.withContext(function($ctx2) {
  38432. return $recv(each)._isTempDeclaration();
  38433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38434. }));
  38435. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  38436. },
  38437. args: [],
  38438. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  38439. referencedClasses: [],
  38440. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  38441. }),
  38442. $globals.IRClosureInstruction);
  38443. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  38444. $core.addMethod(
  38445. $core.method({
  38446. selector: "acceptDagVisitor:",
  38447. protocol: "visiting",
  38448. fn: function (aVisitor){
  38449. var self=this;
  38450. return $core.withContext(function($ctx1) {
  38451. return $recv(aVisitor)._visitIRClosure_(self);
  38452. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  38453. },
  38454. args: ["aVisitor"],
  38455. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  38456. referencedClasses: [],
  38457. messageSends: ["visitIRClosure:"]
  38458. }),
  38459. $globals.IRClosure);
  38460. $core.addMethod(
  38461. $core.method({
  38462. selector: "isClosure",
  38463. protocol: "testing",
  38464. fn: function (){
  38465. var self=this;
  38466. return true;
  38467. },
  38468. args: [],
  38469. source: "isClosure\x0a\x09^ true",
  38470. referencedClasses: [],
  38471. messageSends: []
  38472. }),
  38473. $globals.IRClosure);
  38474. $core.addMethod(
  38475. $core.method({
  38476. selector: "sequence",
  38477. protocol: "accessing",
  38478. fn: function (){
  38479. var self=this;
  38480. return $core.withContext(function($ctx1) {
  38481. return $recv(self._dagChildren())._last();
  38482. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  38483. },
  38484. args: [],
  38485. source: "sequence\x0a\x09^ self dagChildren last",
  38486. referencedClasses: [],
  38487. messageSends: ["last", "dagChildren"]
  38488. }),
  38489. $globals.IRClosure);
  38490. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  38491. $globals.IRMethod.comment="I am a method instruction";
  38492. $core.addMethod(
  38493. $core.method({
  38494. selector: "acceptDagVisitor:",
  38495. protocol: "visiting",
  38496. fn: function (aVisitor){
  38497. var self=this;
  38498. return $core.withContext(function($ctx1) {
  38499. return $recv(aVisitor)._visitIRMethod_(self);
  38500. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  38501. },
  38502. args: ["aVisitor"],
  38503. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  38504. referencedClasses: [],
  38505. messageSends: ["visitIRMethod:"]
  38506. }),
  38507. $globals.IRMethod);
  38508. $core.addMethod(
  38509. $core.method({
  38510. selector: "classReferences",
  38511. protocol: "accessing",
  38512. fn: function (){
  38513. var self=this;
  38514. return self["@classReferences"];
  38515. },
  38516. args: [],
  38517. source: "classReferences\x0a\x09^ classReferences",
  38518. referencedClasses: [],
  38519. messageSends: []
  38520. }),
  38521. $globals.IRMethod);
  38522. $core.addMethod(
  38523. $core.method({
  38524. selector: "classReferences:",
  38525. protocol: "accessing",
  38526. fn: function (aCollection){
  38527. var self=this;
  38528. self["@classReferences"]=aCollection;
  38529. return self;
  38530. },
  38531. args: ["aCollection"],
  38532. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  38533. referencedClasses: [],
  38534. messageSends: []
  38535. }),
  38536. $globals.IRMethod);
  38537. $core.addMethod(
  38538. $core.method({
  38539. selector: "internalVariables",
  38540. protocol: "accessing",
  38541. fn: function (){
  38542. var self=this;
  38543. return $core.withContext(function($ctx1) {
  38544. var $1,$receiver;
  38545. $1=self["@internalVariables"];
  38546. if(($receiver = $1) == null || $receiver.isNil){
  38547. self["@internalVariables"]=$recv($globals.Set)._new();
  38548. return self["@internalVariables"];
  38549. } else {
  38550. return $1;
  38551. }
  38552. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  38553. },
  38554. args: [],
  38555. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  38556. referencedClasses: ["Set"],
  38557. messageSends: ["ifNil:", "new"]
  38558. }),
  38559. $globals.IRMethod);
  38560. $core.addMethod(
  38561. $core.method({
  38562. selector: "isMethod",
  38563. protocol: "testing",
  38564. fn: function (){
  38565. var self=this;
  38566. return true;
  38567. },
  38568. args: [],
  38569. source: "isMethod\x0a\x09^ true",
  38570. referencedClasses: [],
  38571. messageSends: []
  38572. }),
  38573. $globals.IRMethod);
  38574. $core.addMethod(
  38575. $core.method({
  38576. selector: "messageSends",
  38577. protocol: "accessing",
  38578. fn: function (){
  38579. var self=this;
  38580. return $core.withContext(function($ctx1) {
  38581. return $recv(self._sendIndexes())._keys();
  38582. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  38583. },
  38584. args: [],
  38585. source: "messageSends\x0a\x09^ self sendIndexes keys",
  38586. referencedClasses: [],
  38587. messageSends: ["keys", "sendIndexes"]
  38588. }),
  38589. $globals.IRMethod);
  38590. $core.addMethod(
  38591. $core.method({
  38592. selector: "method",
  38593. protocol: "accessing",
  38594. fn: function (){
  38595. var self=this;
  38596. return self;
  38597. },
  38598. args: [],
  38599. source: "method\x0a\x09^ self",
  38600. referencedClasses: [],
  38601. messageSends: []
  38602. }),
  38603. $globals.IRMethod);
  38604. $core.addMethod(
  38605. $core.method({
  38606. selector: "selector",
  38607. protocol: "accessing",
  38608. fn: function (){
  38609. var self=this;
  38610. return self["@selector"];
  38611. },
  38612. args: [],
  38613. source: "selector\x0a\x09^ selector",
  38614. referencedClasses: [],
  38615. messageSends: []
  38616. }),
  38617. $globals.IRMethod);
  38618. $core.addMethod(
  38619. $core.method({
  38620. selector: "selector:",
  38621. protocol: "accessing",
  38622. fn: function (aString){
  38623. var self=this;
  38624. self["@selector"]=aString;
  38625. return self;
  38626. },
  38627. args: ["aString"],
  38628. source: "selector: aString\x0a\x09selector := aString",
  38629. referencedClasses: [],
  38630. messageSends: []
  38631. }),
  38632. $globals.IRMethod);
  38633. $core.addMethod(
  38634. $core.method({
  38635. selector: "sendIndexes",
  38636. protocol: "accessing",
  38637. fn: function (){
  38638. var self=this;
  38639. return self["@sendIndexes"];
  38640. },
  38641. args: [],
  38642. source: "sendIndexes\x0a\x09^ sendIndexes",
  38643. referencedClasses: [],
  38644. messageSends: []
  38645. }),
  38646. $globals.IRMethod);
  38647. $core.addMethod(
  38648. $core.method({
  38649. selector: "sendIndexes:",
  38650. protocol: "accessing",
  38651. fn: function (aDictionary){
  38652. var self=this;
  38653. self["@sendIndexes"]=aDictionary;
  38654. return self;
  38655. },
  38656. args: ["aDictionary"],
  38657. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  38658. referencedClasses: [],
  38659. messageSends: []
  38660. }),
  38661. $globals.IRMethod);
  38662. $core.addMethod(
  38663. $core.method({
  38664. selector: "source",
  38665. protocol: "accessing",
  38666. fn: function (){
  38667. var self=this;
  38668. return self["@source"];
  38669. },
  38670. args: [],
  38671. source: "source\x0a\x09^ source",
  38672. referencedClasses: [],
  38673. messageSends: []
  38674. }),
  38675. $globals.IRMethod);
  38676. $core.addMethod(
  38677. $core.method({
  38678. selector: "source:",
  38679. protocol: "accessing",
  38680. fn: function (aString){
  38681. var self=this;
  38682. self["@source"]=aString;
  38683. return self;
  38684. },
  38685. args: ["aString"],
  38686. source: "source: aString\x0a\x09source := aString",
  38687. referencedClasses: [],
  38688. messageSends: []
  38689. }),
  38690. $globals.IRMethod);
  38691. $core.addMethod(
  38692. $core.method({
  38693. selector: "theClass",
  38694. protocol: "accessing",
  38695. fn: function (){
  38696. var self=this;
  38697. return self["@theClass"];
  38698. },
  38699. args: [],
  38700. source: "theClass\x0a\x09^ theClass",
  38701. referencedClasses: [],
  38702. messageSends: []
  38703. }),
  38704. $globals.IRMethod);
  38705. $core.addMethod(
  38706. $core.method({
  38707. selector: "theClass:",
  38708. protocol: "accessing",
  38709. fn: function (aClass){
  38710. var self=this;
  38711. self["@theClass"]=aClass;
  38712. return self;
  38713. },
  38714. args: ["aClass"],
  38715. source: "theClass: aClass\x0a\x09theClass := aClass",
  38716. referencedClasses: [],
  38717. messageSends: []
  38718. }),
  38719. $globals.IRMethod);
  38720. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  38721. $globals.IRReturn.comment="I am a local return instruction.";
  38722. $core.addMethod(
  38723. $core.method({
  38724. selector: "acceptDagVisitor:",
  38725. protocol: "visiting",
  38726. fn: function (aVisitor){
  38727. var self=this;
  38728. return $core.withContext(function($ctx1) {
  38729. return $recv(aVisitor)._visitIRReturn_(self);
  38730. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  38731. },
  38732. args: ["aVisitor"],
  38733. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  38734. referencedClasses: [],
  38735. messageSends: ["visitIRReturn:"]
  38736. }),
  38737. $globals.IRReturn);
  38738. $core.addMethod(
  38739. $core.method({
  38740. selector: "expression",
  38741. protocol: "accessing",
  38742. fn: function (){
  38743. var self=this;
  38744. return $core.withContext(function($ctx1) {
  38745. return $recv(self._dagChildren())._single();
  38746. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  38747. },
  38748. args: [],
  38749. source: "expression\x0a\x09^ self dagChildren single",
  38750. referencedClasses: [],
  38751. messageSends: ["single", "dagChildren"]
  38752. }),
  38753. $globals.IRReturn);
  38754. $core.addMethod(
  38755. $core.method({
  38756. selector: "scope",
  38757. protocol: "accessing",
  38758. fn: function (){
  38759. var self=this;
  38760. return $core.withContext(function($ctx1) {
  38761. var $1,$receiver;
  38762. $1=self["@scope"];
  38763. if(($receiver = $1) == null || $receiver.isNil){
  38764. return $recv(self._parent())._scope();
  38765. } else {
  38766. return $1;
  38767. }
  38768. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  38769. },
  38770. args: [],
  38771. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  38772. referencedClasses: [],
  38773. messageSends: ["ifNil:", "scope", "parent"]
  38774. }),
  38775. $globals.IRReturn);
  38776. $core.addMethod(
  38777. $core.method({
  38778. selector: "yieldsValue",
  38779. protocol: "testing",
  38780. fn: function (){
  38781. var self=this;
  38782. return false;
  38783. },
  38784. args: [],
  38785. source: "yieldsValue\x0a\x09^ false",
  38786. referencedClasses: [],
  38787. messageSends: []
  38788. }),
  38789. $globals.IRReturn);
  38790. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  38791. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  38792. $core.addMethod(
  38793. $core.method({
  38794. selector: "acceptDagVisitor:",
  38795. protocol: "visiting",
  38796. fn: function (aVisitor){
  38797. var self=this;
  38798. return $core.withContext(function($ctx1) {
  38799. return $recv(aVisitor)._visitIRBlockReturn_(self);
  38800. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  38801. },
  38802. args: ["aVisitor"],
  38803. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  38804. referencedClasses: [],
  38805. messageSends: ["visitIRBlockReturn:"]
  38806. }),
  38807. $globals.IRBlockReturn);
  38808. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  38809. $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.";
  38810. $core.addMethod(
  38811. $core.method({
  38812. selector: "acceptDagVisitor:",
  38813. protocol: "visiting",
  38814. fn: function (aVisitor){
  38815. var self=this;
  38816. return $core.withContext(function($ctx1) {
  38817. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  38818. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  38819. },
  38820. args: ["aVisitor"],
  38821. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  38822. referencedClasses: [],
  38823. messageSends: ["visitIRNonLocalReturn:"]
  38824. }),
  38825. $globals.IRNonLocalReturn);
  38826. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  38827. $core.addMethod(
  38828. $core.method({
  38829. selector: "acceptDagVisitor:",
  38830. protocol: "visiting",
  38831. fn: function (aVisitor){
  38832. var self=this;
  38833. return $core.withContext(function($ctx1) {
  38834. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  38835. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  38836. },
  38837. args: ["aVisitor"],
  38838. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  38839. referencedClasses: [],
  38840. messageSends: ["visitIRTempDeclaration:"]
  38841. }),
  38842. $globals.IRTempDeclaration);
  38843. $core.addMethod(
  38844. $core.method({
  38845. selector: "isTempDeclaration",
  38846. protocol: "testing",
  38847. fn: function (){
  38848. var self=this;
  38849. return true;
  38850. },
  38851. args: [],
  38852. source: "isTempDeclaration\x0a\x09^ true",
  38853. referencedClasses: [],
  38854. messageSends: []
  38855. }),
  38856. $globals.IRTempDeclaration);
  38857. $core.addMethod(
  38858. $core.method({
  38859. selector: "name",
  38860. protocol: "accessing",
  38861. fn: function (){
  38862. var self=this;
  38863. return self["@name"];
  38864. },
  38865. args: [],
  38866. source: "name\x0a\x09^ name",
  38867. referencedClasses: [],
  38868. messageSends: []
  38869. }),
  38870. $globals.IRTempDeclaration);
  38871. $core.addMethod(
  38872. $core.method({
  38873. selector: "name:",
  38874. protocol: "accessing",
  38875. fn: function (aString){
  38876. var self=this;
  38877. self["@name"]=aString;
  38878. return self;
  38879. },
  38880. args: ["aString"],
  38881. source: "name: aString\x0a\x09name := aString",
  38882. referencedClasses: [],
  38883. messageSends: []
  38884. }),
  38885. $globals.IRTempDeclaration);
  38886. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  38887. $globals.IRSend.comment="I am a message send instruction.";
  38888. $core.addMethod(
  38889. $core.method({
  38890. selector: "acceptDagVisitor:",
  38891. protocol: "visiting",
  38892. fn: function (aVisitor){
  38893. var self=this;
  38894. return $core.withContext(function($ctx1) {
  38895. return $recv(aVisitor)._visitIRSend_(self);
  38896. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  38897. },
  38898. args: ["aVisitor"],
  38899. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  38900. referencedClasses: [],
  38901. messageSends: ["visitIRSend:"]
  38902. }),
  38903. $globals.IRSend);
  38904. $core.addMethod(
  38905. $core.method({
  38906. selector: "arguments",
  38907. protocol: "accessing",
  38908. fn: function (){
  38909. var self=this;
  38910. return $core.withContext(function($ctx1) {
  38911. return $recv(self._dagChildren())._allButFirst();
  38912. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  38913. },
  38914. args: [],
  38915. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  38916. referencedClasses: [],
  38917. messageSends: ["allButFirst", "dagChildren"]
  38918. }),
  38919. $globals.IRSend);
  38920. $core.addMethod(
  38921. $core.method({
  38922. selector: "index",
  38923. protocol: "accessing",
  38924. fn: function (){
  38925. var self=this;
  38926. return self["@index"];
  38927. },
  38928. args: [],
  38929. source: "index\x0a\x09^ index",
  38930. referencedClasses: [],
  38931. messageSends: []
  38932. }),
  38933. $globals.IRSend);
  38934. $core.addMethod(
  38935. $core.method({
  38936. selector: "index:",
  38937. protocol: "accessing",
  38938. fn: function (anInteger){
  38939. var self=this;
  38940. self["@index"]=anInteger;
  38941. return self;
  38942. },
  38943. args: ["anInteger"],
  38944. source: "index: anInteger\x0a\x09index := anInteger",
  38945. referencedClasses: [],
  38946. messageSends: []
  38947. }),
  38948. $globals.IRSend);
  38949. $core.addMethod(
  38950. $core.method({
  38951. selector: "isSend",
  38952. protocol: "testing",
  38953. fn: function (){
  38954. var self=this;
  38955. return true;
  38956. },
  38957. args: [],
  38958. source: "isSend\x0a\x09^ true",
  38959. referencedClasses: [],
  38960. messageSends: []
  38961. }),
  38962. $globals.IRSend);
  38963. $core.addMethod(
  38964. $core.method({
  38965. selector: "isSuperSend",
  38966. protocol: "testing",
  38967. fn: function (){
  38968. var self=this;
  38969. var receiver;
  38970. return $core.withContext(function($ctx1) {
  38971. receiver=self._receiver();
  38972. return $recv($recv(receiver)._isVariable())._and_((function(){
  38973. return $core.withContext(function($ctx2) {
  38974. return $recv($recv($recv(receiver)._variable())._name()).__eq("super");
  38975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38976. }));
  38977. }, function($ctx1) {$ctx1.fill(self,"isSuperSend",{receiver:receiver},$globals.IRSend)});
  38978. },
  38979. args: [],
  38980. source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self receiver.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
  38981. referencedClasses: [],
  38982. messageSends: ["receiver", "and:", "isVariable", "=", "name", "variable"]
  38983. }),
  38984. $globals.IRSend);
  38985. $core.addMethod(
  38986. $core.method({
  38987. selector: "receiver",
  38988. protocol: "accessing",
  38989. fn: function (){
  38990. var self=this;
  38991. return $core.withContext(function($ctx1) {
  38992. return $recv(self._dagChildren())._first();
  38993. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  38994. },
  38995. args: [],
  38996. source: "receiver\x0a\x09^ self dagChildren first",
  38997. referencedClasses: [],
  38998. messageSends: ["first", "dagChildren"]
  38999. }),
  39000. $globals.IRSend);
  39001. $core.addMethod(
  39002. $core.method({
  39003. selector: "selector",
  39004. protocol: "accessing",
  39005. fn: function (){
  39006. var self=this;
  39007. return self["@selector"];
  39008. },
  39009. args: [],
  39010. source: "selector\x0a\x09^ selector",
  39011. referencedClasses: [],
  39012. messageSends: []
  39013. }),
  39014. $globals.IRSend);
  39015. $core.addMethod(
  39016. $core.method({
  39017. selector: "selector:",
  39018. protocol: "accessing",
  39019. fn: function (aString){
  39020. var self=this;
  39021. self["@selector"]=aString;
  39022. return self;
  39023. },
  39024. args: ["aString"],
  39025. source: "selector: aString\x0a\x09selector := aString",
  39026. referencedClasses: [],
  39027. messageSends: []
  39028. }),
  39029. $globals.IRSend);
  39030. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  39031. $core.addMethod(
  39032. $core.method({
  39033. selector: "acceptDagVisitor:",
  39034. protocol: "visiting",
  39035. fn: function (aVisitor){
  39036. var self=this;
  39037. return $core.withContext(function($ctx1) {
  39038. return $recv(aVisitor)._visitIRSequence_(self);
  39039. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  39040. },
  39041. args: ["aVisitor"],
  39042. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  39043. referencedClasses: [],
  39044. messageSends: ["visitIRSequence:"]
  39045. }),
  39046. $globals.IRSequence);
  39047. $core.addMethod(
  39048. $core.method({
  39049. selector: "isSequence",
  39050. protocol: "testing",
  39051. fn: function (){
  39052. var self=this;
  39053. return true;
  39054. },
  39055. args: [],
  39056. source: "isSequence\x0a\x09^ true",
  39057. referencedClasses: [],
  39058. messageSends: []
  39059. }),
  39060. $globals.IRSequence);
  39061. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  39062. $core.addMethod(
  39063. $core.method({
  39064. selector: "acceptDagVisitor:",
  39065. protocol: "visiting",
  39066. fn: function (aVisitor){
  39067. var self=this;
  39068. return $core.withContext(function($ctx1) {
  39069. return $recv(aVisitor)._visitIRBlockSequence_(self);
  39070. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  39071. },
  39072. args: ["aVisitor"],
  39073. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  39074. referencedClasses: [],
  39075. messageSends: ["visitIRBlockSequence:"]
  39076. }),
  39077. $globals.IRBlockSequence);
  39078. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  39079. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  39080. $core.addMethod(
  39081. $core.method({
  39082. selector: "acceptDagVisitor:",
  39083. protocol: "visiting",
  39084. fn: function (aVisitor){
  39085. var self=this;
  39086. return $core.withContext(function($ctx1) {
  39087. return $recv(aVisitor)._visitIRValue_(self);
  39088. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  39089. },
  39090. args: ["aVisitor"],
  39091. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  39092. referencedClasses: [],
  39093. messageSends: ["visitIRValue:"]
  39094. }),
  39095. $globals.IRValue);
  39096. $core.addMethod(
  39097. $core.method({
  39098. selector: "needsBoxingAsReceiver",
  39099. protocol: "testing",
  39100. fn: function (){
  39101. var self=this;
  39102. return false;
  39103. },
  39104. args: [],
  39105. source: "needsBoxingAsReceiver\x0a\x09^ false",
  39106. referencedClasses: [],
  39107. messageSends: []
  39108. }),
  39109. $globals.IRValue);
  39110. $core.addMethod(
  39111. $core.method({
  39112. selector: "value",
  39113. protocol: "accessing",
  39114. fn: function (){
  39115. var self=this;
  39116. return self["@value"];
  39117. },
  39118. args: [],
  39119. source: "value\x0a\x09^ value",
  39120. referencedClasses: [],
  39121. messageSends: []
  39122. }),
  39123. $globals.IRValue);
  39124. $core.addMethod(
  39125. $core.method({
  39126. selector: "value:",
  39127. protocol: "accessing",
  39128. fn: function (aString){
  39129. var self=this;
  39130. self["@value"]=aString;
  39131. return self;
  39132. },
  39133. args: ["aString"],
  39134. source: "value: aString\x0a\x09value := aString",
  39135. referencedClasses: [],
  39136. messageSends: []
  39137. }),
  39138. $globals.IRValue);
  39139. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  39140. $globals.IRVariable.comment="I am a variable instruction.";
  39141. $core.addMethod(
  39142. $core.method({
  39143. selector: "acceptDagVisitor:",
  39144. protocol: "visiting",
  39145. fn: function (aVisitor){
  39146. var self=this;
  39147. return $core.withContext(function($ctx1) {
  39148. return $recv(aVisitor)._visitIRVariable_(self);
  39149. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  39150. },
  39151. args: ["aVisitor"],
  39152. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  39153. referencedClasses: [],
  39154. messageSends: ["visitIRVariable:"]
  39155. }),
  39156. $globals.IRVariable);
  39157. $core.addMethod(
  39158. $core.method({
  39159. selector: "isVariable",
  39160. protocol: "testing",
  39161. fn: function (){
  39162. var self=this;
  39163. return true;
  39164. },
  39165. args: [],
  39166. source: "isVariable\x0a\x09^ true",
  39167. referencedClasses: [],
  39168. messageSends: []
  39169. }),
  39170. $globals.IRVariable);
  39171. $core.addMethod(
  39172. $core.method({
  39173. selector: "needsBoxingAsReceiver",
  39174. protocol: "testing",
  39175. fn: function (){
  39176. var self=this;
  39177. return $core.withContext(function($ctx1) {
  39178. return $recv($recv(self._variable())._isPseudoVar())._not();
  39179. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  39180. },
  39181. args: [],
  39182. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  39183. referencedClasses: [],
  39184. messageSends: ["not", "isPseudoVar", "variable"]
  39185. }),
  39186. $globals.IRVariable);
  39187. $core.addMethod(
  39188. $core.method({
  39189. selector: "variable",
  39190. protocol: "accessing",
  39191. fn: function (){
  39192. var self=this;
  39193. return self["@variable"];
  39194. },
  39195. args: [],
  39196. source: "variable\x0a\x09^ variable",
  39197. referencedClasses: [],
  39198. messageSends: []
  39199. }),
  39200. $globals.IRVariable);
  39201. $core.addMethod(
  39202. $core.method({
  39203. selector: "variable:",
  39204. protocol: "accessing",
  39205. fn: function (aScopeVariable){
  39206. var self=this;
  39207. self["@variable"]=aScopeVariable;
  39208. return self;
  39209. },
  39210. args: ["aScopeVariable"],
  39211. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  39212. referencedClasses: [],
  39213. messageSends: []
  39214. }),
  39215. $globals.IRVariable);
  39216. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  39217. $core.addMethod(
  39218. $core.method({
  39219. selector: "acceptDagVisitor:",
  39220. protocol: "visiting",
  39221. fn: function (aVisitor){
  39222. var self=this;
  39223. return $core.withContext(function($ctx1) {
  39224. return $recv(aVisitor)._visitIRVerbatim_(self);
  39225. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  39226. },
  39227. args: ["aVisitor"],
  39228. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  39229. referencedClasses: [],
  39230. messageSends: ["visitIRVerbatim:"]
  39231. }),
  39232. $globals.IRVerbatim);
  39233. $core.addMethod(
  39234. $core.method({
  39235. selector: "source",
  39236. protocol: "accessing",
  39237. fn: function (){
  39238. var self=this;
  39239. return self["@source"];
  39240. },
  39241. args: [],
  39242. source: "source\x0a\x09^ source",
  39243. referencedClasses: [],
  39244. messageSends: []
  39245. }),
  39246. $globals.IRVerbatim);
  39247. $core.addMethod(
  39248. $core.method({
  39249. selector: "source:",
  39250. protocol: "accessing",
  39251. fn: function (aString){
  39252. var self=this;
  39253. self["@source"]=aString;
  39254. return self;
  39255. },
  39256. args: ["aString"],
  39257. source: "source: aString\x0a\x09source := aString",
  39258. referencedClasses: [],
  39259. messageSends: []
  39260. }),
  39261. $globals.IRVerbatim);
  39262. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  39263. $core.addMethod(
  39264. $core.method({
  39265. selector: "visitDagNode:",
  39266. protocol: "visiting",
  39267. fn: function (aNode){
  39268. var self=this;
  39269. return $core.withContext(function($ctx1) {
  39270. return self._visitDagNodeVariantSimple_(aNode);
  39271. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  39272. },
  39273. args: ["aNode"],
  39274. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  39275. referencedClasses: [],
  39276. messageSends: ["visitDagNodeVariantSimple:"]
  39277. }),
  39278. $globals.IRVisitor);
  39279. $core.addMethod(
  39280. $core.method({
  39281. selector: "visitIRAssignment:",
  39282. protocol: "visiting",
  39283. fn: function (anIRAssignment){
  39284. var self=this;
  39285. return $core.withContext(function($ctx1) {
  39286. return self._visitDagNode_(anIRAssignment);
  39287. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  39288. },
  39289. args: ["anIRAssignment"],
  39290. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  39291. referencedClasses: [],
  39292. messageSends: ["visitDagNode:"]
  39293. }),
  39294. $globals.IRVisitor);
  39295. $core.addMethod(
  39296. $core.method({
  39297. selector: "visitIRBlockReturn:",
  39298. protocol: "visiting",
  39299. fn: function (anIRBlockReturn){
  39300. var self=this;
  39301. return $core.withContext(function($ctx1) {
  39302. return self._visitIRReturn_(anIRBlockReturn);
  39303. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  39304. },
  39305. args: ["anIRBlockReturn"],
  39306. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  39307. referencedClasses: [],
  39308. messageSends: ["visitIRReturn:"]
  39309. }),
  39310. $globals.IRVisitor);
  39311. $core.addMethod(
  39312. $core.method({
  39313. selector: "visitIRBlockSequence:",
  39314. protocol: "visiting",
  39315. fn: function (anIRBlockSequence){
  39316. var self=this;
  39317. return $core.withContext(function($ctx1) {
  39318. return self._visitIRSequence_(anIRBlockSequence);
  39319. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  39320. },
  39321. args: ["anIRBlockSequence"],
  39322. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  39323. referencedClasses: [],
  39324. messageSends: ["visitIRSequence:"]
  39325. }),
  39326. $globals.IRVisitor);
  39327. $core.addMethod(
  39328. $core.method({
  39329. selector: "visitIRClosure:",
  39330. protocol: "visiting",
  39331. fn: function (anIRClosure){
  39332. var self=this;
  39333. return $core.withContext(function($ctx1) {
  39334. return self._visitDagNode_(anIRClosure);
  39335. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  39336. },
  39337. args: ["anIRClosure"],
  39338. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  39339. referencedClasses: [],
  39340. messageSends: ["visitDagNode:"]
  39341. }),
  39342. $globals.IRVisitor);
  39343. $core.addMethod(
  39344. $core.method({
  39345. selector: "visitIRDynamicArray:",
  39346. protocol: "visiting",
  39347. fn: function (anIRDynamicArray){
  39348. var self=this;
  39349. return $core.withContext(function($ctx1) {
  39350. return self._visitDagNode_(anIRDynamicArray);
  39351. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  39352. },
  39353. args: ["anIRDynamicArray"],
  39354. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  39355. referencedClasses: [],
  39356. messageSends: ["visitDagNode:"]
  39357. }),
  39358. $globals.IRVisitor);
  39359. $core.addMethod(
  39360. $core.method({
  39361. selector: "visitIRDynamicDictionary:",
  39362. protocol: "visiting",
  39363. fn: function (anIRDynamicDictionary){
  39364. var self=this;
  39365. return $core.withContext(function($ctx1) {
  39366. return self._visitDagNode_(anIRDynamicDictionary);
  39367. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  39368. },
  39369. args: ["anIRDynamicDictionary"],
  39370. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  39371. referencedClasses: [],
  39372. messageSends: ["visitDagNode:"]
  39373. }),
  39374. $globals.IRVisitor);
  39375. $core.addMethod(
  39376. $core.method({
  39377. selector: "visitIRInlinedClosure:",
  39378. protocol: "visiting",
  39379. fn: function (anIRInlinedClosure){
  39380. var self=this;
  39381. return $core.withContext(function($ctx1) {
  39382. return self._visitIRClosure_(anIRInlinedClosure);
  39383. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  39384. },
  39385. args: ["anIRInlinedClosure"],
  39386. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  39387. referencedClasses: [],
  39388. messageSends: ["visitIRClosure:"]
  39389. }),
  39390. $globals.IRVisitor);
  39391. $core.addMethod(
  39392. $core.method({
  39393. selector: "visitIRInlinedSequence:",
  39394. protocol: "visiting",
  39395. fn: function (anIRInlinedSequence){
  39396. var self=this;
  39397. return $core.withContext(function($ctx1) {
  39398. return self._visitIRSequence_(anIRInlinedSequence);
  39399. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  39400. },
  39401. args: ["anIRInlinedSequence"],
  39402. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  39403. referencedClasses: [],
  39404. messageSends: ["visitIRSequence:"]
  39405. }),
  39406. $globals.IRVisitor);
  39407. $core.addMethod(
  39408. $core.method({
  39409. selector: "visitIRMethod:",
  39410. protocol: "visiting",
  39411. fn: function (anIRMethod){
  39412. var self=this;
  39413. return $core.withContext(function($ctx1) {
  39414. return self._visitDagNode_(anIRMethod);
  39415. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  39416. },
  39417. args: ["anIRMethod"],
  39418. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  39419. referencedClasses: [],
  39420. messageSends: ["visitDagNode:"]
  39421. }),
  39422. $globals.IRVisitor);
  39423. $core.addMethod(
  39424. $core.method({
  39425. selector: "visitIRNonLocalReturn:",
  39426. protocol: "visiting",
  39427. fn: function (anIRNonLocalReturn){
  39428. var self=this;
  39429. return $core.withContext(function($ctx1) {
  39430. return self._visitDagNode_(anIRNonLocalReturn);
  39431. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  39432. },
  39433. args: ["anIRNonLocalReturn"],
  39434. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  39435. referencedClasses: [],
  39436. messageSends: ["visitDagNode:"]
  39437. }),
  39438. $globals.IRVisitor);
  39439. $core.addMethod(
  39440. $core.method({
  39441. selector: "visitIRNonLocalReturnHandling:",
  39442. protocol: "visiting",
  39443. fn: function (anIRNonLocalReturnHandling){
  39444. var self=this;
  39445. return $core.withContext(function($ctx1) {
  39446. return self._visitDagNode_(anIRNonLocalReturnHandling);
  39447. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  39448. },
  39449. args: ["anIRNonLocalReturnHandling"],
  39450. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  39451. referencedClasses: [],
  39452. messageSends: ["visitDagNode:"]
  39453. }),
  39454. $globals.IRVisitor);
  39455. $core.addMethod(
  39456. $core.method({
  39457. selector: "visitIRReturn:",
  39458. protocol: "visiting",
  39459. fn: function (anIRReturn){
  39460. var self=this;
  39461. return $core.withContext(function($ctx1) {
  39462. return self._visitDagNode_(anIRReturn);
  39463. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  39464. },
  39465. args: ["anIRReturn"],
  39466. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  39467. referencedClasses: [],
  39468. messageSends: ["visitDagNode:"]
  39469. }),
  39470. $globals.IRVisitor);
  39471. $core.addMethod(
  39472. $core.method({
  39473. selector: "visitIRSend:",
  39474. protocol: "visiting",
  39475. fn: function (anIRSend){
  39476. var self=this;
  39477. return $core.withContext(function($ctx1) {
  39478. return self._visitDagNode_(anIRSend);
  39479. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  39480. },
  39481. args: ["anIRSend"],
  39482. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  39483. referencedClasses: [],
  39484. messageSends: ["visitDagNode:"]
  39485. }),
  39486. $globals.IRVisitor);
  39487. $core.addMethod(
  39488. $core.method({
  39489. selector: "visitIRSequence:",
  39490. protocol: "visiting",
  39491. fn: function (anIRSequence){
  39492. var self=this;
  39493. return $core.withContext(function($ctx1) {
  39494. return self._visitDagNode_(anIRSequence);
  39495. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  39496. },
  39497. args: ["anIRSequence"],
  39498. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  39499. referencedClasses: [],
  39500. messageSends: ["visitDagNode:"]
  39501. }),
  39502. $globals.IRVisitor);
  39503. $core.addMethod(
  39504. $core.method({
  39505. selector: "visitIRTempDeclaration:",
  39506. protocol: "visiting",
  39507. fn: function (anIRTempDeclaration){
  39508. var self=this;
  39509. return $core.withContext(function($ctx1) {
  39510. return self._visitDagNode_(anIRTempDeclaration);
  39511. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  39512. },
  39513. args: ["anIRTempDeclaration"],
  39514. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  39515. referencedClasses: [],
  39516. messageSends: ["visitDagNode:"]
  39517. }),
  39518. $globals.IRVisitor);
  39519. $core.addMethod(
  39520. $core.method({
  39521. selector: "visitIRValue:",
  39522. protocol: "visiting",
  39523. fn: function (anIRValue){
  39524. var self=this;
  39525. return $core.withContext(function($ctx1) {
  39526. return self._visitDagNode_(anIRValue);
  39527. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  39528. },
  39529. args: ["anIRValue"],
  39530. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  39531. referencedClasses: [],
  39532. messageSends: ["visitDagNode:"]
  39533. }),
  39534. $globals.IRVisitor);
  39535. $core.addMethod(
  39536. $core.method({
  39537. selector: "visitIRVariable:",
  39538. protocol: "visiting",
  39539. fn: function (anIRVariable){
  39540. var self=this;
  39541. return $core.withContext(function($ctx1) {
  39542. return self._visitDagNode_(anIRVariable);
  39543. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  39544. },
  39545. args: ["anIRVariable"],
  39546. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  39547. referencedClasses: [],
  39548. messageSends: ["visitDagNode:"]
  39549. }),
  39550. $globals.IRVisitor);
  39551. $core.addMethod(
  39552. $core.method({
  39553. selector: "visitIRVerbatim:",
  39554. protocol: "visiting",
  39555. fn: function (anIRVerbatim){
  39556. var self=this;
  39557. return $core.withContext(function($ctx1) {
  39558. return self._visitDagNode_(anIRVerbatim);
  39559. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  39560. },
  39561. args: ["anIRVerbatim"],
  39562. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  39563. referencedClasses: [],
  39564. messageSends: ["visitDagNode:"]
  39565. }),
  39566. $globals.IRVisitor);
  39567. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  39568. $core.addMethod(
  39569. $core.method({
  39570. selector: "contents",
  39571. protocol: "accessing",
  39572. fn: function (){
  39573. var self=this;
  39574. return $core.withContext(function($ctx1) {
  39575. return $recv(self._stream())._contents();
  39576. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  39577. },
  39578. args: [],
  39579. source: "contents\x0a\x09^ self stream contents",
  39580. referencedClasses: [],
  39581. messageSends: ["contents", "stream"]
  39582. }),
  39583. $globals.IRJSTranslator);
  39584. $core.addMethod(
  39585. $core.method({
  39586. selector: "currentClass",
  39587. protocol: "accessing",
  39588. fn: function (){
  39589. var self=this;
  39590. return self["@currentClass"];
  39591. },
  39592. args: [],
  39593. source: "currentClass\x0a\x09^ currentClass",
  39594. referencedClasses: [],
  39595. messageSends: []
  39596. }),
  39597. $globals.IRJSTranslator);
  39598. $core.addMethod(
  39599. $core.method({
  39600. selector: "currentClass:",
  39601. protocol: "accessing",
  39602. fn: function (aClass){
  39603. var self=this;
  39604. self["@currentClass"]=aClass;
  39605. return self;
  39606. },
  39607. args: ["aClass"],
  39608. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  39609. referencedClasses: [],
  39610. messageSends: []
  39611. }),
  39612. $globals.IRJSTranslator);
  39613. $core.addMethod(
  39614. $core.method({
  39615. selector: "initialize",
  39616. protocol: "initialization",
  39617. fn: function (){
  39618. var self=this;
  39619. return $core.withContext(function($ctx1) {
  39620. (
  39621. $ctx1.supercall = true,
  39622. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  39623. $ctx1.supercall = false;
  39624. self["@stream"]=$recv($globals.JSStream)._new();
  39625. return self;
  39626. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  39627. },
  39628. args: [],
  39629. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  39630. referencedClasses: ["JSStream"],
  39631. messageSends: ["initialize", "new"]
  39632. }),
  39633. $globals.IRJSTranslator);
  39634. $core.addMethod(
  39635. $core.method({
  39636. selector: "stream",
  39637. protocol: "accessing",
  39638. fn: function (){
  39639. var self=this;
  39640. return self["@stream"];
  39641. },
  39642. args: [],
  39643. source: "stream\x0a\x09^ stream",
  39644. referencedClasses: [],
  39645. messageSends: []
  39646. }),
  39647. $globals.IRJSTranslator);
  39648. $core.addMethod(
  39649. $core.method({
  39650. selector: "stream:",
  39651. protocol: "accessing",
  39652. fn: function (aStream){
  39653. var self=this;
  39654. self["@stream"]=aStream;
  39655. return self;
  39656. },
  39657. args: ["aStream"],
  39658. source: "stream: aStream\x0a\x09stream := aStream",
  39659. referencedClasses: [],
  39660. messageSends: []
  39661. }),
  39662. $globals.IRJSTranslator);
  39663. $core.addMethod(
  39664. $core.method({
  39665. selector: "visitIRAssignment:",
  39666. protocol: "visiting",
  39667. fn: function (anIRAssignment){
  39668. var self=this;
  39669. return $core.withContext(function($ctx1) {
  39670. $recv(self._stream())._nextPutAssignLhs_rhs_((function(){
  39671. return $core.withContext(function($ctx2) {
  39672. return self._visit_($recv(anIRAssignment)._left());
  39673. $ctx2.sendIdx["visit:"]=1;
  39674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39675. }),(function(){
  39676. return $core.withContext(function($ctx2) {
  39677. return self._visit_($recv(anIRAssignment)._right());
  39678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39679. }));
  39680. return self;
  39681. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  39682. },
  39683. args: ["anIRAssignment"],
  39684. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  39685. referencedClasses: [],
  39686. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  39687. }),
  39688. $globals.IRJSTranslator);
  39689. $core.addMethod(
  39690. $core.method({
  39691. selector: "visitIRClosure:",
  39692. protocol: "visiting",
  39693. fn: function (anIRClosure){
  39694. var self=this;
  39695. return $core.withContext(function($ctx1) {
  39696. var $1,$2;
  39697. $1=self._stream();
  39698. $ctx1.sendIdx["stream"]=1;
  39699. $recv($1)._nextPutClosureWith_arguments_((function(){
  39700. return $core.withContext(function($ctx2) {
  39701. $2=self._stream();
  39702. $ctx2.sendIdx["stream"]=2;
  39703. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  39704. return $core.withContext(function($ctx3) {
  39705. return $recv($recv(each)._name())._asVariableName();
  39706. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39707. })));
  39708. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  39709. return $core.withContext(function($ctx3) {
  39710. return (
  39711. $ctx3.supercall = true,
  39712. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  39713. $ctx3.supercall = false;
  39714. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  39715. }));
  39716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39717. }),$recv(anIRClosure)._arguments());
  39718. return self;
  39719. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  39720. },
  39721. args: ["anIRClosure"],
  39722. 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",
  39723. referencedClasses: [],
  39724. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  39725. }),
  39726. $globals.IRJSTranslator);
  39727. $core.addMethod(
  39728. $core.method({
  39729. selector: "visitIRDynamicArray:",
  39730. protocol: "visiting",
  39731. fn: function (anIRDynamicArray){
  39732. var self=this;
  39733. return $core.withContext(function($ctx1) {
  39734. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  39735. return self;
  39736. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  39737. },
  39738. args: ["anIRDynamicArray"],
  39739. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  39740. referencedClasses: [],
  39741. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  39742. }),
  39743. $globals.IRJSTranslator);
  39744. $core.addMethod(
  39745. $core.method({
  39746. selector: "visitIRDynamicDictionary:",
  39747. protocol: "visiting",
  39748. fn: function (anIRDynamicDictionary){
  39749. var self=this;
  39750. return $core.withContext(function($ctx1) {
  39751. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  39752. return self;
  39753. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  39754. },
  39755. args: ["anIRDynamicDictionary"],
  39756. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  39757. referencedClasses: [],
  39758. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  39759. }),
  39760. $globals.IRJSTranslator);
  39761. $core.addMethod(
  39762. $core.method({
  39763. selector: "visitIRMethod:",
  39764. protocol: "visiting",
  39765. fn: function (anIRMethod){
  39766. var self=this;
  39767. return $core.withContext(function($ctx1) {
  39768. var $1,$2,$3,$4,$5,$6,$7;
  39769. $1=self._stream();
  39770. $ctx1.sendIdx["stream"]=1;
  39771. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  39772. return $core.withContext(function($ctx2) {
  39773. $2=self._stream();
  39774. $ctx2.sendIdx["stream"]=2;
  39775. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  39776. return $core.withContext(function($ctx3) {
  39777. $3=self._stream();
  39778. $ctx3.sendIdx["stream"]=3;
  39779. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  39780. return $core.withContext(function($ctx4) {
  39781. return $recv($recv(each)._name())._asVariableName();
  39782. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39783. }));
  39784. $ctx3.sendIdx["collect:"]=1;
  39785. $recv($3)._nextPutVars_($4);
  39786. $ctx3.sendIdx["nextPutVars:"]=1;
  39787. $5=self._stream();
  39788. $ctx3.sendIdx["stream"]=4;
  39789. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  39790. return $core.withContext(function($ctx4) {
  39791. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  39792. return $core.withContext(function($ctx5) {
  39793. $6=self._stream();
  39794. $ctx5.sendIdx["stream"]=5;
  39795. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  39796. return $core.withContext(function($ctx6) {
  39797. return $recv($recv(each)._variable())._alias();
  39798. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  39799. })));
  39800. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  39801. }));
  39802. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  39803. if($core.assert($7)){
  39804. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  39805. return $core.withContext(function($ctx5) {
  39806. return (
  39807. $ctx5.supercall = true,
  39808. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39809. $ctx5.supercall = false;
  39810. $ctx5.sendIdx["visitIRMethod:"]=1;
  39811. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  39812. }));
  39813. } else {
  39814. return (
  39815. $ctx4.supercall = true,
  39816. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39817. $ctx4.supercall = false;
  39818. }
  39819. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  39820. }));
  39821. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39822. }),$recv(anIRMethod)._arguments());
  39823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39824. }));
  39825. return self._contents();
  39826. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  39827. },
  39828. args: ["anIRMethod"],
  39829. 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",
  39830. referencedClasses: [],
  39831. 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"]
  39832. }),
  39833. $globals.IRJSTranslator);
  39834. $core.addMethod(
  39835. $core.method({
  39836. selector: "visitIRNonLocalReturn:",
  39837. protocol: "visiting",
  39838. fn: function (anIRNonLocalReturn){
  39839. var self=this;
  39840. return $core.withContext(function($ctx1) {
  39841. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  39842. return $core.withContext(function($ctx2) {
  39843. return (
  39844. $ctx2.supercall = true,
  39845. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39846. $ctx2.supercall = false;
  39847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39848. }));
  39849. return self;
  39850. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  39851. },
  39852. args: ["anIRNonLocalReturn"],
  39853. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  39854. referencedClasses: [],
  39855. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  39856. }),
  39857. $globals.IRJSTranslator);
  39858. $core.addMethod(
  39859. $core.method({
  39860. selector: "visitIRReturn:",
  39861. protocol: "visiting",
  39862. fn: function (anIRReturn){
  39863. var self=this;
  39864. return $core.withContext(function($ctx1) {
  39865. $recv(self._stream())._nextPutReturnWith_((function(){
  39866. return $core.withContext(function($ctx2) {
  39867. return (
  39868. $ctx2.supercall = true,
  39869. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39870. $ctx2.supercall = false;
  39871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39872. }));
  39873. return self;
  39874. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  39875. },
  39876. args: ["anIRReturn"],
  39877. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  39878. referencedClasses: [],
  39879. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  39880. }),
  39881. $globals.IRJSTranslator);
  39882. $core.addMethod(
  39883. $core.method({
  39884. selector: "visitIRSend:",
  39885. protocol: "visiting",
  39886. fn: function (anIRSend){
  39887. var self=this;
  39888. var sends,superclass;
  39889. return $core.withContext(function($ctx1) {
  39890. var $1,$2;
  39891. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  39892. $1=$recv(anIRSend)._isSuperSend();
  39893. if($core.assert($1)){
  39894. self._visitSuperSend_(anIRSend);
  39895. } else {
  39896. self._visitSend_(anIRSend);
  39897. }
  39898. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  39899. if($core.assert($2)){
  39900. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  39901. }
  39902. return self;
  39903. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  39904. },
  39905. args: ["anIRSend"],
  39906. source: "visitIRSend: anIRSend\x0a\x09| sends superclass |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend isSuperSend\x0a\x09\x09ifTrue: [ self visitSuperSend: anIRSend ]\x0a\x09\x09ifFalse: [ self visitSend: anIRSend ].\x0a\x09\x09\x0a\x09anIRSend index < sends\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  39907. referencedClasses: [],
  39908. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuperSend", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  39909. }),
  39910. $globals.IRJSTranslator);
  39911. $core.addMethod(
  39912. $core.method({
  39913. selector: "visitIRSequence:",
  39914. protocol: "visiting",
  39915. fn: function (anIRSequence){
  39916. var self=this;
  39917. return $core.withContext(function($ctx1) {
  39918. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  39919. return $core.withContext(function($ctx2) {
  39920. return $recv(self._stream())._nextPutStatementWith_((function(){
  39921. return $core.withContext(function($ctx3) {
  39922. return self._visit_(each);
  39923. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39924. }));
  39925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39926. }));
  39927. return self;
  39928. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  39929. },
  39930. args: ["anIRSequence"],
  39931. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  39932. referencedClasses: [],
  39933. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  39934. }),
  39935. $globals.IRJSTranslator);
  39936. $core.addMethod(
  39937. $core.method({
  39938. selector: "visitIRTempDeclaration:",
  39939. protocol: "visiting",
  39940. fn: function (anIRTempDeclaration){
  39941. var self=this;
  39942. return self;
  39943. },
  39944. args: ["anIRTempDeclaration"],
  39945. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  39946. referencedClasses: [],
  39947. messageSends: []
  39948. }),
  39949. $globals.IRJSTranslator);
  39950. $core.addMethod(
  39951. $core.method({
  39952. selector: "visitIRValue:",
  39953. protocol: "visiting",
  39954. fn: function (anIRValue){
  39955. var self=this;
  39956. return $core.withContext(function($ctx1) {
  39957. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  39958. return self;
  39959. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  39960. },
  39961. args: ["anIRValue"],
  39962. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  39963. referencedClasses: [],
  39964. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  39965. }),
  39966. $globals.IRJSTranslator);
  39967. $core.addMethod(
  39968. $core.method({
  39969. selector: "visitIRVariable:",
  39970. protocol: "visiting",
  39971. fn: function (anIRVariable){
  39972. var self=this;
  39973. return $core.withContext(function($ctx1) {
  39974. var $3,$2,$1,$4;
  39975. $3=$recv(anIRVariable)._variable();
  39976. $ctx1.sendIdx["variable"]=1;
  39977. $2=$recv($3)._name();
  39978. $1=$recv($2).__eq("thisContext");
  39979. if($core.assert($1)){
  39980. $4=self._stream();
  39981. $ctx1.sendIdx["stream"]=1;
  39982. $recv($4)._nextPutAll_("$core.getThisContext()");
  39983. $ctx1.sendIdx["nextPutAll:"]=1;
  39984. } else {
  39985. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  39986. }
  39987. return self;
  39988. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  39989. },
  39990. args: ["anIRVariable"],
  39991. 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 ]",
  39992. referencedClasses: [],
  39993. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  39994. }),
  39995. $globals.IRJSTranslator);
  39996. $core.addMethod(
  39997. $core.method({
  39998. selector: "visitIRVerbatim:",
  39999. protocol: "visiting",
  40000. fn: function (anIRVerbatim){
  40001. var self=this;
  40002. return $core.withContext(function($ctx1) {
  40003. var $1;
  40004. $1=self._stream();
  40005. $ctx1.sendIdx["stream"]=1;
  40006. $recv($1)._nextPutStatementWith_((function(){
  40007. return $core.withContext(function($ctx2) {
  40008. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  40009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40010. }));
  40011. return self;
  40012. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  40013. },
  40014. args: ["anIRVerbatim"],
  40015. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  40016. referencedClasses: [],
  40017. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  40018. }),
  40019. $globals.IRJSTranslator);
  40020. $core.addMethod(
  40021. $core.method({
  40022. selector: "visitInstructionList:enclosedBetween:and:",
  40023. protocol: "visiting",
  40024. fn: function (anArray,aString,anotherString){
  40025. var self=this;
  40026. return $core.withContext(function($ctx1) {
  40027. var $1;
  40028. $1=self._stream();
  40029. $ctx1.sendIdx["stream"]=1;
  40030. $recv($1)._nextPutAll_(aString);
  40031. $ctx1.sendIdx["nextPutAll:"]=1;
  40032. $recv(anArray)._do_separatedBy_((function(each){
  40033. return $core.withContext(function($ctx2) {
  40034. return self._visit_(each);
  40035. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40036. }),(function(){
  40037. return $core.withContext(function($ctx2) {
  40038. return $recv(self._stream())._nextPutAll_(",");
  40039. $ctx2.sendIdx["nextPutAll:"]=2;
  40040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40041. }));
  40042. $recv(self["@stream"])._nextPutAll_(anotherString);
  40043. return self;
  40044. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  40045. },
  40046. args: ["anArray", "aString", "anotherString"],
  40047. 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",
  40048. referencedClasses: [],
  40049. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  40050. }),
  40051. $globals.IRJSTranslator);
  40052. $core.addMethod(
  40053. $core.method({
  40054. selector: "visitReceiver:",
  40055. protocol: "visiting",
  40056. fn: function (anIRInstruction){
  40057. var self=this;
  40058. return $core.withContext(function($ctx1) {
  40059. var $1,$2,$3;
  40060. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  40061. if(!$core.assert($1)){
  40062. $2=self._visit_(anIRInstruction);
  40063. $ctx1.sendIdx["visit:"]=1;
  40064. return $2;
  40065. }
  40066. $3=self._stream();
  40067. $ctx1.sendIdx["stream"]=1;
  40068. $recv($3)._nextPutAll_("$recv(");
  40069. $ctx1.sendIdx["nextPutAll:"]=1;
  40070. self._visit_(anIRInstruction);
  40071. $recv(self._stream())._nextPutAll_(")");
  40072. return self;
  40073. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  40074. },
  40075. args: ["anIRInstruction"],
  40076. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  40077. referencedClasses: [],
  40078. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  40079. }),
  40080. $globals.IRJSTranslator);
  40081. $core.addMethod(
  40082. $core.method({
  40083. selector: "visitSend:",
  40084. protocol: "visiting",
  40085. fn: function (anIRSend){
  40086. var self=this;
  40087. return $core.withContext(function($ctx1) {
  40088. self._visitReceiver_($recv(anIRSend)._receiver());
  40089. $recv(self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  40090. self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  40091. return self;
  40092. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  40093. },
  40094. args: ["anIRSend"],
  40095. 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: ')'",
  40096. referencedClasses: [],
  40097. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  40098. }),
  40099. $globals.IRJSTranslator);
  40100. $core.addMethod(
  40101. $core.method({
  40102. selector: "visitSuperSend:",
  40103. protocol: "visiting",
  40104. fn: function (anIRSend){
  40105. var self=this;
  40106. return $core.withContext(function($ctx1) {
  40107. var $1,$4,$3,$2,$5,$6,$7,$8;
  40108. $1=self._stream();
  40109. $ctx1.sendIdx["stream"]=1;
  40110. $recv($1)._nextPutAll_("(");
  40111. $ctx1.sendIdx["nextPutAll:"]=1;
  40112. $recv($1)._lf();
  40113. $ctx1.sendIdx["lf"]=1;
  40114. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40115. $ctx1.sendIdx["nextPutAll:"]=2;
  40116. $recv($1)._lf();
  40117. $ctx1.sendIdx["lf"]=2;
  40118. $4=$recv(anIRSend)._scope();
  40119. $ctx1.sendIdx["scope"]=1;
  40120. $3=$recv($4)._alias();
  40121. $ctx1.sendIdx["alias"]=1;
  40122. $2=$recv($3).__comma(".supercall = true,");
  40123. $ctx1.sendIdx[","]=1;
  40124. $recv($1)._nextPutAll_($2);
  40125. $ctx1.sendIdx["nextPutAll:"]=3;
  40126. $recv($1)._lf();
  40127. $ctx1.sendIdx["lf"]=3;
  40128. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40129. $ctx1.sendIdx["nextPutAll:"]=4;
  40130. $recv($1)._lf();
  40131. $ctx1.sendIdx["lf"]=4;
  40132. $5="(".__comma($recv(self._currentClass())._asJavaScriptSource());
  40133. $ctx1.sendIdx[","]=2;
  40134. $recv($1)._nextPutAll_($5);
  40135. $ctx1.sendIdx["nextPutAll:"]=5;
  40136. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  40137. $ctx1.sendIdx["nextPutAll:"]=6;
  40138. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  40139. $ctx1.sendIdx[","]=3;
  40140. $recv($1)._nextPutAll_($6);
  40141. $ctx1.sendIdx["nextPutAll:"]=7;
  40142. $7=$recv($1)._nextPutAll_("$recv(self), ");
  40143. $ctx1.sendIdx["nextPutAll:"]=8;
  40144. self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  40145. $8=self._stream();
  40146. $recv($8)._nextPutAll_("));");
  40147. $ctx1.sendIdx["nextPutAll:"]=9;
  40148. $recv($8)._lf();
  40149. $ctx1.sendIdx["lf"]=5;
  40150. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40151. $ctx1.sendIdx["nextPutAll:"]=10;
  40152. $recv($8)._lf();
  40153. $ctx1.sendIdx["lf"]=6;
  40154. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  40155. $ctx1.sendIdx["nextPutAll:"]=11;
  40156. $recv($8)._lf();
  40157. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40158. return self;
  40159. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  40160. },
  40161. args: ["anIRSend"],
  40162. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true,'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: '(', self currentClass asJavaScriptSource;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv(self), '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream \x0a\x09\x09nextPutAll: '));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  40163. referencedClasses: [],
  40164. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  40165. }),
  40166. $globals.IRJSTranslator);
  40167. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  40168. $core.addMethod(
  40169. $core.method({
  40170. selector: "contents",
  40171. protocol: "accessing",
  40172. fn: function (){
  40173. var self=this;
  40174. return $core.withContext(function($ctx1) {
  40175. return $recv(self["@stream"])._contents();
  40176. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  40177. },
  40178. args: [],
  40179. source: "contents\x0a\x09^ stream contents",
  40180. referencedClasses: [],
  40181. messageSends: ["contents"]
  40182. }),
  40183. $globals.JSStream);
  40184. $core.addMethod(
  40185. $core.method({
  40186. selector: "initialize",
  40187. protocol: "initialization",
  40188. fn: function (){
  40189. var self=this;
  40190. return $core.withContext(function($ctx1) {
  40191. (
  40192. $ctx1.supercall = true,
  40193. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  40194. $ctx1.supercall = false;
  40195. self["@stream"]=""._writeStream();
  40196. return self;
  40197. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  40198. },
  40199. args: [],
  40200. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  40201. referencedClasses: [],
  40202. messageSends: ["initialize", "writeStream"]
  40203. }),
  40204. $globals.JSStream);
  40205. $core.addMethod(
  40206. $core.method({
  40207. selector: "lf",
  40208. protocol: "streaming",
  40209. fn: function (){
  40210. var self=this;
  40211. return $core.withContext(function($ctx1) {
  40212. $recv(self["@stream"])._lf();
  40213. return self;
  40214. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  40215. },
  40216. args: [],
  40217. source: "lf\x0a\x09stream lf",
  40218. referencedClasses: [],
  40219. messageSends: ["lf"]
  40220. }),
  40221. $globals.JSStream);
  40222. $core.addMethod(
  40223. $core.method({
  40224. selector: "nextPut:",
  40225. protocol: "streaming",
  40226. fn: function (aString){
  40227. var self=this;
  40228. return $core.withContext(function($ctx1) {
  40229. $recv(self["@stream"])._nextPut_(aString);
  40230. return self;
  40231. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  40232. },
  40233. args: ["aString"],
  40234. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  40235. referencedClasses: [],
  40236. messageSends: ["nextPut:"]
  40237. }),
  40238. $globals.JSStream);
  40239. $core.addMethod(
  40240. $core.method({
  40241. selector: "nextPutAll:",
  40242. protocol: "streaming",
  40243. fn: function (aString){
  40244. var self=this;
  40245. return $core.withContext(function($ctx1) {
  40246. $recv(self["@stream"])._nextPutAll_(aString);
  40247. return self;
  40248. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  40249. },
  40250. args: ["aString"],
  40251. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  40252. referencedClasses: [],
  40253. messageSends: ["nextPutAll:"]
  40254. }),
  40255. $globals.JSStream);
  40256. $core.addMethod(
  40257. $core.method({
  40258. selector: "nextPutAssignLhs:rhs:",
  40259. protocol: "streaming",
  40260. fn: function (aBlock,anotherBlock){
  40261. var self=this;
  40262. return $core.withContext(function($ctx1) {
  40263. $recv(aBlock)._value();
  40264. $ctx1.sendIdx["value"]=1;
  40265. $recv(self["@stream"])._nextPutAll_("=");
  40266. $recv(anotherBlock)._value();
  40267. return self;
  40268. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  40269. },
  40270. args: ["aBlock", "anotherBlock"],
  40271. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  40272. referencedClasses: [],
  40273. messageSends: ["value", "nextPutAll:"]
  40274. }),
  40275. $globals.JSStream);
  40276. $core.addMethod(
  40277. $core.method({
  40278. selector: "nextPutBlockContextFor:during:",
  40279. protocol: "streaming",
  40280. fn: function (anIRClosure,aBlock){
  40281. var self=this;
  40282. return $core.withContext(function($ctx1) {
  40283. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  40284. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  40285. if(!$core.assert($1)){
  40286. $2=$recv(aBlock)._value();
  40287. $ctx1.sendIdx["value"]=1;
  40288. return $2;
  40289. }
  40290. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40291. $ctx1.sendIdx["nextPutAll:"]=1;
  40292. self._lf();
  40293. $ctx1.sendIdx["lf"]=1;
  40294. $6=$recv(anIRClosure)._scope();
  40295. $ctx1.sendIdx["scope"]=1;
  40296. $5=$recv($6)._alias();
  40297. $ctx1.sendIdx["alias"]=1;
  40298. $4="return $core.withContext(function(".__comma($5);
  40299. $ctx1.sendIdx[","]=2;
  40300. $3=$recv($4).__comma(") {");
  40301. $ctx1.sendIdx[","]=1;
  40302. self._nextPutAll_($3);
  40303. $ctx1.sendIdx["nextPutAll:"]=2;
  40304. self._lf();
  40305. $ctx1.sendIdx["lf"]=2;
  40306. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40307. $ctx1.sendIdx["nextPutAll:"]=3;
  40308. $7=self._lf();
  40309. $ctx1.sendIdx["lf"]=3;
  40310. $recv(aBlock)._value();
  40311. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40312. $ctx1.sendIdx["nextPutAll:"]=4;
  40313. self._lf();
  40314. $ctx1.sendIdx["lf"]=4;
  40315. $11=$recv(anIRClosure)._scope();
  40316. $ctx1.sendIdx["scope"]=2;
  40317. $10=$recv($11)._alias();
  40318. $ctx1.sendIdx["alias"]=2;
  40319. $9="}, function(".__comma($10);
  40320. $ctx1.sendIdx[","]=4;
  40321. $8=$recv($9).__comma(") {");
  40322. $ctx1.sendIdx[","]=3;
  40323. self._nextPutAll_($8);
  40324. $ctx1.sendIdx["nextPutAll:"]=5;
  40325. $15=$recv(anIRClosure)._scope();
  40326. $ctx1.sendIdx["scope"]=3;
  40327. $14=$recv($15)._alias();
  40328. $ctx1.sendIdx["alias"]=3;
  40329. $13=$recv($14).__comma(".fillBlock({");
  40330. $ctx1.sendIdx[","]=5;
  40331. $12=self._nextPutAll_($13);
  40332. $ctx1.sendIdx["nextPutAll:"]=6;
  40333. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  40334. return $core.withContext(function($ctx2) {
  40335. $16=$recv(each)._asVariableName();
  40336. $ctx2.sendIdx["asVariableName"]=1;
  40337. self._nextPutAll_($16);
  40338. $ctx2.sendIdx["nextPutAll:"]=7;
  40339. self._nextPutAll_(":");
  40340. $ctx2.sendIdx["nextPutAll:"]=8;
  40341. $17=self._nextPutAll_($recv(each)._asVariableName());
  40342. $ctx2.sendIdx["nextPutAll:"]=9;
  40343. return $17;
  40344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40345. }),(function(){
  40346. return $core.withContext(function($ctx2) {
  40347. return self._nextPutAll_(",");
  40348. $ctx2.sendIdx["nextPutAll:"]=10;
  40349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40350. }));
  40351. self._nextPutAll_("},");
  40352. $ctx1.sendIdx["nextPutAll:"]=11;
  40353. $23=$recv(anIRClosure)._scope();
  40354. $ctx1.sendIdx["scope"]=4;
  40355. $22=$recv($23)._outerScope();
  40356. $21=$recv($22)._alias();
  40357. $20=$recv($21).__comma(",");
  40358. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  40359. $ctx1.sendIdx[","]=7;
  40360. $18=$recv($19).__comma(")});");
  40361. $ctx1.sendIdx[","]=6;
  40362. self._nextPutAll_($18);
  40363. $ctx1.sendIdx["nextPutAll:"]=12;
  40364. self._lf();
  40365. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40366. return self;
  40367. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  40368. },
  40369. args: ["anIRClosure", "aBlock"],
  40370. 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);'",
  40371. referencedClasses: [],
  40372. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  40373. }),
  40374. $globals.JSStream);
  40375. $core.addMethod(
  40376. $core.method({
  40377. selector: "nextPutClosureWith:arguments:",
  40378. protocol: "streaming",
  40379. fn: function (aBlock,anArray){
  40380. var self=this;
  40381. return $core.withContext(function($ctx1) {
  40382. var $1,$2,$3;
  40383. $recv(self["@stream"])._nextPutAll_("(function(");
  40384. $ctx1.sendIdx["nextPutAll:"]=1;
  40385. $recv(anArray)._do_separatedBy_((function(each){
  40386. return $core.withContext(function($ctx2) {
  40387. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  40388. $ctx2.sendIdx["nextPutAll:"]=2;
  40389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40390. }),(function(){
  40391. return $core.withContext(function($ctx2) {
  40392. return $recv(self["@stream"])._nextPut_(",");
  40393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40394. }));
  40395. $1=self["@stream"];
  40396. $recv($1)._nextPutAll_("){");
  40397. $ctx1.sendIdx["nextPutAll:"]=3;
  40398. $2=$recv($1)._lf();
  40399. $ctx1.sendIdx["lf"]=1;
  40400. $recv(aBlock)._value();
  40401. $3=self["@stream"];
  40402. $recv($3)._lf();
  40403. $recv($3)._nextPutAll_("})");
  40404. return self;
  40405. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  40406. },
  40407. args: ["aBlock", "anArray"],
  40408. 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: '})'",
  40409. referencedClasses: [],
  40410. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  40411. }),
  40412. $globals.JSStream);
  40413. $core.addMethod(
  40414. $core.method({
  40415. selector: "nextPutContextFor:during:",
  40416. protocol: "streaming",
  40417. fn: function (aMethod,aBlock){
  40418. var self=this;
  40419. return $core.withContext(function($ctx1) {
  40420. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  40421. $1=$recv(aMethod)._requiresSmalltalkContext();
  40422. if(!$core.assert($1)){
  40423. $2=$recv(aBlock)._value();
  40424. $ctx1.sendIdx["value"]=1;
  40425. return $2;
  40426. }
  40427. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40428. $ctx1.sendIdx["nextPutAll:"]=1;
  40429. self._lf();
  40430. $ctx1.sendIdx["lf"]=1;
  40431. $6=$recv(aMethod)._scope();
  40432. $ctx1.sendIdx["scope"]=1;
  40433. $5=$recv($6)._alias();
  40434. $ctx1.sendIdx["alias"]=1;
  40435. $4="return $core.withContext(function(".__comma($5);
  40436. $ctx1.sendIdx[","]=2;
  40437. $3=$recv($4).__comma(") {");
  40438. $ctx1.sendIdx[","]=1;
  40439. self._nextPutAll_($3);
  40440. $ctx1.sendIdx["nextPutAll:"]=2;
  40441. self._lf();
  40442. $ctx1.sendIdx["lf"]=2;
  40443. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40444. $ctx1.sendIdx["nextPutAll:"]=3;
  40445. $7=self._lf();
  40446. $ctx1.sendIdx["lf"]=3;
  40447. $recv(aBlock)._value();
  40448. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40449. $ctx1.sendIdx["nextPutAll:"]=4;
  40450. self._lf();
  40451. $ctx1.sendIdx["lf"]=4;
  40452. $12=$recv(aMethod)._scope();
  40453. $ctx1.sendIdx["scope"]=2;
  40454. $11=$recv($12)._alias();
  40455. $ctx1.sendIdx["alias"]=2;
  40456. $10="}, function(".__comma($11);
  40457. $ctx1.sendIdx[","]=5;
  40458. $9=$recv($10).__comma(") {");
  40459. $ctx1.sendIdx[","]=4;
  40460. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  40461. $ctx1.sendIdx[","]=3;
  40462. self._nextPutAll_($8);
  40463. $ctx1.sendIdx["nextPutAll:"]=5;
  40464. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  40465. $ctx1.sendIdx["asJavaScriptSource"]=1;
  40466. $15=".fill(self,".__comma($16);
  40467. $14=$recv($15).__comma(",{");
  40468. $ctx1.sendIdx[","]=6;
  40469. $13=self._nextPutAll_($14);
  40470. $ctx1.sendIdx["nextPutAll:"]=6;
  40471. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  40472. return $core.withContext(function($ctx2) {
  40473. $17=$recv(each)._asVariableName();
  40474. $ctx2.sendIdx["asVariableName"]=1;
  40475. self._nextPutAll_($17);
  40476. $ctx2.sendIdx["nextPutAll:"]=7;
  40477. self._nextPutAll_(":");
  40478. $ctx2.sendIdx["nextPutAll:"]=8;
  40479. $18=self._nextPutAll_($recv(each)._asVariableName());
  40480. $ctx2.sendIdx["nextPutAll:"]=9;
  40481. return $18;
  40482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40483. }),(function(){
  40484. return $core.withContext(function($ctx2) {
  40485. return self._nextPutAll_(",");
  40486. $ctx2.sendIdx["nextPutAll:"]=10;
  40487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40488. }));
  40489. self._nextPutAll_("},");
  40490. $ctx1.sendIdx["nextPutAll:"]=11;
  40491. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  40492. $ctx1.sendIdx["nextPutAll:"]=12;
  40493. self._nextPutAll_(")});");
  40494. $ctx1.sendIdx["nextPutAll:"]=13;
  40495. self._lf();
  40496. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40497. return self;
  40498. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  40499. },
  40500. args: ["aMethod", "aBlock"],
  40501. 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);'",
  40502. referencedClasses: [],
  40503. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  40504. }),
  40505. $globals.JSStream);
  40506. $core.addMethod(
  40507. $core.method({
  40508. selector: "nextPutFunctionWith:arguments:",
  40509. protocol: "streaming",
  40510. fn: function (aBlock,anArray){
  40511. var self=this;
  40512. return $core.withContext(function($ctx1) {
  40513. var $1,$2,$3,$4,$5;
  40514. $recv(self["@stream"])._nextPutAll_("fn: function(");
  40515. $ctx1.sendIdx["nextPutAll:"]=1;
  40516. $recv(anArray)._do_separatedBy_((function(each){
  40517. return $core.withContext(function($ctx2) {
  40518. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  40519. $ctx2.sendIdx["nextPutAll:"]=2;
  40520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40521. }),(function(){
  40522. return $core.withContext(function($ctx2) {
  40523. return $recv(self["@stream"])._nextPut_(",");
  40524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40525. }));
  40526. $1=self["@stream"];
  40527. $recv($1)._nextPutAll_("){");
  40528. $ctx1.sendIdx["nextPutAll:"]=3;
  40529. $2=$recv($1)._lf();
  40530. $ctx1.sendIdx["lf"]=1;
  40531. $3=self["@stream"];
  40532. $recv($3)._nextPutAll_("var self=this;");
  40533. $ctx1.sendIdx["nextPutAll:"]=4;
  40534. $4=$recv($3)._lf();
  40535. $ctx1.sendIdx["lf"]=2;
  40536. $recv(aBlock)._value();
  40537. $5=self["@stream"];
  40538. $recv($5)._lf();
  40539. $recv($5)._nextPutAll_("}");
  40540. return self;
  40541. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  40542. },
  40543. args: ["aBlock", "anArray"],
  40544. source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  40545. referencedClasses: [],
  40546. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  40547. }),
  40548. $globals.JSStream);
  40549. $core.addMethod(
  40550. $core.method({
  40551. selector: "nextPutIf:then:",
  40552. protocol: "streaming",
  40553. fn: function (aBlock,anotherBlock){
  40554. var self=this;
  40555. return $core.withContext(function($ctx1) {
  40556. var $1;
  40557. $recv(self["@stream"])._nextPutAll_("if(");
  40558. $ctx1.sendIdx["nextPutAll:"]=1;
  40559. $recv(aBlock)._value();
  40560. $ctx1.sendIdx["value"]=1;
  40561. $1=self["@stream"];
  40562. $recv($1)._nextPutAll_("){");
  40563. $ctx1.sendIdx["nextPutAll:"]=2;
  40564. $recv($1)._lf();
  40565. $recv(anotherBlock)._value();
  40566. $recv(self["@stream"])._nextPutAll_("}");
  40567. self._omitSemicolon_(true);
  40568. return self;
  40569. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  40570. },
  40571. args: ["aBlock", "anotherBlock"],
  40572. 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",
  40573. referencedClasses: [],
  40574. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  40575. }),
  40576. $globals.JSStream);
  40577. $core.addMethod(
  40578. $core.method({
  40579. selector: "nextPutIf:then:else:",
  40580. protocol: "streaming",
  40581. fn: function (aBlock,ifBlock,elseBlock){
  40582. var self=this;
  40583. return $core.withContext(function($ctx1) {
  40584. var $1,$2,$3;
  40585. $recv(self["@stream"])._nextPutAll_("if(");
  40586. $ctx1.sendIdx["nextPutAll:"]=1;
  40587. $recv(aBlock)._value();
  40588. $ctx1.sendIdx["value"]=1;
  40589. $1=self["@stream"];
  40590. $recv($1)._nextPutAll_("){");
  40591. $ctx1.sendIdx["nextPutAll:"]=2;
  40592. $2=$recv($1)._lf();
  40593. $ctx1.sendIdx["lf"]=1;
  40594. $recv(ifBlock)._value();
  40595. $ctx1.sendIdx["value"]=2;
  40596. $3=self["@stream"];
  40597. $recv($3)._nextPutAll_("} else {");
  40598. $ctx1.sendIdx["nextPutAll:"]=3;
  40599. $recv($3)._lf();
  40600. $recv(elseBlock)._value();
  40601. $recv(self["@stream"])._nextPutAll_("}");
  40602. self._omitSemicolon_(true);
  40603. return self;
  40604. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  40605. },
  40606. args: ["aBlock", "ifBlock", "elseBlock"],
  40607. 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",
  40608. referencedClasses: [],
  40609. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  40610. }),
  40611. $globals.JSStream);
  40612. $core.addMethod(
  40613. $core.method({
  40614. selector: "nextPutMethodDeclaration:with:",
  40615. protocol: "streaming",
  40616. fn: function (aMethod,aBlock){
  40617. var self=this;
  40618. return $core.withContext(function($ctx1) {
  40619. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  40620. $1=self["@stream"];
  40621. $recv($1)._nextPutAll_("$core.method({");
  40622. $ctx1.sendIdx["nextPutAll:"]=1;
  40623. $recv($1)._lf();
  40624. $ctx1.sendIdx["lf"]=1;
  40625. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  40626. $ctx1.sendIdx["asJavaScriptSource"]=1;
  40627. $3="selector: ".__comma($4);
  40628. $ctx1.sendIdx[","]=2;
  40629. $2=$recv($3).__comma(",");
  40630. $ctx1.sendIdx[","]=1;
  40631. $recv($1)._nextPutAll_($2);
  40632. $ctx1.sendIdx["nextPutAll:"]=2;
  40633. $recv($1)._lf();
  40634. $ctx1.sendIdx["lf"]=2;
  40635. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  40636. $ctx1.sendIdx["asJavaScriptSource"]=2;
  40637. $6="source: ".__comma($7);
  40638. $ctx1.sendIdx[","]=4;
  40639. $5=$recv($6).__comma(",");
  40640. $ctx1.sendIdx[","]=3;
  40641. $recv($1)._nextPutAll_($5);
  40642. $ctx1.sendIdx["nextPutAll:"]=3;
  40643. $8=$recv($1)._lf();
  40644. $ctx1.sendIdx["lf"]=3;
  40645. $recv(aBlock)._value();
  40646. $ctx1.sendIdx["value"]=1;
  40647. $9=self["@stream"];
  40648. $12=$recv($globals.String)._lf();
  40649. $ctx1.sendIdx["lf"]=4;
  40650. $11=",".__comma($12);
  40651. $ctx1.sendIdx[","]=6;
  40652. $10=$recv($11).__comma("messageSends: ");
  40653. $ctx1.sendIdx[","]=5;
  40654. $recv($9)._nextPutAll_($10);
  40655. $ctx1.sendIdx["nextPutAll:"]=4;
  40656. $15=$recv($recv(aMethod)._messageSends())._asArray();
  40657. $ctx1.sendIdx["asArray"]=1;
  40658. $14=$recv($15)._asJavaScriptSource();
  40659. $ctx1.sendIdx["asJavaScriptSource"]=3;
  40660. $13=$recv($14).__comma(",");
  40661. $ctx1.sendIdx[","]=7;
  40662. $recv($9)._nextPutAll_($13);
  40663. $ctx1.sendIdx["nextPutAll:"]=5;
  40664. $recv($9)._lf();
  40665. $ctx1.sendIdx["lf"]=5;
  40666. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  40667. return $core.withContext(function($ctx2) {
  40668. return $recv(each)._value();
  40669. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40670. })))._asArray())._asJavaScriptSource();
  40671. $ctx1.sendIdx["asJavaScriptSource"]=4;
  40672. $17="args: ".__comma($18);
  40673. $16=$recv($17).__comma(",");
  40674. $ctx1.sendIdx[","]=8;
  40675. $recv($9)._nextPutAll_($16);
  40676. $ctx1.sendIdx["nextPutAll:"]=6;
  40677. $recv($9)._lf();
  40678. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  40679. $ctx1.sendIdx["nextPutAll:"]=7;
  40680. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  40681. return $core.withContext(function($ctx2) {
  40682. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  40683. $ctx2.sendIdx["nextPutAll:"]=8;
  40684. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40685. }),(function(){
  40686. return $core.withContext(function($ctx2) {
  40687. return $recv(self["@stream"])._nextPutAll_(",");
  40688. $ctx2.sendIdx["nextPutAll:"]=9;
  40689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40690. }));
  40691. $20=self["@stream"];
  40692. $recv($20)._nextPutAll_("]");
  40693. $ctx1.sendIdx["nextPutAll:"]=10;
  40694. $recv($20)._nextPutAll_("})");
  40695. return self;
  40696. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  40697. },
  40698. args: ["aMethod", "aBlock"],
  40699. 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: '})'",
  40700. referencedClasses: ["String"],
  40701. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  40702. }),
  40703. $globals.JSStream);
  40704. $core.addMethod(
  40705. $core.method({
  40706. selector: "nextPutNonLocalReturnHandlingWith:",
  40707. protocol: "streaming",
  40708. fn: function (aBlock){
  40709. var self=this;
  40710. return $core.withContext(function($ctx1) {
  40711. var $1,$2,$3;
  40712. $1=self["@stream"];
  40713. $recv($1)._nextPutAll_("var $early={};");
  40714. $ctx1.sendIdx["nextPutAll:"]=1;
  40715. $recv($1)._lf();
  40716. $ctx1.sendIdx["lf"]=1;
  40717. $recv($1)._nextPutAll_("try {");
  40718. $ctx1.sendIdx["nextPutAll:"]=2;
  40719. $2=$recv($1)._lf();
  40720. $ctx1.sendIdx["lf"]=2;
  40721. $recv(aBlock)._value();
  40722. $3=self["@stream"];
  40723. $recv($3)._nextPutAll_("}");
  40724. $ctx1.sendIdx["nextPutAll:"]=3;
  40725. $recv($3)._lf();
  40726. $ctx1.sendIdx["lf"]=3;
  40727. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  40728. $recv($3)._lf();
  40729. return self;
  40730. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  40731. },
  40732. args: ["aBlock"],
  40733. 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",
  40734. referencedClasses: [],
  40735. messageSends: ["nextPutAll:", "lf", "value"]
  40736. }),
  40737. $globals.JSStream);
  40738. $core.addMethod(
  40739. $core.method({
  40740. selector: "nextPutNonLocalReturnWith:",
  40741. protocol: "streaming",
  40742. fn: function (aBlock){
  40743. var self=this;
  40744. return $core.withContext(function($ctx1) {
  40745. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  40746. $ctx1.sendIdx["nextPutAll:"]=1;
  40747. $recv(aBlock)._value();
  40748. $recv(self["@stream"])._nextPutAll_("]");
  40749. return self;
  40750. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40751. },
  40752. args: ["aBlock"],
  40753. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  40754. referencedClasses: [],
  40755. messageSends: ["nextPutAll:", "value"]
  40756. }),
  40757. $globals.JSStream);
  40758. $core.addMethod(
  40759. $core.method({
  40760. selector: "nextPutReturnWith:",
  40761. protocol: "streaming",
  40762. fn: function (aBlock){
  40763. var self=this;
  40764. return $core.withContext(function($ctx1) {
  40765. $recv(self["@stream"])._nextPutAll_("return ");
  40766. $recv(aBlock)._value();
  40767. return self;
  40768. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40769. },
  40770. args: ["aBlock"],
  40771. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  40772. referencedClasses: [],
  40773. messageSends: ["nextPutAll:", "value"]
  40774. }),
  40775. $globals.JSStream);
  40776. $core.addMethod(
  40777. $core.method({
  40778. selector: "nextPutSendIndexFor:",
  40779. protocol: "streaming",
  40780. fn: function (anIRSend){
  40781. var self=this;
  40782. return $core.withContext(function($ctx1) {
  40783. self._nextPutAll_(";");
  40784. $ctx1.sendIdx["nextPutAll:"]=1;
  40785. self._lf();
  40786. $ctx1.sendIdx["lf"]=1;
  40787. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40788. $ctx1.sendIdx["nextPutAll:"]=2;
  40789. self._lf();
  40790. $ctx1.sendIdx["lf"]=2;
  40791. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  40792. $ctx1.sendIdx["nextPutAll:"]=3;
  40793. self._nextPutAll_(".sendIdx[");
  40794. $ctx1.sendIdx["nextPutAll:"]=4;
  40795. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  40796. $ctx1.sendIdx["nextPutAll:"]=5;
  40797. self._nextPutAll_("]=");
  40798. $ctx1.sendIdx["nextPutAll:"]=6;
  40799. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  40800. $ctx1.sendIdx["nextPutAll:"]=7;
  40801. self._nextPutAll_(";");
  40802. $ctx1.sendIdx["nextPutAll:"]=8;
  40803. self._lf();
  40804. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  40805. return self;
  40806. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  40807. },
  40808. args: ["anIRSend"],
  40809. 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)'",
  40810. referencedClasses: [],
  40811. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  40812. }),
  40813. $globals.JSStream);
  40814. $core.addMethod(
  40815. $core.method({
  40816. selector: "nextPutStatementWith:",
  40817. protocol: "streaming",
  40818. fn: function (aBlock){
  40819. var self=this;
  40820. return $core.withContext(function($ctx1) {
  40821. var $1;
  40822. self._omitSemicolon_(false);
  40823. $ctx1.sendIdx["omitSemicolon:"]=1;
  40824. $recv(aBlock)._value();
  40825. $1=self._omitSemicolon();
  40826. if(!$core.assert($1)){
  40827. $recv(self["@stream"])._nextPutAll_(";");
  40828. }
  40829. self._omitSemicolon_(false);
  40830. $recv(self["@stream"])._lf();
  40831. return self;
  40832. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  40833. },
  40834. args: ["aBlock"],
  40835. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  40836. referencedClasses: [],
  40837. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  40838. }),
  40839. $globals.JSStream);
  40840. $core.addMethod(
  40841. $core.method({
  40842. selector: "nextPutVars:",
  40843. protocol: "streaming",
  40844. fn: function (aCollection){
  40845. var self=this;
  40846. return $core.withContext(function($ctx1) {
  40847. var $1;
  40848. $recv(aCollection)._ifNotEmpty_((function(){
  40849. return $core.withContext(function($ctx2) {
  40850. $recv(self["@stream"])._nextPutAll_("var ");
  40851. $ctx2.sendIdx["nextPutAll:"]=1;
  40852. $recv(aCollection)._do_separatedBy_((function(each){
  40853. return $core.withContext(function($ctx3) {
  40854. return $recv(self["@stream"])._nextPutAll_(each);
  40855. $ctx3.sendIdx["nextPutAll:"]=2;
  40856. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40857. }),(function(){
  40858. return $core.withContext(function($ctx3) {
  40859. return $recv(self["@stream"])._nextPutAll_(",");
  40860. $ctx3.sendIdx["nextPutAll:"]=3;
  40861. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  40862. }));
  40863. $1=self["@stream"];
  40864. $recv($1)._nextPutAll_(";");
  40865. return $recv($1)._lf();
  40866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40867. }));
  40868. return self;
  40869. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  40870. },
  40871. args: ["aCollection"],
  40872. 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 ]",
  40873. referencedClasses: [],
  40874. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  40875. }),
  40876. $globals.JSStream);
  40877. $core.addMethod(
  40878. $core.method({
  40879. selector: "omitSemicolon",
  40880. protocol: "accessing",
  40881. fn: function (){
  40882. var self=this;
  40883. return self["@omitSemicolon"];
  40884. },
  40885. args: [],
  40886. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  40887. referencedClasses: [],
  40888. messageSends: []
  40889. }),
  40890. $globals.JSStream);
  40891. $core.addMethod(
  40892. $core.method({
  40893. selector: "omitSemicolon:",
  40894. protocol: "accessing",
  40895. fn: function (aBoolean){
  40896. var self=this;
  40897. self["@omitSemicolon"]=aBoolean;
  40898. return self;
  40899. },
  40900. args: ["aBoolean"],
  40901. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  40902. referencedClasses: [],
  40903. messageSends: []
  40904. }),
  40905. $globals.JSStream);
  40906. $core.addMethod(
  40907. $core.method({
  40908. selector: "isReferenced",
  40909. protocol: "*Compiler-IR",
  40910. fn: function (){
  40911. var self=this;
  40912. return $core.withContext(function($ctx1) {
  40913. var $3,$2,$1;
  40914. $3=self._parent();
  40915. $ctx1.sendIdx["parent"]=1;
  40916. $2=$recv($3)._isSequenceNode();
  40917. $1=$recv($2)._or_((function(){
  40918. return $core.withContext(function($ctx2) {
  40919. return $recv(self._parent())._isAssignmentNode();
  40920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40921. }));
  40922. return $recv($1)._not();
  40923. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  40924. },
  40925. args: [],
  40926. 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",
  40927. referencedClasses: [],
  40928. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  40929. }),
  40930. $globals.ASTNode);
  40931. $core.addMethod(
  40932. $core.method({
  40933. selector: "subtreeNeedsAliasing",
  40934. protocol: "*Compiler-IR",
  40935. fn: function (){
  40936. var self=this;
  40937. return $core.withContext(function($ctx1) {
  40938. return $recv(self._shouldBeAliased())._or_((function(){
  40939. return $core.withContext(function($ctx2) {
  40940. return $recv(self._dagChildren())._anySatisfy_((function(each){
  40941. return $core.withContext(function($ctx3) {
  40942. return $recv(each)._subtreeNeedsAliasing();
  40943. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40944. }));
  40945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40946. }));
  40947. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  40948. },
  40949. args: [],
  40950. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  40951. referencedClasses: [],
  40952. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  40953. }),
  40954. $globals.ASTNode);
  40955. $core.addMethod(
  40956. $core.method({
  40957. selector: "shouldBeAliased",
  40958. protocol: "*Compiler-IR",
  40959. fn: function (){
  40960. var self=this;
  40961. return $core.withContext(function($ctx1) {
  40962. var $1;
  40963. $1=(
  40964. $ctx1.supercall = true,
  40965. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  40966. $ctx1.supercall = false;
  40967. return $recv($1)._or_((function(){
  40968. return $core.withContext(function($ctx2) {
  40969. return self._isReferenced();
  40970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40971. }));
  40972. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  40973. },
  40974. args: [],
  40975. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  40976. referencedClasses: [],
  40977. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  40978. }),
  40979. $globals.AssignmentNode);
  40980. $core.addMethod(
  40981. $core.method({
  40982. selector: "appendToInstruction:",
  40983. protocol: "*Compiler-IR",
  40984. fn: function (anIRInstruction){
  40985. var self=this;
  40986. return $core.withContext(function($ctx1) {
  40987. $recv(anIRInstruction)._appendBlock_(self);
  40988. return self;
  40989. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  40990. },
  40991. args: ["anIRInstruction"],
  40992. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  40993. referencedClasses: [],
  40994. messageSends: ["appendBlock:"]
  40995. }),
  40996. $globals.BlockClosure);
  40997. $core.addMethod(
  40998. $core.method({
  40999. selector: "subtreeNeedsAliasing",
  41000. protocol: "*Compiler-IR",
  41001. fn: function (){
  41002. var self=this;
  41003. return $core.withContext(function($ctx1) {
  41004. return self._shouldBeAliased();
  41005. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  41006. },
  41007. args: [],
  41008. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  41009. referencedClasses: [],
  41010. messageSends: ["shouldBeAliased"]
  41011. }),
  41012. $globals.BlockNode);
  41013. $core.addMethod(
  41014. $core.method({
  41015. selector: "subtreeNeedsAliasing",
  41016. protocol: "*Compiler-IR",
  41017. fn: function (){
  41018. var self=this;
  41019. return $core.withContext(function($ctx1) {
  41020. return $recv($recv(self._parent())._isSequenceNode())._not();
  41021. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  41022. },
  41023. args: [],
  41024. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  41025. referencedClasses: [],
  41026. messageSends: ["not", "isSequenceNode", "parent"]
  41027. }),
  41028. $globals.CascadeNode);
  41029. $core.addMethod(
  41030. $core.method({
  41031. selector: "shouldBeAliased",
  41032. protocol: "*Compiler-IR",
  41033. fn: function (){
  41034. var self=this;
  41035. var sends;
  41036. return $core.withContext(function($ctx1) {
  41037. var $2,$1;
  41038. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  41039. $2=(
  41040. $ctx1.supercall = true,
  41041. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  41042. $ctx1.supercall = false;
  41043. $1=$recv($2)._or_((function(){
  41044. return $core.withContext(function($ctx2) {
  41045. return $recv(self._isReferenced())._and_((function(){
  41046. return $core.withContext(function($ctx3) {
  41047. return $recv($recv(self._index()).__lt(sends))._or_((function(){
  41048. return $core.withContext(function($ctx4) {
  41049. return self._superSend();
  41050. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  41051. }));
  41052. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41053. }));
  41054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41055. }));
  41056. $ctx1.sendIdx["or:"]=1;
  41057. return $1;
  41058. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  41059. },
  41060. args: [],
  41061. 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 ] ] ])",
  41062. referencedClasses: [],
  41063. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  41064. }),
  41065. $globals.SendNode);
  41066. $core.addMethod(
  41067. $core.method({
  41068. selector: "subtreeNeedsAliasing",
  41069. protocol: "*Compiler-IR",
  41070. fn: function (){
  41071. var self=this;
  41072. return $core.withContext(function($ctx1) {
  41073. return $recv(self._shouldBeInlined())._or_((function(){
  41074. return $core.withContext(function($ctx2) {
  41075. return (
  41076. $ctx2.supercall = true,
  41077. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($recv(self), []));
  41078. $ctx2.supercall = false;
  41079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41080. }));
  41081. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  41082. },
  41083. args: [],
  41084. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  41085. referencedClasses: [],
  41086. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  41087. }),
  41088. $globals.SendNode);
  41089. });
  41090. 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";
  41091. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  41092. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  41093. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  41094. $core.addPackage("Compiler-Inlining");
  41095. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  41096. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  41097. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  41098. $core.addMethod(
  41099. $core.method({
  41100. selector: "visitSendNode:",
  41101. protocol: "visiting",
  41102. fn: function (aNode){
  41103. var self=this;
  41104. return $core.withContext(function($ctx1) {
  41105. var $1,$2,$3,$4,$receiver;
  41106. $1=$recv(aNode)._superSend();
  41107. if(!$core.assert($1)){
  41108. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  41109. if($core.assert($2)){
  41110. $recv(aNode)._shouldBeInlined_(true);
  41111. $3=$recv(aNode)._receiver();
  41112. if(($receiver = $3) == null || $receiver.isNil){
  41113. $3;
  41114. } else {
  41115. var receiver;
  41116. receiver=$receiver;
  41117. $recv(receiver)._shouldBeAliased_(true);
  41118. }
  41119. }
  41120. }
  41121. $4=(
  41122. $ctx1.supercall = true,
  41123. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  41124. $ctx1.supercall = false;
  41125. return $4;
  41126. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  41127. },
  41128. args: ["aNode"],
  41129. 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",
  41130. referencedClasses: ["IRSendInliner"],
  41131. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  41132. }),
  41133. $globals.ASTPreInliner);
  41134. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  41135. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  41136. $core.addMethod(
  41137. $core.method({
  41138. selector: "acceptDagVisitor:",
  41139. protocol: "visiting",
  41140. fn: function (aVisitor){
  41141. var self=this;
  41142. return $core.withContext(function($ctx1) {
  41143. $recv(aVisitor)._visitIRInlinedClosure_(self);
  41144. return self;
  41145. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  41146. },
  41147. args: ["aVisitor"],
  41148. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  41149. referencedClasses: [],
  41150. messageSends: ["visitIRInlinedClosure:"]
  41151. }),
  41152. $globals.IRInlinedClosure);
  41153. $core.addMethod(
  41154. $core.method({
  41155. selector: "isInlined",
  41156. protocol: "testing",
  41157. fn: function (){
  41158. var self=this;
  41159. return true;
  41160. },
  41161. args: [],
  41162. source: "isInlined\x0a\x09^ true",
  41163. referencedClasses: [],
  41164. messageSends: []
  41165. }),
  41166. $globals.IRInlinedClosure);
  41167. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  41168. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  41169. $core.addMethod(
  41170. $core.method({
  41171. selector: "acceptDagVisitor:",
  41172. protocol: "visiting",
  41173. fn: function (aVisitor){
  41174. var self=this;
  41175. return $core.withContext(function($ctx1) {
  41176. $recv(aVisitor)._visitInlinedSend_(self);
  41177. return self;
  41178. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  41179. },
  41180. args: ["aVisitor"],
  41181. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  41182. referencedClasses: [],
  41183. messageSends: ["visitInlinedSend:"]
  41184. }),
  41185. $globals.IRInlinedSend);
  41186. $core.addMethod(
  41187. $core.method({
  41188. selector: "internalVariables",
  41189. protocol: "accessing",
  41190. fn: function (){
  41191. var self=this;
  41192. return [];
  41193. },
  41194. args: [],
  41195. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  41196. referencedClasses: [],
  41197. messageSends: []
  41198. }),
  41199. $globals.IRInlinedSend);
  41200. $core.addMethod(
  41201. $core.method({
  41202. selector: "isInlined",
  41203. protocol: "testing",
  41204. fn: function (){
  41205. var self=this;
  41206. return true;
  41207. },
  41208. args: [],
  41209. source: "isInlined\x0a\x09^ true",
  41210. referencedClasses: [],
  41211. messageSends: []
  41212. }),
  41213. $globals.IRInlinedSend);
  41214. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41215. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  41216. $core.addMethod(
  41217. $core.method({
  41218. selector: "acceptDagVisitor:",
  41219. protocol: "visiting",
  41220. fn: function (aVisitor){
  41221. var self=this;
  41222. return $core.withContext(function($ctx1) {
  41223. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  41224. return self;
  41225. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  41226. },
  41227. args: ["aVisitor"],
  41228. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  41229. referencedClasses: [],
  41230. messageSends: ["visitIRInlinedIfFalse:"]
  41231. }),
  41232. $globals.IRInlinedIfFalse);
  41233. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41234. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  41235. $core.addMethod(
  41236. $core.method({
  41237. selector: "acceptDagVisitor:",
  41238. protocol: "visiting",
  41239. fn: function (aVisitor){
  41240. var self=this;
  41241. return $core.withContext(function($ctx1) {
  41242. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  41243. return self;
  41244. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  41245. },
  41246. args: ["aVisitor"],
  41247. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  41248. referencedClasses: [],
  41249. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  41250. }),
  41251. $globals.IRInlinedIfNilIfNotNil);
  41252. $core.addMethod(
  41253. $core.method({
  41254. selector: "internalVariables",
  41255. protocol: "accessing",
  41256. fn: function (){
  41257. var self=this;
  41258. return $core.withContext(function($ctx1) {
  41259. return $recv($globals.Array)._with_(self._receiverInternalVariable());
  41260. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  41261. },
  41262. args: [],
  41263. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  41264. referencedClasses: ["Array"],
  41265. messageSends: ["with:", "receiverInternalVariable"]
  41266. }),
  41267. $globals.IRInlinedIfNilIfNotNil);
  41268. $core.addMethod(
  41269. $core.method({
  41270. selector: "receiverInternalVariable",
  41271. protocol: "accessing",
  41272. fn: function (){
  41273. var self=this;
  41274. return $core.withContext(function($ctx1) {
  41275. var $1;
  41276. $1=$recv($globals.IRVariable)._new();
  41277. $ctx1.sendIdx["new"]=1;
  41278. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_(self._receiverInternalVariableName()));
  41279. return $recv($1)._yourself();
  41280. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  41281. },
  41282. args: [],
  41283. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  41284. referencedClasses: ["IRVariable", "AliasVar"],
  41285. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  41286. }),
  41287. $globals.IRInlinedIfNilIfNotNil);
  41288. $core.addMethod(
  41289. $core.method({
  41290. selector: "receiverInternalVariableName",
  41291. protocol: "accessing",
  41292. fn: function (){
  41293. var self=this;
  41294. return "$receiver";
  41295. },
  41296. args: [],
  41297. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  41298. referencedClasses: [],
  41299. messageSends: []
  41300. }),
  41301. $globals.IRInlinedIfNilIfNotNil);
  41302. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41303. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  41304. $core.addMethod(
  41305. $core.method({
  41306. selector: "acceptDagVisitor:",
  41307. protocol: "visiting",
  41308. fn: function (aVisitor){
  41309. var self=this;
  41310. return $core.withContext(function($ctx1) {
  41311. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  41312. return self;
  41313. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  41314. },
  41315. args: ["aVisitor"],
  41316. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  41317. referencedClasses: [],
  41318. messageSends: ["visitIRInlinedIfTrue:"]
  41319. }),
  41320. $globals.IRInlinedIfTrue);
  41321. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  41322. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  41323. $core.addMethod(
  41324. $core.method({
  41325. selector: "acceptDagVisitor:",
  41326. protocol: "visiting",
  41327. fn: function (aVisitor){
  41328. var self=this;
  41329. return $core.withContext(function($ctx1) {
  41330. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  41331. return self;
  41332. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  41333. },
  41334. args: ["aVisitor"],
  41335. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  41336. referencedClasses: [],
  41337. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  41338. }),
  41339. $globals.IRInlinedIfTrueIfFalse);
  41340. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  41341. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  41342. $core.addMethod(
  41343. $core.method({
  41344. selector: "acceptDagVisitor:",
  41345. protocol: "visiting",
  41346. fn: function (aVisitor){
  41347. var self=this;
  41348. return $core.withContext(function($ctx1) {
  41349. $recv(aVisitor)._visitIRInlinedSequence_(self);
  41350. return self;
  41351. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  41352. },
  41353. args: ["aVisitor"],
  41354. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  41355. referencedClasses: [],
  41356. messageSends: ["visitIRInlinedSequence:"]
  41357. }),
  41358. $globals.IRInlinedSequence);
  41359. $core.addMethod(
  41360. $core.method({
  41361. selector: "isInlined",
  41362. protocol: "testing",
  41363. fn: function (){
  41364. var self=this;
  41365. return true;
  41366. },
  41367. args: [],
  41368. source: "isInlined\x0a\x09^ true",
  41369. referencedClasses: [],
  41370. messageSends: []
  41371. }),
  41372. $globals.IRInlinedSequence);
  41373. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  41374. $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`";
  41375. $core.addMethod(
  41376. $core.method({
  41377. selector: "assignmentInliner",
  41378. protocol: "factory",
  41379. fn: function (){
  41380. var self=this;
  41381. return $core.withContext(function($ctx1) {
  41382. var $1;
  41383. $1=$recv($globals.IRAssignmentInliner)._new();
  41384. $recv($1)._translator_(self);
  41385. return $recv($1)._yourself();
  41386. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  41387. },
  41388. args: [],
  41389. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41390. referencedClasses: ["IRAssignmentInliner"],
  41391. messageSends: ["translator:", "new", "yourself"]
  41392. }),
  41393. $globals.IRInliner);
  41394. $core.addMethod(
  41395. $core.method({
  41396. selector: "returnInliner",
  41397. protocol: "factory",
  41398. fn: function (){
  41399. var self=this;
  41400. return $core.withContext(function($ctx1) {
  41401. var $1;
  41402. $1=$recv($globals.IRReturnInliner)._new();
  41403. $recv($1)._translator_(self);
  41404. return $recv($1)._yourself();
  41405. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  41406. },
  41407. args: [],
  41408. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41409. referencedClasses: ["IRReturnInliner"],
  41410. messageSends: ["translator:", "new", "yourself"]
  41411. }),
  41412. $globals.IRInliner);
  41413. $core.addMethod(
  41414. $core.method({
  41415. selector: "sendInliner",
  41416. protocol: "factory",
  41417. fn: function (){
  41418. var self=this;
  41419. return $core.withContext(function($ctx1) {
  41420. var $1;
  41421. $1=$recv($globals.IRSendInliner)._new();
  41422. $recv($1)._translator_(self);
  41423. return $recv($1)._yourself();
  41424. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  41425. },
  41426. args: [],
  41427. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41428. referencedClasses: ["IRSendInliner"],
  41429. messageSends: ["translator:", "new", "yourself"]
  41430. }),
  41431. $globals.IRInliner);
  41432. $core.addMethod(
  41433. $core.method({
  41434. selector: "shouldInlineAssignment:",
  41435. protocol: "testing",
  41436. fn: function (anIRAssignment){
  41437. var self=this;
  41438. return $core.withContext(function($ctx1) {
  41439. var $3,$2,$1;
  41440. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  41441. return $core.withContext(function($ctx2) {
  41442. $3=$recv(anIRAssignment)._right();
  41443. $ctx2.sendIdx["right"]=1;
  41444. $2=$recv($3)._isSend();
  41445. return $recv($2)._and_((function(){
  41446. return $core.withContext(function($ctx3) {
  41447. return self._shouldInlineSend_($recv(anIRAssignment)._right());
  41448. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41449. }));
  41450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41451. }));
  41452. $ctx1.sendIdx["and:"]=1;
  41453. return $1;
  41454. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  41455. },
  41456. args: ["anIRAssignment"],
  41457. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  41458. referencedClasses: [],
  41459. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  41460. }),
  41461. $globals.IRInliner);
  41462. $core.addMethod(
  41463. $core.method({
  41464. selector: "shouldInlineReturn:",
  41465. protocol: "testing",
  41466. fn: function (anIRReturn){
  41467. var self=this;
  41468. return $core.withContext(function($ctx1) {
  41469. var $3,$2,$1;
  41470. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  41471. return $core.withContext(function($ctx2) {
  41472. $3=$recv(anIRReturn)._expression();
  41473. $ctx2.sendIdx["expression"]=1;
  41474. $2=$recv($3)._isSend();
  41475. return $recv($2)._and_((function(){
  41476. return $core.withContext(function($ctx3) {
  41477. return self._shouldInlineSend_($recv(anIRReturn)._expression());
  41478. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41479. }));
  41480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41481. }));
  41482. $ctx1.sendIdx["and:"]=1;
  41483. return $1;
  41484. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  41485. },
  41486. args: ["anIRReturn"],
  41487. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  41488. referencedClasses: [],
  41489. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  41490. }),
  41491. $globals.IRInliner);
  41492. $core.addMethod(
  41493. $core.method({
  41494. selector: "shouldInlineSend:",
  41495. protocol: "testing",
  41496. fn: function (anIRSend){
  41497. var self=this;
  41498. return $core.withContext(function($ctx1) {
  41499. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  41500. return $core.withContext(function($ctx2) {
  41501. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  41502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41503. }));
  41504. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  41505. },
  41506. args: ["anIRSend"],
  41507. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  41508. referencedClasses: ["IRSendInliner"],
  41509. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  41510. }),
  41511. $globals.IRInliner);
  41512. $core.addMethod(
  41513. $core.method({
  41514. selector: "visitIRAssignment:",
  41515. protocol: "visiting",
  41516. fn: function (anIRAssignment){
  41517. var self=this;
  41518. return $core.withContext(function($ctx1) {
  41519. var $1;
  41520. $1=self._shouldInlineAssignment_(anIRAssignment);
  41521. if($core.assert($1)){
  41522. return $recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  41523. } else {
  41524. return (
  41525. $ctx1.supercall = true,
  41526. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  41527. $ctx1.supercall = false;
  41528. }
  41529. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  41530. },
  41531. args: ["anIRAssignment"],
  41532. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  41533. referencedClasses: [],
  41534. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  41535. }),
  41536. $globals.IRInliner);
  41537. $core.addMethod(
  41538. $core.method({
  41539. selector: "visitIRNonLocalReturn:",
  41540. protocol: "visiting",
  41541. fn: function (anIRNonLocalReturn){
  41542. var self=this;
  41543. var localReturn;
  41544. return $core.withContext(function($ctx1) {
  41545. var $2,$1,$4,$3,$5,$6,$7;
  41546. $2=$recv(anIRNonLocalReturn)._scope();
  41547. $ctx1.sendIdx["scope"]=1;
  41548. $1=$recv($2)._canInlineNonLocalReturns();
  41549. if($core.assert($1)){
  41550. $4=$recv(anIRNonLocalReturn)._scope();
  41551. $ctx1.sendIdx["scope"]=2;
  41552. $3=$recv($4)._methodScope();
  41553. $5=$recv(anIRNonLocalReturn)._scope();
  41554. $ctx1.sendIdx["scope"]=3;
  41555. $recv($3)._removeNonLocalReturn_($5);
  41556. $6=$recv($globals.IRReturn)._new();
  41557. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  41558. localReturn=$recv($6)._yourself();
  41559. localReturn;
  41560. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  41561. return $core.withContext(function($ctx2) {
  41562. return $recv(localReturn)._add_(each);
  41563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41564. }));
  41565. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  41566. return self._visitIRReturn_(localReturn);
  41567. }
  41568. $7=(
  41569. $ctx1.supercall = true,
  41570. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  41571. $ctx1.supercall = false;
  41572. return $7;
  41573. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  41574. },
  41575. args: ["anIRNonLocalReturn"],
  41576. 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",
  41577. referencedClasses: ["IRReturn"],
  41578. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  41579. }),
  41580. $globals.IRInliner);
  41581. $core.addMethod(
  41582. $core.method({
  41583. selector: "visitIRReturn:",
  41584. protocol: "visiting",
  41585. fn: function (anIRReturn){
  41586. var self=this;
  41587. return $core.withContext(function($ctx1) {
  41588. var $1;
  41589. $1=self._shouldInlineReturn_(anIRReturn);
  41590. if($core.assert($1)){
  41591. return $recv(self._returnInliner())._inlineReturn_(anIRReturn);
  41592. } else {
  41593. return (
  41594. $ctx1.supercall = true,
  41595. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  41596. $ctx1.supercall = false;
  41597. }
  41598. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  41599. },
  41600. args: ["anIRReturn"],
  41601. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  41602. referencedClasses: [],
  41603. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  41604. }),
  41605. $globals.IRInliner);
  41606. $core.addMethod(
  41607. $core.method({
  41608. selector: "visitIRSend:",
  41609. protocol: "visiting",
  41610. fn: function (anIRSend){
  41611. var self=this;
  41612. return $core.withContext(function($ctx1) {
  41613. var $1;
  41614. $1=self._shouldInlineSend_(anIRSend);
  41615. if($core.assert($1)){
  41616. return $recv(self._sendInliner())._inlineSend_(anIRSend);
  41617. } else {
  41618. return (
  41619. $ctx1.supercall = true,
  41620. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  41621. $ctx1.supercall = false;
  41622. }
  41623. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  41624. },
  41625. args: ["anIRSend"],
  41626. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  41627. referencedClasses: [],
  41628. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  41629. }),
  41630. $globals.IRInliner);
  41631. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  41632. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  41633. $core.addMethod(
  41634. $core.method({
  41635. selector: "visitIRInlinedClosure:",
  41636. protocol: "visiting",
  41637. fn: function (anIRInlinedClosure){
  41638. var self=this;
  41639. return $core.withContext(function($ctx1) {
  41640. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  41641. return $core.withContext(function($ctx2) {
  41642. return $recv($recv(each)._name())._asVariableName();
  41643. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41644. })));
  41645. self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  41646. return self;
  41647. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  41648. },
  41649. args: ["anIRInlinedClosure"],
  41650. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  41651. referencedClasses: [],
  41652. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  41653. }),
  41654. $globals.IRInliningJSTranslator);
  41655. $core.addMethod(
  41656. $core.method({
  41657. selector: "visitIRInlinedIfFalse:",
  41658. protocol: "visiting",
  41659. fn: function (anIRInlinedIfFalse){
  41660. var self=this;
  41661. return $core.withContext(function($ctx1) {
  41662. var $1,$2,$4,$3;
  41663. $1=self._stream();
  41664. $ctx1.sendIdx["stream"]=1;
  41665. $recv($1)._nextPutIf_then_((function(){
  41666. return $core.withContext(function($ctx2) {
  41667. $2=self._stream();
  41668. $ctx2.sendIdx["stream"]=2;
  41669. $recv($2)._nextPutAll_("!$core.assert(");
  41670. $ctx2.sendIdx["nextPutAll:"]=1;
  41671. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  41672. $ctx2.sendIdx["dagChildren"]=1;
  41673. $3=$recv($4)._first();
  41674. self._visit_($3);
  41675. $ctx2.sendIdx["visit:"]=1;
  41676. return $recv(self._stream())._nextPutAll_(")");
  41677. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41678. }),(function(){
  41679. return $core.withContext(function($ctx2) {
  41680. return self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  41681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41682. }));
  41683. return self;
  41684. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  41685. },
  41686. args: ["anIRInlinedIfFalse"],
  41687. 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 ]",
  41688. referencedClasses: [],
  41689. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  41690. }),
  41691. $globals.IRInliningJSTranslator);
  41692. $core.addMethod(
  41693. $core.method({
  41694. selector: "visitIRInlinedIfNilIfNotNil:",
  41695. protocol: "visiting",
  41696. fn: function (anIRInlinedIfNilIfNotNil){
  41697. var self=this;
  41698. return $core.withContext(function($ctx1) {
  41699. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  41700. $1=self._stream();
  41701. $ctx1.sendIdx["stream"]=1;
  41702. $recv($1)._nextPutIf_then_else_((function(){
  41703. var recvVarName;
  41704. return $core.withContext(function($ctx2) {
  41705. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  41706. recvVarName;
  41707. $2=self._stream();
  41708. $ctx2.sendIdx["stream"]=2;
  41709. $4="(".__comma(recvVarName);
  41710. $ctx2.sendIdx[","]=2;
  41711. $3=$recv($4).__comma(" = ");
  41712. $ctx2.sendIdx[","]=1;
  41713. $recv($2)._nextPutAll_($3);
  41714. $ctx2.sendIdx["nextPutAll:"]=1;
  41715. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  41716. $ctx2.sendIdx["dagChildren"]=1;
  41717. $5=$recv($6)._first();
  41718. self._visit_($5);
  41719. $ctx2.sendIdx["visit:"]=1;
  41720. $7=self._stream();
  41721. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".isNil");
  41722. $ctx2.sendIdx[","]=3;
  41723. return $recv($7)._nextPutAll_($8);
  41724. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  41725. }),(function(){
  41726. return $core.withContext(function($ctx2) {
  41727. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  41728. $ctx2.sendIdx["dagChildren"]=2;
  41729. $9=$recv($10)._second();
  41730. return self._visit_($9);
  41731. $ctx2.sendIdx["visit:"]=2;
  41732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41733. }),(function(){
  41734. return $core.withContext(function($ctx2) {
  41735. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  41736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41737. }));
  41738. return self;
  41739. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  41740. },
  41741. args: ["anIRInlinedIfNilIfNotNil"],
  41742. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09| recvVarName |\x0a\x09\x09\x09recvVarName := anIRInlinedIfNilIfNotNil receiverInternalVariableName.\x0a\x09\x09\x09self stream nextPutAll: '(', recvVarName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || ', recvVarName, '.isNil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]",
  41743. referencedClasses: [],
  41744. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  41745. }),
  41746. $globals.IRInliningJSTranslator);
  41747. $core.addMethod(
  41748. $core.method({
  41749. selector: "visitIRInlinedIfTrue:",
  41750. protocol: "visiting",
  41751. fn: function (anIRInlinedIfTrue){
  41752. var self=this;
  41753. return $core.withContext(function($ctx1) {
  41754. var $1,$2,$4,$3;
  41755. $1=self._stream();
  41756. $ctx1.sendIdx["stream"]=1;
  41757. $recv($1)._nextPutIf_then_((function(){
  41758. return $core.withContext(function($ctx2) {
  41759. $2=self._stream();
  41760. $ctx2.sendIdx["stream"]=2;
  41761. $recv($2)._nextPutAll_("$core.assert(");
  41762. $ctx2.sendIdx["nextPutAll:"]=1;
  41763. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  41764. $ctx2.sendIdx["dagChildren"]=1;
  41765. $3=$recv($4)._first();
  41766. self._visit_($3);
  41767. $ctx2.sendIdx["visit:"]=1;
  41768. return $recv(self._stream())._nextPutAll_(")");
  41769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41770. }),(function(){
  41771. return $core.withContext(function($ctx2) {
  41772. return self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  41773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41774. }));
  41775. return self;
  41776. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  41777. },
  41778. args: ["anIRInlinedIfTrue"],
  41779. 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 ]",
  41780. referencedClasses: [],
  41781. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  41782. }),
  41783. $globals.IRInliningJSTranslator);
  41784. $core.addMethod(
  41785. $core.method({
  41786. selector: "visitIRInlinedIfTrueIfFalse:",
  41787. protocol: "visiting",
  41788. fn: function (anIRInlinedIfTrueIfFalse){
  41789. var self=this;
  41790. return $core.withContext(function($ctx1) {
  41791. var $1,$2,$4,$3,$6,$5;
  41792. $1=self._stream();
  41793. $ctx1.sendIdx["stream"]=1;
  41794. $recv($1)._nextPutIf_then_else_((function(){
  41795. return $core.withContext(function($ctx2) {
  41796. $2=self._stream();
  41797. $ctx2.sendIdx["stream"]=2;
  41798. $recv($2)._nextPutAll_("$core.assert(");
  41799. $ctx2.sendIdx["nextPutAll:"]=1;
  41800. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  41801. $ctx2.sendIdx["dagChildren"]=1;
  41802. $3=$recv($4)._first();
  41803. self._visit_($3);
  41804. $ctx2.sendIdx["visit:"]=1;
  41805. return $recv(self._stream())._nextPutAll_(")");
  41806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41807. }),(function(){
  41808. return $core.withContext(function($ctx2) {
  41809. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  41810. $ctx2.sendIdx["dagChildren"]=2;
  41811. $5=$recv($6)._second();
  41812. return self._visit_($5);
  41813. $ctx2.sendIdx["visit:"]=2;
  41814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41815. }),(function(){
  41816. return $core.withContext(function($ctx2) {
  41817. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  41818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41819. }));
  41820. return self;
  41821. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  41822. },
  41823. args: ["anIRInlinedIfTrueIfFalse"],
  41824. 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 ]",
  41825. referencedClasses: [],
  41826. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  41827. }),
  41828. $globals.IRInliningJSTranslator);
  41829. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  41830. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  41831. $core.addMethod(
  41832. $core.method({
  41833. selector: "ifFalse:",
  41834. protocol: "inlining",
  41835. fn: function (anIRInstruction){
  41836. var self=this;
  41837. return $core.withContext(function($ctx1) {
  41838. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  41839. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41840. },
  41841. args: ["anIRInstruction"],
  41842. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  41843. referencedClasses: ["IRInlinedIfFalse"],
  41844. messageSends: ["inlinedSend:withBlock:", "new"]
  41845. }),
  41846. $globals.IRSendInliner);
  41847. $core.addMethod(
  41848. $core.method({
  41849. selector: "ifFalse:ifTrue:",
  41850. protocol: "inlining",
  41851. fn: function (anIRInstruction,anotherIRInstruction){
  41852. var self=this;
  41853. return $core.withContext(function($ctx1) {
  41854. return self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  41855. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41856. },
  41857. args: ["anIRInstruction", "anotherIRInstruction"],
  41858. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  41859. referencedClasses: [],
  41860. messageSends: ["perform:withArguments:"]
  41861. }),
  41862. $globals.IRSendInliner);
  41863. $core.addMethod(
  41864. $core.method({
  41865. selector: "ifNil:",
  41866. protocol: "inlining",
  41867. fn: function (anIRInstruction){
  41868. var self=this;
  41869. return $core.withContext(function($ctx1) {
  41870. var $1,$3,$5,$6,$4,$2;
  41871. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  41872. $ctx1.sendIdx["new"]=1;
  41873. $3=$recv($globals.IRClosure)._new();
  41874. $ctx1.sendIdx["new"]=2;
  41875. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41876. $5=$recv($globals.IRBlockSequence)._new();
  41877. $recv($5)._add_($recv(self._send())._receiver());
  41878. $6=$recv($5)._yourself();
  41879. $ctx1.sendIdx["yourself"]=1;
  41880. $4=$6;
  41881. $recv($3)._add_($4);
  41882. $ctx1.sendIdx["add:"]=1;
  41883. $2=$recv($3)._yourself();
  41884. return self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  41885. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41886. },
  41887. args: ["anIRInstruction"],
  41888. 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)",
  41889. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41890. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  41891. }),
  41892. $globals.IRSendInliner);
  41893. $core.addMethod(
  41894. $core.method({
  41895. selector: "ifNil:ifNotNil:",
  41896. protocol: "inlining",
  41897. fn: function (anIRInstruction,anotherIRInstruction){
  41898. var self=this;
  41899. return $core.withContext(function($ctx1) {
  41900. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  41901. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41902. },
  41903. args: ["anIRInstruction", "anotherIRInstruction"],
  41904. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  41905. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41906. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  41907. }),
  41908. $globals.IRSendInliner);
  41909. $core.addMethod(
  41910. $core.method({
  41911. selector: "ifNotNil:",
  41912. protocol: "inlining",
  41913. fn: function (anIRInstruction){
  41914. var self=this;
  41915. return $core.withContext(function($ctx1) {
  41916. var $1,$3,$5,$6,$4,$2;
  41917. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  41918. $ctx1.sendIdx["new"]=1;
  41919. $3=$recv($globals.IRClosure)._new();
  41920. $ctx1.sendIdx["new"]=2;
  41921. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41922. $5=$recv($globals.IRBlockSequence)._new();
  41923. $recv($5)._add_($recv(self._send())._receiver());
  41924. $6=$recv($5)._yourself();
  41925. $ctx1.sendIdx["yourself"]=1;
  41926. $4=$6;
  41927. $recv($3)._add_($4);
  41928. $ctx1.sendIdx["add:"]=1;
  41929. $2=$recv($3)._yourself();
  41930. return self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  41931. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41932. },
  41933. args: ["anIRInstruction"],
  41934. 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",
  41935. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41936. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  41937. }),
  41938. $globals.IRSendInliner);
  41939. $core.addMethod(
  41940. $core.method({
  41941. selector: "ifNotNil:ifNil:",
  41942. protocol: "inlining",
  41943. fn: function (anIRInstruction,anotherIRInstruction){
  41944. var self=this;
  41945. return $core.withContext(function($ctx1) {
  41946. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  41947. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41948. },
  41949. args: ["anIRInstruction", "anotherIRInstruction"],
  41950. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  41951. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41952. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  41953. }),
  41954. $globals.IRSendInliner);
  41955. $core.addMethod(
  41956. $core.method({
  41957. selector: "ifTrue:",
  41958. protocol: "inlining",
  41959. fn: function (anIRInstruction){
  41960. var self=this;
  41961. return $core.withContext(function($ctx1) {
  41962. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  41963. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41964. },
  41965. args: ["anIRInstruction"],
  41966. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  41967. referencedClasses: ["IRInlinedIfTrue"],
  41968. messageSends: ["inlinedSend:withBlock:", "new"]
  41969. }),
  41970. $globals.IRSendInliner);
  41971. $core.addMethod(
  41972. $core.method({
  41973. selector: "ifTrue:ifFalse:",
  41974. protocol: "inlining",
  41975. fn: function (anIRInstruction,anotherIRInstruction){
  41976. var self=this;
  41977. return $core.withContext(function($ctx1) {
  41978. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  41979. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41980. },
  41981. args: ["anIRInstruction", "anotherIRInstruction"],
  41982. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  41983. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  41984. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  41985. }),
  41986. $globals.IRSendInliner);
  41987. $core.addMethod(
  41988. $core.method({
  41989. selector: "inlineClosure:",
  41990. protocol: "inlining",
  41991. fn: function (anIRClosure){
  41992. var self=this;
  41993. var inlinedClosure,sequence,statements;
  41994. return $core.withContext(function($ctx1) {
  41995. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  41996. inlinedClosure=self._inlinedClosure();
  41997. $1=inlinedClosure;
  41998. $2=$recv(anIRClosure)._scope();
  41999. $ctx1.sendIdx["scope"]=1;
  42000. $recv($1)._scope_($2);
  42001. $ctx1.sendIdx["scope:"]=1;
  42002. $recv($1)._parent_($recv(anIRClosure)._parent());
  42003. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  42004. return $core.withContext(function($ctx2) {
  42005. return $recv(inlinedClosure)._add_(each);
  42006. $ctx2.sendIdx["add:"]=1;
  42007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42008. }));
  42009. $ctx1.sendIdx["do:"]=1;
  42010. sequence=self._inlinedSequence();
  42011. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  42012. return $core.withContext(function($ctx2) {
  42013. $3=inlinedClosure;
  42014. $5=$recv($globals.IRTempDeclaration)._new();
  42015. $ctx2.sendIdx["new"]=1;
  42016. $recv($5)._name_(each);
  42017. $ctx2.sendIdx["name:"]=1;
  42018. $6=$recv($5)._yourself();
  42019. $ctx2.sendIdx["yourself"]=1;
  42020. $4=$6;
  42021. $recv($3)._add_($4);
  42022. $ctx2.sendIdx["add:"]=2;
  42023. $7=sequence;
  42024. $9=$recv($globals.IRAssignment)._new();
  42025. $ctx2.sendIdx["new"]=2;
  42026. $11=$recv($globals.IRVariable)._new();
  42027. $ctx2.sendIdx["new"]=3;
  42028. $13=$recv($globals.AliasVar)._new();
  42029. $ctx2.sendIdx["new"]=4;
  42030. $14=$recv(inlinedClosure)._scope();
  42031. $ctx2.sendIdx["scope"]=2;
  42032. $recv($13)._scope_($14);
  42033. $ctx2.sendIdx["scope:"]=2;
  42034. $recv($13)._name_(each);
  42035. $ctx2.sendIdx["name:"]=2;
  42036. $15=$recv($13)._yourself();
  42037. $ctx2.sendIdx["yourself"]=2;
  42038. $12=$15;
  42039. $10=$recv($11)._variable_($12);
  42040. $ctx2.sendIdx["variable:"]=1;
  42041. $recv($9)._add_($10);
  42042. $ctx2.sendIdx["add:"]=4;
  42043. $17=$recv($globals.IRVariable)._new();
  42044. $ctx2.sendIdx["new"]=5;
  42045. $19=$recv($globals.AliasVar)._new();
  42046. $recv($19)._scope_($recv(inlinedClosure)._scope());
  42047. $recv($19)._name_("$receiver");
  42048. $20=$recv($19)._yourself();
  42049. $ctx2.sendIdx["yourself"]=3;
  42050. $18=$20;
  42051. $16=$recv($17)._variable_($18);
  42052. $recv($9)._add_($16);
  42053. $ctx2.sendIdx["add:"]=5;
  42054. $8=$recv($9)._yourself();
  42055. return $recv($7)._add_($8);
  42056. $ctx2.sendIdx["add:"]=3;
  42057. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42058. }));
  42059. $ctx1.sendIdx["do:"]=2;
  42060. $recv(inlinedClosure)._add_(sequence);
  42061. $ctx1.sendIdx["add:"]=6;
  42062. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  42063. $recv(statements)._ifNotEmpty_((function(){
  42064. return $core.withContext(function($ctx2) {
  42065. $recv($recv(statements)._allButLast())._do_((function(each){
  42066. return $core.withContext(function($ctx3) {
  42067. return $recv(sequence)._add_(each);
  42068. $ctx3.sendIdx["add:"]=7;
  42069. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  42070. }));
  42071. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  42072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42073. }));
  42074. return inlinedClosure;
  42075. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  42076. },
  42077. args: ["anIRClosure"],
  42078. 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",
  42079. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  42080. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  42081. }),
  42082. $globals.IRSendInliner);
  42083. $core.addMethod(
  42084. $core.method({
  42085. selector: "inlineSend:",
  42086. protocol: "inlining",
  42087. fn: function (anIRSend){
  42088. var self=this;
  42089. return $core.withContext(function($ctx1) {
  42090. var $2,$1;
  42091. self._send_(anIRSend);
  42092. $2=self._send();
  42093. $ctx1.sendIdx["send"]=1;
  42094. $1=$recv($2)._selector();
  42095. return self._perform_withArguments_($1,$recv(self._send())._arguments());
  42096. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  42097. },
  42098. args: ["anIRSend"],
  42099. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  42100. referencedClasses: [],
  42101. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  42102. }),
  42103. $globals.IRSendInliner);
  42104. $core.addMethod(
  42105. $core.method({
  42106. selector: "inlineSend:andReplace:",
  42107. protocol: "private",
  42108. fn: function (anIRSend,anIRInstruction){
  42109. var self=this;
  42110. return $core.withContext(function($ctx1) {
  42111. $recv(anIRInstruction)._replaceWith_(anIRSend);
  42112. return self._inlineSend_(anIRSend);
  42113. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  42114. },
  42115. args: ["anIRSend", "anIRInstruction"],
  42116. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  42117. referencedClasses: [],
  42118. messageSends: ["replaceWith:", "inlineSend:"]
  42119. }),
  42120. $globals.IRSendInliner);
  42121. $core.addMethod(
  42122. $core.method({
  42123. selector: "inlinedClosure",
  42124. protocol: "factory",
  42125. fn: function (){
  42126. var self=this;
  42127. return $core.withContext(function($ctx1) {
  42128. return $recv($globals.IRInlinedClosure)._new();
  42129. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  42130. },
  42131. args: [],
  42132. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  42133. referencedClasses: ["IRInlinedClosure"],
  42134. messageSends: ["new"]
  42135. }),
  42136. $globals.IRSendInliner);
  42137. $core.addMethod(
  42138. $core.method({
  42139. selector: "inlinedSend:withBlock:",
  42140. protocol: "private",
  42141. fn: function (inlinedSend,anIRInstruction){
  42142. var self=this;
  42143. var inlinedClosure;
  42144. return $core.withContext(function($ctx1) {
  42145. var $1,$2,$4,$3,$5;
  42146. $1=$recv(anIRInstruction)._isClosure();
  42147. if(!$core.assert($1)){
  42148. self._inliningError_("Message argument should be a block");
  42149. $ctx1.sendIdx["inliningError:"]=1;
  42150. }
  42151. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  42152. if(!$core.assert($2)){
  42153. self._inliningError_("Inlined block should have zero argument");
  42154. }
  42155. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  42156. $4=self._send();
  42157. $ctx1.sendIdx["send"]=1;
  42158. $3=$recv($4)._receiver();
  42159. $recv(inlinedSend)._add_($3);
  42160. $ctx1.sendIdx["add:"]=1;
  42161. $recv(inlinedSend)._add_(inlinedClosure);
  42162. $recv(self._send())._replaceWith_(inlinedSend);
  42163. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  42164. $ctx1.sendIdx["internalVariables"]=1;
  42165. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  42166. return inlinedSend;
  42167. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  42168. },
  42169. args: ["inlinedSend", "anIRInstruction"],
  42170. 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",
  42171. referencedClasses: [],
  42172. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  42173. }),
  42174. $globals.IRSendInliner);
  42175. $core.addMethod(
  42176. $core.method({
  42177. selector: "inlinedSend:withBlock:withBlock:",
  42178. protocol: "private",
  42179. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  42180. var self=this;
  42181. var inlinedClosure1,inlinedClosure2;
  42182. return $core.withContext(function($ctx1) {
  42183. var $1,$2,$3,$4,$6,$5,$7;
  42184. $1=$recv(anIRInstruction)._isClosure();
  42185. $ctx1.sendIdx["isClosure"]=1;
  42186. if(!$core.assert($1)){
  42187. self._inliningError_("Message argument should be a block");
  42188. $ctx1.sendIdx["inliningError:"]=1;
  42189. }
  42190. $2=$recv(anotherIRInstruction)._isClosure();
  42191. if(!$core.assert($2)){
  42192. self._inliningError_("Message argument should be a block");
  42193. }
  42194. $3=self._translator();
  42195. $ctx1.sendIdx["translator"]=1;
  42196. $4=self._inlineClosure_(anIRInstruction);
  42197. $ctx1.sendIdx["inlineClosure:"]=1;
  42198. inlinedClosure1=$recv($3)._visit_($4);
  42199. $ctx1.sendIdx["visit:"]=1;
  42200. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  42201. $6=self._send();
  42202. $ctx1.sendIdx["send"]=1;
  42203. $5=$recv($6)._receiver();
  42204. $recv(inlinedSend)._add_($5);
  42205. $ctx1.sendIdx["add:"]=1;
  42206. $recv(inlinedSend)._add_(inlinedClosure1);
  42207. $ctx1.sendIdx["add:"]=2;
  42208. $recv(inlinedSend)._add_(inlinedClosure2);
  42209. $recv(self._send())._replaceWith_(inlinedSend);
  42210. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  42211. $ctx1.sendIdx["internalVariables"]=1;
  42212. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  42213. return inlinedSend;
  42214. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  42215. },
  42216. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  42217. 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",
  42218. referencedClasses: [],
  42219. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  42220. }),
  42221. $globals.IRSendInliner);
  42222. $core.addMethod(
  42223. $core.method({
  42224. selector: "inlinedSequence",
  42225. protocol: "factory",
  42226. fn: function (){
  42227. var self=this;
  42228. return $core.withContext(function($ctx1) {
  42229. return $recv($globals.IRInlinedSequence)._new();
  42230. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  42231. },
  42232. args: [],
  42233. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  42234. referencedClasses: ["IRInlinedSequence"],
  42235. messageSends: ["new"]
  42236. }),
  42237. $globals.IRSendInliner);
  42238. $core.addMethod(
  42239. $core.method({
  42240. selector: "inliningError:",
  42241. protocol: "error handling",
  42242. fn: function (aString){
  42243. var self=this;
  42244. return $core.withContext(function($ctx1) {
  42245. $recv($globals.InliningError)._signal_(aString);
  42246. return self;
  42247. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  42248. },
  42249. args: ["aString"],
  42250. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  42251. referencedClasses: ["InliningError"],
  42252. messageSends: ["signal:"]
  42253. }),
  42254. $globals.IRSendInliner);
  42255. $core.addMethod(
  42256. $core.method({
  42257. selector: "send",
  42258. protocol: "accessing",
  42259. fn: function (){
  42260. var self=this;
  42261. return self["@send"];
  42262. },
  42263. args: [],
  42264. source: "send\x0a\x09^ send",
  42265. referencedClasses: [],
  42266. messageSends: []
  42267. }),
  42268. $globals.IRSendInliner);
  42269. $core.addMethod(
  42270. $core.method({
  42271. selector: "send:",
  42272. protocol: "accessing",
  42273. fn: function (anIRSend){
  42274. var self=this;
  42275. self["@send"]=anIRSend;
  42276. return self;
  42277. },
  42278. args: ["anIRSend"],
  42279. source: "send: anIRSend\x0a\x09send := anIRSend",
  42280. referencedClasses: [],
  42281. messageSends: []
  42282. }),
  42283. $globals.IRSendInliner);
  42284. $core.addMethod(
  42285. $core.method({
  42286. selector: "translator",
  42287. protocol: "accessing",
  42288. fn: function (){
  42289. var self=this;
  42290. return self["@translator"];
  42291. },
  42292. args: [],
  42293. source: "translator\x0a\x09^ translator",
  42294. referencedClasses: [],
  42295. messageSends: []
  42296. }),
  42297. $globals.IRSendInliner);
  42298. $core.addMethod(
  42299. $core.method({
  42300. selector: "translator:",
  42301. protocol: "accessing",
  42302. fn: function (anASTTranslator){
  42303. var self=this;
  42304. self["@translator"]=anASTTranslator;
  42305. return self;
  42306. },
  42307. args: ["anASTTranslator"],
  42308. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  42309. referencedClasses: [],
  42310. messageSends: []
  42311. }),
  42312. $globals.IRSendInliner);
  42313. $core.addMethod(
  42314. $core.method({
  42315. selector: "inlinedSelectors",
  42316. protocol: "accessing",
  42317. fn: function (){
  42318. var self=this;
  42319. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  42320. },
  42321. args: [],
  42322. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  42323. referencedClasses: [],
  42324. messageSends: []
  42325. }),
  42326. $globals.IRSendInliner.klass);
  42327. $core.addMethod(
  42328. $core.method({
  42329. selector: "shouldInline:",
  42330. protocol: "accessing",
  42331. fn: function (anIRSend){
  42332. var self=this;
  42333. return $core.withContext(function($ctx1) {
  42334. var $1;
  42335. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  42336. if(!$core.assert($1)){
  42337. return false;
  42338. }
  42339. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  42340. return $core.withContext(function($ctx2) {
  42341. return $recv(each)._isClosure();
  42342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42343. }));
  42344. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.klass)});
  42345. },
  42346. args: ["anIRSend"],
  42347. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  42348. referencedClasses: [],
  42349. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  42350. }),
  42351. $globals.IRSendInliner.klass);
  42352. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  42353. $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};";
  42354. $core.addMethod(
  42355. $core.method({
  42356. selector: "inlineAssignment:",
  42357. protocol: "inlining",
  42358. fn: function (anIRAssignment){
  42359. var self=this;
  42360. return $core.withContext(function($ctx1) {
  42361. self._target_($recv(anIRAssignment)._left());
  42362. return self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  42363. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  42364. },
  42365. args: ["anIRAssignment"],
  42366. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  42367. referencedClasses: [],
  42368. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  42369. }),
  42370. $globals.IRAssignmentInliner);
  42371. $core.addMethod(
  42372. $core.method({
  42373. selector: "inlineClosure:",
  42374. protocol: "inlining",
  42375. fn: function (anIRClosure){
  42376. var self=this;
  42377. var closure,sequence,statements;
  42378. return $core.withContext(function($ctx1) {
  42379. var $1,$2,$3,$5,$4;
  42380. closure=(
  42381. $ctx1.supercall = true,
  42382. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  42383. $ctx1.supercall = false;
  42384. sequence=$recv(closure)._sequence();
  42385. statements=$recv(sequence)._dagChildren();
  42386. $recv(statements)._ifNotEmpty_((function(){
  42387. var final;
  42388. return $core.withContext(function($ctx2) {
  42389. final=$recv(statements)._last();
  42390. final;
  42391. $1=$recv(final)._yieldsValue();
  42392. if($core.assert($1)){
  42393. $2=sequence;
  42394. $3=final;
  42395. $5=$recv($globals.IRAssignment)._new();
  42396. $recv($5)._add_(self._target());
  42397. $ctx2.sendIdx["add:"]=1;
  42398. $recv($5)._add_($recv(final)._copy());
  42399. $4=$recv($5)._yourself();
  42400. return $recv($2)._replace_with_($3,$4);
  42401. }
  42402. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  42403. }));
  42404. return closure;
  42405. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  42406. },
  42407. args: ["anIRClosure"],
  42408. 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",
  42409. referencedClasses: ["IRAssignment"],
  42410. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  42411. }),
  42412. $globals.IRAssignmentInliner);
  42413. $core.addMethod(
  42414. $core.method({
  42415. selector: "target",
  42416. protocol: "accessing",
  42417. fn: function (){
  42418. var self=this;
  42419. return self["@target"];
  42420. },
  42421. args: [],
  42422. source: "target\x0a\x09^ target",
  42423. referencedClasses: [],
  42424. messageSends: []
  42425. }),
  42426. $globals.IRAssignmentInliner);
  42427. $core.addMethod(
  42428. $core.method({
  42429. selector: "target:",
  42430. protocol: "accessing",
  42431. fn: function (anObject){
  42432. var self=this;
  42433. self["@target"]=anObject;
  42434. return self;
  42435. },
  42436. args: ["anObject"],
  42437. source: "target: anObject\x0a\x09target := anObject",
  42438. referencedClasses: [],
  42439. messageSends: []
  42440. }),
  42441. $globals.IRAssignmentInliner);
  42442. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  42443. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  42444. $core.addMethod(
  42445. $core.method({
  42446. selector: "inlineClosure:",
  42447. protocol: "inlining",
  42448. fn: function (anIRClosure){
  42449. var self=this;
  42450. var closure,sequence,statements;
  42451. return $core.withContext(function($ctx1) {
  42452. var $1,$2,$3,$5,$4;
  42453. closure=(
  42454. $ctx1.supercall = true,
  42455. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  42456. $ctx1.supercall = false;
  42457. sequence=$recv(closure)._sequence();
  42458. statements=$recv(sequence)._dagChildren();
  42459. $recv(statements)._ifNotEmpty_((function(){
  42460. var final;
  42461. return $core.withContext(function($ctx2) {
  42462. final=$recv(statements)._last();
  42463. final;
  42464. $1=$recv(final)._yieldsValue();
  42465. if($core.assert($1)){
  42466. $2=sequence;
  42467. $3=final;
  42468. $5=$recv($globals.IRReturn)._new();
  42469. $recv($5)._add_($recv(final)._copy());
  42470. $4=$recv($5)._yourself();
  42471. return $recv($2)._replace_with_($3,$4);
  42472. }
  42473. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  42474. }));
  42475. return closure;
  42476. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  42477. },
  42478. args: ["anIRClosure"],
  42479. 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",
  42480. referencedClasses: ["IRReturn"],
  42481. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  42482. }),
  42483. $globals.IRReturnInliner);
  42484. $core.addMethod(
  42485. $core.method({
  42486. selector: "inlineReturn:",
  42487. protocol: "inlining",
  42488. fn: function (anIRReturn){
  42489. var self=this;
  42490. return $core.withContext(function($ctx1) {
  42491. return self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  42492. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  42493. },
  42494. args: ["anIRReturn"],
  42495. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  42496. referencedClasses: [],
  42497. messageSends: ["inlineSend:andReplace:", "expression"]
  42498. }),
  42499. $globals.IRReturnInliner);
  42500. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  42501. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  42502. $core.addMethod(
  42503. $core.method({
  42504. selector: "inliner",
  42505. protocol: "compiling",
  42506. fn: function (){
  42507. var self=this;
  42508. return $core.withContext(function($ctx1) {
  42509. return $recv($globals.IRInliner)._new();
  42510. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  42511. },
  42512. args: [],
  42513. source: "inliner\x0a\x09^ IRInliner new",
  42514. referencedClasses: ["IRInliner"],
  42515. messageSends: ["new"]
  42516. }),
  42517. $globals.InliningCodeGenerator);
  42518. $core.addMethod(
  42519. $core.method({
  42520. selector: "irTranslatorClass",
  42521. protocol: "compiling",
  42522. fn: function (){
  42523. var self=this;
  42524. return $globals.IRInliningJSTranslator;
  42525. },
  42526. args: [],
  42527. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  42528. referencedClasses: ["IRInliningJSTranslator"],
  42529. messageSends: []
  42530. }),
  42531. $globals.InliningCodeGenerator);
  42532. $core.addMethod(
  42533. $core.method({
  42534. selector: "preInliner",
  42535. protocol: "compiling",
  42536. fn: function (){
  42537. var self=this;
  42538. return $core.withContext(function($ctx1) {
  42539. return $recv($globals.ASTPreInliner)._new();
  42540. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  42541. },
  42542. args: [],
  42543. source: "preInliner\x0a\x09^ ASTPreInliner new",
  42544. referencedClasses: ["ASTPreInliner"],
  42545. messageSends: ["new"]
  42546. }),
  42547. $globals.InliningCodeGenerator);
  42548. $core.addMethod(
  42549. $core.method({
  42550. selector: "transformersDictionary",
  42551. protocol: "compiling",
  42552. fn: function (){
  42553. var self=this;
  42554. return $core.withContext(function($ctx1) {
  42555. var $1,$2,$receiver;
  42556. $1=self["@transformersDictionary"];
  42557. if(($receiver = $1) == null || $receiver.isNil){
  42558. $2=(
  42559. $ctx1.supercall = true,
  42560. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($recv(self), []));
  42561. $ctx1.supercall = false;
  42562. $recv($2)._at_put_("3000-inlinerTagging",self._preInliner());
  42563. $ctx1.sendIdx["at:put:"]=1;
  42564. $recv($2)._at_put_("6000-inliner",self._inliner());
  42565. $ctx1.sendIdx["at:put:"]=2;
  42566. $recv($2)._at_put_("8000-irToJs",self._irTranslator());
  42567. self["@transformersDictionary"]=$recv($2)._yourself();
  42568. return self["@transformersDictionary"];
  42569. } else {
  42570. return $1;
  42571. }
  42572. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  42573. },
  42574. args: [],
  42575. 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 ]",
  42576. referencedClasses: [],
  42577. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  42578. }),
  42579. $globals.InliningCodeGenerator);
  42580. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  42581. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  42582. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  42583. $core.addMethod(
  42584. $core.method({
  42585. selector: "visitSendNode:",
  42586. protocol: "visiting",
  42587. fn: function (aNode){
  42588. var self=this;
  42589. return $core.withContext(function($ctx1) {
  42590. var $1,$2,$3,$receiver;
  42591. $1=$recv(aNode)._superSend();
  42592. if(!$core.assert($1)){
  42593. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42594. if($core.assert($2)){
  42595. $recv(aNode)._shouldBeInlined_(true);
  42596. $3=$recv(aNode)._receiver();
  42597. if(($receiver = $3) == null || $receiver.isNil){
  42598. $3;
  42599. } else {
  42600. var receiver;
  42601. receiver=$receiver;
  42602. $recv(receiver)._shouldBeAliased_(true);
  42603. }
  42604. }
  42605. }
  42606. (
  42607. $ctx1.supercall = true,
  42608. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  42609. $ctx1.supercall = false;
  42610. return self;
  42611. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  42612. },
  42613. args: ["aNode"],
  42614. 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",
  42615. referencedClasses: ["IRSendInliner"],
  42616. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42617. }),
  42618. $globals.InliningSemanticAnalyzer);
  42619. $core.addMethod(
  42620. $core.method({
  42621. selector: "asInlinedBlockResult",
  42622. protocol: "*Compiler-Inlining",
  42623. fn: function (){
  42624. var self=this;
  42625. return $core.withContext(function($ctx1) {
  42626. return self._expression();
  42627. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  42628. },
  42629. args: [],
  42630. source: "asInlinedBlockResult\x0a\x09^ self expression",
  42631. referencedClasses: [],
  42632. messageSends: ["expression"]
  42633. }),
  42634. $globals.IRBlockReturn);
  42635. $core.addMethod(
  42636. $core.method({
  42637. selector: "asInlinedBlockResult",
  42638. protocol: "*Compiler-Inlining",
  42639. fn: function (){
  42640. var self=this;
  42641. return self;
  42642. },
  42643. args: [],
  42644. source: "asInlinedBlockResult\x0a\x09^ self",
  42645. referencedClasses: [],
  42646. messageSends: []
  42647. }),
  42648. $globals.IRInstruction);
  42649. });
  42650. 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";
  42651. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  42652. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42653. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  42654. $core.addPackage("Compiler-Interpreter");
  42655. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  42656. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42657. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  42658. $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`).";
  42659. $core.addMethod(
  42660. $core.method({
  42661. selector: "applyTo:arguments:",
  42662. protocol: "evaluating",
  42663. fn: function (anObject,aCollection){
  42664. var self=this;
  42665. return $core.withContext(function($ctx1) {
  42666. self._interpreterError();
  42667. return self;
  42668. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  42669. },
  42670. args: ["anObject", "aCollection"],
  42671. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  42672. referencedClasses: [],
  42673. messageSends: ["interpreterError"]
  42674. }),
  42675. $globals.AIBlockClosure);
  42676. $core.addMethod(
  42677. $core.method({
  42678. selector: "compiledSource",
  42679. protocol: "accessing",
  42680. fn: function (){
  42681. var self=this;
  42682. return "[ AST Block closure ]";
  42683. },
  42684. args: [],
  42685. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  42686. referencedClasses: [],
  42687. messageSends: []
  42688. }),
  42689. $globals.AIBlockClosure);
  42690. $core.addMethod(
  42691. $core.method({
  42692. selector: "currySelf",
  42693. protocol: "converting",
  42694. fn: function (){
  42695. var self=this;
  42696. return $core.withContext(function($ctx1) {
  42697. self._interpreterError();
  42698. return self;
  42699. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  42700. },
  42701. args: [],
  42702. source: "currySelf\x0a\x09self interpreterError",
  42703. referencedClasses: [],
  42704. messageSends: ["interpreterError"]
  42705. }),
  42706. $globals.AIBlockClosure);
  42707. $core.addMethod(
  42708. $core.method({
  42709. selector: "initializeWithContext:node:",
  42710. protocol: "initialization",
  42711. fn: function (aContext,aNode){
  42712. var self=this;
  42713. self["@node"]=aNode;
  42714. self["@outerContext"]=aContext;
  42715. return self;
  42716. },
  42717. args: ["aContext", "aNode"],
  42718. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  42719. referencedClasses: [],
  42720. messageSends: []
  42721. }),
  42722. $globals.AIBlockClosure);
  42723. $core.addMethod(
  42724. $core.method({
  42725. selector: "interpreterError",
  42726. protocol: "error handling",
  42727. fn: function (){
  42728. var self=this;
  42729. return $core.withContext(function($ctx1) {
  42730. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  42731. return self;
  42732. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  42733. },
  42734. args: [],
  42735. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  42736. referencedClasses: ["ASTInterpreterError"],
  42737. messageSends: ["signal:"]
  42738. }),
  42739. $globals.AIBlockClosure);
  42740. $core.addMethod(
  42741. $core.method({
  42742. selector: "numArgs",
  42743. protocol: "accessing",
  42744. fn: function (){
  42745. var self=this;
  42746. return $core.withContext(function($ctx1) {
  42747. return $recv($recv(self["@node"])._temps())._size();
  42748. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  42749. },
  42750. args: [],
  42751. source: "numArgs\x0a\x09^ node temps size",
  42752. referencedClasses: [],
  42753. messageSends: ["size", "temps"]
  42754. }),
  42755. $globals.AIBlockClosure);
  42756. $core.addMethod(
  42757. $core.method({
  42758. selector: "value",
  42759. protocol: "evaluating",
  42760. fn: function (){
  42761. var self=this;
  42762. return $core.withContext(function($ctx1) {
  42763. return self._valueWithPossibleArguments_([]);
  42764. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  42765. },
  42766. args: [],
  42767. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  42768. referencedClasses: [],
  42769. messageSends: ["valueWithPossibleArguments:"]
  42770. }),
  42771. $globals.AIBlockClosure);
  42772. $core.addMethod(
  42773. $core.method({
  42774. selector: "value:",
  42775. protocol: "evaluating",
  42776. fn: function (anArgument){
  42777. var self=this;
  42778. return $core.withContext(function($ctx1) {
  42779. return self._valueWithPossibleArguments_([anArgument]);
  42780. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  42781. },
  42782. args: ["anArgument"],
  42783. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  42784. referencedClasses: [],
  42785. messageSends: ["valueWithPossibleArguments:"]
  42786. }),
  42787. $globals.AIBlockClosure);
  42788. $core.addMethod(
  42789. $core.method({
  42790. selector: "value:value:",
  42791. protocol: "evaluating",
  42792. fn: function (firstArgument,secondArgument){
  42793. var self=this;
  42794. return $core.withContext(function($ctx1) {
  42795. return self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  42796. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  42797. },
  42798. args: ["firstArgument", "secondArgument"],
  42799. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  42800. referencedClasses: [],
  42801. messageSends: ["valueWithPossibleArguments:"]
  42802. }),
  42803. $globals.AIBlockClosure);
  42804. $core.addMethod(
  42805. $core.method({
  42806. selector: "value:value:value:",
  42807. protocol: "evaluating",
  42808. fn: function (firstArgument,secondArgument,thirdArgument){
  42809. var self=this;
  42810. return $core.withContext(function($ctx1) {
  42811. return self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  42812. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  42813. },
  42814. args: ["firstArgument", "secondArgument", "thirdArgument"],
  42815. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  42816. referencedClasses: [],
  42817. messageSends: ["valueWithPossibleArguments:"]
  42818. }),
  42819. $globals.AIBlockClosure);
  42820. $core.addMethod(
  42821. $core.method({
  42822. selector: "valueWithPossibleArguments:",
  42823. protocol: "evaluating",
  42824. fn: function (aCollection){
  42825. var self=this;
  42826. var context,sequenceNode;
  42827. return $core.withContext(function($ctx1) {
  42828. var $1,$2,$3;
  42829. context=$recv(self["@outerContext"])._newInnerContext();
  42830. $1=$recv($recv($recv(self["@node"])._dagChildren())._first())._copy();
  42831. $recv($1)._parent_(nil);
  42832. sequenceNode=$recv($1)._yourself();
  42833. $recv($recv(sequenceNode)._temps())._do_((function(each){
  42834. return $core.withContext(function($ctx2) {
  42835. return $recv(context)._defineLocal_(each);
  42836. $ctx2.sendIdx["defineLocal:"]=1;
  42837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42838. }));
  42839. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  42840. return $core.withContext(function($ctx2) {
  42841. $recv(context)._defineLocal_(each);
  42842. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  42843. return nil;
  42844. })));
  42845. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  42846. }));
  42847. $2=$recv(context)._interpreter();
  42848. $ctx1.sendIdx["interpreter"]=1;
  42849. $recv($2)._node_(sequenceNode);
  42850. $recv($2)._enterNode();
  42851. $recv($2)._proceed();
  42852. $3=$recv(self["@outerContext"])._interpreter();
  42853. $ctx1.sendIdx["interpreter"]=2;
  42854. $recv($3)._setNonLocalReturnFromContext_(context);
  42855. return $recv($recv(context)._interpreter())._pop();
  42856. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  42857. },
  42858. args: ["aCollection"],
  42859. 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",
  42860. referencedClasses: [],
  42861. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  42862. }),
  42863. $globals.AIBlockClosure);
  42864. $core.addMethod(
  42865. $core.method({
  42866. selector: "forContext:node:",
  42867. protocol: "instance creation",
  42868. fn: function (aContext,aNode){
  42869. var self=this;
  42870. return $core.withContext(function($ctx1) {
  42871. var $1;
  42872. $1=self._new();
  42873. $recv($1)._initializeWithContext_node_(aContext,aNode);
  42874. return $recv($1)._yourself();
  42875. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  42876. },
  42877. args: ["aContext", "aNode"],
  42878. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  42879. referencedClasses: [],
  42880. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  42881. }),
  42882. $globals.AIBlockClosure.klass);
  42883. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  42884. $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)";
  42885. $core.addMethod(
  42886. $core.method({
  42887. selector: "arguments",
  42888. protocol: "interpreting",
  42889. fn: function (){
  42890. var self=this;
  42891. return $core.withContext(function($ctx1) {
  42892. return $recv($recv(self._ast())._arguments())._collect_((function(each){
  42893. return $core.withContext(function($ctx2) {
  42894. return self._localAt_ifAbsent_(each,(function(){
  42895. return $core.withContext(function($ctx3) {
  42896. return self._error_("Argument not in context");
  42897. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42898. }));
  42899. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42900. }));
  42901. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  42902. },
  42903. args: [],
  42904. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  42905. referencedClasses: [],
  42906. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  42907. }),
  42908. $globals.AIContext);
  42909. $core.addMethod(
  42910. $core.method({
  42911. selector: "ast",
  42912. protocol: "interpreting",
  42913. fn: function (){
  42914. var self=this;
  42915. return $core.withContext(function($ctx1) {
  42916. var $1,$2,$3,$receiver;
  42917. $1=self._isBlockContext();
  42918. if($core.assert($1)){
  42919. $2=self._outerContext();
  42920. if(($receiver = $2) == null || $receiver.isNil){
  42921. return $2;
  42922. } else {
  42923. var context;
  42924. context=$receiver;
  42925. return $recv(context)._ast();
  42926. }
  42927. }
  42928. $3=self["@ast"];
  42929. if(($receiver = $3) == null || $receiver.isNil){
  42930. self._initializeAST();
  42931. } else {
  42932. $3;
  42933. }
  42934. return self["@ast"];
  42935. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  42936. },
  42937. args: [],
  42938. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  42939. referencedClasses: [],
  42940. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  42941. }),
  42942. $globals.AIContext);
  42943. $core.addMethod(
  42944. $core.method({
  42945. selector: "basicLocalAt:",
  42946. protocol: "private",
  42947. fn: function (aString){
  42948. var self=this;
  42949. return $core.withContext(function($ctx1) {
  42950. return $recv(self._locals())._at_(aString);
  42951. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  42952. },
  42953. args: ["aString"],
  42954. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  42955. referencedClasses: [],
  42956. messageSends: ["at:", "locals"]
  42957. }),
  42958. $globals.AIContext);
  42959. $core.addMethod(
  42960. $core.method({
  42961. selector: "basicLocalAt:put:",
  42962. protocol: "private",
  42963. fn: function (aString,anObject){
  42964. var self=this;
  42965. return $core.withContext(function($ctx1) {
  42966. $recv(self._locals())._at_put_(aString,anObject);
  42967. return self;
  42968. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  42969. },
  42970. args: ["aString", "anObject"],
  42971. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  42972. referencedClasses: [],
  42973. messageSends: ["at:put:", "locals"]
  42974. }),
  42975. $globals.AIContext);
  42976. $core.addMethod(
  42977. $core.method({
  42978. selector: "basicReceiver",
  42979. protocol: "interpreting",
  42980. fn: function (){
  42981. var self=this;
  42982. return $core.withContext(function($ctx1) {
  42983. return self._localAt_("self");
  42984. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  42985. },
  42986. args: [],
  42987. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  42988. referencedClasses: [],
  42989. messageSends: ["localAt:"]
  42990. }),
  42991. $globals.AIContext);
  42992. $core.addMethod(
  42993. $core.method({
  42994. selector: "defineLocal:",
  42995. protocol: "accessing",
  42996. fn: function (aString){
  42997. var self=this;
  42998. return $core.withContext(function($ctx1) {
  42999. $recv(self._locals())._at_put_(aString,nil);
  43000. return self;
  43001. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  43002. },
  43003. args: ["aString"],
  43004. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  43005. referencedClasses: [],
  43006. messageSends: ["at:put:", "locals"]
  43007. }),
  43008. $globals.AIContext);
  43009. $core.addMethod(
  43010. $core.method({
  43011. selector: "evaluate:on:",
  43012. protocol: "evaluating",
  43013. fn: function (aString,anEvaluator){
  43014. var self=this;
  43015. return $core.withContext(function($ctx1) {
  43016. return $recv(anEvaluator)._evaluate_context_(aString,self);
  43017. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  43018. },
  43019. args: ["aString", "anEvaluator"],
  43020. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  43021. referencedClasses: [],
  43022. messageSends: ["evaluate:context:"]
  43023. }),
  43024. $globals.AIContext);
  43025. $core.addMethod(
  43026. $core.method({
  43027. selector: "evaluateNode:",
  43028. protocol: "evaluating",
  43029. fn: function (aNode){
  43030. var self=this;
  43031. return $core.withContext(function($ctx1) {
  43032. var $1;
  43033. $1=$recv($globals.ASTInterpreter)._new();
  43034. $recv($1)._context_(self);
  43035. $recv($1)._node_(aNode);
  43036. $recv($1)._enterNode();
  43037. $recv($1)._proceed();
  43038. return $recv($1)._result();
  43039. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  43040. },
  43041. args: ["aNode"],
  43042. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  43043. referencedClasses: ["ASTInterpreter"],
  43044. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  43045. }),
  43046. $globals.AIContext);
  43047. $core.addMethod(
  43048. $core.method({
  43049. selector: "evaluatedSelector",
  43050. protocol: "accessing",
  43051. fn: function (){
  43052. var self=this;
  43053. return self["@evaluatedSelector"];
  43054. },
  43055. args: [],
  43056. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  43057. referencedClasses: [],
  43058. messageSends: []
  43059. }),
  43060. $globals.AIContext);
  43061. $core.addMethod(
  43062. $core.method({
  43063. selector: "evaluatedSelector:",
  43064. protocol: "accessing",
  43065. fn: function (aString){
  43066. var self=this;
  43067. self["@evaluatedSelector"]=aString;
  43068. return self;
  43069. },
  43070. args: ["aString"],
  43071. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  43072. referencedClasses: [],
  43073. messageSends: []
  43074. }),
  43075. $globals.AIContext);
  43076. $core.addMethod(
  43077. $core.method({
  43078. selector: "index",
  43079. protocol: "accessing",
  43080. fn: function (){
  43081. var self=this;
  43082. return $core.withContext(function($ctx1) {
  43083. var $1,$receiver;
  43084. $1=self["@index"];
  43085. if(($receiver = $1) == null || $receiver.isNil){
  43086. return (0);
  43087. } else {
  43088. return $1;
  43089. }
  43090. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  43091. },
  43092. args: [],
  43093. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  43094. referencedClasses: [],
  43095. messageSends: ["ifNil:"]
  43096. }),
  43097. $globals.AIContext);
  43098. $core.addMethod(
  43099. $core.method({
  43100. selector: "index:",
  43101. protocol: "accessing",
  43102. fn: function (anInteger){
  43103. var self=this;
  43104. self["@index"]=anInteger;
  43105. return self;
  43106. },
  43107. args: ["anInteger"],
  43108. source: "index: anInteger\x0a\x09index := anInteger",
  43109. referencedClasses: [],
  43110. messageSends: []
  43111. }),
  43112. $globals.AIContext);
  43113. $core.addMethod(
  43114. $core.method({
  43115. selector: "initializeAST",
  43116. protocol: "initialization",
  43117. fn: function (){
  43118. var self=this;
  43119. return $core.withContext(function($ctx1) {
  43120. var $1;
  43121. $1=self._method();
  43122. $ctx1.sendIdx["method"]=1;
  43123. self["@ast"]=$recv($1)._ast();
  43124. $recv($recv($globals.SemanticAnalyzer)._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  43125. return self;
  43126. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  43127. },
  43128. args: [],
  43129. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  43130. referencedClasses: ["SemanticAnalyzer"],
  43131. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  43132. }),
  43133. $globals.AIContext);
  43134. $core.addMethod(
  43135. $core.method({
  43136. selector: "initializeFromMethodContext:",
  43137. protocol: "initialization",
  43138. fn: function (aMethodContext){
  43139. var self=this;
  43140. return $core.withContext(function($ctx1) {
  43141. var $1,$2,$3,$receiver;
  43142. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  43143. self._index_($recv(aMethodContext)._index());
  43144. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  43145. self._receiver_($recv(aMethodContext)._receiver());
  43146. self._supercall_($recv(aMethodContext)._supercall());
  43147. self._selector_($recv(aMethodContext)._selector());
  43148. $1=$recv(aMethodContext)._outerContext();
  43149. $ctx1.sendIdx["outerContext"]=1;
  43150. if(($receiver = $1) == null || $receiver.isNil){
  43151. $1;
  43152. } else {
  43153. var outer;
  43154. outer=$receiver;
  43155. $2=$recv(outer)._methodContext();
  43156. if(($receiver = $2) == null || $receiver.isNil){
  43157. $2;
  43158. } else {
  43159. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  43160. }
  43161. $3=$recv(aMethodContext)._locals();
  43162. $ctx1.sendIdx["locals"]=1;
  43163. $recv($3)._keysAndValuesDo_((function(key,value){
  43164. return $core.withContext(function($ctx2) {
  43165. return $recv(self._locals())._at_put_(key,value);
  43166. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  43167. }));
  43168. }
  43169. return self;
  43170. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  43171. },
  43172. args: ["aMethodContext"],
  43173. 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 ] ]",
  43174. referencedClasses: [],
  43175. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  43176. }),
  43177. $globals.AIContext);
  43178. $core.addMethod(
  43179. $core.method({
  43180. selector: "initializeInterpreter",
  43181. protocol: "initialization",
  43182. fn: function (){
  43183. var self=this;
  43184. return $core.withContext(function($ctx1) {
  43185. var $1,$2,$receiver;
  43186. $1=$recv($globals.ASTInterpreter)._new();
  43187. $recv($1)._context_(self);
  43188. self["@interpreter"]=$recv($1)._yourself();
  43189. $2=self._innerContext();
  43190. if(($receiver = $2) == null || $receiver.isNil){
  43191. $2;
  43192. } else {
  43193. self._setupInterpreter_(self["@interpreter"]);
  43194. }
  43195. return self;
  43196. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  43197. },
  43198. args: [],
  43199. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  43200. referencedClasses: ["ASTInterpreter"],
  43201. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  43202. }),
  43203. $globals.AIContext);
  43204. $core.addMethod(
  43205. $core.method({
  43206. selector: "initializeLocals",
  43207. protocol: "initialization",
  43208. fn: function (){
  43209. var self=this;
  43210. return $core.withContext(function($ctx1) {
  43211. self["@locals"]=$recv($globals.Dictionary)._new();
  43212. $recv(self["@locals"])._at_put_("thisContext",self);
  43213. return self;
  43214. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  43215. },
  43216. args: [],
  43217. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  43218. referencedClasses: ["Dictionary"],
  43219. messageSends: ["new", "at:put:"]
  43220. }),
  43221. $globals.AIContext);
  43222. $core.addMethod(
  43223. $core.method({
  43224. selector: "innerContext",
  43225. protocol: "accessing",
  43226. fn: function (){
  43227. var self=this;
  43228. return self["@innerContext"];
  43229. },
  43230. args: [],
  43231. source: "innerContext\x0a\x09^ innerContext",
  43232. referencedClasses: [],
  43233. messageSends: []
  43234. }),
  43235. $globals.AIContext);
  43236. $core.addMethod(
  43237. $core.method({
  43238. selector: "innerContext:",
  43239. protocol: "accessing",
  43240. fn: function (anAIContext){
  43241. var self=this;
  43242. self["@innerContext"]=anAIContext;
  43243. return self;
  43244. },
  43245. args: ["anAIContext"],
  43246. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  43247. referencedClasses: [],
  43248. messageSends: []
  43249. }),
  43250. $globals.AIContext);
  43251. $core.addMethod(
  43252. $core.method({
  43253. selector: "interpreter",
  43254. protocol: "interpreting",
  43255. fn: function (){
  43256. var self=this;
  43257. return $core.withContext(function($ctx1) {
  43258. var $1,$receiver;
  43259. $1=self["@interpreter"];
  43260. if(($receiver = $1) == null || $receiver.isNil){
  43261. self._initializeInterpreter();
  43262. } else {
  43263. $1;
  43264. }
  43265. return self["@interpreter"];
  43266. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  43267. },
  43268. args: [],
  43269. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  43270. referencedClasses: [],
  43271. messageSends: ["ifNil:", "initializeInterpreter"]
  43272. }),
  43273. $globals.AIContext);
  43274. $core.addMethod(
  43275. $core.method({
  43276. selector: "interpreter:",
  43277. protocol: "interpreting",
  43278. fn: function (anInterpreter){
  43279. var self=this;
  43280. self["@interpreter"]=anInterpreter;
  43281. return self;
  43282. },
  43283. args: ["anInterpreter"],
  43284. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  43285. referencedClasses: [],
  43286. messageSends: []
  43287. }),
  43288. $globals.AIContext);
  43289. $core.addMethod(
  43290. $core.method({
  43291. selector: "isTopContext",
  43292. protocol: "testing",
  43293. fn: function (){
  43294. var self=this;
  43295. return $core.withContext(function($ctx1) {
  43296. return $recv(self._innerContext())._isNil();
  43297. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  43298. },
  43299. args: [],
  43300. source: "isTopContext\x0a\x09^ self innerContext isNil",
  43301. referencedClasses: [],
  43302. messageSends: ["isNil", "innerContext"]
  43303. }),
  43304. $globals.AIContext);
  43305. $core.addMethod(
  43306. $core.method({
  43307. selector: "localAt:",
  43308. protocol: "accessing",
  43309. fn: function (aString){
  43310. var self=this;
  43311. var context;
  43312. return $core.withContext(function($ctx1) {
  43313. context=self._lookupContextForLocal_(aString);
  43314. return $recv(context)._basicLocalAt_(aString);
  43315. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  43316. },
  43317. args: ["aString"],
  43318. 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",
  43319. referencedClasses: [],
  43320. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  43321. }),
  43322. $globals.AIContext);
  43323. $core.addMethod(
  43324. $core.method({
  43325. selector: "localAt:ifAbsent:",
  43326. protocol: "accessing",
  43327. fn: function (aString,aBlock){
  43328. var self=this;
  43329. var context;
  43330. return $core.withContext(function($ctx1) {
  43331. var $early={};
  43332. try {
  43333. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  43334. return $core.withContext(function($ctx2) {
  43335. throw $early=[$recv(aBlock)._value()];
  43336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43337. }));
  43338. return $recv(context)._basicLocalAt_(aString);
  43339. }
  43340. catch(e) {if(e===$early)return e[0]; throw e}
  43341. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  43342. },
  43343. args: ["aString", "aBlock"],
  43344. 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",
  43345. referencedClasses: [],
  43346. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  43347. }),
  43348. $globals.AIContext);
  43349. $core.addMethod(
  43350. $core.method({
  43351. selector: "localAt:put:",
  43352. protocol: "accessing",
  43353. fn: function (aString,anObject){
  43354. var self=this;
  43355. var context;
  43356. return $core.withContext(function($ctx1) {
  43357. context=self._lookupContextForLocal_(aString);
  43358. $recv(context)._basicLocalAt_put_(aString,anObject);
  43359. return self;
  43360. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  43361. },
  43362. args: ["aString", "anObject"],
  43363. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  43364. referencedClasses: [],
  43365. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  43366. }),
  43367. $globals.AIContext);
  43368. $core.addMethod(
  43369. $core.method({
  43370. selector: "locals",
  43371. protocol: "accessing",
  43372. fn: function (){
  43373. var self=this;
  43374. return $core.withContext(function($ctx1) {
  43375. var $1,$receiver;
  43376. $1=self["@locals"];
  43377. if(($receiver = $1) == null || $receiver.isNil){
  43378. self._initializeLocals();
  43379. } else {
  43380. $1;
  43381. }
  43382. return self["@locals"];
  43383. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  43384. },
  43385. args: [],
  43386. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  43387. referencedClasses: [],
  43388. messageSends: ["ifNil:", "initializeLocals"]
  43389. }),
  43390. $globals.AIContext);
  43391. $core.addMethod(
  43392. $core.method({
  43393. selector: "lookupContextForLocal:",
  43394. protocol: "private",
  43395. fn: function (aString){
  43396. var self=this;
  43397. return $core.withContext(function($ctx1) {
  43398. return self._lookupContextForLocal_ifNone_(aString,(function(){
  43399. return $core.withContext(function($ctx2) {
  43400. return self._variableNotFound();
  43401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43402. }));
  43403. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  43404. },
  43405. args: ["aString"],
  43406. 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 ]",
  43407. referencedClasses: [],
  43408. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  43409. }),
  43410. $globals.AIContext);
  43411. $core.addMethod(
  43412. $core.method({
  43413. selector: "lookupContextForLocal:ifNone:",
  43414. protocol: "private",
  43415. fn: function (aString,aBlock){
  43416. var self=this;
  43417. return $core.withContext(function($ctx1) {
  43418. var $1;
  43419. return $recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  43420. return self;
  43421. }),(function(){
  43422. return $core.withContext(function($ctx2) {
  43423. $1=self._outerContext();
  43424. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  43425. return $core.withContext(function($ctx3) {
  43426. return $recv(context)._lookupContextForLocal_(aString);
  43427. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  43428. }));
  43429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43430. }));
  43431. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  43432. },
  43433. args: ["aString", "aBlock"],
  43434. 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 ] ]",
  43435. referencedClasses: [],
  43436. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  43437. }),
  43438. $globals.AIContext);
  43439. $core.addMethod(
  43440. $core.method({
  43441. selector: "newInnerContext",
  43442. protocol: "factory",
  43443. fn: function (){
  43444. var self=this;
  43445. return $core.withContext(function($ctx1) {
  43446. var $1;
  43447. $1=$recv(self._class())._new();
  43448. $recv($1)._outerContext_(self);
  43449. return $recv($1)._yourself();
  43450. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  43451. },
  43452. args: [],
  43453. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  43454. referencedClasses: [],
  43455. messageSends: ["outerContext:", "new", "class", "yourself"]
  43456. }),
  43457. $globals.AIContext);
  43458. $core.addMethod(
  43459. $core.method({
  43460. selector: "outerContext",
  43461. protocol: "accessing",
  43462. fn: function (){
  43463. var self=this;
  43464. return self["@outerContext"];
  43465. },
  43466. args: [],
  43467. source: "outerContext\x0a\x09^ outerContext",
  43468. referencedClasses: [],
  43469. messageSends: []
  43470. }),
  43471. $globals.AIContext);
  43472. $core.addMethod(
  43473. $core.method({
  43474. selector: "outerContext:",
  43475. protocol: "accessing",
  43476. fn: function (anAIContext){
  43477. var self=this;
  43478. return $core.withContext(function($ctx1) {
  43479. var $1,$receiver;
  43480. self["@outerContext"]=anAIContext;
  43481. $1=self["@outerContext"];
  43482. if(($receiver = $1) == null || $receiver.isNil){
  43483. $1;
  43484. } else {
  43485. var context;
  43486. context=$receiver;
  43487. $recv(context)._innerContext_(self);
  43488. }
  43489. return self;
  43490. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  43491. },
  43492. args: ["anAIContext"],
  43493. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  43494. referencedClasses: [],
  43495. messageSends: ["ifNotNil:", "innerContext:"]
  43496. }),
  43497. $globals.AIContext);
  43498. $core.addMethod(
  43499. $core.method({
  43500. selector: "receiver:",
  43501. protocol: "interpreting",
  43502. fn: function (anObject){
  43503. var self=this;
  43504. return $core.withContext(function($ctx1) {
  43505. $recv(self._locals())._at_put_("self",anObject);
  43506. return self;
  43507. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  43508. },
  43509. args: ["anObject"],
  43510. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  43511. referencedClasses: [],
  43512. messageSends: ["at:put:", "locals"]
  43513. }),
  43514. $globals.AIContext);
  43515. $core.addMethod(
  43516. $core.method({
  43517. selector: "selector",
  43518. protocol: "accessing",
  43519. fn: function (){
  43520. var self=this;
  43521. return self["@selector"];
  43522. },
  43523. args: [],
  43524. source: "selector\x0a\x09^ selector",
  43525. referencedClasses: [],
  43526. messageSends: []
  43527. }),
  43528. $globals.AIContext);
  43529. $core.addMethod(
  43530. $core.method({
  43531. selector: "selector:",
  43532. protocol: "accessing",
  43533. fn: function (aString){
  43534. var self=this;
  43535. self["@selector"]=aString;
  43536. return self;
  43537. },
  43538. args: ["aString"],
  43539. source: "selector: aString\x0a\x09selector := aString",
  43540. referencedClasses: [],
  43541. messageSends: []
  43542. }),
  43543. $globals.AIContext);
  43544. $core.addMethod(
  43545. $core.method({
  43546. selector: "sendIndexAt:",
  43547. protocol: "accessing",
  43548. fn: function (aString){
  43549. var self=this;
  43550. return $core.withContext(function($ctx1) {
  43551. return $recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  43552. return (0);
  43553. }));
  43554. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  43555. },
  43556. args: ["aString"],
  43557. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  43558. referencedClasses: [],
  43559. messageSends: ["at:ifAbsent:", "sendIndexes"]
  43560. }),
  43561. $globals.AIContext);
  43562. $core.addMethod(
  43563. $core.method({
  43564. selector: "sendIndexes",
  43565. protocol: "accessing",
  43566. fn: function (){
  43567. var self=this;
  43568. return $core.withContext(function($ctx1) {
  43569. var $1,$receiver;
  43570. $1=self["@sendIndexes"];
  43571. if(($receiver = $1) == null || $receiver.isNil){
  43572. return $recv($globals.Dictionary)._new();
  43573. } else {
  43574. return $1;
  43575. }
  43576. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  43577. },
  43578. args: [],
  43579. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  43580. referencedClasses: ["Dictionary"],
  43581. messageSends: ["ifNil:", "new"]
  43582. }),
  43583. $globals.AIContext);
  43584. $core.addMethod(
  43585. $core.method({
  43586. selector: "sendIndexes:",
  43587. protocol: "accessing",
  43588. fn: function (aDictionary){
  43589. var self=this;
  43590. self["@sendIndexes"]=aDictionary;
  43591. return self;
  43592. },
  43593. args: ["aDictionary"],
  43594. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  43595. referencedClasses: [],
  43596. messageSends: []
  43597. }),
  43598. $globals.AIContext);
  43599. $core.addMethod(
  43600. $core.method({
  43601. selector: "setupInterpreter:",
  43602. protocol: "interpreting",
  43603. fn: function (anInterpreter){
  43604. var self=this;
  43605. var currentNode;
  43606. return $core.withContext(function($ctx1) {
  43607. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  43608. $1=$recv($globals.ASTPCNodeVisitor)._new();
  43609. $2=self._evaluatedSelector();
  43610. $ctx1.sendIdx["evaluatedSelector"]=1;
  43611. $recv($1)._selector_($2);
  43612. $recv($1)._index_(self._sendIndexAt_(self._evaluatedSelector()));
  43613. $3=self._ast();
  43614. $ctx1.sendIdx["ast"]=1;
  43615. $recv($1)._visit_($3);
  43616. currentNode=$recv($1)._currentNode();
  43617. $4=$recv(self._ast())._sequenceNode();
  43618. if(($receiver = $4) == null || $receiver.isNil){
  43619. $4;
  43620. } else {
  43621. var sequence;
  43622. sequence=$receiver;
  43623. $recv($recv(sequence)._temps())._do_((function(each){
  43624. return $core.withContext(function($ctx2) {
  43625. return self._defineLocal_(each);
  43626. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43627. }));
  43628. $ctx1.sendIdx["do:"]=1;
  43629. }
  43630. $recv(anInterpreter)._node_(currentNode);
  43631. $7=self._innerContext();
  43632. $ctx1.sendIdx["innerContext"]=1;
  43633. $6=$recv($7)._arguments();
  43634. $5=$recv($6)._reversed();
  43635. $recv($5)._do_((function(each){
  43636. return $core.withContext(function($ctx2) {
  43637. return $recv(anInterpreter)._push_(each);
  43638. $ctx2.sendIdx["push:"]=1;
  43639. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  43640. }));
  43641. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  43642. return self;
  43643. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  43644. },
  43645. args: ["anInterpreter"],
  43646. 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)",
  43647. referencedClasses: ["ASTPCNodeVisitor"],
  43648. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  43649. }),
  43650. $globals.AIContext);
  43651. $core.addMethod(
  43652. $core.method({
  43653. selector: "supercall",
  43654. protocol: "interpreting",
  43655. fn: function (){
  43656. var self=this;
  43657. return $core.withContext(function($ctx1) {
  43658. var $1,$receiver;
  43659. $1=self["@supercall"];
  43660. if(($receiver = $1) == null || $receiver.isNil){
  43661. return false;
  43662. } else {
  43663. return $1;
  43664. }
  43665. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  43666. },
  43667. args: [],
  43668. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  43669. referencedClasses: [],
  43670. messageSends: ["ifNil:"]
  43671. }),
  43672. $globals.AIContext);
  43673. $core.addMethod(
  43674. $core.method({
  43675. selector: "supercall:",
  43676. protocol: "interpreting",
  43677. fn: function (aBoolean){
  43678. var self=this;
  43679. self["@supercall"]=aBoolean;
  43680. return self;
  43681. },
  43682. args: ["aBoolean"],
  43683. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  43684. referencedClasses: [],
  43685. messageSends: []
  43686. }),
  43687. $globals.AIContext);
  43688. $core.addMethod(
  43689. $core.method({
  43690. selector: "variableNotFound",
  43691. protocol: "error handling",
  43692. fn: function (){
  43693. var self=this;
  43694. return $core.withContext(function($ctx1) {
  43695. self._error_("Variable missing");
  43696. return self;
  43697. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  43698. },
  43699. args: [],
  43700. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  43701. referencedClasses: [],
  43702. messageSends: ["error:"]
  43703. }),
  43704. $globals.AIContext);
  43705. $core.addMethod(
  43706. $core.method({
  43707. selector: "fromMethodContext:",
  43708. protocol: "instance creation",
  43709. fn: function (aMethodContext){
  43710. var self=this;
  43711. return $core.withContext(function($ctx1) {
  43712. var $1;
  43713. $1=self._new();
  43714. $recv($1)._initializeFromMethodContext_(aMethodContext);
  43715. return $recv($1)._yourself();
  43716. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  43717. },
  43718. args: ["aMethodContext"],
  43719. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  43720. referencedClasses: [],
  43721. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  43722. }),
  43723. $globals.AIContext.klass);
  43724. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  43725. $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.";
  43726. $core.addMethod(
  43727. $core.method({
  43728. selector: "context",
  43729. protocol: "accessing",
  43730. fn: function (){
  43731. var self=this;
  43732. return self["@context"];
  43733. },
  43734. args: [],
  43735. source: "context\x0a\x09^ context",
  43736. referencedClasses: [],
  43737. messageSends: []
  43738. }),
  43739. $globals.AISemanticAnalyzer);
  43740. $core.addMethod(
  43741. $core.method({
  43742. selector: "context:",
  43743. protocol: "accessing",
  43744. fn: function (anAIContext){
  43745. var self=this;
  43746. self["@context"]=anAIContext;
  43747. return self;
  43748. },
  43749. args: ["anAIContext"],
  43750. source: "context: anAIContext\x0a\x09context := anAIContext",
  43751. referencedClasses: [],
  43752. messageSends: []
  43753. }),
  43754. $globals.AISemanticAnalyzer);
  43755. $core.addMethod(
  43756. $core.method({
  43757. selector: "visitVariableNode:",
  43758. protocol: "visiting",
  43759. fn: function (aNode){
  43760. var self=this;
  43761. return $core.withContext(function($ctx1) {
  43762. var $1;
  43763. var $early={};
  43764. try {
  43765. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  43766. return $core.withContext(function($ctx2) {
  43767. $1=(
  43768. $ctx2.supercall = true,
  43769. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  43770. $ctx2.supercall = false;
  43771. throw $early=[$1];
  43772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43773. }));
  43774. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  43775. return self;
  43776. }
  43777. catch(e) {if(e===$early)return e[0]; throw e}
  43778. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  43779. },
  43780. args: ["aNode"],
  43781. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  43782. referencedClasses: ["ASTContextVar"],
  43783. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  43784. }),
  43785. $globals.AISemanticAnalyzer);
  43786. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  43787. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  43788. $core.addMethod(
  43789. $core.method({
  43790. selector: "context",
  43791. protocol: "accessing",
  43792. fn: function (){
  43793. var self=this;
  43794. return self["@context"];
  43795. },
  43796. args: [],
  43797. source: "context\x0a\x09^ context",
  43798. referencedClasses: [],
  43799. messageSends: []
  43800. }),
  43801. $globals.ASTContextVar);
  43802. $core.addMethod(
  43803. $core.method({
  43804. selector: "context:",
  43805. protocol: "accessing",
  43806. fn: function (anObject){
  43807. var self=this;
  43808. self["@context"]=anObject;
  43809. return self;
  43810. },
  43811. args: ["anObject"],
  43812. source: "context: anObject\x0a\x09context := anObject",
  43813. referencedClasses: [],
  43814. messageSends: []
  43815. }),
  43816. $globals.ASTContextVar);
  43817. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  43818. $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.";
  43819. $core.addMethod(
  43820. $core.method({
  43821. selector: "atEnd",
  43822. protocol: "testing",
  43823. fn: function (){
  43824. var self=this;
  43825. return $core.withContext(function($ctx1) {
  43826. var $1,$receiver;
  43827. $1=self._context();
  43828. $ctx1.sendIdx["context"]=1;
  43829. if(($receiver = $1) == null || $receiver.isNil){
  43830. return true;
  43831. } else {
  43832. $1;
  43833. }
  43834. return $recv($recv(self._interpreter())._atEnd())._and_((function(){
  43835. return $core.withContext(function($ctx2) {
  43836. return $recv(self._context())._isTopContext();
  43837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43838. }));
  43839. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  43840. },
  43841. args: [],
  43842. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  43843. referencedClasses: [],
  43844. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  43845. }),
  43846. $globals.ASTDebugger);
  43847. $core.addMethod(
  43848. $core.method({
  43849. selector: "context",
  43850. protocol: "accessing",
  43851. fn: function (){
  43852. var self=this;
  43853. return self["@context"];
  43854. },
  43855. args: [],
  43856. source: "context\x0a\x09^ context",
  43857. referencedClasses: [],
  43858. messageSends: []
  43859. }),
  43860. $globals.ASTDebugger);
  43861. $core.addMethod(
  43862. $core.method({
  43863. selector: "context:",
  43864. protocol: "accessing",
  43865. fn: function (aContext){
  43866. var self=this;
  43867. self["@context"]=aContext;
  43868. return self;
  43869. },
  43870. args: ["aContext"],
  43871. source: "context: aContext\x0a\x09context := aContext",
  43872. referencedClasses: [],
  43873. messageSends: []
  43874. }),
  43875. $globals.ASTDebugger);
  43876. $core.addMethod(
  43877. $core.method({
  43878. selector: "flushInnerContexts",
  43879. protocol: "actions",
  43880. fn: function (){
  43881. var self=this;
  43882. return $core.withContext(function($ctx1) {
  43883. var $1,$receiver;
  43884. $1=self._context();
  43885. if(($receiver = $1) == null || $receiver.isNil){
  43886. $1;
  43887. } else {
  43888. var cxt;
  43889. cxt=$receiver;
  43890. $recv(cxt)._innerContext_(nil);
  43891. }
  43892. return self;
  43893. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  43894. },
  43895. args: [],
  43896. 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 ]",
  43897. referencedClasses: [],
  43898. messageSends: ["ifNotNil:", "context", "innerContext:"]
  43899. }),
  43900. $globals.ASTDebugger);
  43901. $core.addMethod(
  43902. $core.method({
  43903. selector: "interpreter",
  43904. protocol: "accessing",
  43905. fn: function (){
  43906. var self=this;
  43907. return $core.withContext(function($ctx1) {
  43908. var $1,$receiver;
  43909. $1=self._context();
  43910. if(($receiver = $1) == null || $receiver.isNil){
  43911. return $1;
  43912. } else {
  43913. var ctx;
  43914. ctx=$receiver;
  43915. return $recv(ctx)._interpreter();
  43916. }
  43917. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  43918. },
  43919. args: [],
  43920. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  43921. referencedClasses: [],
  43922. messageSends: ["ifNotNil:", "context", "interpreter"]
  43923. }),
  43924. $globals.ASTDebugger);
  43925. $core.addMethod(
  43926. $core.method({
  43927. selector: "method",
  43928. protocol: "accessing",
  43929. fn: function (){
  43930. var self=this;
  43931. return $core.withContext(function($ctx1) {
  43932. return $recv(self._context())._method();
  43933. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  43934. },
  43935. args: [],
  43936. source: "method\x0a\x09^ self context method",
  43937. referencedClasses: [],
  43938. messageSends: ["method", "context"]
  43939. }),
  43940. $globals.ASTDebugger);
  43941. $core.addMethod(
  43942. $core.method({
  43943. selector: "node",
  43944. protocol: "accessing",
  43945. fn: function (){
  43946. var self=this;
  43947. return $core.withContext(function($ctx1) {
  43948. var $1,$receiver;
  43949. $1=self._interpreter();
  43950. $ctx1.sendIdx["interpreter"]=1;
  43951. if(($receiver = $1) == null || $receiver.isNil){
  43952. return $1;
  43953. } else {
  43954. return $recv(self._interpreter())._node();
  43955. }
  43956. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  43957. },
  43958. args: [],
  43959. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  43960. referencedClasses: [],
  43961. messageSends: ["ifNotNil:", "interpreter", "node"]
  43962. }),
  43963. $globals.ASTDebugger);
  43964. $core.addMethod(
  43965. $core.method({
  43966. selector: "onStep",
  43967. protocol: "private",
  43968. fn: function (){
  43969. var self=this;
  43970. return $core.withContext(function($ctx1) {
  43971. var $1,$3,$2,$4,$6,$5,$receiver;
  43972. $1=self._interpreter();
  43973. $ctx1.sendIdx["interpreter"]=1;
  43974. self["@result"]=$recv($1)._result();
  43975. $3=self._interpreter();
  43976. $ctx1.sendIdx["interpreter"]=2;
  43977. $2=$recv($3)._atEnd();
  43978. $ctx1.sendIdx["atEnd"]=1;
  43979. if($core.assert($2)){
  43980. $4=$recv(self._context())._outerContext();
  43981. if(($receiver = $4) == null || $receiver.isNil){
  43982. $4;
  43983. } else {
  43984. var outerContext;
  43985. outerContext=$receiver;
  43986. self._context_(outerContext);
  43987. }
  43988. $6=self._interpreter();
  43989. $ctx1.sendIdx["interpreter"]=3;
  43990. $5=$recv($6)._atEnd();
  43991. if(!$core.assert($5)){
  43992. $recv(self._interpreter())._skip();
  43993. }
  43994. }
  43995. self._flushInnerContexts();
  43996. return self;
  43997. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  43998. },
  43999. args: [],
  44000. 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",
  44001. referencedClasses: [],
  44002. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  44003. }),
  44004. $globals.ASTDebugger);
  44005. $core.addMethod(
  44006. $core.method({
  44007. selector: "proceed",
  44008. protocol: "stepping",
  44009. fn: function (){
  44010. var self=this;
  44011. return $core.withContext(function($ctx1) {
  44012. $recv((function(){
  44013. return $core.withContext(function($ctx2) {
  44014. return self._atEnd();
  44015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44016. }))._whileFalse_((function(){
  44017. return $core.withContext(function($ctx2) {
  44018. return self._stepOver();
  44019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44020. }));
  44021. return self;
  44022. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  44023. },
  44024. args: [],
  44025. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  44026. referencedClasses: [],
  44027. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  44028. }),
  44029. $globals.ASTDebugger);
  44030. $core.addMethod(
  44031. $core.method({
  44032. selector: "restart",
  44033. protocol: "stepping",
  44034. fn: function (){
  44035. var self=this;
  44036. return $core.withContext(function($ctx1) {
  44037. $recv(self._interpreter())._restart();
  44038. self._flushInnerContexts();
  44039. return self;
  44040. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  44041. },
  44042. args: [],
  44043. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  44044. referencedClasses: [],
  44045. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  44046. }),
  44047. $globals.ASTDebugger);
  44048. $core.addMethod(
  44049. $core.method({
  44050. selector: "result",
  44051. protocol: "accessing",
  44052. fn: function (){
  44053. var self=this;
  44054. return self["@result"];
  44055. },
  44056. args: [],
  44057. source: "result\x0a\x09^ result",
  44058. referencedClasses: [],
  44059. messageSends: []
  44060. }),
  44061. $globals.ASTDebugger);
  44062. $core.addMethod(
  44063. $core.method({
  44064. selector: "stepInto",
  44065. protocol: "stepping",
  44066. fn: function (){
  44067. var self=this;
  44068. return $core.withContext(function($ctx1) {
  44069. self._shouldBeImplemented();
  44070. return self;
  44071. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  44072. },
  44073. args: [],
  44074. source: "stepInto\x0a\x09self shouldBeImplemented",
  44075. referencedClasses: [],
  44076. messageSends: ["shouldBeImplemented"]
  44077. }),
  44078. $globals.ASTDebugger);
  44079. $core.addMethod(
  44080. $core.method({
  44081. selector: "stepOver",
  44082. protocol: "stepping",
  44083. fn: function (){
  44084. var self=this;
  44085. return $core.withContext(function($ctx1) {
  44086. var $1,$2;
  44087. $1=$recv(self._context())._isTopContext();
  44088. if($core.assert($1)){
  44089. $recv(self._interpreter())._stepOver();
  44090. } else {
  44091. $2=self._interpreter();
  44092. $ctx1.sendIdx["interpreter"]=1;
  44093. $recv($2)._skip();
  44094. }
  44095. self._onStep();
  44096. return self;
  44097. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  44098. },
  44099. args: [],
  44100. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  44101. referencedClasses: [],
  44102. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  44103. }),
  44104. $globals.ASTDebugger);
  44105. $core.addMethod(
  44106. $core.method({
  44107. selector: "context:",
  44108. protocol: "instance creation",
  44109. fn: function (aContext){
  44110. var self=this;
  44111. return $core.withContext(function($ctx1) {
  44112. var $1;
  44113. $1=self._new();
  44114. $recv($1)._context_(aContext);
  44115. return $recv($1)._yourself();
  44116. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  44117. },
  44118. args: ["aContext"],
  44119. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  44120. referencedClasses: [],
  44121. messageSends: ["context:", "new", "yourself"]
  44122. }),
  44123. $globals.ASTDebugger.klass);
  44124. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  44125. $core.addMethod(
  44126. $core.method({
  44127. selector: "interpreter",
  44128. protocol: "accessing",
  44129. fn: function (){
  44130. var self=this;
  44131. return self["@interpreter"];
  44132. },
  44133. args: [],
  44134. source: "interpreter\x0a\x09^ interpreter",
  44135. referencedClasses: [],
  44136. messageSends: []
  44137. }),
  44138. $globals.ASTEnterNode);
  44139. $core.addMethod(
  44140. $core.method({
  44141. selector: "interpreter:",
  44142. protocol: "accessing",
  44143. fn: function (anObject){
  44144. var self=this;
  44145. self["@interpreter"]=anObject;
  44146. return self;
  44147. },
  44148. args: ["anObject"],
  44149. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  44150. referencedClasses: [],
  44151. messageSends: []
  44152. }),
  44153. $globals.ASTEnterNode);
  44154. $core.addMethod(
  44155. $core.method({
  44156. selector: "visitBlockNode:",
  44157. protocol: "visiting",
  44158. fn: function (aNode){
  44159. var self=this;
  44160. return aNode;
  44161. },
  44162. args: ["aNode"],
  44163. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  44164. referencedClasses: [],
  44165. messageSends: []
  44166. }),
  44167. $globals.ASTEnterNode);
  44168. $core.addMethod(
  44169. $core.method({
  44170. selector: "visitDagNode:",
  44171. protocol: "visiting",
  44172. fn: function (aNode){
  44173. var self=this;
  44174. return $core.withContext(function($ctx1) {
  44175. var $early={};
  44176. try {
  44177. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  44178. throw $early=[aNode];
  44179. }),(function(nodes){
  44180. return $core.withContext(function($ctx2) {
  44181. throw $early=[self._visit_($recv(nodes)._first())];
  44182. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  44183. }));
  44184. return self;
  44185. }
  44186. catch(e) {if(e===$early)return e[0]; throw e}
  44187. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  44188. },
  44189. args: ["aNode"],
  44190. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  44191. referencedClasses: [],
  44192. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  44193. }),
  44194. $globals.ASTEnterNode);
  44195. $core.addMethod(
  44196. $core.method({
  44197. selector: "visitSequenceNode:",
  44198. protocol: "visiting",
  44199. fn: function (aNode){
  44200. var self=this;
  44201. return $core.withContext(function($ctx1) {
  44202. var $1;
  44203. $recv($recv(aNode)._temps())._do_((function(each){
  44204. return $core.withContext(function($ctx2) {
  44205. return $recv($recv(self._interpreter())._context())._defineLocal_(each);
  44206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44207. }));
  44208. $1=(
  44209. $ctx1.supercall = true,
  44210. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  44211. $ctx1.supercall = false;
  44212. return $1;
  44213. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  44214. },
  44215. args: ["aNode"],
  44216. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  44217. referencedClasses: [],
  44218. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  44219. }),
  44220. $globals.ASTEnterNode);
  44221. $core.addMethod(
  44222. $core.method({
  44223. selector: "on:",
  44224. protocol: "instance creation",
  44225. fn: function (anInterpreter){
  44226. var self=this;
  44227. return $core.withContext(function($ctx1) {
  44228. var $1;
  44229. $1=self._new();
  44230. $recv($1)._interpreter_(anInterpreter);
  44231. return $recv($1)._yourself();
  44232. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.klass)});
  44233. },
  44234. args: ["anInterpreter"],
  44235. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  44236. referencedClasses: [],
  44237. messageSends: ["interpreter:", "new", "yourself"]
  44238. }),
  44239. $globals.ASTEnterNode.klass);
  44240. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  44241. $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";
  44242. $core.addMethod(
  44243. $core.method({
  44244. selector: "assign:to:",
  44245. protocol: "private",
  44246. fn: function (aNode,anObject){
  44247. var self=this;
  44248. return $core.withContext(function($ctx1) {
  44249. var $1,$3,$2,$4;
  44250. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  44251. if($core.assert($1)){
  44252. $3=self._context();
  44253. $ctx1.sendIdx["context"]=1;
  44254. $2=$recv($3)._receiver();
  44255. $4=$recv(aNode)._value();
  44256. $ctx1.sendIdx["value"]=1;
  44257. $recv($2)._instVarAt_put_($4,anObject);
  44258. } else {
  44259. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  44260. }
  44261. return self;
  44262. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  44263. },
  44264. args: ["aNode", "anObject"],
  44265. 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 ]",
  44266. referencedClasses: [],
  44267. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  44268. }),
  44269. $globals.ASTInterpreter);
  44270. $core.addMethod(
  44271. $core.method({
  44272. selector: "atEnd",
  44273. protocol: "testing",
  44274. fn: function (){
  44275. var self=this;
  44276. return $core.withContext(function($ctx1) {
  44277. var $1;
  44278. $1=self["@forceAtEnd"];
  44279. if($core.assert($1)){
  44280. return true;
  44281. }
  44282. return $recv(self._hasReturned())._or_((function(){
  44283. return $core.withContext(function($ctx2) {
  44284. return $recv(self._node())._isNil();
  44285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44286. }));
  44287. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  44288. },
  44289. args: [],
  44290. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  44291. referencedClasses: [],
  44292. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  44293. }),
  44294. $globals.ASTInterpreter);
  44295. $core.addMethod(
  44296. $core.method({
  44297. selector: "context",
  44298. protocol: "accessing",
  44299. fn: function (){
  44300. var self=this;
  44301. return self["@context"];
  44302. },
  44303. args: [],
  44304. source: "context\x0a\x09^ context",
  44305. referencedClasses: [],
  44306. messageSends: []
  44307. }),
  44308. $globals.ASTInterpreter);
  44309. $core.addMethod(
  44310. $core.method({
  44311. selector: "context:",
  44312. protocol: "accessing",
  44313. fn: function (aContext){
  44314. var self=this;
  44315. self["@context"]=aContext;
  44316. return self;
  44317. },
  44318. args: ["aContext"],
  44319. source: "context: aContext\x0a\x09context := aContext",
  44320. referencedClasses: [],
  44321. messageSends: []
  44322. }),
  44323. $globals.ASTInterpreter);
  44324. $core.addMethod(
  44325. $core.method({
  44326. selector: "enterNode",
  44327. protocol: "interpreting",
  44328. fn: function (){
  44329. var self=this;
  44330. return $core.withContext(function($ctx1) {
  44331. self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_(self._node()));
  44332. return self;
  44333. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  44334. },
  44335. args: [],
  44336. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  44337. referencedClasses: ["ASTEnterNode"],
  44338. messageSends: ["node:", "visit:", "on:", "node"]
  44339. }),
  44340. $globals.ASTInterpreter);
  44341. $core.addMethod(
  44342. $core.method({
  44343. selector: "eval:",
  44344. protocol: "private",
  44345. fn: function (aString){
  44346. var self=this;
  44347. var source,function_;
  44348. return $core.withContext(function($ctx1) {
  44349. var $3,$2,$1;
  44350. source=$recv($globals.String)._streamContents_((function(str){
  44351. return $core.withContext(function($ctx2) {
  44352. $recv(str)._nextPutAll_("0,(function(");
  44353. $ctx2.sendIdx["nextPutAll:"]=1;
  44354. $3=self._context();
  44355. $ctx2.sendIdx["context"]=1;
  44356. $2=$recv($3)._locals();
  44357. $ctx2.sendIdx["locals"]=1;
  44358. $1=$recv($2)._keys();
  44359. $recv($1)._do_separatedBy_((function(each){
  44360. return $core.withContext(function($ctx3) {
  44361. return $recv(str)._nextPutAll_(each);
  44362. $ctx3.sendIdx["nextPutAll:"]=2;
  44363. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  44364. }),(function(){
  44365. return $core.withContext(function($ctx3) {
  44366. return $recv(str)._nextPutAll_(",");
  44367. $ctx3.sendIdx["nextPutAll:"]=3;
  44368. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44369. }));
  44370. $recv(str)._nextPutAll_("){ return (function() {");
  44371. $ctx2.sendIdx["nextPutAll:"]=4;
  44372. $recv(str)._nextPutAll_(aString);
  44373. $ctx2.sendIdx["nextPutAll:"]=5;
  44374. return $recv(str)._nextPutAll_("})()})");
  44375. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  44376. }));
  44377. function_=$recv($recv($globals.Compiler)._new())._eval_(source);
  44378. return $recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  44379. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  44380. },
  44381. args: ["aString"],
  44382. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '0,(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})()})' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  44383. referencedClasses: ["String", "Compiler"],
  44384. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  44385. }),
  44386. $globals.ASTInterpreter);
  44387. $core.addMethod(
  44388. $core.method({
  44389. selector: "hasReturned",
  44390. protocol: "testing",
  44391. fn: function (){
  44392. var self=this;
  44393. return $core.withContext(function($ctx1) {
  44394. var $1,$receiver;
  44395. $1=self["@returned"];
  44396. if(($receiver = $1) == null || $receiver.isNil){
  44397. return false;
  44398. } else {
  44399. return $1;
  44400. }
  44401. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  44402. },
  44403. args: [],
  44404. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  44405. referencedClasses: [],
  44406. messageSends: ["ifNil:"]
  44407. }),
  44408. $globals.ASTInterpreter);
  44409. $core.addMethod(
  44410. $core.method({
  44411. selector: "initialize",
  44412. protocol: "initialization",
  44413. fn: function (){
  44414. var self=this;
  44415. return $core.withContext(function($ctx1) {
  44416. (
  44417. $ctx1.supercall = true,
  44418. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  44419. $ctx1.supercall = false;
  44420. self["@forceAtEnd"]=false;
  44421. return self;
  44422. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  44423. },
  44424. args: [],
  44425. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  44426. referencedClasses: [],
  44427. messageSends: ["initialize"]
  44428. }),
  44429. $globals.ASTInterpreter);
  44430. $core.addMethod(
  44431. $core.method({
  44432. selector: "interpret",
  44433. protocol: "interpreting",
  44434. fn: function (){
  44435. var self=this;
  44436. return $core.withContext(function($ctx1) {
  44437. self._visit_(self._node());
  44438. return self;
  44439. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  44440. },
  44441. args: [],
  44442. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  44443. referencedClasses: [],
  44444. messageSends: ["visit:", "node"]
  44445. }),
  44446. $globals.ASTInterpreter);
  44447. $core.addMethod(
  44448. $core.method({
  44449. selector: "messageFromSendNode:arguments:",
  44450. protocol: "private",
  44451. fn: function (aSendNode,aCollection){
  44452. var self=this;
  44453. return $core.withContext(function($ctx1) {
  44454. var $1;
  44455. $1=$recv($globals.Message)._new();
  44456. $recv($1)._selector_($recv(aSendNode)._selector());
  44457. $recv($1)._arguments_(aCollection);
  44458. return $recv($1)._yourself();
  44459. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  44460. },
  44461. args: ["aSendNode", "aCollection"],
  44462. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  44463. referencedClasses: ["Message"],
  44464. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  44465. }),
  44466. $globals.ASTInterpreter);
  44467. $core.addMethod(
  44468. $core.method({
  44469. selector: "messageNotUnderstood:receiver:",
  44470. protocol: "private",
  44471. fn: function (aMessage,anObject){
  44472. var self=this;
  44473. return $core.withContext(function($ctx1) {
  44474. var $1;
  44475. $1=$recv($globals.MessageNotUnderstood)._new();
  44476. $recv($1)._message_(aMessage);
  44477. $recv($1)._receiver_(anObject);
  44478. $recv($1)._signal();
  44479. return self;
  44480. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  44481. },
  44482. args: ["aMessage", "anObject"],
  44483. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  44484. referencedClasses: ["MessageNotUnderstood"],
  44485. messageSends: ["message:", "new", "receiver:", "signal"]
  44486. }),
  44487. $globals.ASTInterpreter);
  44488. $core.addMethod(
  44489. $core.method({
  44490. selector: "next",
  44491. protocol: "interpreting",
  44492. fn: function (){
  44493. var self=this;
  44494. var nd,nextNode;
  44495. return $core.withContext(function($ctx1) {
  44496. var $1,$2,$receiver;
  44497. nd=self._node();
  44498. $1=$recv(nd)._parent();
  44499. if(($receiver = $1) == null || $receiver.isNil){
  44500. nextNode=$1;
  44501. } else {
  44502. var parent;
  44503. parent=$receiver;
  44504. $2=$recv(parent)._nextSiblingNode_(nd);
  44505. if(($receiver = $2) == null || $receiver.isNil){
  44506. nextNode=parent;
  44507. } else {
  44508. var sibling;
  44509. sibling=$receiver;
  44510. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  44511. }
  44512. }
  44513. self._node_(nextNode);
  44514. return self;
  44515. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  44516. },
  44517. args: [],
  44518. 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",
  44519. referencedClasses: ["ASTEnterNode"],
  44520. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  44521. }),
  44522. $globals.ASTInterpreter);
  44523. $core.addMethod(
  44524. $core.method({
  44525. selector: "node",
  44526. protocol: "accessing",
  44527. fn: function (){
  44528. var self=this;
  44529. return self["@node"];
  44530. },
  44531. args: [],
  44532. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  44533. referencedClasses: [],
  44534. messageSends: []
  44535. }),
  44536. $globals.ASTInterpreter);
  44537. $core.addMethod(
  44538. $core.method({
  44539. selector: "node:",
  44540. protocol: "accessing",
  44541. fn: function (aNode){
  44542. var self=this;
  44543. self["@node"]=aNode;
  44544. return self;
  44545. },
  44546. args: ["aNode"],
  44547. source: "node: aNode\x0a\x09node := aNode",
  44548. referencedClasses: [],
  44549. messageSends: []
  44550. }),
  44551. $globals.ASTInterpreter);
  44552. $core.addMethod(
  44553. $core.method({
  44554. selector: "peek",
  44555. protocol: "stack",
  44556. fn: function (){
  44557. var self=this;
  44558. return $core.withContext(function($ctx1) {
  44559. var $1;
  44560. var $early={};
  44561. try {
  44562. $1=self._stack();
  44563. $ctx1.sendIdx["stack"]=1;
  44564. $recv($1)._ifEmpty_((function(){
  44565. throw $early=[nil];
  44566. }));
  44567. return $recv(self._stack())._last();
  44568. }
  44569. catch(e) {if(e===$early)return e[0]; throw e}
  44570. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  44571. },
  44572. args: [],
  44573. 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",
  44574. referencedClasses: [],
  44575. messageSends: ["ifEmpty:", "stack", "last"]
  44576. }),
  44577. $globals.ASTInterpreter);
  44578. $core.addMethod(
  44579. $core.method({
  44580. selector: "pop",
  44581. protocol: "stack",
  44582. fn: function (){
  44583. var self=this;
  44584. var peekedValue;
  44585. return $core.withContext(function($ctx1) {
  44586. peekedValue=self._peek();
  44587. $recv(self._stack())._removeLast();
  44588. return peekedValue;
  44589. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  44590. },
  44591. args: [],
  44592. 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",
  44593. referencedClasses: [],
  44594. messageSends: ["peek", "removeLast", "stack"]
  44595. }),
  44596. $globals.ASTInterpreter);
  44597. $core.addMethod(
  44598. $core.method({
  44599. selector: "proceed",
  44600. protocol: "interpreting",
  44601. fn: function (){
  44602. var self=this;
  44603. return $core.withContext(function($ctx1) {
  44604. $recv((function(){
  44605. return $core.withContext(function($ctx2) {
  44606. return self._atEnd();
  44607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44608. }))._whileFalse_((function(){
  44609. return $core.withContext(function($ctx2) {
  44610. return self._step();
  44611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44612. }));
  44613. return self;
  44614. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  44615. },
  44616. args: [],
  44617. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  44618. referencedClasses: [],
  44619. messageSends: ["whileFalse:", "atEnd", "step"]
  44620. }),
  44621. $globals.ASTInterpreter);
  44622. $core.addMethod(
  44623. $core.method({
  44624. selector: "push:",
  44625. protocol: "stack",
  44626. fn: function (anObject){
  44627. var self=this;
  44628. return $core.withContext(function($ctx1) {
  44629. return $recv(self._stack())._add_(anObject);
  44630. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  44631. },
  44632. args: ["anObject"],
  44633. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  44634. referencedClasses: [],
  44635. messageSends: ["add:", "stack"]
  44636. }),
  44637. $globals.ASTInterpreter);
  44638. $core.addMethod(
  44639. $core.method({
  44640. selector: "restart",
  44641. protocol: "interpreting",
  44642. fn: function (){
  44643. var self=this;
  44644. return $core.withContext(function($ctx1) {
  44645. self._node_($recv(self._context())._ast());
  44646. self._enterNode();
  44647. return self;
  44648. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  44649. },
  44650. args: [],
  44651. source: "restart\x0a\x09self node: self context ast; enterNode",
  44652. referencedClasses: [],
  44653. messageSends: ["node:", "ast", "context", "enterNode"]
  44654. }),
  44655. $globals.ASTInterpreter);
  44656. $core.addMethod(
  44657. $core.method({
  44658. selector: "result",
  44659. protocol: "accessing",
  44660. fn: function (){
  44661. var self=this;
  44662. return $core.withContext(function($ctx1) {
  44663. var $1;
  44664. $1=self._hasReturned();
  44665. if($core.assert($1)){
  44666. return self._returnValue();
  44667. } else {
  44668. return $recv(self._context())._receiver();
  44669. }
  44670. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  44671. },
  44672. args: [],
  44673. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  44674. referencedClasses: [],
  44675. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  44676. }),
  44677. $globals.ASTInterpreter);
  44678. $core.addMethod(
  44679. $core.method({
  44680. selector: "returnValue",
  44681. protocol: "accessing",
  44682. fn: function (){
  44683. var self=this;
  44684. return self["@returnValue"];
  44685. },
  44686. args: [],
  44687. source: "returnValue\x0a\x09^ returnValue",
  44688. referencedClasses: [],
  44689. messageSends: []
  44690. }),
  44691. $globals.ASTInterpreter);
  44692. $core.addMethod(
  44693. $core.method({
  44694. selector: "returnValue:",
  44695. protocol: "accessing",
  44696. fn: function (anObject){
  44697. var self=this;
  44698. self["@returnValue"]=anObject;
  44699. return self;
  44700. },
  44701. args: ["anObject"],
  44702. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  44703. referencedClasses: [],
  44704. messageSends: []
  44705. }),
  44706. $globals.ASTInterpreter);
  44707. $core.addMethod(
  44708. $core.method({
  44709. selector: "sendMessage:to:superSend:",
  44710. protocol: "private",
  44711. fn: function (aMessage,anObject,aBoolean){
  44712. var self=this;
  44713. var method;
  44714. return $core.withContext(function($ctx1) {
  44715. var $2,$1,$3,$receiver;
  44716. var $early={};
  44717. try {
  44718. if(!$core.assert(aBoolean)){
  44719. return $recv(aMessage)._sendTo_(anObject);
  44720. }
  44721. $2=$recv(anObject)._class();
  44722. $ctx1.sendIdx["class"]=1;
  44723. $1=$recv($2)._superclass();
  44724. $ctx1.sendIdx["superclass"]=1;
  44725. if(($receiver = $1) == null || $receiver.isNil){
  44726. $3=self._messageNotUnderstood_receiver_(aMessage,anObject);
  44727. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  44728. return $3;
  44729. } else {
  44730. $1;
  44731. }
  44732. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  44733. return $core.withContext(function($ctx2) {
  44734. throw $early=[self._messageNotUnderstood_receiver_(aMessage,anObject)];
  44735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44736. }));
  44737. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  44738. }
  44739. catch(e) {if(e===$early)return e[0]; throw e}
  44740. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  44741. },
  44742. args: ["aMessage", "anObject", "aBoolean"],
  44743. 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",
  44744. referencedClasses: [],
  44745. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  44746. }),
  44747. $globals.ASTInterpreter);
  44748. $core.addMethod(
  44749. $core.method({
  44750. selector: "setNonLocalReturnFromContext:",
  44751. protocol: "interpreting",
  44752. fn: function (aContext){
  44753. var self=this;
  44754. return $core.withContext(function($ctx1) {
  44755. var $2,$1;
  44756. $2=$recv(aContext)._interpreter();
  44757. $ctx1.sendIdx["interpreter"]=1;
  44758. $1=$recv($2)._hasReturned();
  44759. if($core.assert($1)){
  44760. self["@returned"]=true;
  44761. self["@returned"];
  44762. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  44763. }
  44764. return self;
  44765. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  44766. },
  44767. args: ["aContext"],
  44768. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  44769. referencedClasses: [],
  44770. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  44771. }),
  44772. $globals.ASTInterpreter);
  44773. $core.addMethod(
  44774. $core.method({
  44775. selector: "skip",
  44776. protocol: "interpreting",
  44777. fn: function (){
  44778. var self=this;
  44779. return $core.withContext(function($ctx1) {
  44780. self._next();
  44781. return self;
  44782. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  44783. },
  44784. args: [],
  44785. source: "skip\x0a\x09self next",
  44786. referencedClasses: [],
  44787. messageSends: ["next"]
  44788. }),
  44789. $globals.ASTInterpreter);
  44790. $core.addMethod(
  44791. $core.method({
  44792. selector: "stack",
  44793. protocol: "accessing",
  44794. fn: function (){
  44795. var self=this;
  44796. return $core.withContext(function($ctx1) {
  44797. var $1,$receiver;
  44798. $1=self["@stack"];
  44799. if(($receiver = $1) == null || $receiver.isNil){
  44800. self["@stack"]=$recv($globals.OrderedCollection)._new();
  44801. return self["@stack"];
  44802. } else {
  44803. return $1;
  44804. }
  44805. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  44806. },
  44807. args: [],
  44808. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  44809. referencedClasses: ["OrderedCollection"],
  44810. messageSends: ["ifNil:", "new"]
  44811. }),
  44812. $globals.ASTInterpreter);
  44813. $core.addMethod(
  44814. $core.method({
  44815. selector: "step",
  44816. protocol: "interpreting",
  44817. fn: function (){
  44818. var self=this;
  44819. return $core.withContext(function($ctx1) {
  44820. self._interpret();
  44821. self._next();
  44822. return self;
  44823. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  44824. },
  44825. args: [],
  44826. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  44827. referencedClasses: [],
  44828. messageSends: ["interpret", "next"]
  44829. }),
  44830. $globals.ASTInterpreter);
  44831. $core.addMethod(
  44832. $core.method({
  44833. selector: "stepOver",
  44834. protocol: "interpreting",
  44835. fn: function (){
  44836. var self=this;
  44837. return $core.withContext(function($ctx1) {
  44838. var $2,$1;
  44839. self._step();
  44840. $ctx1.sendIdx["step"]=1;
  44841. $recv((function(){
  44842. return $core.withContext(function($ctx2) {
  44843. $2=self._node();
  44844. $ctx2.sendIdx["node"]=1;
  44845. $1=$recv($2)._isNil();
  44846. return $recv($1)._or_((function(){
  44847. return $core.withContext(function($ctx3) {
  44848. return $recv(self._node())._isSteppingNode();
  44849. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44850. }));
  44851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44852. }))._whileFalse_((function(){
  44853. return $core.withContext(function($ctx2) {
  44854. return self._step();
  44855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44856. }));
  44857. return self;
  44858. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  44859. },
  44860. args: [],
  44861. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  44862. referencedClasses: [],
  44863. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  44864. }),
  44865. $globals.ASTInterpreter);
  44866. $core.addMethod(
  44867. $core.method({
  44868. selector: "visit:",
  44869. protocol: "visiting",
  44870. fn: function (aNode){
  44871. var self=this;
  44872. return $core.withContext(function($ctx1) {
  44873. var $1;
  44874. $1=self._hasReturned();
  44875. if(!$core.assert($1)){
  44876. (
  44877. $ctx1.supercall = true,
  44878. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  44879. $ctx1.supercall = false;
  44880. }
  44881. return self;
  44882. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  44883. },
  44884. args: ["aNode"],
  44885. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  44886. referencedClasses: [],
  44887. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  44888. }),
  44889. $globals.ASTInterpreter);
  44890. $core.addMethod(
  44891. $core.method({
  44892. selector: "visitAssignmentNode:",
  44893. protocol: "visiting",
  44894. fn: function (aNode){
  44895. var self=this;
  44896. var poppedValue;
  44897. return $core.withContext(function($ctx1) {
  44898. poppedValue=self._pop();
  44899. $ctx1.sendIdx["pop"]=1;
  44900. self._pop();
  44901. self._push_(poppedValue);
  44902. self._assign_to_($recv(aNode)._left(),poppedValue);
  44903. return self;
  44904. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  44905. },
  44906. args: ["aNode"],
  44907. 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",
  44908. referencedClasses: [],
  44909. messageSends: ["pop", "push:", "assign:to:", "left"]
  44910. }),
  44911. $globals.ASTInterpreter);
  44912. $core.addMethod(
  44913. $core.method({
  44914. selector: "visitBlockNode:",
  44915. protocol: "visiting",
  44916. fn: function (aNode){
  44917. var self=this;
  44918. var block;
  44919. return $core.withContext(function($ctx1) {
  44920. block=$recv($globals.AIBlockClosure)._forContext_node_(self._context(),aNode);
  44921. self._push_(block);
  44922. return self;
  44923. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  44924. },
  44925. args: ["aNode"],
  44926. 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",
  44927. referencedClasses: ["AIBlockClosure"],
  44928. messageSends: ["forContext:node:", "context", "push:"]
  44929. }),
  44930. $globals.ASTInterpreter);
  44931. $core.addMethod(
  44932. $core.method({
  44933. selector: "visitBlockSequenceNode:",
  44934. protocol: "visiting",
  44935. fn: function (aNode){
  44936. var self=this;
  44937. return $core.withContext(function($ctx1) {
  44938. (
  44939. $ctx1.supercall = true,
  44940. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  44941. $ctx1.supercall = false;
  44942. self["@forceAtEnd"]=true;
  44943. return self;
  44944. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44945. },
  44946. args: ["aNode"],
  44947. 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",
  44948. referencedClasses: [],
  44949. messageSends: ["visitBlockSequenceNode:"]
  44950. }),
  44951. $globals.ASTInterpreter);
  44952. $core.addMethod(
  44953. $core.method({
  44954. selector: "visitDagNode:",
  44955. protocol: "visiting",
  44956. fn: function (aNode){
  44957. var self=this;
  44958. return self;
  44959. },
  44960. args: ["aNode"],
  44961. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  44962. referencedClasses: [],
  44963. messageSends: []
  44964. }),
  44965. $globals.ASTInterpreter);
  44966. $core.addMethod(
  44967. $core.method({
  44968. selector: "visitDynamicArrayNode:",
  44969. protocol: "visiting",
  44970. fn: function (aNode){
  44971. var self=this;
  44972. var array;
  44973. return $core.withContext(function($ctx1) {
  44974. array=[];
  44975. $recv($recv(aNode)._dagChildren())._do_((function(each){
  44976. return $core.withContext(function($ctx2) {
  44977. return $recv(array)._addFirst_(self._pop());
  44978. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44979. }));
  44980. self._push_(array);
  44981. return self;
  44982. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  44983. },
  44984. args: ["aNode"],
  44985. 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",
  44986. referencedClasses: [],
  44987. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  44988. }),
  44989. $globals.ASTInterpreter);
  44990. $core.addMethod(
  44991. $core.method({
  44992. selector: "visitDynamicDictionaryNode:",
  44993. protocol: "visiting",
  44994. fn: function (aNode){
  44995. var self=this;
  44996. var keyValueList;
  44997. return $core.withContext(function($ctx1) {
  44998. keyValueList=$recv($globals.OrderedCollection)._new();
  44999. $recv($recv(aNode)._dagChildren())._do_((function(each){
  45000. return $core.withContext(function($ctx2) {
  45001. return $recv(keyValueList)._add_(self._pop());
  45002. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45003. }));
  45004. self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  45005. return self;
  45006. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  45007. },
  45008. args: ["aNode"],
  45009. 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)",
  45010. referencedClasses: ["OrderedCollection", "HashedCollection"],
  45011. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  45012. }),
  45013. $globals.ASTInterpreter);
  45014. $core.addMethod(
  45015. $core.method({
  45016. selector: "visitJSStatementNode:",
  45017. protocol: "visiting",
  45018. fn: function (aNode){
  45019. var self=this;
  45020. return $core.withContext(function($ctx1) {
  45021. self["@returned"]=true;
  45022. self._returnValue_(self._eval_($recv(aNode)._source()));
  45023. return self;
  45024. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  45025. },
  45026. args: ["aNode"],
  45027. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  45028. referencedClasses: [],
  45029. messageSends: ["returnValue:", "eval:", "source"]
  45030. }),
  45031. $globals.ASTInterpreter);
  45032. $core.addMethod(
  45033. $core.method({
  45034. selector: "visitReturnNode:",
  45035. protocol: "visiting",
  45036. fn: function (aNode){
  45037. var self=this;
  45038. return $core.withContext(function($ctx1) {
  45039. self["@returned"]=true;
  45040. self._returnValue_(self._pop());
  45041. return self;
  45042. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  45043. },
  45044. args: ["aNode"],
  45045. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  45046. referencedClasses: [],
  45047. messageSends: ["returnValue:", "pop"]
  45048. }),
  45049. $globals.ASTInterpreter);
  45050. $core.addMethod(
  45051. $core.method({
  45052. selector: "visitSendNode:",
  45053. protocol: "visiting",
  45054. fn: function (aNode){
  45055. var self=this;
  45056. var receiver,args,message,result;
  45057. return $core.withContext(function($ctx1) {
  45058. var $1;
  45059. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  45060. return $core.withContext(function($ctx2) {
  45061. return self._pop();
  45062. $ctx2.sendIdx["pop"]=1;
  45063. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45064. }));
  45065. receiver=self._peek();
  45066. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  45067. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  45068. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  45069. return $core.withContext(function($ctx2) {
  45070. return $recv($recv(aNode)._isLastChild())._not();
  45071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45072. }));
  45073. if(!$core.assert($1)){
  45074. self._pop();
  45075. self._push_(result);
  45076. }
  45077. return self;
  45078. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  45079. },
  45080. args: ["aNode"],
  45081. 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 ]",
  45082. referencedClasses: [],
  45083. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  45084. }),
  45085. $globals.ASTInterpreter);
  45086. $core.addMethod(
  45087. $core.method({
  45088. selector: "visitValueNode:",
  45089. protocol: "visiting",
  45090. fn: function (aNode){
  45091. var self=this;
  45092. return $core.withContext(function($ctx1) {
  45093. self._push_($recv(aNode)._value());
  45094. return self;
  45095. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  45096. },
  45097. args: ["aNode"],
  45098. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  45099. referencedClasses: [],
  45100. messageSends: ["push:", "value"]
  45101. }),
  45102. $globals.ASTInterpreter);
  45103. $core.addMethod(
  45104. $core.method({
  45105. selector: "visitVariableNode:",
  45106. protocol: "visiting",
  45107. fn: function (aNode){
  45108. var self=this;
  45109. return $core.withContext(function($ctx1) {
  45110. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  45111. $2=$recv(aNode)._binding();
  45112. $ctx1.sendIdx["binding"]=1;
  45113. $1=$recv($2)._isUnknownVar();
  45114. if($core.assert($1)){
  45115. $5=$recv($globals.Platform)._globals();
  45116. $ctx1.sendIdx["globals"]=1;
  45117. $6=$recv(aNode)._value();
  45118. $ctx1.sendIdx["value"]=1;
  45119. $4=$recv($5)._at_ifAbsent_($6,(function(){
  45120. return $core.withContext(function($ctx2) {
  45121. return self._error_("Unknown variable");
  45122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45123. }));
  45124. $ctx1.sendIdx["at:ifAbsent:"]=1;
  45125. $3=self._push_($4);
  45126. $ctx1.sendIdx["push:"]=1;
  45127. return $3;
  45128. }
  45129. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  45130. if($core.assert($8)){
  45131. $10=self._context();
  45132. $ctx1.sendIdx["context"]=1;
  45133. $9=$recv($10)._receiver();
  45134. $11=$recv(aNode)._value();
  45135. $ctx1.sendIdx["value"]=2;
  45136. $7=$recv($9)._instVarAt_($11);
  45137. } else {
  45138. $12=self._context();
  45139. $13=$recv(aNode)._value();
  45140. $ctx1.sendIdx["value"]=3;
  45141. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  45142. return $core.withContext(function($ctx2) {
  45143. $15=$recv(aNode)._value();
  45144. $ctx2.sendIdx["value"]=4;
  45145. $14=$recv($15)._isCapitalized();
  45146. if($core.assert($14)){
  45147. $16=$recv($globals.Smalltalk)._globals();
  45148. $ctx2.sendIdx["globals"]=2;
  45149. $17=$recv(aNode)._value();
  45150. $ctx2.sendIdx["value"]=5;
  45151. return $recv($16)._at_ifAbsent_($17,(function(){
  45152. return $core.withContext(function($ctx3) {
  45153. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  45154. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  45155. }));
  45156. }
  45157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  45158. }));
  45159. }
  45160. self._push_($7);
  45161. return self;
  45162. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  45163. },
  45164. args: ["aNode"],
  45165. 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 ] ] ] ])",
  45166. referencedClasses: ["Platform", "Smalltalk"],
  45167. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  45168. }),
  45169. $globals.ASTInterpreter);
  45170. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  45171. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  45172. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  45173. $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`";
  45174. $core.addMethod(
  45175. $core.method({
  45176. selector: "currentNode",
  45177. protocol: "accessing",
  45178. fn: function (){
  45179. var self=this;
  45180. return self["@currentNode"];
  45181. },
  45182. args: [],
  45183. source: "currentNode\x0a\x09^ currentNode",
  45184. referencedClasses: [],
  45185. messageSends: []
  45186. }),
  45187. $globals.ASTPCNodeVisitor);
  45188. $core.addMethod(
  45189. $core.method({
  45190. selector: "increaseTrackedIndex",
  45191. protocol: "accessing",
  45192. fn: function (){
  45193. var self=this;
  45194. return $core.withContext(function($ctx1) {
  45195. self["@trackedIndex"]=$recv(self._trackedIndex()).__plus((1));
  45196. return self;
  45197. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  45198. },
  45199. args: [],
  45200. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  45201. referencedClasses: [],
  45202. messageSends: ["+", "trackedIndex"]
  45203. }),
  45204. $globals.ASTPCNodeVisitor);
  45205. $core.addMethod(
  45206. $core.method({
  45207. selector: "index",
  45208. protocol: "accessing",
  45209. fn: function (){
  45210. var self=this;
  45211. return self["@index"];
  45212. },
  45213. args: [],
  45214. source: "index\x0a\x09^ index",
  45215. referencedClasses: [],
  45216. messageSends: []
  45217. }),
  45218. $globals.ASTPCNodeVisitor);
  45219. $core.addMethod(
  45220. $core.method({
  45221. selector: "index:",
  45222. protocol: "accessing",
  45223. fn: function (aNumber){
  45224. var self=this;
  45225. self["@index"]=aNumber;
  45226. return self;
  45227. },
  45228. args: ["aNumber"],
  45229. source: "index: aNumber\x0a\x09index := aNumber",
  45230. referencedClasses: [],
  45231. messageSends: []
  45232. }),
  45233. $globals.ASTPCNodeVisitor);
  45234. $core.addMethod(
  45235. $core.method({
  45236. selector: "selector",
  45237. protocol: "accessing",
  45238. fn: function (){
  45239. var self=this;
  45240. return self["@selector"];
  45241. },
  45242. args: [],
  45243. source: "selector\x0a\x09^ selector",
  45244. referencedClasses: [],
  45245. messageSends: []
  45246. }),
  45247. $globals.ASTPCNodeVisitor);
  45248. $core.addMethod(
  45249. $core.method({
  45250. selector: "selector:",
  45251. protocol: "accessing",
  45252. fn: function (aString){
  45253. var self=this;
  45254. self["@selector"]=aString;
  45255. return self;
  45256. },
  45257. args: ["aString"],
  45258. source: "selector: aString\x0a\x09selector := aString",
  45259. referencedClasses: [],
  45260. messageSends: []
  45261. }),
  45262. $globals.ASTPCNodeVisitor);
  45263. $core.addMethod(
  45264. $core.method({
  45265. selector: "trackedIndex",
  45266. protocol: "accessing",
  45267. fn: function (){
  45268. var self=this;
  45269. return $core.withContext(function($ctx1) {
  45270. var $1,$receiver;
  45271. $1=self["@trackedIndex"];
  45272. if(($receiver = $1) == null || $receiver.isNil){
  45273. self["@trackedIndex"]=(0);
  45274. return self["@trackedIndex"];
  45275. } else {
  45276. return $1;
  45277. }
  45278. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  45279. },
  45280. args: [],
  45281. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  45282. referencedClasses: [],
  45283. messageSends: ["ifNil:"]
  45284. }),
  45285. $globals.ASTPCNodeVisitor);
  45286. $core.addMethod(
  45287. $core.method({
  45288. selector: "visitJSStatementNode:",
  45289. protocol: "visiting",
  45290. fn: function (aNode){
  45291. var self=this;
  45292. self["@currentNode"]=aNode;
  45293. return self;
  45294. },
  45295. args: ["aNode"],
  45296. 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",
  45297. referencedClasses: [],
  45298. messageSends: []
  45299. }),
  45300. $globals.ASTPCNodeVisitor);
  45301. $core.addMethod(
  45302. $core.method({
  45303. selector: "visitSendNode:",
  45304. protocol: "visiting",
  45305. fn: function (aNode){
  45306. var self=this;
  45307. return $core.withContext(function($ctx1) {
  45308. var $2,$1,$3;
  45309. (
  45310. $ctx1.supercall = true,
  45311. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  45312. $ctx1.supercall = false;
  45313. $2=self._selector();
  45314. $ctx1.sendIdx["selector"]=1;
  45315. $1=$recv($2).__eq($recv(aNode)._selector());
  45316. $ctx1.sendIdx["="]=1;
  45317. if($core.assert($1)){
  45318. $3=$recv(self._trackedIndex()).__eq(self._index());
  45319. if($core.assert($3)){
  45320. self["@currentNode"]=aNode;
  45321. self["@currentNode"];
  45322. }
  45323. self._increaseTrackedIndex();
  45324. }
  45325. return self;
  45326. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  45327. },
  45328. args: ["aNode"],
  45329. 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 ]",
  45330. referencedClasses: [],
  45331. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  45332. }),
  45333. $globals.ASTPCNodeVisitor);
  45334. $core.addMethod(
  45335. $core.method({
  45336. selector: "isLastChild",
  45337. protocol: "*Compiler-Interpreter",
  45338. fn: function (){
  45339. var self=this;
  45340. return $core.withContext(function($ctx1) {
  45341. return $recv($recv($recv(self._parent())._dagChildren())._last()).__eq(self);
  45342. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  45343. },
  45344. args: [],
  45345. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  45346. referencedClasses: [],
  45347. messageSends: ["=", "last", "dagChildren", "parent"]
  45348. }),
  45349. $globals.ASTNode);
  45350. $core.addMethod(
  45351. $core.method({
  45352. selector: "isSteppingNode",
  45353. protocol: "*Compiler-Interpreter",
  45354. fn: function (){
  45355. var self=this;
  45356. return false;
  45357. },
  45358. args: [],
  45359. source: "isSteppingNode\x0a\x09^ false",
  45360. referencedClasses: [],
  45361. messageSends: []
  45362. }),
  45363. $globals.ASTNode);
  45364. $core.addMethod(
  45365. $core.method({
  45366. selector: "nextSiblingNode:",
  45367. protocol: "*Compiler-Interpreter",
  45368. fn: function (aNode){
  45369. var self=this;
  45370. return $core.withContext(function($ctx1) {
  45371. var $1;
  45372. var $early={};
  45373. try {
  45374. $1=self._dagChildren();
  45375. $ctx1.sendIdx["dagChildren"]=1;
  45376. return $recv($1)._at_ifAbsent_($recv($recv(self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  45377. throw $early=[nil];
  45378. }));
  45379. }
  45380. catch(e) {if(e===$early)return e[0]; throw e}
  45381. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  45382. },
  45383. args: ["aNode"],
  45384. 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 ]",
  45385. referencedClasses: [],
  45386. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  45387. }),
  45388. $globals.ASTNode);
  45389. $core.addMethod(
  45390. $core.method({
  45391. selector: "isSteppingNode",
  45392. protocol: "*Compiler-Interpreter",
  45393. fn: function (){
  45394. var self=this;
  45395. return true;
  45396. },
  45397. args: [],
  45398. source: "isSteppingNode\x0a\x09^ true",
  45399. referencedClasses: [],
  45400. messageSends: []
  45401. }),
  45402. $globals.AssignmentNode);
  45403. $core.addMethod(
  45404. $core.method({
  45405. selector: "isSteppingNode",
  45406. protocol: "*Compiler-Interpreter",
  45407. fn: function (){
  45408. var self=this;
  45409. return true;
  45410. },
  45411. args: [],
  45412. source: "isSteppingNode\x0a\x09^ true",
  45413. referencedClasses: [],
  45414. messageSends: []
  45415. }),
  45416. $globals.BlockNode);
  45417. $core.addMethod(
  45418. $core.method({
  45419. selector: "nextSiblingNode:",
  45420. protocol: "*Compiler-Interpreter",
  45421. fn: function (aNode){
  45422. var self=this;
  45423. return nil;
  45424. },
  45425. args: ["aNode"],
  45426. 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",
  45427. referencedClasses: [],
  45428. messageSends: []
  45429. }),
  45430. $globals.BlockNode);
  45431. $core.addMethod(
  45432. $core.method({
  45433. selector: "isSteppingNode",
  45434. protocol: "*Compiler-Interpreter",
  45435. fn: function (){
  45436. var self=this;
  45437. return true;
  45438. },
  45439. args: [],
  45440. source: "isSteppingNode\x0a\x09^ true",
  45441. referencedClasses: [],
  45442. messageSends: []
  45443. }),
  45444. $globals.DynamicArrayNode);
  45445. $core.addMethod(
  45446. $core.method({
  45447. selector: "isSteppingNode",
  45448. protocol: "*Compiler-Interpreter",
  45449. fn: function (){
  45450. var self=this;
  45451. return true;
  45452. },
  45453. args: [],
  45454. source: "isSteppingNode\x0a\x09^ true",
  45455. referencedClasses: [],
  45456. messageSends: []
  45457. }),
  45458. $globals.DynamicDictionaryNode);
  45459. $core.addMethod(
  45460. $core.method({
  45461. selector: "isSteppingNode",
  45462. protocol: "*Compiler-Interpreter",
  45463. fn: function (){
  45464. var self=this;
  45465. return true;
  45466. },
  45467. args: [],
  45468. source: "isSteppingNode\x0a\x09^ true",
  45469. referencedClasses: [],
  45470. messageSends: []
  45471. }),
  45472. $globals.JSStatementNode);
  45473. $core.addMethod(
  45474. $core.method({
  45475. selector: "isCascadeSendNode",
  45476. protocol: "*Compiler-Interpreter",
  45477. fn: function (){
  45478. var self=this;
  45479. return $core.withContext(function($ctx1) {
  45480. return $recv(self._parent())._isCascadeNode();
  45481. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  45482. },
  45483. args: [],
  45484. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  45485. referencedClasses: [],
  45486. messageSends: ["isCascadeNode", "parent"]
  45487. }),
  45488. $globals.SendNode);
  45489. $core.addMethod(
  45490. $core.method({
  45491. selector: "isSteppingNode",
  45492. protocol: "*Compiler-Interpreter",
  45493. fn: function (){
  45494. var self=this;
  45495. return true;
  45496. },
  45497. args: [],
  45498. source: "isSteppingNode\x0a\x09^ true",
  45499. referencedClasses: [],
  45500. messageSends: []
  45501. }),
  45502. $globals.SendNode);
  45503. });
  45504. define('amber/lang',[
  45505. './deploy',
  45506. './compatibility', // pre-fetch, dep of ./boot
  45507. './boot', // pre-fetch, dep of ./helpers
  45508. './helpers', // pre-fetch, dep of ./deploy
  45509. './parser',
  45510. // --- packages for the Amber reflection begin here ---
  45511. 'amber_core/Platform-ImportExport',
  45512. 'amber_core/Compiler-Core',
  45513. 'amber_core/Compiler-AST',
  45514. 'amber_core/Compiler-Semantic',
  45515. 'amber_core/Compiler-IR',
  45516. 'amber_core/Compiler-Inlining',
  45517. 'amber_core/Compiler-Interpreter'
  45518. // --- packages for the Amber reflection end here ---
  45519. ], function (amber) {
  45520. return amber;
  45521. });
  45522. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  45523. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  45524. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  45525. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  45526. $core.addPackage("Platform-DOM");
  45527. $core.packages["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  45528. $core.packages["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45529. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  45530. $core.addMethod(
  45531. $core.method({
  45532. selector: "isDomNode:",
  45533. protocol: "testing",
  45534. fn: function (anObject){
  45535. var self=this;
  45536. return $core.withContext(function($ctx1) {
  45537. return anObject.nodeType > 0 &&
  45538. Object.prototype.toString.call(anObject) !== "[object Object]";
  45539. return self;
  45540. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.klass)});
  45541. },
  45542. args: ["anObject"],
  45543. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  45544. referencedClasses: [],
  45545. messageSends: []
  45546. }),
  45547. $globals.PlatformDom.klass);
  45548. $core.addMethod(
  45549. $core.method({
  45550. selector: "isFeasible",
  45551. protocol: "testing",
  45552. fn: function (){
  45553. var self=this;
  45554. return $core.withContext(function($ctx1) {
  45555. if (typeof document === "undefined") return false;
  45556. try {
  45557. var d = document.createElement("div"),
  45558. f = document.createDocumentFragment(),
  45559. t = document.createTextNode("Hello, Amber!");
  45560. f.appendChild(t);
  45561. d.insertBefore(f, null);
  45562. return d.innerHTML === "Hello, Amber!";
  45563. } catch (e) {
  45564. return false;
  45565. };
  45566. return self;
  45567. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.klass)});
  45568. },
  45569. args: [],
  45570. 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'>",
  45571. referencedClasses: [],
  45572. messageSends: []
  45573. }),
  45574. $globals.PlatformDom.klass);
  45575. $core.addMethod(
  45576. $core.method({
  45577. selector: "newCustomEvent:detail:",
  45578. protocol: "creation",
  45579. fn: function (aString,anObject){
  45580. var self=this;
  45581. return $core.withContext(function($ctx1) {
  45582. return new CustomEvent(aString, {detail: anObject});
  45583. return self;
  45584. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.klass)});
  45585. },
  45586. args: ["aString", "anObject"],
  45587. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  45588. referencedClasses: [],
  45589. messageSends: []
  45590. }),
  45591. $globals.PlatformDom.klass);
  45592. $core.addMethod(
  45593. $core.method({
  45594. selector: "toArray:",
  45595. protocol: "converting",
  45596. fn: function (aDomList){
  45597. var self=this;
  45598. return $core.withContext(function($ctx1) {
  45599. return Array.prototype.slice.call(aDomList);
  45600. return self;
  45601. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.klass)});
  45602. },
  45603. args: ["aDomList"],
  45604. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  45605. referencedClasses: [],
  45606. messageSends: []
  45607. }),
  45608. $globals.PlatformDom.klass);
  45609. $core.addMethod(
  45610. $core.method({
  45611. selector: "asDomNode",
  45612. protocol: "*Platform-DOM",
  45613. fn: function (){
  45614. var self=this;
  45615. return $core.withContext(function($ctx1) {
  45616. return $recv(document)._createTextNode_(self._asString());
  45617. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  45618. },
  45619. args: [],
  45620. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  45621. referencedClasses: [],
  45622. messageSends: ["createTextNode:", "asString"]
  45623. }),
  45624. $globals.CharacterArray);
  45625. $core.addMethod(
  45626. $core.method({
  45627. selector: "asDomNode",
  45628. protocol: "*Platform-DOM",
  45629. fn: function (){
  45630. var self=this;
  45631. var fragment;
  45632. return $core.withContext(function($ctx1) {
  45633. fragment=$recv(document)._createDocumentFragment();
  45634. self._do_((function(each){
  45635. return $core.withContext(function($ctx2) {
  45636. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  45637. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45638. }));
  45639. return fragment;
  45640. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  45641. },
  45642. args: [],
  45643. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  45644. referencedClasses: [],
  45645. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  45646. }),
  45647. $globals.Collection);
  45648. $core.addMethod(
  45649. $core.method({
  45650. selector: "asDomNode",
  45651. protocol: "*Platform-DOM",
  45652. fn: function (){
  45653. var self=this;
  45654. return $core.withContext(function($ctx1) {
  45655. var $1,$2;
  45656. $1=$recv($globals.PlatformDom)._isDomNode_(self["@jsObject"]);
  45657. if($core.assert($1)){
  45658. return self["@jsObject"];
  45659. } else {
  45660. $2=(
  45661. $ctx1.supercall = true,
  45662. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($recv(self), []));
  45663. $ctx1.supercall = false;
  45664. return $2;
  45665. }
  45666. return self;
  45667. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  45668. },
  45669. args: [],
  45670. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  45671. referencedClasses: ["PlatformDom"],
  45672. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  45673. }),
  45674. $globals.JSObjectProxy);
  45675. $core.addMethod(
  45676. $core.method({
  45677. selector: "htmlTextContent",
  45678. protocol: "*Platform-DOM",
  45679. fn: function (){
  45680. var self=this;
  45681. return $core.withContext(function($ctx1) {
  45682. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  45683. return self;
  45684. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  45685. },
  45686. args: [],
  45687. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  45688. referencedClasses: [],
  45689. messageSends: []
  45690. }),
  45691. $globals.String);
  45692. });
  45693. 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";
  45694. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  45695. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  45696. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  45697. $core.addPackage("SUnit");
  45698. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  45699. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45700. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  45701. $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.";
  45702. $core.addMethod(
  45703. $core.method({
  45704. selector: "result",
  45705. protocol: "accessing",
  45706. fn: function (){
  45707. var self=this;
  45708. return self["@result"];
  45709. },
  45710. args: [],
  45711. source: "result\x0a\x09^ result",
  45712. referencedClasses: [],
  45713. messageSends: []
  45714. }),
  45715. $globals.ResultAnnouncement);
  45716. $core.addMethod(
  45717. $core.method({
  45718. selector: "result:",
  45719. protocol: "accessing",
  45720. fn: function (aTestResult){
  45721. var self=this;
  45722. self["@result"]=aTestResult;
  45723. return self;
  45724. },
  45725. args: ["aTestResult"],
  45726. source: "result: aTestResult\x0a\x09result := aTestResult",
  45727. referencedClasses: [],
  45728. messageSends: []
  45729. }),
  45730. $globals.ResultAnnouncement);
  45731. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  45732. $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.";
  45733. $core.addMethod(
  45734. $core.method({
  45735. selector: "assert:",
  45736. protocol: "testing",
  45737. fn: function (aBoolean){
  45738. var self=this;
  45739. return $core.withContext(function($ctx1) {
  45740. self._assert_description_(aBoolean,"Assertion failed");
  45741. return self;
  45742. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  45743. },
  45744. args: ["aBoolean"],
  45745. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  45746. referencedClasses: [],
  45747. messageSends: ["assert:description:"]
  45748. }),
  45749. $globals.TestCase);
  45750. $core.addMethod(
  45751. $core.method({
  45752. selector: "assert:description:",
  45753. protocol: "testing",
  45754. fn: function (aBoolean,aString){
  45755. var self=this;
  45756. return $core.withContext(function($ctx1) {
  45757. if(!$core.assert(aBoolean)){
  45758. self._signalFailure_(aString);
  45759. }
  45760. return self;
  45761. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  45762. },
  45763. args: ["aBoolean", "aString"],
  45764. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  45765. referencedClasses: [],
  45766. messageSends: ["ifFalse:", "signalFailure:"]
  45767. }),
  45768. $globals.TestCase);
  45769. $core.addMethod(
  45770. $core.method({
  45771. selector: "assert:equals:",
  45772. protocol: "testing",
  45773. fn: function (actual,expected){
  45774. var self=this;
  45775. return $core.withContext(function($ctx1) {
  45776. var $1,$5,$4,$3,$2;
  45777. $1=$recv(actual).__eq(expected);
  45778. $5=$recv(expected)._printString();
  45779. $ctx1.sendIdx["printString"]=1;
  45780. $4="Expected: ".__comma($5);
  45781. $3=$recv($4).__comma(" but was: ");
  45782. $ctx1.sendIdx[","]=2;
  45783. $2=$recv($3).__comma($recv(actual)._printString());
  45784. $ctx1.sendIdx[","]=1;
  45785. return self._assert_description_($1,$2);
  45786. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  45787. },
  45788. args: ["actual", "expected"],
  45789. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  45790. referencedClasses: [],
  45791. messageSends: ["assert:description:", "=", ",", "printString"]
  45792. }),
  45793. $globals.TestCase);
  45794. $core.addMethod(
  45795. $core.method({
  45796. selector: "async:",
  45797. protocol: "async",
  45798. fn: function (aBlock){
  45799. var self=this;
  45800. var c;
  45801. return $core.withContext(function($ctx1) {
  45802. var $1;
  45803. self._errorIfNotAsync_("#async");
  45804. c=self["@context"];
  45805. return (function(){
  45806. return $core.withContext(function($ctx2) {
  45807. $1=self._isAsync();
  45808. if($core.assert($1)){
  45809. return $recv(c)._execute_(aBlock);
  45810. }
  45811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45812. });
  45813. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  45814. },
  45815. args: ["aBlock"],
  45816. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  45817. referencedClasses: [],
  45818. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  45819. }),
  45820. $globals.TestCase);
  45821. $core.addMethod(
  45822. $core.method({
  45823. selector: "context:",
  45824. protocol: "accessing",
  45825. fn: function (aRunningTestContext){
  45826. var self=this;
  45827. self["@context"]=aRunningTestContext;
  45828. return self;
  45829. },
  45830. args: ["aRunningTestContext"],
  45831. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  45832. referencedClasses: [],
  45833. messageSends: []
  45834. }),
  45835. $globals.TestCase);
  45836. $core.addMethod(
  45837. $core.method({
  45838. selector: "deny:",
  45839. protocol: "testing",
  45840. fn: function (aBoolean){
  45841. var self=this;
  45842. return $core.withContext(function($ctx1) {
  45843. self._assert_($recv(aBoolean)._not());
  45844. return self;
  45845. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  45846. },
  45847. args: ["aBoolean"],
  45848. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  45849. referencedClasses: [],
  45850. messageSends: ["assert:", "not"]
  45851. }),
  45852. $globals.TestCase);
  45853. $core.addMethod(
  45854. $core.method({
  45855. selector: "errorIfNotAsync:",
  45856. protocol: "error handling",
  45857. fn: function (aString){
  45858. var self=this;
  45859. return $core.withContext(function($ctx1) {
  45860. var $1;
  45861. $1=self._isAsync();
  45862. if(!$core.assert($1)){
  45863. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  45864. }
  45865. return self;
  45866. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  45867. },
  45868. args: ["aString"],
  45869. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  45870. referencedClasses: [],
  45871. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  45872. }),
  45873. $globals.TestCase);
  45874. $core.addMethod(
  45875. $core.method({
  45876. selector: "finished",
  45877. protocol: "async",
  45878. fn: function (){
  45879. var self=this;
  45880. return $core.withContext(function($ctx1) {
  45881. self._errorIfNotAsync_("#finished");
  45882. self["@asyncTimeout"]=nil;
  45883. return self;
  45884. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  45885. },
  45886. args: [],
  45887. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  45888. referencedClasses: [],
  45889. messageSends: ["errorIfNotAsync:"]
  45890. }),
  45891. $globals.TestCase);
  45892. $core.addMethod(
  45893. $core.method({
  45894. selector: "isAsync",
  45895. protocol: "testing",
  45896. fn: function (){
  45897. var self=this;
  45898. return $core.withContext(function($ctx1) {
  45899. return $recv(self["@asyncTimeout"])._notNil();
  45900. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  45901. },
  45902. args: [],
  45903. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  45904. referencedClasses: [],
  45905. messageSends: ["notNil"]
  45906. }),
  45907. $globals.TestCase);
  45908. $core.addMethod(
  45909. $core.method({
  45910. selector: "performTest",
  45911. protocol: "running",
  45912. fn: function (){
  45913. var self=this;
  45914. return $core.withContext(function($ctx1) {
  45915. self["@asyncTimeout"]=nil;
  45916. self._perform_(self._selector());
  45917. return self;
  45918. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  45919. },
  45920. args: [],
  45921. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  45922. referencedClasses: [],
  45923. messageSends: ["perform:", "selector"]
  45924. }),
  45925. $globals.TestCase);
  45926. $core.addMethod(
  45927. $core.method({
  45928. selector: "runCase",
  45929. protocol: "running",
  45930. fn: function (){
  45931. var self=this;
  45932. return $core.withContext(function($ctx1) {
  45933. $recv($recv($globals.TestContext)._testCase_(self))._start();
  45934. return self;
  45935. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  45936. },
  45937. args: [],
  45938. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  45939. referencedClasses: ["TestContext"],
  45940. messageSends: ["start", "testCase:"]
  45941. }),
  45942. $globals.TestCase);
  45943. $core.addMethod(
  45944. $core.method({
  45945. selector: "selector",
  45946. protocol: "accessing",
  45947. fn: function (){
  45948. var self=this;
  45949. return self["@testSelector"];
  45950. },
  45951. args: [],
  45952. source: "selector\x0a\x09^ testSelector",
  45953. referencedClasses: [],
  45954. messageSends: []
  45955. }),
  45956. $globals.TestCase);
  45957. $core.addMethod(
  45958. $core.method({
  45959. selector: "setTestSelector:",
  45960. protocol: "accessing",
  45961. fn: function (aSelector){
  45962. var self=this;
  45963. self["@testSelector"]=aSelector;
  45964. return self;
  45965. },
  45966. args: ["aSelector"],
  45967. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  45968. referencedClasses: [],
  45969. messageSends: []
  45970. }),
  45971. $globals.TestCase);
  45972. $core.addMethod(
  45973. $core.method({
  45974. selector: "setUp",
  45975. protocol: "running",
  45976. fn: function (){
  45977. var self=this;
  45978. return self;
  45979. },
  45980. args: [],
  45981. source: "setUp",
  45982. referencedClasses: [],
  45983. messageSends: []
  45984. }),
  45985. $globals.TestCase);
  45986. $core.addMethod(
  45987. $core.method({
  45988. selector: "should:",
  45989. protocol: "testing",
  45990. fn: function (aBlock){
  45991. var self=this;
  45992. return $core.withContext(function($ctx1) {
  45993. self._assert_($recv(aBlock)._value());
  45994. return self;
  45995. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  45996. },
  45997. args: ["aBlock"],
  45998. source: "should: aBlock\x0a\x09self assert: aBlock value",
  45999. referencedClasses: [],
  46000. messageSends: ["assert:", "value"]
  46001. }),
  46002. $globals.TestCase);
  46003. $core.addMethod(
  46004. $core.method({
  46005. selector: "should:raise:",
  46006. protocol: "testing",
  46007. fn: function (aBlock,anExceptionClass){
  46008. var self=this;
  46009. return $core.withContext(function($ctx1) {
  46010. self._assert_($recv((function(){
  46011. return $core.withContext(function($ctx2) {
  46012. $recv(aBlock)._value();
  46013. return false;
  46014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46015. }))._on_do_(anExceptionClass,(function(ex){
  46016. return true;
  46017. })));
  46018. return self;
  46019. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  46020. },
  46021. args: ["aBlock", "anExceptionClass"],
  46022. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  46023. referencedClasses: [],
  46024. messageSends: ["assert:", "on:do:", "value"]
  46025. }),
  46026. $globals.TestCase);
  46027. $core.addMethod(
  46028. $core.method({
  46029. selector: "shouldnt:raise:",
  46030. protocol: "testing",
  46031. fn: function (aBlock,anExceptionClass){
  46032. var self=this;
  46033. return $core.withContext(function($ctx1) {
  46034. self._assert_($recv((function(){
  46035. return $core.withContext(function($ctx2) {
  46036. $recv(aBlock)._value();
  46037. return true;
  46038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46039. }))._on_do_(anExceptionClass,(function(ex){
  46040. return false;
  46041. })));
  46042. return self;
  46043. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  46044. },
  46045. args: ["aBlock", "anExceptionClass"],
  46046. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  46047. referencedClasses: [],
  46048. messageSends: ["assert:", "on:do:", "value"]
  46049. }),
  46050. $globals.TestCase);
  46051. $core.addMethod(
  46052. $core.method({
  46053. selector: "signalFailure:",
  46054. protocol: "private",
  46055. fn: function (aString){
  46056. var self=this;
  46057. return $core.withContext(function($ctx1) {
  46058. var $1;
  46059. $1=$recv($globals.TestFailure)._new();
  46060. $recv($1)._messageText_(aString);
  46061. $recv($1)._signal();
  46062. return self;
  46063. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  46064. },
  46065. args: ["aString"],
  46066. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  46067. referencedClasses: ["TestFailure"],
  46068. messageSends: ["messageText:", "new", "signal"]
  46069. }),
  46070. $globals.TestCase);
  46071. $core.addMethod(
  46072. $core.method({
  46073. selector: "tearDown",
  46074. protocol: "running",
  46075. fn: function (){
  46076. var self=this;
  46077. return self;
  46078. },
  46079. args: [],
  46080. source: "tearDown",
  46081. referencedClasses: [],
  46082. messageSends: []
  46083. }),
  46084. $globals.TestCase);
  46085. $core.addMethod(
  46086. $core.method({
  46087. selector: "timeout:",
  46088. protocol: "async",
  46089. fn: function (aNumber){
  46090. var self=this;
  46091. return $core.withContext(function($ctx1) {
  46092. var $1,$receiver;
  46093. $1=self["@asyncTimeout"];
  46094. if(($receiver = $1) == null || $receiver.isNil){
  46095. $1;
  46096. } else {
  46097. $recv(self["@asyncTimeout"])._clearTimeout();
  46098. }
  46099. self["@asyncTimeout"]=(0);
  46100. self["@asyncTimeout"]=$recv(self._async_((function(){
  46101. return $core.withContext(function($ctx2) {
  46102. return self._assert_description_(false,"SUnit grace time exhausted");
  46103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46104. })))._valueWithTimeout_(aNumber);
  46105. return self;
  46106. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  46107. },
  46108. args: ["aNumber"],
  46109. 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",
  46110. referencedClasses: [],
  46111. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  46112. }),
  46113. $globals.TestCase);
  46114. $core.addMethod(
  46115. $core.method({
  46116. selector: "allTestSelectors",
  46117. protocol: "accessing",
  46118. fn: function (){
  46119. var self=this;
  46120. var selectors;
  46121. return $core.withContext(function($ctx1) {
  46122. var $1;
  46123. selectors=self._testSelectors();
  46124. $1=self._shouldInheritSelectors();
  46125. if($core.assert($1)){
  46126. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  46127. }
  46128. return selectors;
  46129. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  46130. },
  46131. args: [],
  46132. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  46133. referencedClasses: [],
  46134. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  46135. }),
  46136. $globals.TestCase.klass);
  46137. $core.addMethod(
  46138. $core.method({
  46139. selector: "buildSuite",
  46140. protocol: "accessing",
  46141. fn: function (){
  46142. var self=this;
  46143. return $core.withContext(function($ctx1) {
  46144. return $recv(self._allTestSelectors())._collect_((function(each){
  46145. return $core.withContext(function($ctx2) {
  46146. return self._selector_(each);
  46147. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46148. }));
  46149. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  46150. },
  46151. args: [],
  46152. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  46153. referencedClasses: [],
  46154. messageSends: ["collect:", "allTestSelectors", "selector:"]
  46155. }),
  46156. $globals.TestCase.klass);
  46157. $core.addMethod(
  46158. $core.method({
  46159. selector: "classTag",
  46160. protocol: "accessing",
  46161. fn: function (){
  46162. var self=this;
  46163. return "test";
  46164. },
  46165. args: [],
  46166. 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'",
  46167. referencedClasses: [],
  46168. messageSends: []
  46169. }),
  46170. $globals.TestCase.klass);
  46171. $core.addMethod(
  46172. $core.method({
  46173. selector: "isAbstract",
  46174. protocol: "testing",
  46175. fn: function (){
  46176. var self=this;
  46177. return $core.withContext(function($ctx1) {
  46178. return $recv(self._name()).__eq("TestCase");
  46179. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  46180. },
  46181. args: [],
  46182. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  46183. referencedClasses: [],
  46184. messageSends: ["=", "name"]
  46185. }),
  46186. $globals.TestCase.klass);
  46187. $core.addMethod(
  46188. $core.method({
  46189. selector: "isTestClass",
  46190. protocol: "testing",
  46191. fn: function (){
  46192. var self=this;
  46193. return $core.withContext(function($ctx1) {
  46194. return $recv(self._isAbstract())._not();
  46195. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.klass)});
  46196. },
  46197. args: [],
  46198. source: "isTestClass\x0a\x09^ self isAbstract not",
  46199. referencedClasses: [],
  46200. messageSends: ["not", "isAbstract"]
  46201. }),
  46202. $globals.TestCase.klass);
  46203. $core.addMethod(
  46204. $core.method({
  46205. selector: "lookupHierarchyRoot",
  46206. protocol: "accessing",
  46207. fn: function (){
  46208. var self=this;
  46209. return $globals.TestCase;
  46210. },
  46211. args: [],
  46212. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  46213. referencedClasses: ["TestCase"],
  46214. messageSends: []
  46215. }),
  46216. $globals.TestCase.klass);
  46217. $core.addMethod(
  46218. $core.method({
  46219. selector: "selector:",
  46220. protocol: "accessing",
  46221. fn: function (aSelector){
  46222. var self=this;
  46223. return $core.withContext(function($ctx1) {
  46224. var $1;
  46225. $1=self._new();
  46226. $recv($1)._setTestSelector_(aSelector);
  46227. return $recv($1)._yourself();
  46228. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  46229. },
  46230. args: ["aSelector"],
  46231. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  46232. referencedClasses: [],
  46233. messageSends: ["setTestSelector:", "new", "yourself"]
  46234. }),
  46235. $globals.TestCase.klass);
  46236. $core.addMethod(
  46237. $core.method({
  46238. selector: "shouldInheritSelectors",
  46239. protocol: "testing",
  46240. fn: function (){
  46241. var self=this;
  46242. return $core.withContext(function($ctx1) {
  46243. return self.__tild_eq(self._lookupHierarchyRoot());
  46244. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  46245. },
  46246. args: [],
  46247. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  46248. referencedClasses: [],
  46249. messageSends: ["~=", "lookupHierarchyRoot"]
  46250. }),
  46251. $globals.TestCase.klass);
  46252. $core.addMethod(
  46253. $core.method({
  46254. selector: "testSelectors",
  46255. protocol: "accessing",
  46256. fn: function (){
  46257. var self=this;
  46258. return $core.withContext(function($ctx1) {
  46259. return $recv($recv(self._methodDictionary())._keys())._select_((function(each){
  46260. return $core.withContext(function($ctx2) {
  46261. return $recv(each)._match_("^test");
  46262. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46263. }));
  46264. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  46265. },
  46266. args: [],
  46267. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  46268. referencedClasses: [],
  46269. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  46270. }),
  46271. $globals.TestCase.klass);
  46272. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  46273. $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).";
  46274. $core.addMethod(
  46275. $core.method({
  46276. selector: "execute:",
  46277. protocol: "running",
  46278. fn: function (aBlock){
  46279. var self=this;
  46280. var failed;
  46281. return $core.withContext(function($ctx1) {
  46282. var $1,$2;
  46283. $recv(self["@testCase"])._context_(self);
  46284. $ctx1.sendIdx["context:"]=1;
  46285. $recv((function(){
  46286. return $core.withContext(function($ctx2) {
  46287. failed=true;
  46288. failed;
  46289. $recv(aBlock)._value();
  46290. failed=false;
  46291. return failed;
  46292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46293. }))._ensure_((function(){
  46294. return $core.withContext(function($ctx2) {
  46295. $recv(self["@testCase"])._context_(nil);
  46296. $1=$recv(failed)._and_((function(){
  46297. return $core.withContext(function($ctx3) {
  46298. return $recv(self["@testCase"])._isAsync();
  46299. $ctx3.sendIdx["isAsync"]=1;
  46300. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  46301. }));
  46302. if($core.assert($1)){
  46303. $recv(self["@testCase"])._finished();
  46304. }
  46305. $2=$recv(self["@testCase"])._isAsync();
  46306. if(!$core.assert($2)){
  46307. return $recv(self["@testCase"])._tearDown();
  46308. }
  46309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46310. }));
  46311. return self;
  46312. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  46313. },
  46314. args: ["aBlock"],
  46315. 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 ] ]",
  46316. referencedClasses: [],
  46317. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  46318. }),
  46319. $globals.TestContext);
  46320. $core.addMethod(
  46321. $core.method({
  46322. selector: "start",
  46323. protocol: "running",
  46324. fn: function (){
  46325. var self=this;
  46326. return $core.withContext(function($ctx1) {
  46327. self._execute_((function(){
  46328. return $core.withContext(function($ctx2) {
  46329. $recv(self["@testCase"])._setUp();
  46330. return $recv(self["@testCase"])._performTest();
  46331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46332. }));
  46333. return self;
  46334. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  46335. },
  46336. args: [],
  46337. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  46338. referencedClasses: [],
  46339. messageSends: ["execute:", "setUp", "performTest"]
  46340. }),
  46341. $globals.TestContext);
  46342. $core.addMethod(
  46343. $core.method({
  46344. selector: "testCase:",
  46345. protocol: "accessing",
  46346. fn: function (aTestCase){
  46347. var self=this;
  46348. self["@testCase"]=aTestCase;
  46349. return self;
  46350. },
  46351. args: ["aTestCase"],
  46352. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  46353. referencedClasses: [],
  46354. messageSends: []
  46355. }),
  46356. $globals.TestContext);
  46357. $core.addMethod(
  46358. $core.method({
  46359. selector: "testCase:",
  46360. protocol: "instance creation",
  46361. fn: function (aTestCase){
  46362. var self=this;
  46363. return $core.withContext(function($ctx1) {
  46364. var $1;
  46365. $1=self._new();
  46366. $recv($1)._testCase_(aTestCase);
  46367. return $recv($1)._yourself();
  46368. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  46369. },
  46370. args: ["aTestCase"],
  46371. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  46372. referencedClasses: [],
  46373. messageSends: ["testCase:", "new", "yourself"]
  46374. }),
  46375. $globals.TestContext.klass);
  46376. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  46377. $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`.";
  46378. $core.addMethod(
  46379. $core.method({
  46380. selector: "execute:",
  46381. protocol: "running",
  46382. fn: function (aBlock){
  46383. var self=this;
  46384. return $core.withContext(function($ctx1) {
  46385. var $1;
  46386. $recv((function(){
  46387. return $core.withContext(function($ctx2) {
  46388. return self._withErrorReporting_((function(){
  46389. return $core.withContext(function($ctx3) {
  46390. return (
  46391. $ctx3.supercall = true,
  46392. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($recv(self), [aBlock]));
  46393. $ctx3.supercall = false;
  46394. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46395. }));
  46396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46397. }))._ensure_((function(){
  46398. return $core.withContext(function($ctx2) {
  46399. $1=$recv(self["@testCase"])._isAsync();
  46400. if(!$core.assert($1)){
  46401. $recv(self["@result"])._increaseRuns();
  46402. return $recv(self["@finished"])._value();
  46403. }
  46404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46405. }));
  46406. return self;
  46407. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  46408. },
  46409. args: ["aBlock"],
  46410. 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 ] ]",
  46411. referencedClasses: [],
  46412. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  46413. }),
  46414. $globals.ReportingTestContext);
  46415. $core.addMethod(
  46416. $core.method({
  46417. selector: "finished:",
  46418. protocol: "accessing",
  46419. fn: function (aBlock){
  46420. var self=this;
  46421. self["@finished"]=aBlock;
  46422. return self;
  46423. },
  46424. args: ["aBlock"],
  46425. source: "finished: aBlock\x0a\x09finished := aBlock",
  46426. referencedClasses: [],
  46427. messageSends: []
  46428. }),
  46429. $globals.ReportingTestContext);
  46430. $core.addMethod(
  46431. $core.method({
  46432. selector: "result:",
  46433. protocol: "accessing",
  46434. fn: function (aTestResult){
  46435. var self=this;
  46436. self["@result"]=aTestResult;
  46437. return self;
  46438. },
  46439. args: ["aTestResult"],
  46440. source: "result: aTestResult\x0a\x09result := aTestResult",
  46441. referencedClasses: [],
  46442. messageSends: []
  46443. }),
  46444. $globals.ReportingTestContext);
  46445. $core.addMethod(
  46446. $core.method({
  46447. selector: "withErrorReporting:",
  46448. protocol: "private",
  46449. fn: function (aBlock){
  46450. var self=this;
  46451. return $core.withContext(function($ctx1) {
  46452. $recv((function(){
  46453. return $core.withContext(function($ctx2) {
  46454. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  46455. return $core.withContext(function($ctx3) {
  46456. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  46457. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  46458. }));
  46459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46460. }))._on_do_($globals.Error,(function(ex){
  46461. return $core.withContext(function($ctx2) {
  46462. return $recv(self["@result"])._addError_(self["@testCase"]);
  46463. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  46464. }));
  46465. $ctx1.sendIdx["on:do:"]=1;
  46466. return self;
  46467. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  46468. },
  46469. args: ["aBlock"],
  46470. 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 ]",
  46471. referencedClasses: ["TestFailure", "Error"],
  46472. messageSends: ["on:do:", "addFailure:", "addError:"]
  46473. }),
  46474. $globals.ReportingTestContext);
  46475. $core.addMethod(
  46476. $core.method({
  46477. selector: "testCase:result:finished:",
  46478. protocol: "instance creation",
  46479. fn: function (aTestCase,aTestResult,aBlock){
  46480. var self=this;
  46481. return $core.withContext(function($ctx1) {
  46482. var $1;
  46483. $1=(
  46484. $ctx1.supercall = true,
  46485. ($globals.ReportingTestContext.klass.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  46486. $ctx1.supercall = false;
  46487. $recv($1)._result_(aTestResult);
  46488. $recv($1)._finished_(aBlock);
  46489. return $recv($1)._yourself();
  46490. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  46491. },
  46492. args: ["aTestCase", "aTestResult", "aBlock"],
  46493. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  46494. referencedClasses: [],
  46495. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  46496. }),
  46497. $globals.ReportingTestContext.klass);
  46498. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  46499. $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.";
  46500. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  46501. $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";
  46502. $core.addMethod(
  46503. $core.method({
  46504. selector: "addError:",
  46505. protocol: "accessing",
  46506. fn: function (anError){
  46507. var self=this;
  46508. return $core.withContext(function($ctx1) {
  46509. $recv(self._errors())._add_(anError);
  46510. return self;
  46511. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  46512. },
  46513. args: ["anError"],
  46514. source: "addError: anError\x0a\x09self errors add: anError",
  46515. referencedClasses: [],
  46516. messageSends: ["add:", "errors"]
  46517. }),
  46518. $globals.TestResult);
  46519. $core.addMethod(
  46520. $core.method({
  46521. selector: "addFailure:",
  46522. protocol: "accessing",
  46523. fn: function (aFailure){
  46524. var self=this;
  46525. return $core.withContext(function($ctx1) {
  46526. $recv(self._failures())._add_(aFailure);
  46527. return self;
  46528. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  46529. },
  46530. args: ["aFailure"],
  46531. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  46532. referencedClasses: [],
  46533. messageSends: ["add:", "failures"]
  46534. }),
  46535. $globals.TestResult);
  46536. $core.addMethod(
  46537. $core.method({
  46538. selector: "errors",
  46539. protocol: "accessing",
  46540. fn: function (){
  46541. var self=this;
  46542. return self["@errors"];
  46543. },
  46544. args: [],
  46545. source: "errors\x0a\x09^ errors",
  46546. referencedClasses: [],
  46547. messageSends: []
  46548. }),
  46549. $globals.TestResult);
  46550. $core.addMethod(
  46551. $core.method({
  46552. selector: "failures",
  46553. protocol: "accessing",
  46554. fn: function (){
  46555. var self=this;
  46556. return self["@failures"];
  46557. },
  46558. args: [],
  46559. source: "failures\x0a\x09^ failures",
  46560. referencedClasses: [],
  46561. messageSends: []
  46562. }),
  46563. $globals.TestResult);
  46564. $core.addMethod(
  46565. $core.method({
  46566. selector: "increaseRuns",
  46567. protocol: "accessing",
  46568. fn: function (){
  46569. var self=this;
  46570. return $core.withContext(function($ctx1) {
  46571. self["@runs"]=$recv(self["@runs"]).__plus((1));
  46572. return self;
  46573. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  46574. },
  46575. args: [],
  46576. source: "increaseRuns\x0a\x09runs := runs + 1",
  46577. referencedClasses: [],
  46578. messageSends: ["+"]
  46579. }),
  46580. $globals.TestResult);
  46581. $core.addMethod(
  46582. $core.method({
  46583. selector: "initialize",
  46584. protocol: "initialization",
  46585. fn: function (){
  46586. var self=this;
  46587. return $core.withContext(function($ctx1) {
  46588. (
  46589. $ctx1.supercall = true,
  46590. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  46591. $ctx1.supercall = false;
  46592. self["@timestamp"]=$recv($globals.Date)._now();
  46593. self["@runs"]=(0);
  46594. self["@errors"]=$recv($globals.Array)._new();
  46595. $ctx1.sendIdx["new"]=1;
  46596. self["@failures"]=$recv($globals.Array)._new();
  46597. self["@total"]=(0);
  46598. return self;
  46599. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  46600. },
  46601. args: [],
  46602. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  46603. referencedClasses: ["Date", "Array"],
  46604. messageSends: ["initialize", "now", "new"]
  46605. }),
  46606. $globals.TestResult);
  46607. $core.addMethod(
  46608. $core.method({
  46609. selector: "nextRunDo:",
  46610. protocol: "running",
  46611. fn: function (aBlock){
  46612. var self=this;
  46613. return $core.withContext(function($ctx1) {
  46614. var $2,$1;
  46615. $2=self._runs();
  46616. $ctx1.sendIdx["runs"]=1;
  46617. $1=$recv($2).__eq_eq(self._total());
  46618. if(!$core.assert($1)){
  46619. return $recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  46620. }
  46621. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  46622. },
  46623. args: ["aBlock"],
  46624. 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 ]",
  46625. referencedClasses: [],
  46626. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  46627. }),
  46628. $globals.TestResult);
  46629. $core.addMethod(
  46630. $core.method({
  46631. selector: "runCase:",
  46632. protocol: "running",
  46633. fn: function (aTestCase){
  46634. var self=this;
  46635. return $core.withContext(function($ctx1) {
  46636. $recv((function(){
  46637. return $core.withContext(function($ctx2) {
  46638. return $recv((function(){
  46639. return $core.withContext(function($ctx3) {
  46640. self._increaseRuns();
  46641. return $recv(aTestCase)._runCase();
  46642. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46643. }))._on_do_($globals.TestFailure,(function(ex){
  46644. return $core.withContext(function($ctx3) {
  46645. return self._addFailure_(aTestCase);
  46646. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  46647. }));
  46648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46649. }))._on_do_($globals.Error,(function(ex){
  46650. return $core.withContext(function($ctx2) {
  46651. return self._addError_(aTestCase);
  46652. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  46653. }));
  46654. $ctx1.sendIdx["on:do:"]=1;
  46655. return self;
  46656. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  46657. },
  46658. args: ["aTestCase"],
  46659. 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 ]",
  46660. referencedClasses: ["TestFailure", "Error"],
  46661. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  46662. }),
  46663. $globals.TestResult);
  46664. $core.addMethod(
  46665. $core.method({
  46666. selector: "runs",
  46667. protocol: "accessing",
  46668. fn: function (){
  46669. var self=this;
  46670. return self["@runs"];
  46671. },
  46672. args: [],
  46673. source: "runs\x0a\x09^ runs",
  46674. referencedClasses: [],
  46675. messageSends: []
  46676. }),
  46677. $globals.TestResult);
  46678. $core.addMethod(
  46679. $core.method({
  46680. selector: "status",
  46681. protocol: "accessing",
  46682. fn: function (){
  46683. var self=this;
  46684. return $core.withContext(function($ctx1) {
  46685. var $1;
  46686. $1=$recv(self._errors())._ifNotEmpty_ifEmpty_((function(){
  46687. return "error";
  46688. }),(function(){
  46689. return $core.withContext(function($ctx2) {
  46690. return $recv(self._failures())._ifNotEmpty_ifEmpty_((function(){
  46691. return "failure";
  46692. }),(function(){
  46693. return "success";
  46694. }));
  46695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46696. }));
  46697. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  46698. return $1;
  46699. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  46700. },
  46701. args: [],
  46702. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  46703. referencedClasses: [],
  46704. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  46705. }),
  46706. $globals.TestResult);
  46707. $core.addMethod(
  46708. $core.method({
  46709. selector: "timestamp",
  46710. protocol: "accessing",
  46711. fn: function (){
  46712. var self=this;
  46713. return self["@timestamp"];
  46714. },
  46715. args: [],
  46716. source: "timestamp\x0a\x09^ timestamp",
  46717. referencedClasses: [],
  46718. messageSends: []
  46719. }),
  46720. $globals.TestResult);
  46721. $core.addMethod(
  46722. $core.method({
  46723. selector: "total",
  46724. protocol: "accessing",
  46725. fn: function (){
  46726. var self=this;
  46727. return self["@total"];
  46728. },
  46729. args: [],
  46730. source: "total\x0a\x09^ total",
  46731. referencedClasses: [],
  46732. messageSends: []
  46733. }),
  46734. $globals.TestResult);
  46735. $core.addMethod(
  46736. $core.method({
  46737. selector: "total:",
  46738. protocol: "accessing",
  46739. fn: function (aNumber){
  46740. var self=this;
  46741. self["@total"]=aNumber;
  46742. return self;
  46743. },
  46744. args: ["aNumber"],
  46745. source: "total: aNumber\x0a\x09total := aNumber",
  46746. referencedClasses: [],
  46747. messageSends: []
  46748. }),
  46749. $globals.TestResult);
  46750. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  46751. $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`.";
  46752. $core.addMethod(
  46753. $core.method({
  46754. selector: "announcer",
  46755. protocol: "accessing",
  46756. fn: function (){
  46757. var self=this;
  46758. return self["@announcer"];
  46759. },
  46760. args: [],
  46761. source: "announcer\x0a\x09^ announcer",
  46762. referencedClasses: [],
  46763. messageSends: []
  46764. }),
  46765. $globals.TestSuiteRunner);
  46766. $core.addMethod(
  46767. $core.method({
  46768. selector: "contextOf:",
  46769. protocol: "private",
  46770. fn: function (anInteger){
  46771. var self=this;
  46772. return $core.withContext(function($ctx1) {
  46773. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  46774. return $core.withContext(function($ctx2) {
  46775. return self._resume();
  46776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46777. }));
  46778. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  46779. },
  46780. args: ["anInteger"],
  46781. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  46782. referencedClasses: ["ReportingTestContext"],
  46783. messageSends: ["testCase:result:finished:", "at:", "resume"]
  46784. }),
  46785. $globals.TestSuiteRunner);
  46786. $core.addMethod(
  46787. $core.method({
  46788. selector: "initialize",
  46789. protocol: "initialization",
  46790. fn: function (){
  46791. var self=this;
  46792. return $core.withContext(function($ctx1) {
  46793. var $1;
  46794. (
  46795. $ctx1.supercall = true,
  46796. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  46797. $ctx1.supercall = false;
  46798. self["@announcer"]=$recv($globals.Announcer)._new();
  46799. $ctx1.sendIdx["new"]=1;
  46800. self["@result"]=$recv($globals.TestResult)._new();
  46801. self["@runNextTest"]=(function(){
  46802. var runs;
  46803. return $core.withContext(function($ctx2) {
  46804. runs=$recv(self["@result"])._runs();
  46805. runs;
  46806. $1=$recv(runs).__lt($recv(self["@result"])._total());
  46807. if($core.assert($1)){
  46808. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  46809. }
  46810. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  46811. });
  46812. return self;
  46813. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  46814. },
  46815. args: [],
  46816. 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 ] ].",
  46817. referencedClasses: ["Announcer", "TestResult"],
  46818. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  46819. }),
  46820. $globals.TestSuiteRunner);
  46821. $core.addMethod(
  46822. $core.method({
  46823. selector: "result",
  46824. protocol: "accessing",
  46825. fn: function (){
  46826. var self=this;
  46827. return self["@result"];
  46828. },
  46829. args: [],
  46830. source: "result\x0a\x09^ result",
  46831. referencedClasses: [],
  46832. messageSends: []
  46833. }),
  46834. $globals.TestSuiteRunner);
  46835. $core.addMethod(
  46836. $core.method({
  46837. selector: "resume",
  46838. protocol: "actions",
  46839. fn: function (){
  46840. var self=this;
  46841. return $core.withContext(function($ctx1) {
  46842. $recv(self["@runNextTest"])._fork();
  46843. $recv(self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_(self["@result"]));
  46844. return self;
  46845. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  46846. },
  46847. args: [],
  46848. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  46849. referencedClasses: ["ResultAnnouncement"],
  46850. messageSends: ["fork", "announce:", "result:", "new"]
  46851. }),
  46852. $globals.TestSuiteRunner);
  46853. $core.addMethod(
  46854. $core.method({
  46855. selector: "run",
  46856. protocol: "actions",
  46857. fn: function (){
  46858. var self=this;
  46859. return $core.withContext(function($ctx1) {
  46860. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  46861. self._resume();
  46862. return self;
  46863. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  46864. },
  46865. args: [],
  46866. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  46867. referencedClasses: [],
  46868. messageSends: ["total:", "size", "resume"]
  46869. }),
  46870. $globals.TestSuiteRunner);
  46871. $core.addMethod(
  46872. $core.method({
  46873. selector: "suite:",
  46874. protocol: "accessing",
  46875. fn: function (aCollection){
  46876. var self=this;
  46877. self["@suite"]=aCollection;
  46878. return self;
  46879. },
  46880. args: ["aCollection"],
  46881. source: "suite: aCollection\x0a\x09suite := aCollection",
  46882. referencedClasses: [],
  46883. messageSends: []
  46884. }),
  46885. $globals.TestSuiteRunner);
  46886. $core.addMethod(
  46887. $core.method({
  46888. selector: "new",
  46889. protocol: "instance creation",
  46890. fn: function (){
  46891. var self=this;
  46892. return $core.withContext(function($ctx1) {
  46893. self._shouldNotImplement();
  46894. return self;
  46895. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  46896. },
  46897. args: [],
  46898. source: "new\x0a\x09self shouldNotImplement",
  46899. referencedClasses: [],
  46900. messageSends: ["shouldNotImplement"]
  46901. }),
  46902. $globals.TestSuiteRunner.klass);
  46903. $core.addMethod(
  46904. $core.method({
  46905. selector: "on:",
  46906. protocol: "instance creation",
  46907. fn: function (aCollection){
  46908. var self=this;
  46909. return $core.withContext(function($ctx1) {
  46910. var $1;
  46911. $1=(
  46912. $ctx1.supercall = true,
  46913. ($globals.TestSuiteRunner.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  46914. $ctx1.supercall = false;
  46915. return $recv($1)._suite_(aCollection);
  46916. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  46917. },
  46918. args: ["aCollection"],
  46919. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  46920. referencedClasses: [],
  46921. messageSends: ["suite:", "new"]
  46922. }),
  46923. $globals.TestSuiteRunner.klass);
  46924. $core.addMethod(
  46925. $core.method({
  46926. selector: "isTestClass",
  46927. protocol: "*SUnit",
  46928. fn: function (){
  46929. var self=this;
  46930. return false;
  46931. },
  46932. args: [],
  46933. source: "isTestClass\x0a\x09^ false",
  46934. referencedClasses: [],
  46935. messageSends: []
  46936. }),
  46937. $globals.BehaviorBody);
  46938. $core.addMethod(
  46939. $core.method({
  46940. selector: "isTestPackage",
  46941. protocol: "*SUnit",
  46942. fn: function (){
  46943. var self=this;
  46944. return $core.withContext(function($ctx1) {
  46945. return $recv(self._classes())._anySatisfy_((function(each){
  46946. return $core.withContext(function($ctx2) {
  46947. return $recv(each)._isTestClass();
  46948. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46949. }));
  46950. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  46951. },
  46952. args: [],
  46953. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  46954. referencedClasses: [],
  46955. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  46956. }),
  46957. $globals.Package);
  46958. });
  46959. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  46960. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  46961. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46962. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  46963. $core.addPackage("Compiler-Tests");
  46964. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  46965. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46966. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  46967. $core.addMethod(
  46968. $core.method({
  46969. selector: "analyze:forClass:",
  46970. protocol: "convenience",
  46971. fn: function (aNode,aClass){
  46972. var self=this;
  46973. return $core.withContext(function($ctx1) {
  46974. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  46975. return aNode;
  46976. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  46977. },
  46978. args: ["aNode", "aClass"],
  46979. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46980. referencedClasses: ["SemanticAnalyzer"],
  46981. messageSends: ["visit:", "on:"]
  46982. }),
  46983. $globals.ASTParsingTest);
  46984. $core.addMethod(
  46985. $core.method({
  46986. selector: "parse:",
  46987. protocol: "parsing",
  46988. fn: function (aString){
  46989. var self=this;
  46990. return $core.withContext(function($ctx1) {
  46991. return $recv($globals.Smalltalk)._parse_(aString);
  46992. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  46993. },
  46994. args: ["aString"],
  46995. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46996. referencedClasses: ["Smalltalk"],
  46997. messageSends: ["parse:"]
  46998. }),
  46999. $globals.ASTParsingTest);
  47000. $core.addMethod(
  47001. $core.method({
  47002. selector: "parse:forClass:",
  47003. protocol: "parsing",
  47004. fn: function (aString,aClass){
  47005. var self=this;
  47006. return $core.withContext(function($ctx1) {
  47007. return self._analyze_forClass_(self._parse_(aString),aClass);
  47008. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  47009. },
  47010. args: ["aString", "aClass"],
  47011. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  47012. referencedClasses: [],
  47013. messageSends: ["analyze:forClass:", "parse:"]
  47014. }),
  47015. $globals.ASTParsingTest);
  47016. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  47017. $core.addMethod(
  47018. $core.method({
  47019. selector: "astPCNodeVisitor",
  47020. protocol: "factory",
  47021. fn: function (){
  47022. var self=this;
  47023. return $core.withContext(function($ctx1) {
  47024. var $1;
  47025. $1=$recv($globals.ASTPCNodeVisitor)._new();
  47026. $recv($1)._index_((0));
  47027. return $recv($1)._yourself();
  47028. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  47029. },
  47030. args: [],
  47031. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  47032. referencedClasses: ["ASTPCNodeVisitor"],
  47033. messageSends: ["index:", "new", "yourself"]
  47034. }),
  47035. $globals.ASTPCNodeVisitorTest);
  47036. $core.addMethod(
  47037. $core.method({
  47038. selector: "astPCNodeVisitorForSelector:",
  47039. protocol: "factory",
  47040. fn: function (aString){
  47041. var self=this;
  47042. return $core.withContext(function($ctx1) {
  47043. var $1;
  47044. $1=$recv($globals.ASTPCNodeVisitor)._new();
  47045. $recv($1)._selector_(aString);
  47046. $recv($1)._index_((0));
  47047. return $recv($1)._yourself();
  47048. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  47049. },
  47050. args: ["aString"],
  47051. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  47052. referencedClasses: ["ASTPCNodeVisitor"],
  47053. messageSends: ["selector:", "new", "index:", "yourself"]
  47054. }),
  47055. $globals.ASTPCNodeVisitorTest);
  47056. $core.addMethod(
  47057. $core.method({
  47058. selector: "testJSStatementNode",
  47059. protocol: "tests",
  47060. fn: function (){
  47061. var self=this;
  47062. var ast,visitor;
  47063. return $core.withContext(function($ctx1) {
  47064. var $3,$2,$1;
  47065. ast=self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  47066. $3=self._astPCNodeVisitor();
  47067. $recv($3)._visit_(ast);
  47068. $2=$recv($3)._currentNode();
  47069. $1=$recv($2)._isJSStatementNode();
  47070. self._assert_($1);
  47071. return self;
  47072. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  47073. },
  47074. args: [],
  47075. 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",
  47076. referencedClasses: ["Object"],
  47077. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  47078. }),
  47079. $globals.ASTPCNodeVisitorTest);
  47080. $core.addMethod(
  47081. $core.method({
  47082. selector: "testLegacyJSStatementNode",
  47083. protocol: "tests",
  47084. fn: function (){
  47085. var self=this;
  47086. var ast,visitor;
  47087. return $core.withContext(function($ctx1) {
  47088. var $3,$2,$1;
  47089. ast=self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  47090. $3=self._astPCNodeVisitor();
  47091. $recv($3)._visit_(ast);
  47092. $2=$recv($3)._currentNode();
  47093. $1=$recv($2)._isJSStatementNode();
  47094. self._assert_($1);
  47095. return self;
  47096. }, function($ctx1) {$ctx1.fill(self,"testLegacyJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  47097. },
  47098. args: [],
  47099. source: "testLegacyJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  47100. referencedClasses: ["Object"],
  47101. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  47102. }),
  47103. $globals.ASTPCNodeVisitorTest);
  47104. $core.addMethod(
  47105. $core.method({
  47106. selector: "testMessageSend",
  47107. protocol: "tests",
  47108. fn: function (){
  47109. var self=this;
  47110. var ast;
  47111. return $core.withContext(function($ctx1) {
  47112. var $3,$2,$1;
  47113. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  47114. $3=self._astPCNodeVisitorForSelector_("yourself");
  47115. $recv($3)._visit_(ast);
  47116. $2=$recv($3)._currentNode();
  47117. $1=$recv($2)._selector();
  47118. self._assert_equals_($1,"yourself");
  47119. return self;
  47120. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  47121. },
  47122. args: [],
  47123. 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'",
  47124. referencedClasses: ["Object"],
  47125. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  47126. }),
  47127. $globals.ASTPCNodeVisitorTest);
  47128. $core.addMethod(
  47129. $core.method({
  47130. selector: "testMessageSendWithBlocks",
  47131. protocol: "tests",
  47132. fn: function (){
  47133. var self=this;
  47134. var ast;
  47135. return $core.withContext(function($ctx1) {
  47136. var $3,$2,$1;
  47137. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  47138. $3=self._astPCNodeVisitorForSelector_("yourself");
  47139. $recv($3)._visit_(ast);
  47140. $2=$recv($3)._currentNode();
  47141. $1=$recv($2)._selector();
  47142. self._assert_equals_($1,"yourself");
  47143. return self;
  47144. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  47145. },
  47146. args: [],
  47147. 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'",
  47148. referencedClasses: ["Object"],
  47149. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  47150. }),
  47151. $globals.ASTPCNodeVisitorTest);
  47152. $core.addMethod(
  47153. $core.method({
  47154. selector: "testMessageSendWithInlining",
  47155. protocol: "tests",
  47156. fn: function (){
  47157. var self=this;
  47158. var ast;
  47159. return $core.withContext(function($ctx1) {
  47160. var $3,$4,$2,$1,$7,$6,$5;
  47161. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  47162. $ctx1.sendIdx["parse:forClass:"]=1;
  47163. $3=self._astPCNodeVisitorForSelector_("yourself");
  47164. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  47165. $recv($3)._visit_(ast);
  47166. $ctx1.sendIdx["visit:"]=1;
  47167. $4=$recv($3)._currentNode();
  47168. $ctx1.sendIdx["currentNode"]=1;
  47169. $2=$4;
  47170. $1=$recv($2)._selector();
  47171. $ctx1.sendIdx["selector"]=1;
  47172. self._assert_equals_($1,"yourself");
  47173. $ctx1.sendIdx["assert:equals:"]=1;
  47174. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  47175. $7=self._astPCNodeVisitorForSelector_("asBoolean");
  47176. $recv($7)._visit_(ast);
  47177. $6=$recv($7)._currentNode();
  47178. $5=$recv($6)._selector();
  47179. self._assert_equals_($5,"asBoolean");
  47180. return self;
  47181. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  47182. },
  47183. args: [],
  47184. 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'",
  47185. referencedClasses: ["Object"],
  47186. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  47187. }),
  47188. $globals.ASTPCNodeVisitorTest);
  47189. $core.addMethod(
  47190. $core.method({
  47191. selector: "testNoMessageSend",
  47192. protocol: "tests",
  47193. fn: function (){
  47194. var self=this;
  47195. var ast;
  47196. return $core.withContext(function($ctx1) {
  47197. var $3,$2,$1;
  47198. ast=self._parse_forClass_("foo ^ self",$globals.Object);
  47199. $3=self._astPCNodeVisitor();
  47200. $recv($3)._visit_(ast);
  47201. $2=$recv($3)._currentNode();
  47202. $1=$recv($2)._isNil();
  47203. self._assert_($1);
  47204. return self;
  47205. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  47206. },
  47207. args: [],
  47208. 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",
  47209. referencedClasses: ["Object"],
  47210. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  47211. }),
  47212. $globals.ASTPCNodeVisitorTest);
  47213. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  47214. $core.addMethod(
  47215. $core.method({
  47216. selector: "testNodeAtPosition",
  47217. protocol: "tests",
  47218. fn: function (){
  47219. var self=this;
  47220. var node;
  47221. return $core.withContext(function($ctx1) {
  47222. var $3,$4,$2,$1,$7,$8,$6,$5;
  47223. node=self._parse_("yourself\x0a\x09^ self");
  47224. $ctx1.sendIdx["parse:"]=1;
  47225. $3=node;
  47226. $4=(2).__at((4));
  47227. $ctx1.sendIdx["@"]=1;
  47228. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  47229. return nil;
  47230. }));
  47231. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  47232. $1=$recv($2)._source();
  47233. self._assert_equals_($1,"self");
  47234. $ctx1.sendIdx["assert:equals:"]=1;
  47235. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  47236. $ctx1.sendIdx["parse:"]=2;
  47237. $7=node;
  47238. $8=(2).__at((7));
  47239. $ctx1.sendIdx["@"]=2;
  47240. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  47241. return nil;
  47242. }));
  47243. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  47244. $5=$recv($6)._selector();
  47245. $ctx1.sendIdx["selector"]=1;
  47246. self._assert_equals_($5,"ifTrue:");
  47247. $ctx1.sendIdx["assert:equals:"]=2;
  47248. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  47249. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  47250. return nil;
  47251. })))._selector(),"foo");
  47252. return self;
  47253. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  47254. },
  47255. args: [],
  47256. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  47257. referencedClasses: [],
  47258. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  47259. }),
  47260. $globals.ASTPositionTest);
  47261. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  47262. $core.addMethod(
  47263. $core.method({
  47264. selector: "codeGeneratorClass",
  47265. protocol: "accessing",
  47266. fn: function (){
  47267. var self=this;
  47268. return $globals.CodeGenerator;
  47269. },
  47270. args: [],
  47271. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  47272. referencedClasses: ["CodeGenerator"],
  47273. messageSends: []
  47274. }),
  47275. $globals.CodeGeneratorTest);
  47276. $core.addMethod(
  47277. $core.method({
  47278. selector: "compiler",
  47279. protocol: "factory",
  47280. fn: function (){
  47281. var self=this;
  47282. return $core.withContext(function($ctx1) {
  47283. var $1;
  47284. $1=$recv($globals.Compiler)._new();
  47285. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  47286. return $recv($1)._yourself();
  47287. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  47288. },
  47289. args: [],
  47290. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  47291. referencedClasses: ["Compiler"],
  47292. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  47293. }),
  47294. $globals.CodeGeneratorTest);
  47295. $core.addMethod(
  47296. $core.method({
  47297. selector: "setUp",
  47298. protocol: "initialization",
  47299. fn: function (){
  47300. var self=this;
  47301. return $core.withContext(function($ctx1) {
  47302. self["@receiver"]=$recv($globals.DoIt)._new();
  47303. return self;
  47304. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  47305. },
  47306. args: [],
  47307. source: "setUp\x0a\x09receiver := DoIt new",
  47308. referencedClasses: ["DoIt"],
  47309. messageSends: ["new"]
  47310. }),
  47311. $globals.CodeGeneratorTest);
  47312. $core.addMethod(
  47313. $core.method({
  47314. selector: "should:receiver:raise:",
  47315. protocol: "testing",
  47316. fn: function (aString,anObject,anErrorClass){
  47317. var self=this;
  47318. var method,result;
  47319. return $core.withContext(function($ctx1) {
  47320. var $1,$2,$3,$receiver;
  47321. self["@receiver"]=anObject;
  47322. $recv((function(){
  47323. return $core.withContext(function($ctx2) {
  47324. return self._should_raise_((function(){
  47325. return $core.withContext(function($ctx3) {
  47326. $1=self._compiler();
  47327. $2=$recv(anObject)._class();
  47328. $ctx3.sendIdx["class"]=1;
  47329. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  47330. method;
  47331. return $recv(self["@receiver"])._perform_($recv(method)._selector());
  47332. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47333. }),anErrorClass);
  47334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47335. }))._ensure_((function(){
  47336. return $core.withContext(function($ctx2) {
  47337. $3=method;
  47338. if(($receiver = $3) == null || $receiver.isNil){
  47339. return $3;
  47340. } else {
  47341. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  47342. }
  47343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47344. }));
  47345. return self;
  47346. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  47347. },
  47348. args: ["aString", "anObject", "anErrorClass"],
  47349. 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 ] ]",
  47350. referencedClasses: [],
  47351. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  47352. }),
  47353. $globals.CodeGeneratorTest);
  47354. $core.addMethod(
  47355. $core.method({
  47356. selector: "should:receiver:return:",
  47357. protocol: "testing",
  47358. fn: function (aString,anObject,aResult){
  47359. var self=this;
  47360. var method,result;
  47361. return $core.withContext(function($ctx1) {
  47362. var $1,$2;
  47363. self["@receiver"]=anObject;
  47364. $1=self._compiler();
  47365. $2=$recv(anObject)._class();
  47366. $ctx1.sendIdx["class"]=1;
  47367. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  47368. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  47369. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  47370. self._assert_equals_(aResult,result);
  47371. return self;
  47372. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  47373. },
  47374. args: ["aString", "anObject", "aResult"],
  47375. 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",
  47376. referencedClasses: [],
  47377. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  47378. }),
  47379. $globals.CodeGeneratorTest);
  47380. $core.addMethod(
  47381. $core.method({
  47382. selector: "should:return:",
  47383. protocol: "testing",
  47384. fn: function (aString,anObject){
  47385. var self=this;
  47386. return $core.withContext(function($ctx1) {
  47387. return self._should_receiver_return_(aString,self["@receiver"],anObject);
  47388. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  47389. },
  47390. args: ["aString", "anObject"],
  47391. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  47392. referencedClasses: [],
  47393. messageSends: ["should:receiver:return:"]
  47394. }),
  47395. $globals.CodeGeneratorTest);
  47396. $core.addMethod(
  47397. $core.method({
  47398. selector: "tearDown",
  47399. protocol: "initialization",
  47400. fn: function (){
  47401. var self=this;
  47402. return self;
  47403. },
  47404. args: [],
  47405. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  47406. referencedClasses: [],
  47407. messageSends: []
  47408. }),
  47409. $globals.CodeGeneratorTest);
  47410. $core.addMethod(
  47411. $core.method({
  47412. selector: "testAssignment",
  47413. protocol: "tests",
  47414. fn: function (){
  47415. var self=this;
  47416. return $core.withContext(function($ctx1) {
  47417. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  47418. $ctx1.sendIdx["should:return:"]=1;
  47419. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  47420. $ctx1.sendIdx["should:return:"]=2;
  47421. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  47422. return self;
  47423. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  47424. },
  47425. args: [],
  47426. 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",
  47427. referencedClasses: [],
  47428. messageSends: ["should:return:"]
  47429. }),
  47430. $globals.CodeGeneratorTest);
  47431. $core.addMethod(
  47432. $core.method({
  47433. selector: "testBackslashSelectors",
  47434. protocol: "tests",
  47435. fn: function (){
  47436. var self=this;
  47437. return $core.withContext(function($ctx1) {
  47438. self._should_return_("\x5c arg ^ 4",(4));
  47439. $ctx1.sendIdx["should:return:"]=1;
  47440. self._should_return_("\x5c\x5c arg ^ 42",(42));
  47441. return self;
  47442. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  47443. },
  47444. args: [],
  47445. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  47446. referencedClasses: [],
  47447. messageSends: ["should:return:"]
  47448. }),
  47449. $globals.CodeGeneratorTest);
  47450. $core.addMethod(
  47451. $core.method({
  47452. selector: "testBlockReturn",
  47453. protocol: "tests",
  47454. fn: function (){
  47455. var self=this;
  47456. return $core.withContext(function($ctx1) {
  47457. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  47458. $ctx1.sendIdx["should:return:"]=1;
  47459. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  47460. $ctx1.sendIdx["should:return:"]=2;
  47461. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  47462. return self;
  47463. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  47464. },
  47465. args: [],
  47466. 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).",
  47467. referencedClasses: [],
  47468. messageSends: ["should:return:"]
  47469. }),
  47470. $globals.CodeGeneratorTest);
  47471. $core.addMethod(
  47472. $core.method({
  47473. selector: "testCascades",
  47474. protocol: "tests",
  47475. fn: function (){
  47476. var self=this;
  47477. return $core.withContext(function($ctx1) {
  47478. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  47479. return self;
  47480. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  47481. },
  47482. args: [],
  47483. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  47484. referencedClasses: [],
  47485. messageSends: ["should:return:"]
  47486. }),
  47487. $globals.CodeGeneratorTest);
  47488. $core.addMethod(
  47489. $core.method({
  47490. selector: "testCascadesInDynamicArray",
  47491. protocol: "tests",
  47492. fn: function (){
  47493. var self=this;
  47494. return $core.withContext(function($ctx1) {
  47495. self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  47496. return self;
  47497. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  47498. },
  47499. args: [],
  47500. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  47501. referencedClasses: [],
  47502. messageSends: ["should:return:"]
  47503. }),
  47504. $globals.CodeGeneratorTest);
  47505. $core.addMethod(
  47506. $core.method({
  47507. selector: "testCascadesInDynamicDictioary",
  47508. protocol: "tests",
  47509. fn: function (){
  47510. var self=this;
  47511. return $core.withContext(function($ctx1) {
  47512. self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  47513. return self;
  47514. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  47515. },
  47516. args: [],
  47517. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  47518. referencedClasses: [],
  47519. messageSends: ["should:return:"]
  47520. }),
  47521. $globals.CodeGeneratorTest);
  47522. $core.addMethod(
  47523. $core.method({
  47524. selector: "testCascadesInSend",
  47525. protocol: "tests",
  47526. fn: function (){
  47527. var self=this;
  47528. return $core.withContext(function($ctx1) {
  47529. self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  47530. return self;
  47531. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  47532. },
  47533. args: [],
  47534. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  47535. referencedClasses: [],
  47536. messageSends: ["should:return:"]
  47537. }),
  47538. $globals.CodeGeneratorTest);
  47539. $core.addMethod(
  47540. $core.method({
  47541. selector: "testCascadesWithInlining",
  47542. protocol: "tests",
  47543. fn: function (){
  47544. var self=this;
  47545. return $core.withContext(function($ctx1) {
  47546. self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  47547. $ctx1.sendIdx["should:return:"]=1;
  47548. self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  47549. return self;
  47550. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  47551. },
  47552. args: [],
  47553. 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",
  47554. referencedClasses: [],
  47555. messageSends: ["should:return:"]
  47556. }),
  47557. $globals.CodeGeneratorTest);
  47558. $core.addMethod(
  47559. $core.method({
  47560. selector: "testDynamicArrayElementsOrdered",
  47561. protocol: "tests",
  47562. fn: function (){
  47563. var self=this;
  47564. return $core.withContext(function($ctx1) {
  47565. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  47566. $ctx1.sendIdx["should:return:"]=1;
  47567. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  47568. return self;
  47569. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  47570. },
  47571. args: [],
  47572. 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).",
  47573. referencedClasses: [],
  47574. messageSends: ["should:return:"]
  47575. }),
  47576. $globals.CodeGeneratorTest);
  47577. $core.addMethod(
  47578. $core.method({
  47579. selector: "testDynamicDictionaryElementsOrdered",
  47580. protocol: "tests",
  47581. fn: function (){
  47582. var self=this;
  47583. return $core.withContext(function($ctx1) {
  47584. 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)]));
  47585. return self;
  47586. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  47587. },
  47588. args: [],
  47589. 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}.",
  47590. referencedClasses: [],
  47591. messageSends: ["should:return:"]
  47592. }),
  47593. $globals.CodeGeneratorTest);
  47594. $core.addMethod(
  47595. $core.method({
  47596. selector: "testDynamicDictionaryWithMoreArrows",
  47597. protocol: "tests",
  47598. fn: function (){
  47599. var self=this;
  47600. return $core.withContext(function($ctx1) {
  47601. var $2,$1;
  47602. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  47603. $ctx1.sendIdx["->"]=1;
  47604. $1=$recv($globals.HashedCollection)._with_($2);
  47605. self._should_return_("foo ^ #{1->2->3}",$1);
  47606. return self;
  47607. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  47608. },
  47609. args: [],
  47610. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  47611. referencedClasses: ["HashedCollection"],
  47612. messageSends: ["should:return:", "with:", "->"]
  47613. }),
  47614. $globals.CodeGeneratorTest);
  47615. $core.addMethod(
  47616. $core.method({
  47617. selector: "testGlobalVar",
  47618. protocol: "tests",
  47619. fn: function (){
  47620. var self=this;
  47621. return $core.withContext(function($ctx1) {
  47622. self._should_return_("foo ^ eval class",$globals.BlockClosure);
  47623. $ctx1.sendIdx["should:return:"]=1;
  47624. self._should_return_("foo ^ Math cos: 0",(1));
  47625. $ctx1.sendIdx["should:return:"]=2;
  47626. self._should_return_("foo ^ NonExistingVar",nil);
  47627. return self;
  47628. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  47629. },
  47630. args: [],
  47631. 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",
  47632. referencedClasses: ["BlockClosure"],
  47633. messageSends: ["should:return:"]
  47634. }),
  47635. $globals.CodeGeneratorTest);
  47636. $core.addMethod(
  47637. $core.method({
  47638. selector: "testInnerTemporalDependentElementsOrdered",
  47639. protocol: "tests",
  47640. fn: function (){
  47641. var self=this;
  47642. return $core.withContext(function($ctx1) {
  47643. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  47644. $2="foo".__minus_gt($globals.Array);
  47645. $ctx1.sendIdx["->"]=1;
  47646. $3="bar".__minus_gt((2));
  47647. $ctx1.sendIdx["->"]=2;
  47648. $1=[$2,$3];
  47649. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  47650. $ctx1.sendIdx["should:return:"]=1;
  47651. $5="foo".__minus_gt($globals.Array);
  47652. $ctx1.sendIdx["->"]=3;
  47653. $6="bar".__minus_gt((2));
  47654. $ctx1.sendIdx["->"]=4;
  47655. $4=[$5,$6];
  47656. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  47657. $ctx1.sendIdx["should:return:"]=2;
  47658. $8="foo".__minus_gt((1));
  47659. $ctx1.sendIdx["->"]=5;
  47660. $9="bar".__minus_gt((2));
  47661. $ctx1.sendIdx["->"]=6;
  47662. $7=[$8,$9];
  47663. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  47664. $ctx1.sendIdx["should:return:"]=3;
  47665. $11="foo".__minus_gt((1));
  47666. $ctx1.sendIdx["->"]=7;
  47667. $10=[$11,"bar".__minus_gt((2))];
  47668. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  47669. $ctx1.sendIdx["should:return:"]=4;
  47670. 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)]));
  47671. return self;
  47672. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  47673. },
  47674. args: [],
  47675. 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}.",
  47676. referencedClasses: ["Array"],
  47677. messageSends: ["should:return:", "->"]
  47678. }),
  47679. $globals.CodeGeneratorTest);
  47680. $core.addMethod(
  47681. $core.method({
  47682. selector: "testJSStatement",
  47683. protocol: "tests",
  47684. fn: function (){
  47685. var self=this;
  47686. return $core.withContext(function($ctx1) {
  47687. self._should_return_("foo <return 2+3>",(5));
  47688. return self;
  47689. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  47690. },
  47691. args: [],
  47692. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  47693. referencedClasses: [],
  47694. messageSends: ["should:return:"]
  47695. }),
  47696. $globals.CodeGeneratorTest);
  47697. $core.addMethod(
  47698. $core.method({
  47699. selector: "testLexicalScope",
  47700. protocol: "tests",
  47701. fn: function (){
  47702. var self=this;
  47703. return $core.withContext(function($ctx1) {
  47704. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  47705. return self;
  47706. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  47707. },
  47708. args: [],
  47709. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  47710. referencedClasses: [],
  47711. messageSends: ["should:return:"]
  47712. }),
  47713. $globals.CodeGeneratorTest);
  47714. $core.addMethod(
  47715. $core.method({
  47716. selector: "testLiterals",
  47717. protocol: "tests",
  47718. fn: function (){
  47719. var self=this;
  47720. return $core.withContext(function($ctx1) {
  47721. self._should_return_("foo ^ 1",(1));
  47722. $ctx1.sendIdx["should:return:"]=1;
  47723. self._should_return_("foo ^ 'hello'","hello");
  47724. $ctx1.sendIdx["should:return:"]=2;
  47725. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  47726. $ctx1.sendIdx["should:return:"]=3;
  47727. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  47728. $ctx1.sendIdx["should:return:"]=4;
  47729. self._should_return_("foo ^ true",true);
  47730. $ctx1.sendIdx["should:return:"]=5;
  47731. self._should_return_("foo ^ false",false);
  47732. $ctx1.sendIdx["should:return:"]=6;
  47733. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  47734. $ctx1.sendIdx["should:return:"]=7;
  47735. self._should_return_("foo ^ #hello","hello");
  47736. $ctx1.sendIdx["should:return:"]=8;
  47737. self._should_return_("foo ^ $h","h");
  47738. $ctx1.sendIdx["should:return:"]=9;
  47739. self._should_return_("foo ^ -123.456",(-123.456));
  47740. $ctx1.sendIdx["should:return:"]=10;
  47741. self._should_return_("foo ^ -2.5e4",(-25000));
  47742. return self;
  47743. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  47744. },
  47745. args: [],
  47746. 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.",
  47747. referencedClasses: [],
  47748. messageSends: ["should:return:"]
  47749. }),
  47750. $globals.CodeGeneratorTest);
  47751. $core.addMethod(
  47752. $core.method({
  47753. selector: "testLocalReturn",
  47754. protocol: "tests",
  47755. fn: function (){
  47756. var self=this;
  47757. return $core.withContext(function($ctx1) {
  47758. self._should_return_("foo ^ 1",(1));
  47759. $ctx1.sendIdx["should:return:"]=1;
  47760. self._should_return_("foo ^ 1 + 1",(2));
  47761. $ctx1.sendIdx["should:return:"]=2;
  47762. self._should_return_("foo ",self["@receiver"]);
  47763. $ctx1.sendIdx["should:return:"]=3;
  47764. self._should_return_("foo self asString",self["@receiver"]);
  47765. $ctx1.sendIdx["should:return:"]=4;
  47766. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  47767. return self;
  47768. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  47769. },
  47770. args: [],
  47771. 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",
  47772. referencedClasses: [],
  47773. messageSends: ["should:return:"]
  47774. }),
  47775. $globals.CodeGeneratorTest);
  47776. $core.addMethod(
  47777. $core.method({
  47778. selector: "testMessageSends",
  47779. protocol: "tests",
  47780. fn: function (){
  47781. var self=this;
  47782. return $core.withContext(function($ctx1) {
  47783. self._should_return_("foo ^ 1 asString","1");
  47784. $ctx1.sendIdx["should:return:"]=1;
  47785. self._should_return_("foo ^ 1 + 1",(2));
  47786. $ctx1.sendIdx["should:return:"]=2;
  47787. self._should_return_("foo ^ 1 + 2 * 3",(9));
  47788. $ctx1.sendIdx["should:return:"]=3;
  47789. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  47790. $ctx1.sendIdx["should:return:"]=4;
  47791. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  47792. return self;
  47793. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  47794. },
  47795. args: [],
  47796. 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)",
  47797. referencedClasses: [],
  47798. messageSends: ["should:return:"]
  47799. }),
  47800. $globals.CodeGeneratorTest);
  47801. $core.addMethod(
  47802. $core.method({
  47803. selector: "testMistypedPragmaJSStatement",
  47804. protocol: "tests",
  47805. fn: function (){
  47806. var self=this;
  47807. return $core.withContext(function($ctx1) {
  47808. self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",self["@receiver"],$globals.ParseError);
  47809. return self;
  47810. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  47811. },
  47812. args: [],
  47813. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  47814. referencedClasses: ["ParseError"],
  47815. messageSends: ["should:receiver:raise:"]
  47816. }),
  47817. $globals.CodeGeneratorTest);
  47818. $core.addMethod(
  47819. $core.method({
  47820. selector: "testMultipleSequences",
  47821. protocol: "tests",
  47822. fn: function (){
  47823. var self=this;
  47824. return $core.withContext(function($ctx1) {
  47825. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  47826. return self;
  47827. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  47828. },
  47829. args: [],
  47830. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  47831. referencedClasses: [],
  47832. messageSends: ["should:return:"]
  47833. }),
  47834. $globals.CodeGeneratorTest);
  47835. $core.addMethod(
  47836. $core.method({
  47837. selector: "testMutableLiterals",
  47838. protocol: "tests",
  47839. fn: function (){
  47840. var self=this;
  47841. return $core.withContext(function($ctx1) {
  47842. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  47843. return self;
  47844. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  47845. },
  47846. args: [],
  47847. 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)",
  47848. referencedClasses: [],
  47849. messageSends: ["should:return:"]
  47850. }),
  47851. $globals.CodeGeneratorTest);
  47852. $core.addMethod(
  47853. $core.method({
  47854. selector: "testNestedIfTrue",
  47855. protocol: "tests",
  47856. fn: function (){
  47857. var self=this;
  47858. return $core.withContext(function($ctx1) {
  47859. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  47860. $ctx1.sendIdx["should:return:"]=1;
  47861. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  47862. $ctx1.sendIdx["should:return:"]=2;
  47863. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  47864. $ctx1.sendIdx["should:return:"]=3;
  47865. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  47866. return self;
  47867. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  47868. },
  47869. args: [],
  47870. 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.",
  47871. referencedClasses: [],
  47872. messageSends: ["should:return:"]
  47873. }),
  47874. $globals.CodeGeneratorTest);
  47875. $core.addMethod(
  47876. $core.method({
  47877. selector: "testNestedSends",
  47878. protocol: "tests",
  47879. fn: function (){
  47880. var self=this;
  47881. return $core.withContext(function($ctx1) {
  47882. 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());
  47883. return self;
  47884. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  47885. },
  47886. args: [],
  47887. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  47888. referencedClasses: ["Point"],
  47889. messageSends: ["should:return:", "asString", "x:y:", "@"]
  47890. }),
  47891. $globals.CodeGeneratorTest);
  47892. $core.addMethod(
  47893. $core.method({
  47894. selector: "testNonLocalReturn",
  47895. protocol: "tests",
  47896. fn: function (){
  47897. var self=this;
  47898. return $core.withContext(function($ctx1) {
  47899. self._should_return_("foo [ ^ 1 ] value",(1));
  47900. $ctx1.sendIdx["should:return:"]=1;
  47901. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  47902. $ctx1.sendIdx["should:return:"]=2;
  47903. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  47904. $ctx1.sendIdx["should:return:"]=3;
  47905. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  47906. return self;
  47907. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  47908. },
  47909. args: [],
  47910. 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",
  47911. referencedClasses: [],
  47912. messageSends: ["should:return:"]
  47913. }),
  47914. $globals.CodeGeneratorTest);
  47915. $core.addMethod(
  47916. $core.method({
  47917. selector: "testPascalCaseGlobal",
  47918. protocol: "tests",
  47919. fn: function (){
  47920. var self=this;
  47921. return $core.withContext(function($ctx1) {
  47922. self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  47923. $ctx1.sendIdx["should:return:"]=1;
  47924. self._should_return_("foo ^NonExistent",nil);
  47925. return self;
  47926. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  47927. },
  47928. args: [],
  47929. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  47930. referencedClasses: ["Smalltalk"],
  47931. messageSends: ["should:return:", "at:", "globals"]
  47932. }),
  47933. $globals.CodeGeneratorTest);
  47934. $core.addMethod(
  47935. $core.method({
  47936. selector: "testPragmaJSStatement",
  47937. protocol: "tests",
  47938. fn: function (){
  47939. var self=this;
  47940. return $core.withContext(function($ctx1) {
  47941. self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  47942. return self;
  47943. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  47944. },
  47945. args: [],
  47946. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  47947. referencedClasses: [],
  47948. messageSends: ["should:return:"]
  47949. }),
  47950. $globals.CodeGeneratorTest);
  47951. $core.addMethod(
  47952. $core.method({
  47953. selector: "testRootSuperSend",
  47954. protocol: "tests",
  47955. fn: function (){
  47956. var self=this;
  47957. return $core.withContext(function($ctx1) {
  47958. self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  47959. return self;
  47960. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  47961. },
  47962. args: [],
  47963. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  47964. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  47965. messageSends: ["should:receiver:raise:", "new"]
  47966. }),
  47967. $globals.CodeGeneratorTest);
  47968. $core.addMethod(
  47969. $core.method({
  47970. selector: "testSendReceiverAndArgumentsOrdered",
  47971. protocol: "tests",
  47972. fn: function (){
  47973. var self=this;
  47974. return $core.withContext(function($ctx1) {
  47975. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  47976. $ctx1.sendIdx["should:return:"]=1;
  47977. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  47978. return self;
  47979. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  47980. },
  47981. args: [],
  47982. 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}.",
  47983. referencedClasses: ["Array"],
  47984. messageSends: ["should:return:"]
  47985. }),
  47986. $globals.CodeGeneratorTest);
  47987. $core.addMethod(
  47988. $core.method({
  47989. selector: "testSuperSend",
  47990. protocol: "tests",
  47991. fn: function (){
  47992. var self=this;
  47993. return $core.withContext(function($ctx1) {
  47994. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  47995. return self;
  47996. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  47997. },
  47998. args: [],
  47999. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  48000. referencedClasses: [],
  48001. messageSends: ["should:receiver:return:"]
  48002. }),
  48003. $globals.CodeGeneratorTest);
  48004. $core.addMethod(
  48005. $core.method({
  48006. selector: "testTempVariables",
  48007. protocol: "tests",
  48008. fn: function (){
  48009. var self=this;
  48010. return $core.withContext(function($ctx1) {
  48011. self._should_return_("foo | a | ^ a",nil);
  48012. $ctx1.sendIdx["should:return:"]=1;
  48013. self._should_return_("foo | AVariable | ^ AVariable",nil);
  48014. $ctx1.sendIdx["should:return:"]=2;
  48015. self._should_return_("foo | a b c | ^ c",nil);
  48016. $ctx1.sendIdx["should:return:"]=3;
  48017. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  48018. $ctx1.sendIdx["should:return:"]=4;
  48019. self._should_return_("foo | a | a:= 1. ^ a",(1));
  48020. $ctx1.sendIdx["should:return:"]=5;
  48021. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  48022. return self;
  48023. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  48024. },
  48025. args: [],
  48026. 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.",
  48027. referencedClasses: [],
  48028. messageSends: ["should:return:"]
  48029. }),
  48030. $globals.CodeGeneratorTest);
  48031. $core.addMethod(
  48032. $core.method({
  48033. selector: "testThisContext",
  48034. protocol: "tests",
  48035. fn: function (){
  48036. var self=this;
  48037. return $core.withContext(function($ctx1) {
  48038. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  48039. return self;
  48040. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  48041. },
  48042. args: [],
  48043. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  48044. referencedClasses: [],
  48045. messageSends: ["should:return:"]
  48046. }),
  48047. $globals.CodeGeneratorTest);
  48048. $core.addMethod(
  48049. $core.method({
  48050. selector: "testifFalse",
  48051. protocol: "tests",
  48052. fn: function (){
  48053. var self=this;
  48054. return $core.withContext(function($ctx1) {
  48055. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  48056. $ctx1.sendIdx["should:return:"]=1;
  48057. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  48058. $ctx1.sendIdx["should:return:"]=2;
  48059. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  48060. $ctx1.sendIdx["should:return:"]=3;
  48061. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  48062. return self;
  48063. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  48064. },
  48065. args: [],
  48066. 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.",
  48067. referencedClasses: [],
  48068. messageSends: ["should:return:"]
  48069. }),
  48070. $globals.CodeGeneratorTest);
  48071. $core.addMethod(
  48072. $core.method({
  48073. selector: "testifFalseIfTrue",
  48074. protocol: "tests",
  48075. fn: function (){
  48076. var self=this;
  48077. return $core.withContext(function($ctx1) {
  48078. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  48079. $ctx1.sendIdx["should:return:"]=1;
  48080. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  48081. $ctx1.sendIdx["should:return:"]=2;
  48082. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  48083. $ctx1.sendIdx["should:return:"]=3;
  48084. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  48085. return self;
  48086. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  48087. },
  48088. args: [],
  48089. 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.",
  48090. referencedClasses: [],
  48091. messageSends: ["should:return:"]
  48092. }),
  48093. $globals.CodeGeneratorTest);
  48094. $core.addMethod(
  48095. $core.method({
  48096. selector: "testifNil",
  48097. protocol: "tests",
  48098. fn: function (){
  48099. var self=this;
  48100. return $core.withContext(function($ctx1) {
  48101. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  48102. $ctx1.sendIdx["should:return:"]=1;
  48103. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  48104. $ctx1.sendIdx["should:return:"]=2;
  48105. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  48106. $ctx1.sendIdx["should:return:"]=3;
  48107. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  48108. return self;
  48109. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  48110. },
  48111. args: [],
  48112. 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.",
  48113. referencedClasses: [],
  48114. messageSends: ["should:return:"]
  48115. }),
  48116. $globals.CodeGeneratorTest);
  48117. $core.addMethod(
  48118. $core.method({
  48119. selector: "testifNilIfNotNil",
  48120. protocol: "tests",
  48121. fn: function (){
  48122. var self=this;
  48123. return $core.withContext(function($ctx1) {
  48124. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  48125. $ctx1.sendIdx["should:return:"]=1;
  48126. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  48127. $ctx1.sendIdx["should:return:"]=2;
  48128. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  48129. $ctx1.sendIdx["should:return:"]=3;
  48130. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  48131. return self;
  48132. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  48133. },
  48134. args: [],
  48135. 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.",
  48136. referencedClasses: [],
  48137. messageSends: ["should:return:"]
  48138. }),
  48139. $globals.CodeGeneratorTest);
  48140. $core.addMethod(
  48141. $core.method({
  48142. selector: "testifNotNil",
  48143. protocol: "tests",
  48144. fn: function (){
  48145. var self=this;
  48146. return $core.withContext(function($ctx1) {
  48147. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  48148. $ctx1.sendIdx["should:return:"]=1;
  48149. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  48150. $ctx1.sendIdx["should:return:"]=2;
  48151. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  48152. $ctx1.sendIdx["should:return:"]=3;
  48153. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  48154. return self;
  48155. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  48156. },
  48157. args: [],
  48158. 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.",
  48159. referencedClasses: [],
  48160. messageSends: ["should:return:"]
  48161. }),
  48162. $globals.CodeGeneratorTest);
  48163. $core.addMethod(
  48164. $core.method({
  48165. selector: "testifNotNilWithArgument",
  48166. protocol: "tests",
  48167. fn: function (){
  48168. var self=this;
  48169. return $core.withContext(function($ctx1) {
  48170. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  48171. $ctx1.sendIdx["should:return:"]=1;
  48172. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  48173. $ctx1.sendIdx["should:return:"]=2;
  48174. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  48175. $ctx1.sendIdx["should:return:"]=3;
  48176. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  48177. $ctx1.sendIdx["should:return:"]=4;
  48178. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  48179. $ctx1.sendIdx["should:return:"]=5;
  48180. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  48181. return self;
  48182. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  48183. },
  48184. args: [],
  48185. 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",
  48186. referencedClasses: [],
  48187. messageSends: ["should:return:"]
  48188. }),
  48189. $globals.CodeGeneratorTest);
  48190. $core.addMethod(
  48191. $core.method({
  48192. selector: "testifTrue",
  48193. protocol: "tests",
  48194. fn: function (){
  48195. var self=this;
  48196. return $core.withContext(function($ctx1) {
  48197. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  48198. $ctx1.sendIdx["should:return:"]=1;
  48199. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  48200. $ctx1.sendIdx["should:return:"]=2;
  48201. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  48202. $ctx1.sendIdx["should:return:"]=3;
  48203. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  48204. return self;
  48205. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  48206. },
  48207. args: [],
  48208. 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.",
  48209. referencedClasses: [],
  48210. messageSends: ["should:return:"]
  48211. }),
  48212. $globals.CodeGeneratorTest);
  48213. $core.addMethod(
  48214. $core.method({
  48215. selector: "testifTrueIfFalse",
  48216. protocol: "tests",
  48217. fn: function (){
  48218. var self=this;
  48219. return $core.withContext(function($ctx1) {
  48220. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  48221. $ctx1.sendIdx["should:return:"]=1;
  48222. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  48223. $ctx1.sendIdx["should:return:"]=2;
  48224. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  48225. $ctx1.sendIdx["should:return:"]=3;
  48226. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  48227. return self;
  48228. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  48229. },
  48230. args: [],
  48231. 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.",
  48232. referencedClasses: [],
  48233. messageSends: ["should:return:"]
  48234. }),
  48235. $globals.CodeGeneratorTest);
  48236. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  48237. $core.addMethod(
  48238. $core.method({
  48239. selector: "analyze:forClass:",
  48240. protocol: "parsing",
  48241. fn: function (aNode,aClass){
  48242. var self=this;
  48243. return $core.withContext(function($ctx1) {
  48244. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  48245. return aNode;
  48246. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  48247. },
  48248. args: ["aNode", "aClass"],
  48249. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  48250. referencedClasses: ["SemanticAnalyzer"],
  48251. messageSends: ["visit:", "on:"]
  48252. }),
  48253. $globals.ASTInterpreterTest);
  48254. $core.addMethod(
  48255. $core.method({
  48256. selector: "interpret:receiver:withArguments:",
  48257. protocol: "private",
  48258. fn: function (aString,anObject,aDictionary){
  48259. var self=this;
  48260. var ctx,ast,interpreter;
  48261. return $core.withContext(function($ctx1) {
  48262. var $1,$2,$3,$receiver;
  48263. interpreter=$recv($globals.ASTInterpreter)._new();
  48264. $ctx1.sendIdx["new"]=1;
  48265. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  48266. $1=$recv($globals.AIContext)._new();
  48267. $recv($1)._receiver_(anObject);
  48268. $recv($1)._interpreter_(interpreter);
  48269. ctx=$recv($1)._yourself();
  48270. $2=$recv(ast)._sequenceNode();
  48271. if(($receiver = $2) == null || $receiver.isNil){
  48272. $2;
  48273. } else {
  48274. var sequence;
  48275. sequence=$receiver;
  48276. $recv($recv(sequence)._temps())._do_((function(each){
  48277. return $core.withContext(function($ctx2) {
  48278. return $recv(ctx)._defineLocal_(each);
  48279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48280. }));
  48281. }
  48282. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  48283. return $core.withContext(function($ctx2) {
  48284. return $recv(ctx)._localAt_put_(key,value);
  48285. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  48286. }));
  48287. $3=interpreter;
  48288. $recv($3)._context_(ctx);
  48289. $recv($3)._node_(ast);
  48290. $recv($3)._enterNode();
  48291. $recv($3)._proceed();
  48292. return $recv($3)._result();
  48293. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  48294. },
  48295. args: ["aString", "anObject", "aDictionary"],
  48296. 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",
  48297. referencedClasses: ["ASTInterpreter", "AIContext"],
  48298. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  48299. }),
  48300. $globals.ASTInterpreterTest);
  48301. $core.addMethod(
  48302. $core.method({
  48303. selector: "parse:",
  48304. protocol: "parsing",
  48305. fn: function (aString){
  48306. var self=this;
  48307. return $core.withContext(function($ctx1) {
  48308. return $recv($globals.Smalltalk)._parse_(aString);
  48309. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  48310. },
  48311. args: ["aString"],
  48312. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  48313. referencedClasses: ["Smalltalk"],
  48314. messageSends: ["parse:"]
  48315. }),
  48316. $globals.ASTInterpreterTest);
  48317. $core.addMethod(
  48318. $core.method({
  48319. selector: "parse:forClass:",
  48320. protocol: "parsing",
  48321. fn: function (aString,aClass){
  48322. var self=this;
  48323. return $core.withContext(function($ctx1) {
  48324. return self._analyze_forClass_(self._parse_(aString),aClass);
  48325. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  48326. },
  48327. args: ["aString", "aClass"],
  48328. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  48329. referencedClasses: [],
  48330. messageSends: ["analyze:forClass:", "parse:"]
  48331. }),
  48332. $globals.ASTInterpreterTest);
  48333. $core.addMethod(
  48334. $core.method({
  48335. selector: "should:receiver:return:",
  48336. protocol: "testing",
  48337. fn: function (aString,anObject,aResult){
  48338. var self=this;
  48339. return $core.withContext(function($ctx1) {
  48340. self["@receiver"]=anObject;
  48341. return self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  48342. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  48343. },
  48344. args: ["aString", "anObject", "aResult"],
  48345. 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",
  48346. referencedClasses: [],
  48347. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  48348. }),
  48349. $globals.ASTInterpreterTest);
  48350. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  48351. $core.addMethod(
  48352. $core.method({
  48353. selector: "interpret:receiver:withArguments:",
  48354. protocol: "private",
  48355. fn: function (aString,anObject,aDictionary){
  48356. var self=this;
  48357. var ctx,ast,debugger_;
  48358. return $core.withContext(function($ctx1) {
  48359. var $1,$2,$3,$4,$5,$receiver;
  48360. $1=$recv($globals.AIContext)._new();
  48361. $ctx1.sendIdx["new"]=1;
  48362. $recv($1)._receiver_(anObject);
  48363. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  48364. ctx=$recv($1)._yourself();
  48365. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  48366. $2=$recv(ast)._sequenceNode();
  48367. if(($receiver = $2) == null || $receiver.isNil){
  48368. $2;
  48369. } else {
  48370. var sequence;
  48371. sequence=$receiver;
  48372. $recv($recv(sequence)._temps())._do_((function(each){
  48373. return $core.withContext(function($ctx2) {
  48374. return $recv(ctx)._defineLocal_(each);
  48375. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48376. }));
  48377. }
  48378. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  48379. return $core.withContext(function($ctx2) {
  48380. return $recv(ctx)._localAt_put_(key,value);
  48381. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  48382. }));
  48383. $3=$recv(ctx)._interpreter();
  48384. $ctx1.sendIdx["interpreter"]=1;
  48385. $recv($3)._context_(ctx);
  48386. $ctx1.sendIdx["context:"]=1;
  48387. $4=$recv(ctx)._interpreter();
  48388. $recv($4)._node_(ast);
  48389. $recv($4)._enterNode();
  48390. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  48391. $5=debugger_;
  48392. $recv($5)._proceed();
  48393. return $recv($5)._result();
  48394. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  48395. },
  48396. args: ["aString", "anObject", "aDictionary"],
  48397. 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",
  48398. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  48399. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  48400. }),
  48401. $globals.ASTDebuggerTest);
  48402. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  48403. $core.addMethod(
  48404. $core.method({
  48405. selector: "codeGeneratorClass",
  48406. protocol: "accessing",
  48407. fn: function (){
  48408. var self=this;
  48409. return $globals.InliningCodeGenerator;
  48410. },
  48411. args: [],
  48412. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  48413. referencedClasses: ["InliningCodeGenerator"],
  48414. messageSends: []
  48415. }),
  48416. $globals.InliningCodeGeneratorTest);
  48417. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  48418. $core.addMethod(
  48419. $core.method({
  48420. selector: "testClassRefVar",
  48421. protocol: "tests",
  48422. fn: function (){
  48423. var self=this;
  48424. var node;
  48425. return $core.withContext(function($ctx1) {
  48426. var $1,$2;
  48427. $1=$recv($globals.VariableNode)._new();
  48428. $ctx1.sendIdx["new"]=1;
  48429. $recv($1)._value_("Object");
  48430. node=$recv($1)._yourself();
  48431. $2=$recv($globals.SemanticAnalyzer)._new();
  48432. $ctx1.sendIdx["new"]=2;
  48433. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  48434. $recv($2)._visit_(node);
  48435. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  48436. return self;
  48437. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  48438. },
  48439. args: [],
  48440. 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",
  48441. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  48442. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  48443. }),
  48444. $globals.ScopeVarTest);
  48445. $core.addMethod(
  48446. $core.method({
  48447. selector: "testInstanceVar",
  48448. protocol: "tests",
  48449. fn: function (){
  48450. var self=this;
  48451. var node,scope;
  48452. return $core.withContext(function($ctx1) {
  48453. var $1;
  48454. $1=$recv($globals.VariableNode)._new();
  48455. $ctx1.sendIdx["new"]=1;
  48456. $recv($1)._value_("bzzz");
  48457. node=$recv($1)._yourself();
  48458. scope=$recv($globals.MethodLexicalScope)._new();
  48459. $recv(scope)._addIVar_("bzzz");
  48460. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  48461. return self;
  48462. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  48463. },
  48464. args: [],
  48465. 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",
  48466. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48467. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  48468. }),
  48469. $globals.ScopeVarTest);
  48470. $core.addMethod(
  48471. $core.method({
  48472. selector: "testPseudoVar",
  48473. protocol: "tests",
  48474. fn: function (){
  48475. var self=this;
  48476. var node,pseudoVars;
  48477. return $core.withContext(function($ctx1) {
  48478. var $1;
  48479. pseudoVars=["self", "super", "true", "false", "nil"];
  48480. $recv(pseudoVars)._do_((function(each){
  48481. return $core.withContext(function($ctx2) {
  48482. $1=$recv($globals.VariableNode)._new();
  48483. $ctx2.sendIdx["new"]=1;
  48484. $recv($1)._value_(each);
  48485. node=$recv($1)._yourself();
  48486. node;
  48487. return self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  48488. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48489. }));
  48490. return self;
  48491. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  48492. },
  48493. args: [],
  48494. 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]",
  48495. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48496. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  48497. }),
  48498. $globals.ScopeVarTest);
  48499. $core.addMethod(
  48500. $core.method({
  48501. selector: "testTempVar",
  48502. protocol: "tests",
  48503. fn: function (){
  48504. var self=this;
  48505. var node,scope;
  48506. return $core.withContext(function($ctx1) {
  48507. var $1;
  48508. $1=$recv($globals.VariableNode)._new();
  48509. $ctx1.sendIdx["new"]=1;
  48510. $recv($1)._value_("bzzz");
  48511. node=$recv($1)._yourself();
  48512. scope=$recv($globals.MethodLexicalScope)._new();
  48513. $recv(scope)._addTemp_("bzzz");
  48514. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  48515. return self;
  48516. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  48517. },
  48518. args: [],
  48519. 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",
  48520. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48521. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  48522. }),
  48523. $globals.ScopeVarTest);
  48524. $core.addMethod(
  48525. $core.method({
  48526. selector: "testUnknownVar",
  48527. protocol: "tests",
  48528. fn: function (){
  48529. var self=this;
  48530. var node;
  48531. return $core.withContext(function($ctx1) {
  48532. var $1;
  48533. $1=$recv($globals.VariableNode)._new();
  48534. $ctx1.sendIdx["new"]=1;
  48535. $recv($1)._value_("bzzz");
  48536. node=$recv($1)._yourself();
  48537. self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  48538. return self;
  48539. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  48540. },
  48541. args: [],
  48542. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  48543. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  48544. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  48545. }),
  48546. $globals.ScopeVarTest);
  48547. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  48548. $core.addMethod(
  48549. $core.method({
  48550. selector: "setUp",
  48551. protocol: "running",
  48552. fn: function (){
  48553. var self=this;
  48554. return $core.withContext(function($ctx1) {
  48555. self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  48556. return self;
  48557. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  48558. },
  48559. args: [],
  48560. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  48561. referencedClasses: ["SemanticAnalyzer", "Object"],
  48562. messageSends: ["on:"]
  48563. }),
  48564. $globals.SemanticAnalyzerTest);
  48565. $core.addMethod(
  48566. $core.method({
  48567. selector: "testAssignment",
  48568. protocol: "tests",
  48569. fn: function (){
  48570. var self=this;
  48571. var src,ast;
  48572. return $core.withContext(function($ctx1) {
  48573. src="foo self := 1";
  48574. ast=$recv($globals.Smalltalk)._parse_(src);
  48575. self._should_raise_((function(){
  48576. return $core.withContext(function($ctx2) {
  48577. return $recv(self["@analyzer"])._visit_(ast);
  48578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48579. }),$globals.InvalidAssignmentError);
  48580. return self;
  48581. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48582. },
  48583. args: [],
  48584. 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",
  48585. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  48586. messageSends: ["parse:", "should:raise:", "visit:"]
  48587. }),
  48588. $globals.SemanticAnalyzerTest);
  48589. $core.addMethod(
  48590. $core.method({
  48591. selector: "testNonLocalReturn",
  48592. protocol: "tests",
  48593. fn: function (){
  48594. var self=this;
  48595. var src,ast;
  48596. return $core.withContext(function($ctx1) {
  48597. src="foo | a | a + 1. ^ a";
  48598. ast=$recv($globals.Smalltalk)._parse_(src);
  48599. $recv(self["@analyzer"])._visit_(ast);
  48600. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  48601. return self;
  48602. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48603. },
  48604. args: [],
  48605. 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",
  48606. referencedClasses: ["Smalltalk"],
  48607. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  48608. }),
  48609. $globals.SemanticAnalyzerTest);
  48610. $core.addMethod(
  48611. $core.method({
  48612. selector: "testNonLocalReturn2",
  48613. protocol: "tests",
  48614. fn: function (){
  48615. var self=this;
  48616. var src,ast;
  48617. return $core.withContext(function($ctx1) {
  48618. src="foo | a | a + 1. [ [ ^ a] ]";
  48619. ast=$recv($globals.Smalltalk)._parse_(src);
  48620. $recv(self["@analyzer"])._visit_(ast);
  48621. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  48622. return self;
  48623. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48624. },
  48625. args: [],
  48626. 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",
  48627. referencedClasses: ["Smalltalk"],
  48628. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  48629. }),
  48630. $globals.SemanticAnalyzerTest);
  48631. $core.addMethod(
  48632. $core.method({
  48633. selector: "testScope",
  48634. protocol: "tests",
  48635. fn: function (){
  48636. var self=this;
  48637. var src,ast;
  48638. return $core.withContext(function($ctx1) {
  48639. var $4,$3,$2,$1;
  48640. src="foo | a | a + 1. [ | b | b := a ]";
  48641. ast=$recv($globals.Smalltalk)._parse_(src);
  48642. $recv(self["@analyzer"])._visit_(ast);
  48643. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48644. $ctx1.sendIdx["dagChildren"]=1;
  48645. $3=$recv($4)._last();
  48646. $2=$recv($3)._scope();
  48647. $ctx1.sendIdx["scope"]=1;
  48648. $1=$recv($2).__eq_eq($recv(ast)._scope());
  48649. self._deny_($1);
  48650. return self;
  48651. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48652. },
  48653. args: [],
  48654. 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.",
  48655. referencedClasses: ["Smalltalk"],
  48656. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  48657. }),
  48658. $globals.SemanticAnalyzerTest);
  48659. $core.addMethod(
  48660. $core.method({
  48661. selector: "testScope2",
  48662. protocol: "tests",
  48663. fn: function (){
  48664. var self=this;
  48665. var src,ast;
  48666. return $core.withContext(function($ctx1) {
  48667. var $8,$7,$6,$5,$4,$3,$2,$1;
  48668. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  48669. ast=$recv($globals.Smalltalk)._parse_(src);
  48670. $recv(self["@analyzer"])._visit_(ast);
  48671. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48672. $ctx1.sendIdx["dagChildren"]=3;
  48673. $7=$recv($8)._last();
  48674. $6=$recv($7)._dagChildren();
  48675. $ctx1.sendIdx["dagChildren"]=2;
  48676. $5=$recv($6)._first();
  48677. $ctx1.sendIdx["first"]=2;
  48678. $4=$recv($5)._dagChildren();
  48679. $ctx1.sendIdx["dagChildren"]=1;
  48680. $3=$recv($4)._first();
  48681. $ctx1.sendIdx["first"]=1;
  48682. $2=$recv($3)._scope();
  48683. $ctx1.sendIdx["scope"]=1;
  48684. $1=$recv($2).__eq_eq($recv(ast)._scope());
  48685. self._deny_($1);
  48686. return self;
  48687. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48688. },
  48689. args: [],
  48690. 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.",
  48691. referencedClasses: ["Smalltalk"],
  48692. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  48693. }),
  48694. $globals.SemanticAnalyzerTest);
  48695. $core.addMethod(
  48696. $core.method({
  48697. selector: "testScopeLevel",
  48698. protocol: "tests",
  48699. fn: function (){
  48700. var self=this;
  48701. var src,ast;
  48702. return $core.withContext(function($ctx1) {
  48703. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  48704. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  48705. ast=$recv($globals.Smalltalk)._parse_(src);
  48706. $recv(self["@analyzer"])._visit_(ast);
  48707. $2=$recv(ast)._scope();
  48708. $ctx1.sendIdx["scope"]=1;
  48709. $1=$recv($2)._scopeLevel();
  48710. $ctx1.sendIdx["scopeLevel"]=1;
  48711. self._assert_equals_($1,(1));
  48712. $ctx1.sendIdx["assert:equals:"]=1;
  48713. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48714. $ctx1.sendIdx["dagChildren"]=3;
  48715. $9=$recv($10)._last();
  48716. $8=$recv($9)._dagChildren();
  48717. $ctx1.sendIdx["dagChildren"]=2;
  48718. $7=$recv($8)._first();
  48719. $ctx1.sendIdx["first"]=2;
  48720. $6=$recv($7)._dagChildren();
  48721. $ctx1.sendIdx["dagChildren"]=1;
  48722. $5=$recv($6)._first();
  48723. $ctx1.sendIdx["first"]=1;
  48724. $4=$recv($5)._scope();
  48725. $3=$recv($4)._scopeLevel();
  48726. self._assert_equals_($3,(3));
  48727. return self;
  48728. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48729. },
  48730. args: [],
  48731. 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",
  48732. referencedClasses: ["Smalltalk"],
  48733. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  48734. }),
  48735. $globals.SemanticAnalyzerTest);
  48736. $core.addMethod(
  48737. $core.method({
  48738. selector: "testUnknownVariables",
  48739. protocol: "tests",
  48740. fn: function (){
  48741. var self=this;
  48742. var src,ast;
  48743. return $core.withContext(function($ctx1) {
  48744. src="foo | a | b + a";
  48745. ast=$recv($globals.Smalltalk)._parse_(src);
  48746. self._should_raise_((function(){
  48747. return $core.withContext(function($ctx2) {
  48748. return $recv(self["@analyzer"])._visit_(ast);
  48749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48750. }),$globals.UnknownVariableError);
  48751. return self;
  48752. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48753. },
  48754. args: [],
  48755. 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",
  48756. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48757. messageSends: ["parse:", "should:raise:", "visit:"]
  48758. }),
  48759. $globals.SemanticAnalyzerTest);
  48760. $core.addMethod(
  48761. $core.method({
  48762. selector: "testUnknownVariablesWithScope",
  48763. protocol: "tests",
  48764. fn: function (){
  48765. var self=this;
  48766. var src,ast;
  48767. return $core.withContext(function($ctx1) {
  48768. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  48769. ast=$recv($globals.Smalltalk)._parse_(src);
  48770. self._should_raise_((function(){
  48771. return $core.withContext(function($ctx2) {
  48772. return $recv(self["@analyzer"])._visit_(ast);
  48773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48774. }),$globals.UnknownVariableError);
  48775. return self;
  48776. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48777. },
  48778. args: [],
  48779. 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",
  48780. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48781. messageSends: ["parse:", "should:raise:", "visit:"]
  48782. }),
  48783. $globals.SemanticAnalyzerTest);
  48784. $core.addMethod(
  48785. $core.method({
  48786. selector: "testVariableShadowing",
  48787. protocol: "tests",
  48788. fn: function (){
  48789. var self=this;
  48790. var src,ast;
  48791. return $core.withContext(function($ctx1) {
  48792. src="foo | a | a + 1";
  48793. ast=$recv($globals.Smalltalk)._parse_(src);
  48794. $recv(self["@analyzer"])._visit_(ast);
  48795. return self;
  48796. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48797. },
  48798. args: [],
  48799. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  48800. referencedClasses: ["Smalltalk"],
  48801. messageSends: ["parse:", "visit:"]
  48802. }),
  48803. $globals.SemanticAnalyzerTest);
  48804. $core.addMethod(
  48805. $core.method({
  48806. selector: "testVariableShadowing2",
  48807. protocol: "tests",
  48808. fn: function (){
  48809. var self=this;
  48810. var src,ast;
  48811. return $core.withContext(function($ctx1) {
  48812. src="foo | a | a + 1. [ | a | a := 2 ]";
  48813. ast=$recv($globals.Smalltalk)._parse_(src);
  48814. self._should_raise_((function(){
  48815. return $core.withContext(function($ctx2) {
  48816. return $recv(self["@analyzer"])._visit_(ast);
  48817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48818. }),$globals.ShadowingVariableError);
  48819. return self;
  48820. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48821. },
  48822. args: [],
  48823. 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",
  48824. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  48825. messageSends: ["parse:", "should:raise:", "visit:"]
  48826. }),
  48827. $globals.SemanticAnalyzerTest);
  48828. $core.addMethod(
  48829. $core.method({
  48830. selector: "testVariableShadowing3",
  48831. protocol: "tests",
  48832. fn: function (){
  48833. var self=this;
  48834. var src,ast;
  48835. return $core.withContext(function($ctx1) {
  48836. src="foo | a | a + 1. [ | b | b := 2 ]";
  48837. ast=$recv($globals.Smalltalk)._parse_(src);
  48838. $recv(self["@analyzer"])._visit_(ast);
  48839. return self;
  48840. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48841. },
  48842. args: [],
  48843. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  48844. referencedClasses: ["Smalltalk"],
  48845. messageSends: ["parse:", "visit:"]
  48846. }),
  48847. $globals.SemanticAnalyzerTest);
  48848. $core.addMethod(
  48849. $core.method({
  48850. selector: "testVariableShadowing4",
  48851. protocol: "tests",
  48852. fn: function (){
  48853. var self=this;
  48854. var src,ast;
  48855. return $core.withContext(function($ctx1) {
  48856. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  48857. ast=$recv($globals.Smalltalk)._parse_(src);
  48858. $recv(self["@analyzer"])._visit_(ast);
  48859. return self;
  48860. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48861. },
  48862. args: [],
  48863. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  48864. referencedClasses: ["Smalltalk"],
  48865. messageSends: ["parse:", "visit:"]
  48866. }),
  48867. $globals.SemanticAnalyzerTest);
  48868. $core.addMethod(
  48869. $core.method({
  48870. selector: "testVariableShadowing5",
  48871. protocol: "tests",
  48872. fn: function (){
  48873. var self=this;
  48874. var src,ast;
  48875. return $core.withContext(function($ctx1) {
  48876. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  48877. ast=$recv($globals.Smalltalk)._parse_(src);
  48878. self._should_raise_((function(){
  48879. return $core.withContext(function($ctx2) {
  48880. return $recv(self["@analyzer"])._visit_(ast);
  48881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48882. }),$globals.ShadowingVariableError);
  48883. return self;
  48884. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48885. },
  48886. args: [],
  48887. 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",
  48888. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  48889. messageSends: ["parse:", "should:raise:", "visit:"]
  48890. }),
  48891. $globals.SemanticAnalyzerTest);
  48892. $core.addMethod(
  48893. $core.method({
  48894. selector: "testVariablesLookup",
  48895. protocol: "tests",
  48896. fn: function (){
  48897. var self=this;
  48898. var src,ast;
  48899. return $core.withContext(function($ctx1) {
  48900. 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;
  48901. src="foo | a | a + 1. [ | b | b := a ]";
  48902. ast=$recv($globals.Smalltalk)._parse_(src);
  48903. $recv(self["@analyzer"])._visit_(ast);
  48904. $7=$recv(ast)._dagChildren();
  48905. $ctx1.sendIdx["dagChildren"]=2;
  48906. $6=$recv($7)._first();
  48907. $ctx1.sendIdx["first"]=2;
  48908. $5=$recv($6)._dagChildren();
  48909. $ctx1.sendIdx["dagChildren"]=1;
  48910. $4=$recv($5)._first();
  48911. $ctx1.sendIdx["first"]=1;
  48912. $3=$recv($4)._receiver();
  48913. $ctx1.sendIdx["receiver"]=1;
  48914. $2=$recv($3)._binding();
  48915. $ctx1.sendIdx["binding"]=1;
  48916. $1=$recv($2)._isTempVar();
  48917. $ctx1.sendIdx["isTempVar"]=1;
  48918. self._assert_($1);
  48919. $ctx1.sendIdx["assert:"]=1;
  48920. $15=$recv(ast)._dagChildren();
  48921. $ctx1.sendIdx["dagChildren"]=4;
  48922. $14=$recv($15)._first();
  48923. $ctx1.sendIdx["first"]=4;
  48924. $13=$recv($14)._dagChildren();
  48925. $ctx1.sendIdx["dagChildren"]=3;
  48926. $12=$recv($13)._first();
  48927. $ctx1.sendIdx["first"]=3;
  48928. $11=$recv($12)._receiver();
  48929. $10=$recv($11)._binding();
  48930. $ctx1.sendIdx["binding"]=2;
  48931. $9=$recv($10)._scope();
  48932. $ctx1.sendIdx["scope"]=1;
  48933. $16=$recv(ast)._scope();
  48934. $ctx1.sendIdx["scope"]=2;
  48935. $8=$recv($9).__eq_eq($16);
  48936. $ctx1.sendIdx["=="]=1;
  48937. self._assert_($8);
  48938. $ctx1.sendIdx["assert:"]=2;
  48939. $27=$recv(ast)._dagChildren();
  48940. $ctx1.sendIdx["dagChildren"]=8;
  48941. $26=$recv($27)._first();
  48942. $ctx1.sendIdx["first"]=7;
  48943. $25=$recv($26)._dagChildren();
  48944. $ctx1.sendIdx["dagChildren"]=7;
  48945. $24=$recv($25)._last();
  48946. $ctx1.sendIdx["last"]=1;
  48947. $23=$recv($24)._dagChildren();
  48948. $ctx1.sendIdx["dagChildren"]=6;
  48949. $22=$recv($23)._first();
  48950. $ctx1.sendIdx["first"]=6;
  48951. $21=$recv($22)._dagChildren();
  48952. $ctx1.sendIdx["dagChildren"]=5;
  48953. $20=$recv($21)._first();
  48954. $ctx1.sendIdx["first"]=5;
  48955. $19=$recv($20)._left();
  48956. $ctx1.sendIdx["left"]=1;
  48957. $18=$recv($19)._binding();
  48958. $ctx1.sendIdx["binding"]=3;
  48959. $17=$recv($18)._isTempVar();
  48960. self._assert_($17);
  48961. $ctx1.sendIdx["assert:"]=3;
  48962. $39=$recv(ast)._dagChildren();
  48963. $ctx1.sendIdx["dagChildren"]=12;
  48964. $38=$recv($39)._first();
  48965. $ctx1.sendIdx["first"]=10;
  48966. $37=$recv($38)._dagChildren();
  48967. $ctx1.sendIdx["dagChildren"]=11;
  48968. $36=$recv($37)._last();
  48969. $ctx1.sendIdx["last"]=2;
  48970. $35=$recv($36)._dagChildren();
  48971. $ctx1.sendIdx["dagChildren"]=10;
  48972. $34=$recv($35)._first();
  48973. $ctx1.sendIdx["first"]=9;
  48974. $33=$recv($34)._dagChildren();
  48975. $ctx1.sendIdx["dagChildren"]=9;
  48976. $32=$recv($33)._first();
  48977. $ctx1.sendIdx["first"]=8;
  48978. $31=$recv($32)._left();
  48979. $30=$recv($31)._binding();
  48980. $29=$recv($30)._scope();
  48981. $ctx1.sendIdx["scope"]=3;
  48982. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  48983. $ctx1.sendIdx["dagChildren"]=13;
  48984. $41=$recv($42)._last();
  48985. $40=$recv($41)._scope();
  48986. $28=$recv($29).__eq_eq($40);
  48987. self._assert_($28);
  48988. return self;
  48989. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48990. },
  48991. args: [],
  48992. 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.",
  48993. referencedClasses: ["Smalltalk"],
  48994. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  48995. }),
  48996. $globals.SemanticAnalyzerTest);
  48997. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  48998. $core.addMethod(
  48999. $core.method({
  49000. selector: "setUp",
  49001. protocol: "running",
  49002. fn: function (){
  49003. var self=this;
  49004. return $core.withContext(function($ctx1) {
  49005. var $1,$3,$4,$2;
  49006. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  49007. $3=$recv($globals.AIContext)._new();
  49008. $recv($3)._defineLocal_("local");
  49009. $recv($3)._localAt_put_("local",(3));
  49010. $4=$recv($3)._yourself();
  49011. $ctx1.sendIdx["yourself"]=1;
  49012. $2=$4;
  49013. $recv($1)._context_($2);
  49014. self["@analyzer"]=$recv($1)._yourself();
  49015. return self;
  49016. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  49017. },
  49018. args: [],
  49019. 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",
  49020. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  49021. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  49022. }),
  49023. $globals.AISemanticAnalyzerTest);
  49024. $core.addMethod(
  49025. $core.method({
  49026. selector: "testContextVariables",
  49027. protocol: "tests",
  49028. fn: function (){
  49029. var self=this;
  49030. var src,ast;
  49031. return $core.withContext(function($ctx1) {
  49032. src="foo | a | local + a";
  49033. ast=$recv($globals.Smalltalk)._parse_(src);
  49034. self._shouldnt_raise_((function(){
  49035. return $core.withContext(function($ctx2) {
  49036. return $recv(self["@analyzer"])._visit_(ast);
  49037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49038. }),$globals.UnknownVariableError);
  49039. return self;
  49040. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  49041. },
  49042. args: [],
  49043. 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",
  49044. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  49045. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  49046. }),
  49047. $globals.AISemanticAnalyzerTest);
  49048. });
  49049. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  49050. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  49051. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  49052. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  49053. $core.addPackage("Kernel-Tests");
  49054. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  49055. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  49056. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  49057. $core.addMethod(
  49058. $core.method({
  49059. selector: "testAddExtensionMethod",
  49060. protocol: "tests",
  49061. fn: function (){
  49062. var self=this;
  49063. var method,dirty;
  49064. return $core.withContext(function($ctx1) {
  49065. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  49066. $2=self._class();
  49067. $ctx1.sendIdx["class"]=1;
  49068. $1=$recv($2)._package();
  49069. $ctx1.sendIdx["package"]=1;
  49070. dirty=$recv($1)._isDirty();
  49071. $ctx1.sendIdx["isDirty"]=1;
  49072. $4=self._class();
  49073. $ctx1.sendIdx["class"]=2;
  49074. $3=$recv($4)._package();
  49075. $ctx1.sendIdx["package"]=2;
  49076. $recv($3)._beClean();
  49077. $5=self._class();
  49078. $ctx1.sendIdx["class"]=3;
  49079. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  49080. $8=self._class();
  49081. $ctx1.sendIdx["class"]=4;
  49082. $7=$recv($8)._package();
  49083. $ctx1.sendIdx["package"]=3;
  49084. $6=$recv($7)._isDirty();
  49085. self._deny_($6);
  49086. $9=self._class();
  49087. $ctx1.sendIdx["class"]=5;
  49088. $recv($9)._removeCompiledMethod_(method);
  49089. $10=dirty;
  49090. if($core.assert($10)){
  49091. $recv($recv(self._class())._package())._beDirty();
  49092. }
  49093. return self;
  49094. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  49095. },
  49096. args: [],
  49097. 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 ]",
  49098. referencedClasses: [],
  49099. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  49100. }),
  49101. $globals.AnnouncementSubscriptionTest);
  49102. $core.addMethod(
  49103. $core.method({
  49104. selector: "testHandlesAnnouncement",
  49105. protocol: "tests",
  49106. fn: function (){
  49107. var self=this;
  49108. var subscription,announcementClass1,announcementClass2,classBuilder;
  49109. return $core.withContext(function($ctx1) {
  49110. var $1,$2;
  49111. classBuilder=$recv($globals.ClassBuilder)._new();
  49112. $ctx1.sendIdx["new"]=1;
  49113. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  49114. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  49115. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  49116. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  49117. self._assert_equals_($1,true);
  49118. $ctx1.sendIdx["assert:equals:"]=1;
  49119. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  49120. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  49121. self._assert_equals_($2,true);
  49122. $ctx1.sendIdx["assert:equals:"]=2;
  49123. self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  49124. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  49125. return self;
  49126. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  49127. },
  49128. args: [],
  49129. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  49130. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  49131. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  49132. }),
  49133. $globals.AnnouncementSubscriptionTest);
  49134. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  49135. $core.addMethod(
  49136. $core.method({
  49137. selector: "testOnDo",
  49138. protocol: "tests",
  49139. fn: function (){
  49140. var self=this;
  49141. var counter,announcer;
  49142. return $core.withContext(function($ctx1) {
  49143. var $1,$2;
  49144. counter=(0);
  49145. announcer=$recv($globals.Announcer)._new();
  49146. $ctx1.sendIdx["new"]=1;
  49147. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  49148. return $core.withContext(function($ctx2) {
  49149. counter=$recv(counter).__plus((1));
  49150. return counter;
  49151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49152. }));
  49153. $1=announcer;
  49154. $2=$recv($globals.SystemAnnouncement)._new();
  49155. $ctx1.sendIdx["new"]=2;
  49156. $recv($1)._announce_($2);
  49157. $ctx1.sendIdx["announce:"]=1;
  49158. self._assert_equals_(counter,(1));
  49159. $ctx1.sendIdx["assert:equals:"]=1;
  49160. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  49161. self._assert_equals_(counter,(2));
  49162. return self;
  49163. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  49164. },
  49165. args: [],
  49166. 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.",
  49167. referencedClasses: ["Announcer", "SystemAnnouncement"],
  49168. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  49169. }),
  49170. $globals.AnnouncerTest);
  49171. $core.addMethod(
  49172. $core.method({
  49173. selector: "testOnDoFor",
  49174. protocol: "tests",
  49175. fn: function (){
  49176. var self=this;
  49177. var counter,announcer;
  49178. return $core.withContext(function($ctx1) {
  49179. var $1,$2,$3,$4;
  49180. counter=(0);
  49181. announcer=$recv($globals.Announcer)._new();
  49182. $ctx1.sendIdx["new"]=1;
  49183. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  49184. return $core.withContext(function($ctx2) {
  49185. counter=$recv(counter).__plus((1));
  49186. return counter;
  49187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49188. }),self);
  49189. $1=announcer;
  49190. $2=$recv($globals.SystemAnnouncement)._new();
  49191. $ctx1.sendIdx["new"]=2;
  49192. $recv($1)._announce_($2);
  49193. $ctx1.sendIdx["announce:"]=1;
  49194. self._assert_equals_(counter,(1));
  49195. $ctx1.sendIdx["assert:equals:"]=1;
  49196. $3=announcer;
  49197. $4=$recv($globals.SystemAnnouncement)._new();
  49198. $ctx1.sendIdx["new"]=3;
  49199. $recv($3)._announce_($4);
  49200. $ctx1.sendIdx["announce:"]=2;
  49201. self._assert_equals_(counter,(2));
  49202. $ctx1.sendIdx["assert:equals:"]=2;
  49203. $recv(announcer)._unsubscribe_(self);
  49204. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  49205. self._assert_equals_(counter,(2));
  49206. return self;
  49207. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  49208. },
  49209. args: [],
  49210. 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.",
  49211. referencedClasses: ["Announcer", "SystemAnnouncement"],
  49212. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  49213. }),
  49214. $globals.AnnouncerTest);
  49215. $core.addMethod(
  49216. $core.method({
  49217. selector: "testOnDoOnce",
  49218. protocol: "tests",
  49219. fn: function (){
  49220. var self=this;
  49221. var counter,announcer;
  49222. return $core.withContext(function($ctx1) {
  49223. var $1,$2;
  49224. counter=(0);
  49225. announcer=$recv($globals.Announcer)._new();
  49226. $ctx1.sendIdx["new"]=1;
  49227. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  49228. return $core.withContext(function($ctx2) {
  49229. counter=$recv(counter).__plus((1));
  49230. return counter;
  49231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49232. }));
  49233. $1=announcer;
  49234. $2=$recv($globals.SystemAnnouncement)._new();
  49235. $ctx1.sendIdx["new"]=2;
  49236. $recv($1)._announce_($2);
  49237. $ctx1.sendIdx["announce:"]=1;
  49238. self._assert_equals_(counter,(1));
  49239. $ctx1.sendIdx["assert:equals:"]=1;
  49240. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  49241. self._assert_equals_(counter,(1));
  49242. return self;
  49243. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  49244. },
  49245. args: [],
  49246. 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.",
  49247. referencedClasses: ["Announcer", "SystemAnnouncement"],
  49248. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  49249. }),
  49250. $globals.AnnouncerTest);
  49251. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  49252. $core.addMethod(
  49253. $core.method({
  49254. selector: "localReturnOnDoCatch",
  49255. protocol: "fixture",
  49256. fn: function (){
  49257. var self=this;
  49258. return $core.withContext(function($ctx1) {
  49259. var $early={};
  49260. try {
  49261. $recv((function(){
  49262. throw $early=[(2)];
  49263. }))._on_do_($globals.Error,(function(){
  49264. }));
  49265. return (3);
  49266. }
  49267. catch(e) {if(e===$early)return e[0]; throw e}
  49268. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  49269. },
  49270. args: [],
  49271. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  49272. referencedClasses: ["Error"],
  49273. messageSends: ["on:do:"]
  49274. }),
  49275. $globals.BlockClosureTest);
  49276. $core.addMethod(
  49277. $core.method({
  49278. selector: "localReturnOnDoMiss",
  49279. protocol: "fixture",
  49280. fn: function (){
  49281. var self=this;
  49282. return $core.withContext(function($ctx1) {
  49283. var $early={};
  49284. try {
  49285. $recv((function(){
  49286. throw $early=[(2)];
  49287. }))._on_do_($globals.Class,(function(){
  49288. }));
  49289. return (3);
  49290. }
  49291. catch(e) {if(e===$early)return e[0]; throw e}
  49292. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  49293. },
  49294. args: [],
  49295. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  49296. referencedClasses: ["Class"],
  49297. messageSends: ["on:do:"]
  49298. }),
  49299. $globals.BlockClosureTest);
  49300. $core.addMethod(
  49301. $core.method({
  49302. selector: "testCanClearInterval",
  49303. protocol: "tests",
  49304. fn: function (){
  49305. var self=this;
  49306. return $core.withContext(function($ctx1) {
  49307. self._shouldnt_raise_((function(){
  49308. return $core.withContext(function($ctx2) {
  49309. return $recv($recv((function(){
  49310. return $core.withContext(function($ctx3) {
  49311. return $recv($recv($globals.Error)._new())._signal();
  49312. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49313. }))._valueWithInterval_((0)))._clearInterval();
  49314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49315. }),$globals.Error);
  49316. return self;
  49317. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  49318. },
  49319. args: [],
  49320. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  49321. referencedClasses: ["Error"],
  49322. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  49323. }),
  49324. $globals.BlockClosureTest);
  49325. $core.addMethod(
  49326. $core.method({
  49327. selector: "testCanClearTimeout",
  49328. protocol: "tests",
  49329. fn: function (){
  49330. var self=this;
  49331. return $core.withContext(function($ctx1) {
  49332. self._shouldnt_raise_((function(){
  49333. return $core.withContext(function($ctx2) {
  49334. return $recv($recv((function(){
  49335. return $core.withContext(function($ctx3) {
  49336. return $recv($recv($globals.Error)._new())._signal();
  49337. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49338. }))._valueWithTimeout_((0)))._clearTimeout();
  49339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49340. }),$globals.Error);
  49341. return self;
  49342. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  49343. },
  49344. args: [],
  49345. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  49346. referencedClasses: ["Error"],
  49347. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  49348. }),
  49349. $globals.BlockClosureTest);
  49350. $core.addMethod(
  49351. $core.method({
  49352. selector: "testCompiledSource",
  49353. protocol: "tests",
  49354. fn: function (){
  49355. var self=this;
  49356. return $core.withContext(function($ctx1) {
  49357. self._assert_($recv($recv((function(){
  49358. return $core.withContext(function($ctx2) {
  49359. return (1).__plus((1));
  49360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49361. }))._compiledSource())._includesSubString_("function"));
  49362. return self;
  49363. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  49364. },
  49365. args: [],
  49366. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  49367. referencedClasses: [],
  49368. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  49369. }),
  49370. $globals.BlockClosureTest);
  49371. $core.addMethod(
  49372. $core.method({
  49373. selector: "testCurrySelf",
  49374. protocol: "tests",
  49375. fn: function (){
  49376. var self=this;
  49377. var curriedMethod,array;
  49378. return $core.withContext(function($ctx1) {
  49379. curriedMethod=$recv($recv((function(selfarg,x){
  49380. return $core.withContext(function($ctx2) {
  49381. return $recv(selfarg)._at_(x);
  49382. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  49383. }))._currySelf())._asCompiledMethod_("foo:");
  49384. array=[(3), (1), (4)];
  49385. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  49386. $recv((function(){
  49387. return $core.withContext(function($ctx2) {
  49388. return self._assert_equals_($recv(array)._foo_((2)),(1));
  49389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49390. }))._ensure_((function(){
  49391. return $core.withContext(function($ctx2) {
  49392. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  49393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49394. }));
  49395. return self;
  49396. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  49397. },
  49398. args: [],
  49399. 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 ]",
  49400. referencedClasses: ["ClassBuilder", "Array"],
  49401. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  49402. }),
  49403. $globals.BlockClosureTest);
  49404. $core.addMethod(
  49405. $core.method({
  49406. selector: "testEnsure",
  49407. protocol: "tests",
  49408. fn: function (){
  49409. var self=this;
  49410. return $core.withContext(function($ctx1) {
  49411. self._assert_equals_($recv((function(){
  49412. return (3);
  49413. }))._ensure_((function(){
  49414. return (4);
  49415. })),(3));
  49416. return self;
  49417. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  49418. },
  49419. args: [],
  49420. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  49421. referencedClasses: [],
  49422. messageSends: ["assert:equals:", "ensure:"]
  49423. }),
  49424. $globals.BlockClosureTest);
  49425. $core.addMethod(
  49426. $core.method({
  49427. selector: "testEnsureRaises",
  49428. protocol: "tests",
  49429. fn: function (){
  49430. var self=this;
  49431. return $core.withContext(function($ctx1) {
  49432. self._should_raise_((function(){
  49433. return $core.withContext(function($ctx2) {
  49434. return $recv((function(){
  49435. return $core.withContext(function($ctx3) {
  49436. return $recv($recv($globals.Error)._new())._signal();
  49437. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49438. }))._ensure_((function(){
  49439. return true;
  49440. }));
  49441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49442. }),$globals.Error);
  49443. return self;
  49444. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  49445. },
  49446. args: [],
  49447. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  49448. referencedClasses: ["Error"],
  49449. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  49450. }),
  49451. $globals.BlockClosureTest);
  49452. $core.addMethod(
  49453. $core.method({
  49454. selector: "testExceptionSemantics",
  49455. protocol: "tests",
  49456. fn: function (){
  49457. var self=this;
  49458. return $core.withContext(function($ctx1) {
  49459. self._timeout_((100));
  49460. $recv(self._async_((function(){
  49461. return $core.withContext(function($ctx2) {
  49462. return $recv((function(){
  49463. return $core.withContext(function($ctx3) {
  49464. self._assert_(true);
  49465. $recv($globals.Error)._signal();
  49466. self._deny_(true);
  49467. return self._finished();
  49468. $ctx3.sendIdx["finished"]=1;
  49469. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49470. }))._on_do_($globals.Error,(function(ex){
  49471. return $core.withContext(function($ctx3) {
  49472. return self._finished();
  49473. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  49474. }));
  49475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49476. })))._valueWithTimeout_((0));
  49477. return self;
  49478. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  49479. },
  49480. args: [],
  49481. 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",
  49482. referencedClasses: ["Error"],
  49483. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  49484. }),
  49485. $globals.BlockClosureTest);
  49486. $core.addMethod(
  49487. $core.method({
  49488. selector: "testLocalReturnOnDoCatch",
  49489. protocol: "tests",
  49490. fn: function (){
  49491. var self=this;
  49492. return $core.withContext(function($ctx1) {
  49493. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  49494. return self;
  49495. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  49496. },
  49497. args: [],
  49498. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  49499. referencedClasses: [],
  49500. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  49501. }),
  49502. $globals.BlockClosureTest);
  49503. $core.addMethod(
  49504. $core.method({
  49505. selector: "testLocalReturnOnDoMiss",
  49506. protocol: "tests",
  49507. fn: function (){
  49508. var self=this;
  49509. return $core.withContext(function($ctx1) {
  49510. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  49511. return self;
  49512. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  49513. },
  49514. args: [],
  49515. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  49516. referencedClasses: [],
  49517. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  49518. }),
  49519. $globals.BlockClosureTest);
  49520. $core.addMethod(
  49521. $core.method({
  49522. selector: "testNewWithValues",
  49523. protocol: "tests",
  49524. fn: function (){
  49525. var self=this;
  49526. return $core.withContext(function($ctx1) {
  49527. function TestConstructor(arg1, arg2, arg3) {}
  49528. TestConstructor.prototype.name = "theTestPrototype";
  49529. var wrappedConstructor = $recv(TestConstructor);
  49530. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  49531. self._assert_(result instanceof TestConstructor);
  49532. self._assert_equals_(result.name, "theTestPrototype");
  49533. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  49534. self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  49535. return self;
  49536. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  49537. },
  49538. args: [],
  49539. source: "testNewWithValues\x0a<inlineJS: '\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = \x22theTestPrototype\x22;\x0a\x0a\x09var wrappedConstructor = $recv(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, \x22theTestPrototype\x22);\x0a\x0a\x09/* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_(\x22single argument\x22);}, $globals.Error);\x0a'>",
  49540. referencedClasses: [],
  49541. messageSends: []
  49542. }),
  49543. $globals.BlockClosureTest);
  49544. $core.addMethod(
  49545. $core.method({
  49546. selector: "testNumArgs",
  49547. protocol: "tests",
  49548. fn: function (){
  49549. var self=this;
  49550. return $core.withContext(function($ctx1) {
  49551. var $1;
  49552. $1=$recv((function(){
  49553. }))._numArgs();
  49554. $ctx1.sendIdx["numArgs"]=1;
  49555. self._assert_equals_($1,(0));
  49556. $ctx1.sendIdx["assert:equals:"]=1;
  49557. self._assert_equals_($recv((function(a,b){
  49558. }))._numArgs(),(2));
  49559. return self;
  49560. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  49561. },
  49562. args: [],
  49563. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  49564. referencedClasses: [],
  49565. messageSends: ["assert:equals:", "numArgs"]
  49566. }),
  49567. $globals.BlockClosureTest);
  49568. $core.addMethod(
  49569. $core.method({
  49570. selector: "testOnDo",
  49571. protocol: "tests",
  49572. fn: function (){
  49573. var self=this;
  49574. return $core.withContext(function($ctx1) {
  49575. self._assert_($recv((function(){
  49576. return $core.withContext(function($ctx2) {
  49577. return $recv($recv($globals.Error)._new())._signal();
  49578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49579. }))._on_do_($globals.Error,(function(ex){
  49580. return true;
  49581. })));
  49582. return self;
  49583. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  49584. },
  49585. args: [],
  49586. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  49587. referencedClasses: ["Error"],
  49588. messageSends: ["assert:", "on:do:", "signal", "new"]
  49589. }),
  49590. $globals.BlockClosureTest);
  49591. $core.addMethod(
  49592. $core.method({
  49593. selector: "testValue",
  49594. protocol: "tests",
  49595. fn: function (){
  49596. var self=this;
  49597. return $core.withContext(function($ctx1) {
  49598. var $1;
  49599. $1=$recv((function(){
  49600. return $core.withContext(function($ctx2) {
  49601. return (1).__plus((1));
  49602. $ctx2.sendIdx["+"]=1;
  49603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49604. }))._value();
  49605. $ctx1.sendIdx["value"]=1;
  49606. self._assert_equals_($1,(2));
  49607. $ctx1.sendIdx["assert:equals:"]=1;
  49608. self._assert_equals_($recv((function(x){
  49609. return $core.withContext(function($ctx2) {
  49610. return $recv(x).__plus((1));
  49611. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  49612. }))._value_((2)),(3));
  49613. $ctx1.sendIdx["assert:equals:"]=2;
  49614. self._assert_equals_($recv((function(x,y){
  49615. return $core.withContext(function($ctx2) {
  49616. return $recv(x).__star(y);
  49617. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  49618. }))._value_value_((2),(4)),(8));
  49619. $ctx1.sendIdx["assert:equals:"]=3;
  49620. self._assert_equals_($recv((function(a,b,c){
  49621. return (1);
  49622. }))._value(),(1));
  49623. return self;
  49624. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  49625. },
  49626. args: [],
  49627. 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",
  49628. referencedClasses: [],
  49629. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  49630. }),
  49631. $globals.BlockClosureTest);
  49632. $core.addMethod(
  49633. $core.method({
  49634. selector: "testValueWithPossibleArguments",
  49635. protocol: "tests",
  49636. fn: function (){
  49637. var self=this;
  49638. return $core.withContext(function($ctx1) {
  49639. var $1,$2;
  49640. $1=$recv((function(){
  49641. return (1);
  49642. }))._valueWithPossibleArguments_([(3), (4)]);
  49643. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  49644. self._assert_equals_($1,(1));
  49645. $ctx1.sendIdx["assert:equals:"]=1;
  49646. $2=$recv((function(a){
  49647. return $core.withContext(function($ctx2) {
  49648. return $recv(a).__plus((4));
  49649. $ctx2.sendIdx["+"]=1;
  49650. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  49651. }))._valueWithPossibleArguments_([(3), (4)]);
  49652. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  49653. self._assert_equals_($2,(7));
  49654. $ctx1.sendIdx["assert:equals:"]=2;
  49655. self._assert_equals_($recv((function(a,b){
  49656. return $core.withContext(function($ctx2) {
  49657. return $recv(a).__plus(b);
  49658. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  49659. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  49660. return self;
  49661. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  49662. },
  49663. args: [],
  49664. 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.",
  49665. referencedClasses: [],
  49666. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  49667. }),
  49668. $globals.BlockClosureTest);
  49669. $core.addMethod(
  49670. $core.method({
  49671. selector: "testWhileFalse",
  49672. protocol: "tests",
  49673. fn: function (){
  49674. var self=this;
  49675. var i;
  49676. return $core.withContext(function($ctx1) {
  49677. i=(0);
  49678. $recv((function(){
  49679. return $core.withContext(function($ctx2) {
  49680. return $recv(i).__gt((5));
  49681. $ctx2.sendIdx[">"]=1;
  49682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49683. }))._whileFalse_((function(){
  49684. return $core.withContext(function($ctx2) {
  49685. i=$recv(i).__plus((1));
  49686. $ctx2.sendIdx["+"]=1;
  49687. return i;
  49688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49689. }));
  49690. self._assert_equals_(i,(6));
  49691. $ctx1.sendIdx["assert:equals:"]=1;
  49692. i=(0);
  49693. $recv((function(){
  49694. return $core.withContext(function($ctx2) {
  49695. i=$recv(i).__plus((1));
  49696. i;
  49697. return $recv(i).__gt((5));
  49698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49699. }))._whileFalse();
  49700. self._assert_equals_(i,(6));
  49701. return self;
  49702. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  49703. },
  49704. args: [],
  49705. 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",
  49706. referencedClasses: [],
  49707. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  49708. }),
  49709. $globals.BlockClosureTest);
  49710. $core.addMethod(
  49711. $core.method({
  49712. selector: "testWhileTrue",
  49713. protocol: "tests",
  49714. fn: function (){
  49715. var self=this;
  49716. var i;
  49717. return $core.withContext(function($ctx1) {
  49718. i=(0);
  49719. $recv((function(){
  49720. return $core.withContext(function($ctx2) {
  49721. return $recv(i).__lt((5));
  49722. $ctx2.sendIdx["<"]=1;
  49723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49724. }))._whileTrue_((function(){
  49725. return $core.withContext(function($ctx2) {
  49726. i=$recv(i).__plus((1));
  49727. $ctx2.sendIdx["+"]=1;
  49728. return i;
  49729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49730. }));
  49731. self._assert_equals_(i,(5));
  49732. $ctx1.sendIdx["assert:equals:"]=1;
  49733. i=(0);
  49734. $recv((function(){
  49735. return $core.withContext(function($ctx2) {
  49736. i=$recv(i).__plus((1));
  49737. i;
  49738. return $recv(i).__lt((5));
  49739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49740. }))._whileTrue();
  49741. self._assert_equals_(i,(5));
  49742. return self;
  49743. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  49744. },
  49745. args: [],
  49746. 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",
  49747. referencedClasses: [],
  49748. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  49749. }),
  49750. $globals.BlockClosureTest);
  49751. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  49752. $core.addMethod(
  49753. $core.method({
  49754. selector: "testEquality",
  49755. protocol: "tests",
  49756. fn: function (){
  49757. var self=this;
  49758. return $core.withContext(function($ctx1) {
  49759. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  49760. $1=(0).__eq(false);
  49761. $ctx1.sendIdx["="]=1;
  49762. self._deny_($1);
  49763. $ctx1.sendIdx["deny:"]=1;
  49764. $2=false.__eq((0));
  49765. $ctx1.sendIdx["="]=2;
  49766. self._deny_($2);
  49767. $ctx1.sendIdx["deny:"]=2;
  49768. $3="".__eq(false);
  49769. $ctx1.sendIdx["="]=3;
  49770. self._deny_($3);
  49771. $ctx1.sendIdx["deny:"]=3;
  49772. $4=false.__eq("");
  49773. $ctx1.sendIdx["="]=4;
  49774. self._deny_($4);
  49775. $ctx1.sendIdx["deny:"]=4;
  49776. $5=true.__eq(true);
  49777. $ctx1.sendIdx["="]=5;
  49778. self._assert_($5);
  49779. $ctx1.sendIdx["assert:"]=1;
  49780. $6=false.__eq(true);
  49781. $ctx1.sendIdx["="]=6;
  49782. self._deny_($6);
  49783. $ctx1.sendIdx["deny:"]=5;
  49784. $7=true.__eq(false);
  49785. $ctx1.sendIdx["="]=7;
  49786. self._deny_($7);
  49787. $8=false.__eq(false);
  49788. $ctx1.sendIdx["="]=8;
  49789. self._assert_($8);
  49790. $ctx1.sendIdx["assert:"]=2;
  49791. $10=true._yourself();
  49792. $ctx1.sendIdx["yourself"]=1;
  49793. $9=$recv($10).__eq(true);
  49794. $ctx1.sendIdx["="]=9;
  49795. self._assert_($9);
  49796. $ctx1.sendIdx["assert:"]=3;
  49797. $12=true._yourself();
  49798. $ctx1.sendIdx["yourself"]=2;
  49799. $11=$recv($12).__eq(true._yourself());
  49800. self._assert_($11);
  49801. return self;
  49802. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  49803. },
  49804. args: [],
  49805. 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)",
  49806. referencedClasses: [],
  49807. messageSends: ["deny:", "=", "assert:", "yourself"]
  49808. }),
  49809. $globals.BooleanTest);
  49810. $core.addMethod(
  49811. $core.method({
  49812. selector: "testIdentity",
  49813. protocol: "tests",
  49814. fn: function (){
  49815. var self=this;
  49816. return $core.withContext(function($ctx1) {
  49817. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  49818. $1=(0).__eq_eq(false);
  49819. $ctx1.sendIdx["=="]=1;
  49820. self._deny_($1);
  49821. $ctx1.sendIdx["deny:"]=1;
  49822. $2=false.__eq_eq((0));
  49823. $ctx1.sendIdx["=="]=2;
  49824. self._deny_($2);
  49825. $ctx1.sendIdx["deny:"]=2;
  49826. $3="".__eq_eq(false);
  49827. $ctx1.sendIdx["=="]=3;
  49828. self._deny_($3);
  49829. $ctx1.sendIdx["deny:"]=3;
  49830. $4=false.__eq_eq("");
  49831. $ctx1.sendIdx["=="]=4;
  49832. self._deny_($4);
  49833. $ctx1.sendIdx["deny:"]=4;
  49834. $5=true.__eq_eq(true);
  49835. $ctx1.sendIdx["=="]=5;
  49836. self._assert_($5);
  49837. $ctx1.sendIdx["assert:"]=1;
  49838. $6=false.__eq_eq(true);
  49839. $ctx1.sendIdx["=="]=6;
  49840. self._deny_($6);
  49841. $ctx1.sendIdx["deny:"]=5;
  49842. $7=true.__eq_eq(false);
  49843. $ctx1.sendIdx["=="]=7;
  49844. self._deny_($7);
  49845. $8=false.__eq_eq(false);
  49846. $ctx1.sendIdx["=="]=8;
  49847. self._assert_($8);
  49848. $ctx1.sendIdx["assert:"]=2;
  49849. $10=true._yourself();
  49850. $ctx1.sendIdx["yourself"]=1;
  49851. $9=$recv($10).__eq_eq(true);
  49852. $ctx1.sendIdx["=="]=9;
  49853. self._assert_($9);
  49854. $ctx1.sendIdx["assert:"]=3;
  49855. $12=true._yourself();
  49856. $ctx1.sendIdx["yourself"]=2;
  49857. $11=$recv($12).__eq_eq(true._yourself());
  49858. self._assert_($11);
  49859. return self;
  49860. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  49861. },
  49862. args: [],
  49863. 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",
  49864. referencedClasses: [],
  49865. messageSends: ["deny:", "==", "assert:", "yourself"]
  49866. }),
  49867. $globals.BooleanTest);
  49868. $core.addMethod(
  49869. $core.method({
  49870. selector: "testIfTrueIfFalse",
  49871. protocol: "tests",
  49872. fn: function (){
  49873. var self=this;
  49874. return $core.withContext(function($ctx1) {
  49875. var $1,$2,$3,$4,$5,$6,$7,$8;
  49876. if($core.assert(true)){
  49877. $1="alternative block";
  49878. }
  49879. self._assert_equals_($1,"alternative block");
  49880. $ctx1.sendIdx["assert:equals:"]=1;
  49881. if(!$core.assert(true)){
  49882. $2="alternative block";
  49883. }
  49884. self._assert_equals_($2,nil);
  49885. $ctx1.sendIdx["assert:equals:"]=2;
  49886. if($core.assert(false)){
  49887. $3="alternative block";
  49888. }
  49889. self._assert_equals_($3,nil);
  49890. $ctx1.sendIdx["assert:equals:"]=3;
  49891. if(!$core.assert(false)){
  49892. $4="alternative block";
  49893. }
  49894. self._assert_equals_($4,"alternative block");
  49895. $ctx1.sendIdx["assert:equals:"]=4;
  49896. if($core.assert(false)){
  49897. $5="alternative block";
  49898. } else {
  49899. $5="alternative block2";
  49900. }
  49901. self._assert_equals_($5,"alternative block2");
  49902. $ctx1.sendIdx["assert:equals:"]=5;
  49903. if($core.assert(false)){
  49904. $6="alternative block2";
  49905. } else {
  49906. $6="alternative block";
  49907. }
  49908. self._assert_equals_($6,"alternative block");
  49909. $ctx1.sendIdx["assert:equals:"]=6;
  49910. if($core.assert(true)){
  49911. $7="alternative block";
  49912. } else {
  49913. $7="alternative block2";
  49914. }
  49915. self._assert_equals_($7,"alternative block");
  49916. $ctx1.sendIdx["assert:equals:"]=7;
  49917. if($core.assert(true)){
  49918. $8="alternative block2";
  49919. } else {
  49920. $8="alternative block";
  49921. }
  49922. self._assert_equals_($8,"alternative block2");
  49923. return self;
  49924. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  49925. },
  49926. args: [],
  49927. 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'.",
  49928. referencedClasses: [],
  49929. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49930. }),
  49931. $globals.BooleanTest);
  49932. $core.addMethod(
  49933. $core.method({
  49934. selector: "testIfTrueIfFalseWithBoxing",
  49935. protocol: "tests",
  49936. fn: function (){
  49937. var self=this;
  49938. return $core.withContext(function($ctx1) {
  49939. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  49940. $2=true._yourself();
  49941. $ctx1.sendIdx["yourself"]=1;
  49942. if($core.assert($2)){
  49943. $1="alternative block";
  49944. }
  49945. self._assert_equals_($1,"alternative block");
  49946. $ctx1.sendIdx["assert:equals:"]=1;
  49947. $4=true._yourself();
  49948. $ctx1.sendIdx["yourself"]=2;
  49949. if(!$core.assert($4)){
  49950. $3="alternative block";
  49951. }
  49952. self._assert_equals_($3,nil);
  49953. $ctx1.sendIdx["assert:equals:"]=2;
  49954. $6=false._yourself();
  49955. $ctx1.sendIdx["yourself"]=3;
  49956. if($core.assert($6)){
  49957. $5="alternative block";
  49958. }
  49959. self._assert_equals_($5,nil);
  49960. $ctx1.sendIdx["assert:equals:"]=3;
  49961. $8=false._yourself();
  49962. $ctx1.sendIdx["yourself"]=4;
  49963. if(!$core.assert($8)){
  49964. $7="alternative block";
  49965. }
  49966. self._assert_equals_($7,"alternative block");
  49967. $ctx1.sendIdx["assert:equals:"]=4;
  49968. $10=false._yourself();
  49969. $ctx1.sendIdx["yourself"]=5;
  49970. if($core.assert($10)){
  49971. $9="alternative block";
  49972. } else {
  49973. $9="alternative block2";
  49974. }
  49975. self._assert_equals_($9,"alternative block2");
  49976. $ctx1.sendIdx["assert:equals:"]=5;
  49977. $12=false._yourself();
  49978. $ctx1.sendIdx["yourself"]=6;
  49979. if($core.assert($12)){
  49980. $11="alternative block2";
  49981. } else {
  49982. $11="alternative block";
  49983. }
  49984. self._assert_equals_($11,"alternative block");
  49985. $ctx1.sendIdx["assert:equals:"]=6;
  49986. $14=true._yourself();
  49987. $ctx1.sendIdx["yourself"]=7;
  49988. if($core.assert($14)){
  49989. $13="alternative block";
  49990. } else {
  49991. $13="alternative block2";
  49992. }
  49993. self._assert_equals_($13,"alternative block");
  49994. $ctx1.sendIdx["assert:equals:"]=7;
  49995. $16=true._yourself();
  49996. if($core.assert($16)){
  49997. $15="alternative block2";
  49998. } else {
  49999. $15="alternative block";
  50000. }
  50001. self._assert_equals_($15,"alternative block2");
  50002. return self;
  50003. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  50004. },
  50005. args: [],
  50006. 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'.",
  50007. referencedClasses: [],
  50008. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  50009. }),
  50010. $globals.BooleanTest);
  50011. $core.addMethod(
  50012. $core.method({
  50013. selector: "testLogic",
  50014. protocol: "tests",
  50015. fn: function (){
  50016. var self=this;
  50017. return $core.withContext(function($ctx1) {
  50018. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  50019. $1=true.__and(true);
  50020. $ctx1.sendIdx["&"]=1;
  50021. self._assert_($1);
  50022. $ctx1.sendIdx["assert:"]=1;
  50023. $2=true.__and(false);
  50024. $ctx1.sendIdx["&"]=2;
  50025. self._deny_($2);
  50026. $ctx1.sendIdx["deny:"]=1;
  50027. $3=false.__and(true);
  50028. $ctx1.sendIdx["&"]=3;
  50029. self._deny_($3);
  50030. $ctx1.sendIdx["deny:"]=2;
  50031. $5=false.__and(false);
  50032. $ctx1.sendIdx["&"]=4;
  50033. $4=self._deny_($5);
  50034. $ctx1.sendIdx["deny:"]=3;
  50035. $6=true.__or(true);
  50036. $ctx1.sendIdx["|"]=1;
  50037. self._assert_($6);
  50038. $ctx1.sendIdx["assert:"]=2;
  50039. $7=true.__or(false);
  50040. $ctx1.sendIdx["|"]=2;
  50041. self._assert_($7);
  50042. $ctx1.sendIdx["assert:"]=3;
  50043. $8=false.__or(true);
  50044. $ctx1.sendIdx["|"]=3;
  50045. self._assert_($8);
  50046. $ctx1.sendIdx["assert:"]=4;
  50047. $10=false.__or(false);
  50048. $ctx1.sendIdx["|"]=4;
  50049. $9=self._deny_($10);
  50050. $ctx1.sendIdx["deny:"]=4;
  50051. $12=(1).__gt((0));
  50052. $ctx1.sendIdx[">"]=1;
  50053. $11=true.__and($12);
  50054. $ctx1.sendIdx["&"]=5;
  50055. self._assert_($11);
  50056. $ctx1.sendIdx["assert:"]=5;
  50057. $14=(1).__gt((0));
  50058. $ctx1.sendIdx[">"]=2;
  50059. $13=$recv($14).__and(false);
  50060. $ctx1.sendIdx["&"]=6;
  50061. self._deny_($13);
  50062. $ctx1.sendIdx["deny:"]=5;
  50063. $16=(1).__gt((0));
  50064. $ctx1.sendIdx[">"]=3;
  50065. $17=(1).__gt((2));
  50066. $ctx1.sendIdx[">"]=4;
  50067. $15=$recv($16).__and($17);
  50068. self._deny_($15);
  50069. $19=(1).__gt((0));
  50070. $ctx1.sendIdx[">"]=5;
  50071. $18=false.__or($19);
  50072. $ctx1.sendIdx["|"]=5;
  50073. self._assert_($18);
  50074. $ctx1.sendIdx["assert:"]=6;
  50075. $21=(1).__gt((0));
  50076. $ctx1.sendIdx[">"]=6;
  50077. $20=$recv($21).__or(false);
  50078. $ctx1.sendIdx["|"]=6;
  50079. self._assert_($20);
  50080. $ctx1.sendIdx["assert:"]=7;
  50081. $23=(1).__gt((0));
  50082. $ctx1.sendIdx[">"]=7;
  50083. $22=$recv($23).__or((1).__gt((2)));
  50084. self._assert_($22);
  50085. return self;
  50086. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  50087. },
  50088. args: [],
  50089. 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))",
  50090. referencedClasses: [],
  50091. messageSends: ["assert:", "&", "deny:", "|", ">"]
  50092. }),
  50093. $globals.BooleanTest);
  50094. $core.addMethod(
  50095. $core.method({
  50096. selector: "testLogicKeywords",
  50097. protocol: "tests",
  50098. fn: function (){
  50099. var self=this;
  50100. return $core.withContext(function($ctx1) {
  50101. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  50102. $1=true._and_((function(){
  50103. return true;
  50104. }));
  50105. $ctx1.sendIdx["and:"]=1;
  50106. self._assert_($1);
  50107. $ctx1.sendIdx["assert:"]=1;
  50108. $2=true._and_((function(){
  50109. return false;
  50110. }));
  50111. $ctx1.sendIdx["and:"]=2;
  50112. self._deny_($2);
  50113. $ctx1.sendIdx["deny:"]=1;
  50114. $3=false._and_((function(){
  50115. return true;
  50116. }));
  50117. $ctx1.sendIdx["and:"]=3;
  50118. self._deny_($3);
  50119. $ctx1.sendIdx["deny:"]=2;
  50120. $5=false._and_((function(){
  50121. return false;
  50122. }));
  50123. $ctx1.sendIdx["and:"]=4;
  50124. $4=self._deny_($5);
  50125. $ctx1.sendIdx["deny:"]=3;
  50126. $6=true._or_((function(){
  50127. return true;
  50128. }));
  50129. $ctx1.sendIdx["or:"]=1;
  50130. self._assert_($6);
  50131. $ctx1.sendIdx["assert:"]=2;
  50132. $7=true._or_((function(){
  50133. return false;
  50134. }));
  50135. $ctx1.sendIdx["or:"]=2;
  50136. self._assert_($7);
  50137. $ctx1.sendIdx["assert:"]=3;
  50138. $8=false._or_((function(){
  50139. return true;
  50140. }));
  50141. $ctx1.sendIdx["or:"]=3;
  50142. self._assert_($8);
  50143. $ctx1.sendIdx["assert:"]=4;
  50144. $10=false._or_((function(){
  50145. return false;
  50146. }));
  50147. $ctx1.sendIdx["or:"]=4;
  50148. $9=self._deny_($10);
  50149. $ctx1.sendIdx["deny:"]=4;
  50150. $11=true._and_((function(){
  50151. return $core.withContext(function($ctx2) {
  50152. return (1).__gt((0));
  50153. $ctx2.sendIdx[">"]=1;
  50154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  50155. }));
  50156. $ctx1.sendIdx["and:"]=5;
  50157. self._assert_($11);
  50158. $ctx1.sendIdx["assert:"]=5;
  50159. $13=(1).__gt((0));
  50160. $ctx1.sendIdx[">"]=2;
  50161. $12=$recv($13)._and_((function(){
  50162. return false;
  50163. }));
  50164. $ctx1.sendIdx["and:"]=6;
  50165. self._deny_($12);
  50166. $ctx1.sendIdx["deny:"]=5;
  50167. $15=(1).__gt((0));
  50168. $ctx1.sendIdx[">"]=3;
  50169. $14=$recv($15)._and_((function(){
  50170. return $core.withContext(function($ctx2) {
  50171. return (1).__gt((2));
  50172. $ctx2.sendIdx[">"]=4;
  50173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  50174. }));
  50175. self._deny_($14);
  50176. $16=false._or_((function(){
  50177. return $core.withContext(function($ctx2) {
  50178. return (1).__gt((0));
  50179. $ctx2.sendIdx[">"]=5;
  50180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  50181. }));
  50182. $ctx1.sendIdx["or:"]=5;
  50183. self._assert_($16);
  50184. $ctx1.sendIdx["assert:"]=6;
  50185. $18=(1).__gt((0));
  50186. $ctx1.sendIdx[">"]=6;
  50187. $17=$recv($18)._or_((function(){
  50188. return false;
  50189. }));
  50190. $ctx1.sendIdx["or:"]=6;
  50191. self._assert_($17);
  50192. $ctx1.sendIdx["assert:"]=7;
  50193. $20=(1).__gt((0));
  50194. $ctx1.sendIdx[">"]=7;
  50195. $19=$recv($20)._or_((function(){
  50196. return $core.withContext(function($ctx2) {
  50197. return (1).__gt((2));
  50198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  50199. }));
  50200. self._assert_($19);
  50201. return self;
  50202. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  50203. },
  50204. args: [],
  50205. 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 ])",
  50206. referencedClasses: [],
  50207. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  50208. }),
  50209. $globals.BooleanTest);
  50210. $core.addMethod(
  50211. $core.method({
  50212. selector: "testNonBooleanError",
  50213. protocol: "tests",
  50214. fn: function (){
  50215. var self=this;
  50216. return $core.withContext(function($ctx1) {
  50217. self._should_raise_((function(){
  50218. return $core.withContext(function($ctx2) {
  50219. if($core.assert("")){
  50220. } else {
  50221. }
  50222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50223. }),$globals.NonBooleanReceiver);
  50224. return self;
  50225. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  50226. },
  50227. args: [],
  50228. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  50229. referencedClasses: ["NonBooleanReceiver"],
  50230. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  50231. }),
  50232. $globals.BooleanTest);
  50233. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  50234. $core.addMethod(
  50235. $core.method({
  50236. selector: "setUp",
  50237. protocol: "running",
  50238. fn: function (){
  50239. var self=this;
  50240. return $core.withContext(function($ctx1) {
  50241. self["@builder"]=$recv($globals.ClassBuilder)._new();
  50242. return self;
  50243. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  50244. },
  50245. args: [],
  50246. source: "setUp\x0a\x09builder := ClassBuilder new",
  50247. referencedClasses: ["ClassBuilder"],
  50248. messageSends: ["new"]
  50249. }),
  50250. $globals.ClassBuilderTest);
  50251. $core.addMethod(
  50252. $core.method({
  50253. selector: "tearDown",
  50254. protocol: "running",
  50255. fn: function (){
  50256. var self=this;
  50257. return $core.withContext(function($ctx1) {
  50258. var $1,$receiver;
  50259. $1=self["@theClass"];
  50260. if(($receiver = $1) == null || $receiver.isNil){
  50261. $1;
  50262. } else {
  50263. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  50264. self["@theClass"]=nil;
  50265. self["@theClass"];
  50266. }
  50267. return self;
  50268. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  50269. },
  50270. args: [],
  50271. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  50272. referencedClasses: ["Smalltalk"],
  50273. messageSends: ["ifNotNil:", "removeClass:"]
  50274. }),
  50275. $globals.ClassBuilderTest);
  50276. $core.addMethod(
  50277. $core.method({
  50278. selector: "testClassCopy",
  50279. protocol: "tests",
  50280. fn: function (){
  50281. var self=this;
  50282. return $core.withContext(function($ctx1) {
  50283. var $2,$1,$4,$3,$6,$5,$8,$7;
  50284. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50285. $2=$recv(self["@theClass"])._superclass();
  50286. $ctx1.sendIdx["superclass"]=1;
  50287. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  50288. $ctx1.sendIdx["=="]=1;
  50289. self._assert_($1);
  50290. $ctx1.sendIdx["assert:"]=1;
  50291. $4=$recv(self["@theClass"])._instanceVariableNames();
  50292. $ctx1.sendIdx["instanceVariableNames"]=1;
  50293. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  50294. $ctx1.sendIdx["=="]=2;
  50295. self._assert_($3);
  50296. $ctx1.sendIdx["assert:"]=2;
  50297. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  50298. $ctx1.sendIdx["assert:equals:"]=1;
  50299. $6=$recv(self["@theClass"])._package();
  50300. $ctx1.sendIdx["package"]=1;
  50301. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  50302. self._assert_($5);
  50303. $8=$recv(self["@theClass"])._methodDictionary();
  50304. $ctx1.sendIdx["methodDictionary"]=1;
  50305. $7=$recv($8)._keys();
  50306. $ctx1.sendIdx["keys"]=1;
  50307. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  50308. return self;
  50309. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  50310. },
  50311. args: [],
  50312. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  50313. referencedClasses: ["ObjectMock"],
  50314. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  50315. }),
  50316. $globals.ClassBuilderTest);
  50317. $core.addMethod(
  50318. $core.method({
  50319. selector: "testClassMigration",
  50320. protocol: "tests",
  50321. fn: function (){
  50322. var self=this;
  50323. var instance,oldClass;
  50324. return $core.withContext(function($ctx1) {
  50325. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  50326. oldClass=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50327. $2=$recv($globals.Smalltalk)._globals();
  50328. $ctx1.sendIdx["globals"]=1;
  50329. $1=$recv($2)._at_("ObjectMock2");
  50330. $ctx1.sendIdx["at:"]=1;
  50331. instance=$recv($1)._new();
  50332. $4=$recv($globals.Smalltalk)._globals();
  50333. $ctx1.sendIdx["globals"]=2;
  50334. $3=$recv($4)._at_("ObjectMock2");
  50335. $ctx1.sendIdx["at:"]=2;
  50336. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  50337. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  50338. $ctx1.sendIdx["=="]=1;
  50339. self._deny_($5);
  50340. $ctx1.sendIdx["deny:"]=1;
  50341. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  50342. $ctx1.sendIdx["=="]=2;
  50343. self._assert_($6);
  50344. $ctx1.sendIdx["assert:"]=1;
  50345. self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  50346. $ctx1.sendIdx["assert:"]=2;
  50347. $7=$recv($globals.ObjectMock2)._selectors();
  50348. $ctx1.sendIdx["selectors"]=1;
  50349. self._assert_equals_($7,$recv(oldClass)._selectors());
  50350. $ctx1.sendIdx["assert:equals:"]=1;
  50351. $8=$recv($globals.ObjectMock2)._comment();
  50352. $ctx1.sendIdx["comment"]=1;
  50353. self._assert_equals_($8,$recv(oldClass)._comment());
  50354. $ctx1.sendIdx["assert:equals:"]=2;
  50355. $9=$recv($recv($globals.ObjectMock2)._package())._name();
  50356. $ctx1.sendIdx["name"]=1;
  50357. self._assert_equals_($9,"Kernel-Tests");
  50358. $11=$recv(instance)._class();
  50359. $ctx1.sendIdx["class"]=1;
  50360. $10=$recv($11).__eq_eq($globals.ObjectMock2);
  50361. self._deny_($10);
  50362. self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  50363. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  50364. return self;
  50365. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  50366. },
  50367. args: [],
  50368. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  50369. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  50370. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  50371. }),
  50372. $globals.ClassBuilderTest);
  50373. $core.addMethod(
  50374. $core.method({
  50375. selector: "testClassMigrationWithClassInstanceVariables",
  50376. protocol: "tests",
  50377. fn: function (){
  50378. var self=this;
  50379. return $core.withContext(function($ctx1) {
  50380. var $1;
  50381. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50382. $1=$recv($globals.ObjectMock2)._class();
  50383. $ctx1.sendIdx["class"]=1;
  50384. $recv($1)._instanceVariableNames_("foo bar");
  50385. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  50386. self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  50387. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  50388. return self;
  50389. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  50390. },
  50391. args: [],
  50392. 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",
  50393. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  50394. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  50395. }),
  50396. $globals.ClassBuilderTest);
  50397. $core.addMethod(
  50398. $core.method({
  50399. selector: "testClassMigrationWithSubclasses",
  50400. protocol: "tests",
  50401. fn: function (){
  50402. var self=this;
  50403. return $core.withContext(function($ctx1) {
  50404. var $2,$1,$4,$3;
  50405. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50406. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  50407. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  50408. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  50409. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  50410. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  50411. $2=$recv($globals.ObjectMock)._subclasses();
  50412. $ctx1.sendIdx["subclasses"]=1;
  50413. $1=$recv($2)._includes_($globals.ObjectMock2);
  50414. $ctx1.sendIdx["includes:"]=1;
  50415. self._assert_($1);
  50416. $ctx1.sendIdx["assert:"]=1;
  50417. $4=$recv($globals.ObjectMock2)._subclasses();
  50418. $ctx1.sendIdx["subclasses"]=2;
  50419. $3=$recv($4)._includes_($globals.ObjectMock3);
  50420. $ctx1.sendIdx["includes:"]=2;
  50421. self._assert_($3);
  50422. $ctx1.sendIdx["assert:"]=2;
  50423. self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  50424. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  50425. return $core.withContext(function($ctx2) {
  50426. return $recv($globals.Smalltalk)._removeClass_(each);
  50427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50428. }));
  50429. return self;
  50430. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  50431. },
  50432. args: [],
  50433. 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 ]",
  50434. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  50435. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  50436. }),
  50437. $globals.ClassBuilderTest);
  50438. $core.addMethod(
  50439. $core.method({
  50440. selector: "testInstanceVariableNames",
  50441. protocol: "tests",
  50442. fn: function (){
  50443. var self=this;
  50444. return $core.withContext(function($ctx1) {
  50445. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  50446. return self;
  50447. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  50448. },
  50449. args: [],
  50450. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  50451. referencedClasses: [],
  50452. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  50453. }),
  50454. $globals.ClassBuilderTest);
  50455. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  50456. $core.addMethod(
  50457. $core.method({
  50458. selector: "jsConstructor",
  50459. protocol: "running",
  50460. fn: function (){
  50461. var self=this;
  50462. return $core.withContext(function($ctx1) {
  50463. function Foo(){}
  50464. Foo.prototype.valueOf = function () {return 4;};
  50465. return Foo;
  50466. ;
  50467. return self;
  50468. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  50469. },
  50470. args: [],
  50471. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  50472. referencedClasses: [],
  50473. messageSends: []
  50474. }),
  50475. $globals.ClassTest);
  50476. $core.addMethod(
  50477. $core.method({
  50478. selector: "setUp",
  50479. protocol: "running",
  50480. fn: function (){
  50481. var self=this;
  50482. return $core.withContext(function($ctx1) {
  50483. self["@builder"]=$recv($globals.ClassBuilder)._new();
  50484. return self;
  50485. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  50486. },
  50487. args: [],
  50488. source: "setUp\x0a\x09builder := ClassBuilder new",
  50489. referencedClasses: ["ClassBuilder"],
  50490. messageSends: ["new"]
  50491. }),
  50492. $globals.ClassTest);
  50493. $core.addMethod(
  50494. $core.method({
  50495. selector: "tearDown",
  50496. protocol: "running",
  50497. fn: function (){
  50498. var self=this;
  50499. return $core.withContext(function($ctx1) {
  50500. var $1,$receiver;
  50501. $1=self["@theClass"];
  50502. if(($receiver = $1) == null || $receiver.isNil){
  50503. $1;
  50504. } else {
  50505. $recv($recv(self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  50506. return $core.withContext(function($ctx2) {
  50507. return $recv($globals.Smalltalk)._removeClass_(each);
  50508. $ctx2.sendIdx["removeClass:"]=1;
  50509. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50510. }));
  50511. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  50512. self["@theClass"]=nil;
  50513. self["@theClass"];
  50514. }
  50515. return self;
  50516. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  50517. },
  50518. args: [],
  50519. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  50520. referencedClasses: ["Smalltalk"],
  50521. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  50522. }),
  50523. $globals.ClassTest);
  50524. $core.addMethod(
  50525. $core.method({
  50526. selector: "testAllSubclasses",
  50527. protocol: "tests",
  50528. fn: function (){
  50529. var self=this;
  50530. var subclasses,index;
  50531. return $core.withContext(function($ctx1) {
  50532. subclasses=$recv($globals.Object)._subclasses();
  50533. $ctx1.sendIdx["subclasses"]=1;
  50534. index=(1);
  50535. $recv((function(){
  50536. return $core.withContext(function($ctx2) {
  50537. return $recv(index).__gt($recv(subclasses)._size());
  50538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50539. }))._whileFalse_((function(){
  50540. return $core.withContext(function($ctx2) {
  50541. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  50542. index=$recv(index).__plus((1));
  50543. return index;
  50544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50545. }));
  50546. self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  50547. return self;
  50548. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  50549. },
  50550. args: [],
  50551. 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",
  50552. referencedClasses: ["Object"],
  50553. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  50554. }),
  50555. $globals.ClassTest);
  50556. $core.addMethod(
  50557. $core.method({
  50558. selector: "testMetaclassSubclasses",
  50559. protocol: "tests",
  50560. fn: function (){
  50561. var self=this;
  50562. var subclasses;
  50563. return $core.withContext(function($ctx1) {
  50564. var $4,$3,$2,$1;
  50565. $4=$recv($globals.Object)._class();
  50566. $ctx1.sendIdx["class"]=1;
  50567. $3=$recv($4)._instanceClass();
  50568. $2=$recv($3)._subclasses();
  50569. $ctx1.sendIdx["subclasses"]=1;
  50570. $1=$recv($2)._select_((function(each){
  50571. return $core.withContext(function($ctx2) {
  50572. return $recv($recv(each)._isMetaclass())._not();
  50573. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50574. }));
  50575. subclasses=$recv($1)._collect_((function(each){
  50576. return $core.withContext(function($ctx2) {
  50577. return $recv(each)._theMetaClass();
  50578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50579. }));
  50580. self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  50581. return self;
  50582. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  50583. },
  50584. args: [],
  50585. 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",
  50586. referencedClasses: ["Object"],
  50587. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  50588. }),
  50589. $globals.ClassTest);
  50590. $core.addMethod(
  50591. $core.method({
  50592. selector: "testSetJavaScriptConstructor",
  50593. protocol: "tests",
  50594. fn: function (){
  50595. var self=this;
  50596. var instance;
  50597. return $core.withContext(function($ctx1) {
  50598. var $2,$1,$4,$3,$6,$5,$8,$7;
  50599. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50600. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  50601. $2=$recv(self["@theClass"])._superclass();
  50602. $ctx1.sendIdx["superclass"]=1;
  50603. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  50604. $ctx1.sendIdx["=="]=1;
  50605. self._assert_($1);
  50606. $ctx1.sendIdx["assert:"]=1;
  50607. $4=$recv(self["@theClass"])._instanceVariableNames();
  50608. $ctx1.sendIdx["instanceVariableNames"]=1;
  50609. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  50610. $ctx1.sendIdx["=="]=2;
  50611. self._assert_($3);
  50612. $ctx1.sendIdx["assert:"]=2;
  50613. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  50614. $ctx1.sendIdx["assert:equals:"]=1;
  50615. $6=$recv(self["@theClass"])._package();
  50616. $ctx1.sendIdx["package"]=1;
  50617. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  50618. $ctx1.sendIdx["=="]=3;
  50619. self._assert_($5);
  50620. $ctx1.sendIdx["assert:"]=3;
  50621. $8=$recv(self["@theClass"])._methodDictionary();
  50622. $ctx1.sendIdx["methodDictionary"]=1;
  50623. $7=$recv($8)._keys();
  50624. $ctx1.sendIdx["keys"]=1;
  50625. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  50626. $ctx1.sendIdx["assert:equals:"]=2;
  50627. instance=$recv(self["@theClass"])._new();
  50628. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  50629. self._assert_equals_($recv(instance)._value(),(4));
  50630. $ctx1.sendIdx["assert:equals:"]=3;
  50631. self._shouldnt_raise_((function(){
  50632. return $core.withContext(function($ctx2) {
  50633. return $recv(instance)._foo_((9));
  50634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50635. }),$globals.Error);
  50636. self._assert_equals_($recv(instance)._foo(),(9));
  50637. return self;
  50638. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  50639. },
  50640. args: [],
  50641. 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",
  50642. referencedClasses: ["ObjectMock", "Error"],
  50643. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  50644. }),
  50645. $globals.ClassTest);
  50646. $core.addMethod(
  50647. $core.method({
  50648. selector: "testTrickySetJavaScriptConstructor",
  50649. protocol: "tests",
  50650. fn: function (){
  50651. var self=this;
  50652. var instance;
  50653. return $core.withContext(function($ctx1) {
  50654. var $2,$1,$4,$3,$6,$5,$8,$7;
  50655. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  50656. $recv(self["@theClass"])._javascriptConstructor_(self._trickyJsConstructor());
  50657. $2=$recv(self["@theClass"])._superclass();
  50658. $ctx1.sendIdx["superclass"]=1;
  50659. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  50660. $ctx1.sendIdx["=="]=1;
  50661. self._assert_($1);
  50662. $ctx1.sendIdx["assert:"]=1;
  50663. $4=$recv(self["@theClass"])._instanceVariableNames();
  50664. $ctx1.sendIdx["instanceVariableNames"]=1;
  50665. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  50666. $ctx1.sendIdx["=="]=2;
  50667. self._assert_($3);
  50668. $ctx1.sendIdx["assert:"]=2;
  50669. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  50670. $ctx1.sendIdx["assert:equals:"]=1;
  50671. $6=$recv(self["@theClass"])._package();
  50672. $ctx1.sendIdx["package"]=1;
  50673. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  50674. $ctx1.sendIdx["=="]=3;
  50675. self._assert_($5);
  50676. $ctx1.sendIdx["assert:"]=3;
  50677. $8=$recv(self["@theClass"])._methodDictionary();
  50678. $ctx1.sendIdx["methodDictionary"]=1;
  50679. $7=$recv($8)._keys();
  50680. $ctx1.sendIdx["keys"]=1;
  50681. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  50682. $ctx1.sendIdx["assert:equals:"]=2;
  50683. instance=$recv(self["@theClass"])._new();
  50684. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  50685. self._assert_equals_($recv(instance)._value(),(4));
  50686. $ctx1.sendIdx["assert:equals:"]=3;
  50687. self._shouldnt_raise_((function(){
  50688. return $core.withContext(function($ctx2) {
  50689. return $recv(instance)._foo_((9));
  50690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50691. }),$globals.Error);
  50692. self._assert_equals_($recv(instance)._foo(),(9));
  50693. return self;
  50694. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  50695. },
  50696. args: [],
  50697. 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",
  50698. referencedClasses: ["ObjectMock", "Error"],
  50699. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  50700. }),
  50701. $globals.ClassTest);
  50702. $core.addMethod(
  50703. $core.method({
  50704. selector: "trickyJsConstructor",
  50705. protocol: "running",
  50706. fn: function (){
  50707. var self=this;
  50708. return $core.withContext(function($ctx1) {
  50709. function Foo(){}
  50710. Foo.prototype.valueOf = function () {return 4;};
  50711. Foo.prototype._foo = function () {return "bar";};
  50712. return Foo;
  50713. ;
  50714. return self;
  50715. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  50716. },
  50717. args: [],
  50718. 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'>",
  50719. referencedClasses: [],
  50720. messageSends: []
  50721. }),
  50722. $globals.ClassTest);
  50723. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  50724. $core.addMethod(
  50725. $core.method({
  50726. selector: "assertSameContents:as:",
  50727. protocol: "convenience",
  50728. fn: function (aCollection,anotherCollection){
  50729. var self=this;
  50730. return $core.withContext(function($ctx1) {
  50731. var $2,$1,$4,$3;
  50732. $2=$recv(aCollection)._size();
  50733. $ctx1.sendIdx["size"]=1;
  50734. $1=$recv($2).__eq($recv(anotherCollection)._size());
  50735. $ctx1.sendIdx["="]=1;
  50736. self._assert_($1);
  50737. $ctx1.sendIdx["assert:"]=1;
  50738. $recv(aCollection)._do_((function(each){
  50739. return $core.withContext(function($ctx2) {
  50740. $4=$recv(aCollection)._occurrencesOf_(each);
  50741. $ctx2.sendIdx["occurrencesOf:"]=1;
  50742. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  50743. return self._assert_($3);
  50744. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50745. }));
  50746. return self;
  50747. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  50748. },
  50749. args: ["aCollection", "anotherCollection"],
  50750. 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)) ]",
  50751. referencedClasses: [],
  50752. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  50753. }),
  50754. $globals.CollectionTest);
  50755. $core.addMethod(
  50756. $core.method({
  50757. selector: "collection",
  50758. protocol: "fixture",
  50759. fn: function (){
  50760. var self=this;
  50761. return $core.withContext(function($ctx1) {
  50762. self._subclassResponsibility();
  50763. return self;
  50764. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  50765. },
  50766. args: [],
  50767. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  50768. referencedClasses: [],
  50769. messageSends: ["subclassResponsibility"]
  50770. }),
  50771. $globals.CollectionTest);
  50772. $core.addMethod(
  50773. $core.method({
  50774. selector: "collectionClass",
  50775. protocol: "fixture",
  50776. fn: function (){
  50777. var self=this;
  50778. return $core.withContext(function($ctx1) {
  50779. return $recv(self._class())._collectionClass();
  50780. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  50781. },
  50782. args: [],
  50783. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  50784. referencedClasses: [],
  50785. messageSends: ["collectionClass", "class"]
  50786. }),
  50787. $globals.CollectionTest);
  50788. $core.addMethod(
  50789. $core.method({
  50790. selector: "collectionOfPrintStrings",
  50791. protocol: "fixture",
  50792. fn: function (){
  50793. var self=this;
  50794. return $core.withContext(function($ctx1) {
  50795. self._subclassResponsibility();
  50796. return self;
  50797. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  50798. },
  50799. args: [],
  50800. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  50801. referencedClasses: [],
  50802. messageSends: ["subclassResponsibility"]
  50803. }),
  50804. $globals.CollectionTest);
  50805. $core.addMethod(
  50806. $core.method({
  50807. selector: "collectionSize",
  50808. protocol: "fixture",
  50809. fn: function (){
  50810. var self=this;
  50811. return $core.withContext(function($ctx1) {
  50812. self._subclassResponsibility();
  50813. return self;
  50814. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  50815. },
  50816. args: [],
  50817. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  50818. referencedClasses: [],
  50819. messageSends: ["subclassResponsibility"]
  50820. }),
  50821. $globals.CollectionTest);
  50822. $core.addMethod(
  50823. $core.method({
  50824. selector: "collectionWithDuplicates",
  50825. protocol: "fixture",
  50826. fn: function (){
  50827. var self=this;
  50828. return $core.withContext(function($ctx1) {
  50829. self._subclassResponsibility();
  50830. return self;
  50831. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  50832. },
  50833. args: [],
  50834. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  50835. referencedClasses: [],
  50836. messageSends: ["subclassResponsibility"]
  50837. }),
  50838. $globals.CollectionTest);
  50839. $core.addMethod(
  50840. $core.method({
  50841. selector: "collectionWithNewValue",
  50842. protocol: "fixture",
  50843. fn: function (){
  50844. var self=this;
  50845. return $core.withContext(function($ctx1) {
  50846. self._subclassResponsibility();
  50847. return self;
  50848. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  50849. },
  50850. args: [],
  50851. 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",
  50852. referencedClasses: [],
  50853. messageSends: ["subclassResponsibility"]
  50854. }),
  50855. $globals.CollectionTest);
  50856. $core.addMethod(
  50857. $core.method({
  50858. selector: "initialize",
  50859. protocol: "initialization",
  50860. fn: function (){
  50861. var self=this;
  50862. return $core.withContext(function($ctx1) {
  50863. (
  50864. $ctx1.supercall = true,
  50865. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  50866. $ctx1.supercall = false;
  50867. self["@sampleBlock"]=(function(){
  50868. });
  50869. return self;
  50870. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  50871. },
  50872. args: [],
  50873. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  50874. referencedClasses: [],
  50875. messageSends: ["initialize"]
  50876. }),
  50877. $globals.CollectionTest);
  50878. $core.addMethod(
  50879. $core.method({
  50880. selector: "isCollectionReadOnly",
  50881. protocol: "testing",
  50882. fn: function (){
  50883. var self=this;
  50884. return false;
  50885. },
  50886. args: [],
  50887. source: "isCollectionReadOnly\x0a\x09^ false",
  50888. referencedClasses: [],
  50889. messageSends: []
  50890. }),
  50891. $globals.CollectionTest);
  50892. $core.addMethod(
  50893. $core.method({
  50894. selector: "sampleNewValue",
  50895. protocol: "fixture",
  50896. fn: function (){
  50897. var self=this;
  50898. return "N";
  50899. },
  50900. args: [],
  50901. 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'",
  50902. referencedClasses: [],
  50903. messageSends: []
  50904. }),
  50905. $globals.CollectionTest);
  50906. $core.addMethod(
  50907. $core.method({
  50908. selector: "sampleNewValueAsCollection",
  50909. protocol: "fixture",
  50910. fn: function (){
  50911. var self=this;
  50912. return $core.withContext(function($ctx1) {
  50913. return $recv(self._collectionClass())._with_(self._sampleNewValue());
  50914. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  50915. },
  50916. args: [],
  50917. 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",
  50918. referencedClasses: [],
  50919. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  50920. }),
  50921. $globals.CollectionTest);
  50922. $core.addMethod(
  50923. $core.method({
  50924. selector: "testAddAll",
  50925. protocol: "tests",
  50926. fn: function (){
  50927. var self=this;
  50928. return $core.withContext(function($ctx1) {
  50929. 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;
  50930. $2=self._collection();
  50931. $ctx1.sendIdx["collection"]=1;
  50932. $4=self._collectionClass();
  50933. $ctx1.sendIdx["collectionClass"]=1;
  50934. $3=$recv($4)._new();
  50935. $ctx1.sendIdx["new"]=1;
  50936. $recv($2)._addAll_($3);
  50937. $ctx1.sendIdx["addAll:"]=1;
  50938. $5=$recv($2)._yourself();
  50939. $ctx1.sendIdx["yourself"]=1;
  50940. $1=$5;
  50941. $6=self._collection();
  50942. $ctx1.sendIdx["collection"]=2;
  50943. self._assert_equals_($1,$6);
  50944. $ctx1.sendIdx["assert:equals:"]=1;
  50945. $9=self._collectionClass();
  50946. $ctx1.sendIdx["collectionClass"]=2;
  50947. $8=$recv($9)._new();
  50948. $ctx1.sendIdx["new"]=2;
  50949. $10=self._collection();
  50950. $ctx1.sendIdx["collection"]=3;
  50951. $recv($8)._addAll_($10);
  50952. $ctx1.sendIdx["addAll:"]=2;
  50953. $11=$recv($8)._yourself();
  50954. $ctx1.sendIdx["yourself"]=2;
  50955. $7=$11;
  50956. $12=self._collection();
  50957. $ctx1.sendIdx["collection"]=4;
  50958. self._assert_equals_($7,$12);
  50959. $ctx1.sendIdx["assert:equals:"]=2;
  50960. $15=self._collectionClass();
  50961. $ctx1.sendIdx["collectionClass"]=3;
  50962. $14=$recv($15)._new();
  50963. $ctx1.sendIdx["new"]=3;
  50964. $17=self._collectionClass();
  50965. $ctx1.sendIdx["collectionClass"]=4;
  50966. $16=$recv($17)._new();
  50967. $ctx1.sendIdx["new"]=4;
  50968. $recv($14)._addAll_($16);
  50969. $ctx1.sendIdx["addAll:"]=3;
  50970. $18=$recv($14)._yourself();
  50971. $ctx1.sendIdx["yourself"]=3;
  50972. $13=$18;
  50973. self._assert_equals_($13,$recv(self._collectionClass())._new());
  50974. $ctx1.sendIdx["assert:equals:"]=3;
  50975. $20=self._collection();
  50976. $ctx1.sendIdx["collection"]=5;
  50977. $21=self._sampleNewValueAsCollection();
  50978. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  50979. $recv($20)._addAll_($21);
  50980. $ctx1.sendIdx["addAll:"]=4;
  50981. $22=$recv($20)._yourself();
  50982. $ctx1.sendIdx["yourself"]=4;
  50983. $19=$22;
  50984. $23=self._collectionWithNewValue();
  50985. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50986. self._assert_equals_($19,$23);
  50987. $25=self._sampleNewValueAsCollection();
  50988. $recv($25)._addAll_(self._collection());
  50989. $24=$recv($25)._yourself();
  50990. self._assertSameContents_as_($24,self._collectionWithNewValue());
  50991. return self;
  50992. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  50993. },
  50994. args: [],
  50995. 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",
  50996. referencedClasses: [],
  50997. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50998. }),
  50999. $globals.CollectionTest);
  51000. $core.addMethod(
  51001. $core.method({
  51002. selector: "testAllSatisfy",
  51003. protocol: "tests",
  51004. fn: function (){
  51005. var self=this;
  51006. var collection,anyOne;
  51007. return $core.withContext(function($ctx1) {
  51008. var $1;
  51009. collection=self._collection();
  51010. anyOne=$recv(collection)._anyOne();
  51011. $1=$recv(collection)._allSatisfy_((function(each){
  51012. return $core.withContext(function($ctx2) {
  51013. return $recv(collection)._includes_(each);
  51014. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51015. }));
  51016. $ctx1.sendIdx["allSatisfy:"]=1;
  51017. self._assert_($1);
  51018. self._deny_($recv(collection)._allSatisfy_((function(each){
  51019. return $core.withContext(function($ctx2) {
  51020. return $recv(each).__tild_eq(anyOne);
  51021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51022. })));
  51023. return self;
  51024. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  51025. },
  51026. args: [],
  51027. 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 ])",
  51028. referencedClasses: [],
  51029. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  51030. }),
  51031. $globals.CollectionTest);
  51032. $core.addMethod(
  51033. $core.method({
  51034. selector: "testAnyOne",
  51035. protocol: "tests",
  51036. fn: function (){
  51037. var self=this;
  51038. return $core.withContext(function($ctx1) {
  51039. var $2,$1;
  51040. self._should_raise_((function(){
  51041. return $core.withContext(function($ctx2) {
  51042. return $recv($recv(self._collectionClass())._new())._anyOne();
  51043. $ctx2.sendIdx["anyOne"]=1;
  51044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51045. }),$globals.Error);
  51046. $2=self._collection();
  51047. $ctx1.sendIdx["collection"]=1;
  51048. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  51049. self._assert_($1);
  51050. return self;
  51051. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  51052. },
  51053. args: [],
  51054. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  51055. referencedClasses: ["Error"],
  51056. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  51057. }),
  51058. $globals.CollectionTest);
  51059. $core.addMethod(
  51060. $core.method({
  51061. selector: "testAnySatisfy",
  51062. protocol: "tests",
  51063. fn: function (){
  51064. var self=this;
  51065. var anyOne;
  51066. return $core.withContext(function($ctx1) {
  51067. var $1,$3,$2;
  51068. $1=self._collection();
  51069. $ctx1.sendIdx["collection"]=1;
  51070. anyOne=$recv($1)._anyOne();
  51071. $3=self._collection();
  51072. $ctx1.sendIdx["collection"]=2;
  51073. $2=$recv($3)._anySatisfy_((function(each){
  51074. return $core.withContext(function($ctx2) {
  51075. return $recv(each).__eq(anyOne);
  51076. $ctx2.sendIdx["="]=1;
  51077. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51078. }));
  51079. $ctx1.sendIdx["anySatisfy:"]=1;
  51080. self._assert_($2);
  51081. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  51082. return $core.withContext(function($ctx2) {
  51083. return $recv(each).__eq($recv($globals.Object)._new());
  51084. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51085. })));
  51086. return self;
  51087. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  51088. },
  51089. args: [],
  51090. 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 ])",
  51091. referencedClasses: ["Object"],
  51092. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  51093. }),
  51094. $globals.CollectionTest);
  51095. $core.addMethod(
  51096. $core.method({
  51097. selector: "testAsArray",
  51098. protocol: "tests",
  51099. fn: function (){
  51100. var self=this;
  51101. return $core.withContext(function($ctx1) {
  51102. var $1;
  51103. $1=self._collection();
  51104. $ctx1.sendIdx["collection"]=1;
  51105. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  51106. return self;
  51107. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  51108. },
  51109. args: [],
  51110. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  51111. referencedClasses: [],
  51112. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  51113. }),
  51114. $globals.CollectionTest);
  51115. $core.addMethod(
  51116. $core.method({
  51117. selector: "testAsOrderedCollection",
  51118. protocol: "tests",
  51119. fn: function (){
  51120. var self=this;
  51121. return $core.withContext(function($ctx1) {
  51122. var $1;
  51123. $1=self._collection();
  51124. $ctx1.sendIdx["collection"]=1;
  51125. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  51126. return self;
  51127. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  51128. },
  51129. args: [],
  51130. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  51131. referencedClasses: [],
  51132. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  51133. }),
  51134. $globals.CollectionTest);
  51135. $core.addMethod(
  51136. $core.method({
  51137. selector: "testAsSet",
  51138. protocol: "tests",
  51139. fn: function (){
  51140. var self=this;
  51141. var c,set;
  51142. return $core.withContext(function($ctx1) {
  51143. c=self._collectionWithDuplicates();
  51144. set=$recv(c)._asSet();
  51145. self._assert_equals_($recv(set)._size(),(6));
  51146. $recv(c)._do_((function(each){
  51147. return $core.withContext(function($ctx2) {
  51148. return self._assert_($recv(set)._includes_(each));
  51149. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51150. }));
  51151. return self;
  51152. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  51153. },
  51154. args: [],
  51155. 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) ]",
  51156. referencedClasses: [],
  51157. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  51158. }),
  51159. $globals.CollectionTest);
  51160. $core.addMethod(
  51161. $core.method({
  51162. selector: "testCollect",
  51163. protocol: "tests",
  51164. fn: function (){
  51165. var self=this;
  51166. return $core.withContext(function($ctx1) {
  51167. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  51168. $2=self._collection();
  51169. $ctx1.sendIdx["collection"]=1;
  51170. $1=$recv($2)._collect_((function(each){
  51171. return each;
  51172. }));
  51173. $ctx1.sendIdx["collect:"]=1;
  51174. $3=self._collection();
  51175. $ctx1.sendIdx["collection"]=2;
  51176. self._assert_equals_($1,$3);
  51177. $ctx1.sendIdx["assert:equals:"]=1;
  51178. $5=self._collectionWithNewValue();
  51179. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51180. $4=$recv($5)._collect_((function(each){
  51181. return each;
  51182. }));
  51183. $ctx1.sendIdx["collect:"]=2;
  51184. self._assert_equals_($4,self._collectionWithNewValue());
  51185. $ctx1.sendIdx["assert:equals:"]=2;
  51186. $8=self._collectionClass();
  51187. $ctx1.sendIdx["collectionClass"]=1;
  51188. $7=$recv($8)._new();
  51189. $ctx1.sendIdx["new"]=1;
  51190. $6=$recv($7)._collect_((function(each){
  51191. return $core.withContext(function($ctx2) {
  51192. return $recv(each)._printString();
  51193. $ctx2.sendIdx["printString"]=1;
  51194. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  51195. }));
  51196. $ctx1.sendIdx["collect:"]=3;
  51197. self._assert_equals_($6,$recv(self._collectionClass())._new());
  51198. $ctx1.sendIdx["assert:equals:"]=3;
  51199. $11=self._collection();
  51200. $ctx1.sendIdx["collection"]=3;
  51201. $10=$recv($11)._collect_((function(){
  51202. return $core.withContext(function($ctx2) {
  51203. return self._sampleNewValue();
  51204. $ctx2.sendIdx["sampleNewValue"]=1;
  51205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  51206. }));
  51207. $ctx1.sendIdx["collect:"]=4;
  51208. $9=$recv($10)._detect_((function(){
  51209. return true;
  51210. }));
  51211. self._assert_equals_($9,self._sampleNewValue());
  51212. $ctx1.sendIdx["assert:equals:"]=4;
  51213. self._assert_equals_($recv(self._collection())._collect_((function(each){
  51214. return $core.withContext(function($ctx2) {
  51215. return $recv(each)._printString();
  51216. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51217. })),self._collectionOfPrintStrings());
  51218. return self;
  51219. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  51220. },
  51221. args: [],
  51222. 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",
  51223. referencedClasses: [],
  51224. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  51225. }),
  51226. $globals.CollectionTest);
  51227. $core.addMethod(
  51228. $core.method({
  51229. selector: "testComma",
  51230. protocol: "tests",
  51231. fn: function (){
  51232. var self=this;
  51233. return $core.withContext(function($ctx1) {
  51234. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  51235. $2=self._collection();
  51236. $ctx1.sendIdx["collection"]=1;
  51237. $4=self._collectionClass();
  51238. $ctx1.sendIdx["collectionClass"]=1;
  51239. $3=$recv($4)._new();
  51240. $ctx1.sendIdx["new"]=1;
  51241. $1=$recv($2).__comma($3);
  51242. $ctx1.sendIdx[","]=1;
  51243. $5=self._collection();
  51244. $ctx1.sendIdx["collection"]=2;
  51245. self._assert_equals_($1,$5);
  51246. $ctx1.sendIdx["assert:equals:"]=1;
  51247. $8=self._collectionClass();
  51248. $ctx1.sendIdx["collectionClass"]=2;
  51249. $7=$recv($8)._new();
  51250. $ctx1.sendIdx["new"]=2;
  51251. $9=self._collection();
  51252. $ctx1.sendIdx["collection"]=3;
  51253. $6=$recv($7).__comma($9);
  51254. $ctx1.sendIdx[","]=2;
  51255. $10=self._collection();
  51256. $ctx1.sendIdx["collection"]=4;
  51257. self._assert_equals_($6,$10);
  51258. $ctx1.sendIdx["assert:equals:"]=2;
  51259. $13=self._collectionClass();
  51260. $ctx1.sendIdx["collectionClass"]=3;
  51261. $12=$recv($13)._new();
  51262. $ctx1.sendIdx["new"]=3;
  51263. $15=self._collectionClass();
  51264. $ctx1.sendIdx["collectionClass"]=4;
  51265. $14=$recv($15)._new();
  51266. $ctx1.sendIdx["new"]=4;
  51267. $11=$recv($12).__comma($14);
  51268. $ctx1.sendIdx[","]=3;
  51269. self._assert_equals_($11,$recv(self._collectionClass())._new());
  51270. $ctx1.sendIdx["assert:equals:"]=3;
  51271. $17=self._collection();
  51272. $ctx1.sendIdx["collection"]=5;
  51273. $18=self._sampleNewValueAsCollection();
  51274. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  51275. $16=$recv($17).__comma($18);
  51276. $ctx1.sendIdx[","]=4;
  51277. $19=self._collectionWithNewValue();
  51278. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51279. self._assert_equals_($16,$19);
  51280. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  51281. return self;
  51282. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  51283. },
  51284. args: [],
  51285. 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",
  51286. referencedClasses: [],
  51287. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  51288. }),
  51289. $globals.CollectionTest);
  51290. $core.addMethod(
  51291. $core.method({
  51292. selector: "testCopy",
  51293. protocol: "tests",
  51294. fn: function (){
  51295. var self=this;
  51296. return $core.withContext(function($ctx1) {
  51297. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  51298. $3=self._collectionClass();
  51299. $ctx1.sendIdx["collectionClass"]=1;
  51300. $2=$recv($3)._new();
  51301. $ctx1.sendIdx["new"]=1;
  51302. $1=$recv($2)._copy();
  51303. $ctx1.sendIdx["copy"]=1;
  51304. $5=self._collectionClass();
  51305. $ctx1.sendIdx["collectionClass"]=2;
  51306. $4=$recv($5)._new();
  51307. $ctx1.sendIdx["new"]=2;
  51308. self._assert_equals_($1,$4);
  51309. $ctx1.sendIdx["assert:equals:"]=1;
  51310. $7=self._collection();
  51311. $ctx1.sendIdx["collection"]=1;
  51312. $6=$recv($7)._copy();
  51313. $ctx1.sendIdx["copy"]=2;
  51314. $8=self._collection();
  51315. $ctx1.sendIdx["collection"]=2;
  51316. self._assert_equals_($6,$8);
  51317. $ctx1.sendIdx["assert:equals:"]=2;
  51318. $10=self._collectionWithNewValue();
  51319. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51320. $9=$recv($10)._copy();
  51321. $ctx1.sendIdx["copy"]=3;
  51322. $11=self._collectionWithNewValue();
  51323. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51324. self._assert_equals_($9,$11);
  51325. $15=self._collectionClass();
  51326. $ctx1.sendIdx["collectionClass"]=3;
  51327. $14=$recv($15)._new();
  51328. $ctx1.sendIdx["new"]=3;
  51329. $13=$recv($14)._copy();
  51330. $ctx1.sendIdx["copy"]=4;
  51331. $16=self._collection();
  51332. $ctx1.sendIdx["collection"]=3;
  51333. $12=$recv($13).__eq($16);
  51334. $ctx1.sendIdx["="]=1;
  51335. self._deny_($12);
  51336. $ctx1.sendIdx["deny:"]=1;
  51337. $19=self._collection();
  51338. $ctx1.sendIdx["collection"]=4;
  51339. $18=$recv($19)._copy();
  51340. $ctx1.sendIdx["copy"]=5;
  51341. $17=$recv($18).__eq($recv(self._collectionClass())._new());
  51342. $ctx1.sendIdx["="]=2;
  51343. self._deny_($17);
  51344. $ctx1.sendIdx["deny:"]=2;
  51345. self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
  51346. return self;
  51347. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  51348. },
  51349. args: [],
  51350. 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",
  51351. referencedClasses: [],
  51352. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  51353. }),
  51354. $globals.CollectionTest);
  51355. $core.addMethod(
  51356. $core.method({
  51357. selector: "testCopySeparates",
  51358. protocol: "tests",
  51359. fn: function (){
  51360. var self=this;
  51361. var original,copy;
  51362. return $core.withContext(function($ctx1) {
  51363. original=self._collection();
  51364. $ctx1.sendIdx["collection"]=1;
  51365. copy=$recv(original)._copy();
  51366. $recv(copy)._addAll_(self._sampleNewValueAsCollection());
  51367. self._assert_($recv(original).__eq(self._collection()));
  51368. return self;
  51369. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  51370. },
  51371. args: [],
  51372. 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",
  51373. referencedClasses: [],
  51374. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  51375. }),
  51376. $globals.CollectionTest);
  51377. $core.addMethod(
  51378. $core.method({
  51379. selector: "testDetect",
  51380. protocol: "tests",
  51381. fn: function (){
  51382. var self=this;
  51383. return $core.withContext(function($ctx1) {
  51384. var $1,$2,$3,$4,$6,$5,$7;
  51385. self._shouldnt_raise_((function(){
  51386. return $core.withContext(function($ctx2) {
  51387. $1=self._collection();
  51388. $ctx2.sendIdx["collection"]=1;
  51389. return $recv($1)._detect_((function(){
  51390. return true;
  51391. }));
  51392. $ctx2.sendIdx["detect:"]=1;
  51393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51394. }),$globals.Error);
  51395. self._should_raise_((function(){
  51396. return $core.withContext(function($ctx2) {
  51397. $2=self._collection();
  51398. $ctx2.sendIdx["collection"]=2;
  51399. return $recv($2)._detect_((function(){
  51400. return false;
  51401. }));
  51402. $ctx2.sendIdx["detect:"]=2;
  51403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51404. }),$globals.Error);
  51405. $ctx1.sendIdx["should:raise:"]=1;
  51406. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  51407. return true;
  51408. }));
  51409. $ctx1.sendIdx["detect:"]=3;
  51410. $4=self._sampleNewValue();
  51411. $ctx1.sendIdx["sampleNewValue"]=1;
  51412. self._assert_equals_($3,$4);
  51413. $ctx1.sendIdx["assert:equals:"]=1;
  51414. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  51415. return $core.withContext(function($ctx2) {
  51416. $6=self._sampleNewValue();
  51417. $ctx2.sendIdx["sampleNewValue"]=2;
  51418. return $recv(each).__eq($6);
  51419. $ctx2.sendIdx["="]=1;
  51420. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51421. }));
  51422. $ctx1.sendIdx["detect:"]=4;
  51423. $7=self._sampleNewValue();
  51424. $ctx1.sendIdx["sampleNewValue"]=3;
  51425. self._assert_equals_($5,$7);
  51426. self._should_raise_((function(){
  51427. return $core.withContext(function($ctx2) {
  51428. return $recv(self._collection())._detect_((function(each){
  51429. return $core.withContext(function($ctx3) {
  51430. return $recv(each).__eq(self._sampleNewValue());
  51431. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  51432. }));
  51433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  51434. }),$globals.Error);
  51435. return self;
  51436. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  51437. },
  51438. args: [],
  51439. 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",
  51440. referencedClasses: ["Error"],
  51441. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  51442. }),
  51443. $globals.CollectionTest);
  51444. $core.addMethod(
  51445. $core.method({
  51446. selector: "testDetectIfNone",
  51447. protocol: "tests",
  51448. fn: function (){
  51449. var self=this;
  51450. var sentinel;
  51451. return $core.withContext(function($ctx1) {
  51452. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  51453. sentinel=$recv($globals.Object)._new();
  51454. $3=self._collection();
  51455. $ctx1.sendIdx["collection"]=1;
  51456. $2=$recv($3)._detect_ifNone_((function(){
  51457. return true;
  51458. }),(function(){
  51459. return sentinel;
  51460. }));
  51461. $ctx1.sendIdx["detect:ifNone:"]=1;
  51462. $1=$recv($2).__tild_eq(sentinel);
  51463. self._assert_($1);
  51464. $5=self._collection();
  51465. $ctx1.sendIdx["collection"]=2;
  51466. $4=$recv($5)._detect_ifNone_((function(){
  51467. return false;
  51468. }),(function(){
  51469. return sentinel;
  51470. }));
  51471. $ctx1.sendIdx["detect:ifNone:"]=2;
  51472. self._assert_equals_($4,sentinel);
  51473. $ctx1.sendIdx["assert:equals:"]=1;
  51474. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  51475. return true;
  51476. }),(function(){
  51477. return sentinel;
  51478. }));
  51479. $ctx1.sendIdx["detect:ifNone:"]=3;
  51480. $7=self._sampleNewValue();
  51481. $ctx1.sendIdx["sampleNewValue"]=1;
  51482. self._assert_equals_($6,$7);
  51483. $ctx1.sendIdx["assert:equals:"]=2;
  51484. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  51485. return $core.withContext(function($ctx2) {
  51486. $9=self._sampleNewValue();
  51487. $ctx2.sendIdx["sampleNewValue"]=2;
  51488. return $recv(each).__eq($9);
  51489. $ctx2.sendIdx["="]=1;
  51490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  51491. }),(function(){
  51492. return sentinel;
  51493. }));
  51494. $ctx1.sendIdx["detect:ifNone:"]=4;
  51495. $10=self._sampleNewValue();
  51496. $ctx1.sendIdx["sampleNewValue"]=3;
  51497. self._assert_equals_($8,$10);
  51498. $ctx1.sendIdx["assert:equals:"]=3;
  51499. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  51500. return $core.withContext(function($ctx2) {
  51501. return $recv(each).__eq(self._sampleNewValue());
  51502. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  51503. }),(function(){
  51504. return sentinel;
  51505. })),sentinel);
  51506. return self;
  51507. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  51508. },
  51509. args: [],
  51510. 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",
  51511. referencedClasses: ["Object"],
  51512. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  51513. }),
  51514. $globals.CollectionTest);
  51515. $core.addMethod(
  51516. $core.method({
  51517. selector: "testDo",
  51518. protocol: "tests",
  51519. fn: function (){
  51520. var self=this;
  51521. var newCollection;
  51522. return $core.withContext(function($ctx1) {
  51523. var $1,$2;
  51524. newCollection=$recv($globals.OrderedCollection)._new();
  51525. $ctx1.sendIdx["new"]=1;
  51526. $1=self._collection();
  51527. $ctx1.sendIdx["collection"]=1;
  51528. $recv($1)._do_((function(each){
  51529. return $core.withContext(function($ctx2) {
  51530. return $recv(newCollection)._add_(each);
  51531. $ctx2.sendIdx["add:"]=1;
  51532. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51533. }));
  51534. $ctx1.sendIdx["do:"]=1;
  51535. self._assertSameContents_as_(self._collection(),newCollection);
  51536. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51537. newCollection=$recv($globals.OrderedCollection)._new();
  51538. $2=self._collectionWithDuplicates();
  51539. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  51540. $recv($2)._do_((function(each){
  51541. return $core.withContext(function($ctx2) {
  51542. return $recv(newCollection)._add_(each);
  51543. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51544. }));
  51545. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  51546. return self;
  51547. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  51548. },
  51549. args: [],
  51550. 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",
  51551. referencedClasses: ["OrderedCollection"],
  51552. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  51553. }),
  51554. $globals.CollectionTest);
  51555. $core.addMethod(
  51556. $core.method({
  51557. selector: "testEquality",
  51558. protocol: "tests",
  51559. fn: function (){
  51560. var self=this;
  51561. return $core.withContext(function($ctx1) {
  51562. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  51563. $2=self._collectionClass();
  51564. $ctx1.sendIdx["collectionClass"]=1;
  51565. $1=$recv($2)._new();
  51566. $ctx1.sendIdx["new"]=1;
  51567. $4=self._collectionClass();
  51568. $ctx1.sendIdx["collectionClass"]=2;
  51569. $3=$recv($4)._new();
  51570. $ctx1.sendIdx["new"]=2;
  51571. self._assert_equals_($1,$3);
  51572. $ctx1.sendIdx["assert:equals:"]=1;
  51573. $5=self._collection();
  51574. $ctx1.sendIdx["collection"]=1;
  51575. $6=self._collection();
  51576. $ctx1.sendIdx["collection"]=2;
  51577. self._assert_equals_($5,$6);
  51578. $ctx1.sendIdx["assert:equals:"]=2;
  51579. $7=self._collectionWithNewValue();
  51580. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51581. $8=self._collectionWithNewValue();
  51582. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51583. self._assert_equals_($7,$8);
  51584. $11=self._collectionClass();
  51585. $ctx1.sendIdx["collectionClass"]=3;
  51586. $10=$recv($11)._new();
  51587. $ctx1.sendIdx["new"]=3;
  51588. $12=self._collection();
  51589. $ctx1.sendIdx["collection"]=3;
  51590. $9=$recv($10).__eq($12);
  51591. $ctx1.sendIdx["="]=1;
  51592. self._deny_($9);
  51593. $ctx1.sendIdx["deny:"]=1;
  51594. $14=self._collection();
  51595. $ctx1.sendIdx["collection"]=4;
  51596. $13=$recv($14).__eq($recv(self._collectionClass())._new());
  51597. $ctx1.sendIdx["="]=2;
  51598. self._deny_($13);
  51599. $ctx1.sendIdx["deny:"]=2;
  51600. self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
  51601. return self;
  51602. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  51603. },
  51604. args: [],
  51605. 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",
  51606. referencedClasses: [],
  51607. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  51608. }),
  51609. $globals.CollectionTest);
  51610. $core.addMethod(
  51611. $core.method({
  51612. selector: "testIfEmptyFamily",
  51613. protocol: "tests",
  51614. fn: function (){
  51615. var self=this;
  51616. return $core.withContext(function($ctx1) {
  51617. 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;
  51618. $3=self._collectionClass();
  51619. $ctx1.sendIdx["collectionClass"]=1;
  51620. $2=$recv($3)._new();
  51621. $ctx1.sendIdx["new"]=1;
  51622. $1=$recv($2)._ifEmpty_((function(){
  51623. return (42);
  51624. }));
  51625. $ctx1.sendIdx["ifEmpty:"]=1;
  51626. self._assert_equals_($1,(42));
  51627. $ctx1.sendIdx["assert:equals:"]=1;
  51628. $5=self._collection();
  51629. $ctx1.sendIdx["collection"]=1;
  51630. $4=$recv($5)._ifEmpty_((function(){
  51631. return (42);
  51632. }));
  51633. $6=self._collection();
  51634. $ctx1.sendIdx["collection"]=2;
  51635. self._assert_equals_($4,$6);
  51636. $ctx1.sendIdx["assert:equals:"]=2;
  51637. $9=self._collectionClass();
  51638. $ctx1.sendIdx["collectionClass"]=2;
  51639. $8=$recv($9)._new();
  51640. $ctx1.sendIdx["new"]=2;
  51641. $7=$recv($8)._ifNotEmpty_((function(){
  51642. return (42);
  51643. }));
  51644. $ctx1.sendIdx["ifNotEmpty:"]=1;
  51645. $11=self._collectionClass();
  51646. $ctx1.sendIdx["collectionClass"]=3;
  51647. $10=$recv($11)._new();
  51648. $ctx1.sendIdx["new"]=3;
  51649. self._assert_equals_($7,$10);
  51650. $ctx1.sendIdx["assert:equals:"]=3;
  51651. $13=self._collection();
  51652. $ctx1.sendIdx["collection"]=3;
  51653. $12=$recv($13)._ifNotEmpty_((function(){
  51654. return (42);
  51655. }));
  51656. $ctx1.sendIdx["ifNotEmpty:"]=2;
  51657. self._assert_equals_($12,(42));
  51658. $ctx1.sendIdx["assert:equals:"]=4;
  51659. $15=self._collection();
  51660. $ctx1.sendIdx["collection"]=4;
  51661. $14=$recv($15)._ifNotEmpty_((function(col){
  51662. return col;
  51663. }));
  51664. $16=self._collection();
  51665. $ctx1.sendIdx["collection"]=5;
  51666. self._assert_equals_($14,$16);
  51667. $ctx1.sendIdx["assert:equals:"]=5;
  51668. $19=self._collectionClass();
  51669. $ctx1.sendIdx["collectionClass"]=4;
  51670. $18=$recv($19)._new();
  51671. $ctx1.sendIdx["new"]=4;
  51672. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  51673. return (42);
  51674. }),(function(){
  51675. return (999);
  51676. }));
  51677. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  51678. self._assert_equals_($17,(42));
  51679. $ctx1.sendIdx["assert:equals:"]=6;
  51680. $21=self._collection();
  51681. $ctx1.sendIdx["collection"]=6;
  51682. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  51683. return (42);
  51684. }),(function(){
  51685. return (999);
  51686. }));
  51687. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  51688. self._assert_equals_($20,(999));
  51689. $ctx1.sendIdx["assert:equals:"]=7;
  51690. $23=self._collection();
  51691. $ctx1.sendIdx["collection"]=7;
  51692. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  51693. return (42);
  51694. }),(function(col){
  51695. return col;
  51696. }));
  51697. $24=self._collection();
  51698. $ctx1.sendIdx["collection"]=8;
  51699. self._assert_equals_($22,$24);
  51700. $ctx1.sendIdx["assert:equals:"]=8;
  51701. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  51702. return (42);
  51703. }),(function(){
  51704. return (999);
  51705. }));
  51706. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  51707. self._assert_equals_($25,(999));
  51708. $ctx1.sendIdx["assert:equals:"]=9;
  51709. $27=self._collection();
  51710. $ctx1.sendIdx["collection"]=9;
  51711. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  51712. return (42);
  51713. }),(function(){
  51714. return (999);
  51715. }));
  51716. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  51717. self._assert_equals_($26,(42));
  51718. $ctx1.sendIdx["assert:equals:"]=10;
  51719. $29=self._collection();
  51720. $ctx1.sendIdx["collection"]=10;
  51721. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  51722. return col;
  51723. }),(function(){
  51724. return (999);
  51725. }));
  51726. self._assert_equals_($28,self._collection());
  51727. return self;
  51728. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  51729. },
  51730. args: [],
  51731. 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.",
  51732. referencedClasses: [],
  51733. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  51734. }),
  51735. $globals.CollectionTest);
  51736. $core.addMethod(
  51737. $core.method({
  51738. selector: "testIsEmpty",
  51739. protocol: "tests",
  51740. fn: function (){
  51741. var self=this;
  51742. return $core.withContext(function($ctx1) {
  51743. var $1;
  51744. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  51745. $ctx1.sendIdx["isEmpty"]=1;
  51746. self._assert_($1);
  51747. self._deny_($recv(self._collection())._isEmpty());
  51748. return self;
  51749. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  51750. },
  51751. args: [],
  51752. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  51753. referencedClasses: [],
  51754. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  51755. }),
  51756. $globals.CollectionTest);
  51757. $core.addMethod(
  51758. $core.method({
  51759. selector: "testNoneSatisfy",
  51760. protocol: "tests",
  51761. fn: function (){
  51762. var self=this;
  51763. var anyOne;
  51764. return $core.withContext(function($ctx1) {
  51765. var $1,$3,$2;
  51766. $1=self._collection();
  51767. $ctx1.sendIdx["collection"]=1;
  51768. anyOne=$recv($1)._anyOne();
  51769. $3=self._collection();
  51770. $ctx1.sendIdx["collection"]=2;
  51771. $2=$recv($3)._noneSatisfy_((function(each){
  51772. return $core.withContext(function($ctx2) {
  51773. return $recv(each).__eq(anyOne);
  51774. $ctx2.sendIdx["="]=1;
  51775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51776. }));
  51777. $ctx1.sendIdx["noneSatisfy:"]=1;
  51778. self._deny_($2);
  51779. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  51780. return $core.withContext(function($ctx2) {
  51781. return $recv(each).__eq($recv($globals.Object)._new());
  51782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51783. })));
  51784. return self;
  51785. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  51786. },
  51787. args: [],
  51788. 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 ])",
  51789. referencedClasses: ["Object"],
  51790. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  51791. }),
  51792. $globals.CollectionTest);
  51793. $core.addMethod(
  51794. $core.method({
  51795. selector: "testRemoveAll",
  51796. protocol: "tests",
  51797. fn: function (){
  51798. var self=this;
  51799. return $core.withContext(function($ctx1) {
  51800. var $2,$1;
  51801. $2=self._collection();
  51802. $recv($2)._removeAll();
  51803. $1=$recv($2)._yourself();
  51804. self._assert_equals_($1,$recv(self._collectionClass())._new());
  51805. return self;
  51806. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  51807. },
  51808. args: [],
  51809. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  51810. referencedClasses: [],
  51811. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  51812. }),
  51813. $globals.CollectionTest);
  51814. $core.addMethod(
  51815. $core.method({
  51816. selector: "testSelect",
  51817. protocol: "tests",
  51818. fn: function (){
  51819. var self=this;
  51820. return $core.withContext(function($ctx1) {
  51821. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  51822. $2=self._collection();
  51823. $ctx1.sendIdx["collection"]=1;
  51824. $1=$recv($2)._select_((function(){
  51825. return false;
  51826. }));
  51827. $ctx1.sendIdx["select:"]=1;
  51828. $4=self._collectionClass();
  51829. $ctx1.sendIdx["collectionClass"]=1;
  51830. $3=$recv($4)._new();
  51831. $ctx1.sendIdx["new"]=1;
  51832. self._assert_equals_($1,$3);
  51833. $ctx1.sendIdx["assert:equals:"]=1;
  51834. $6=self._collection();
  51835. $ctx1.sendIdx["collection"]=2;
  51836. $5=$recv($6)._select_((function(){
  51837. return true;
  51838. }));
  51839. $ctx1.sendIdx["select:"]=2;
  51840. $7=self._collection();
  51841. $ctx1.sendIdx["collection"]=3;
  51842. self._assert_equals_($5,$7);
  51843. $ctx1.sendIdx["assert:equals:"]=2;
  51844. $9=self._collectionWithNewValue();
  51845. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51846. $8=$recv($9)._select_((function(each){
  51847. return $core.withContext(function($ctx2) {
  51848. $10=self._sampleNewValue();
  51849. $ctx2.sendIdx["sampleNewValue"]=1;
  51850. return $recv(each).__eq($10);
  51851. $ctx2.sendIdx["="]=1;
  51852. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  51853. }));
  51854. $ctx1.sendIdx["select:"]=3;
  51855. self._assert_equals_($8,self._sampleNewValueAsCollection());
  51856. $ctx1.sendIdx["assert:equals:"]=3;
  51857. $12=self._collectionWithNewValue();
  51858. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51859. $11=$recv($12)._select_((function(each){
  51860. return $core.withContext(function($ctx2) {
  51861. $13=self._sampleNewValue();
  51862. $ctx2.sendIdx["sampleNewValue"]=2;
  51863. return $recv(each).__tild_eq($13);
  51864. $ctx2.sendIdx["~="]=1;
  51865. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  51866. }));
  51867. $ctx1.sendIdx["select:"]=4;
  51868. $14=self._collection();
  51869. $ctx1.sendIdx["collection"]=4;
  51870. self._assert_equals_($11,$14);
  51871. $ctx1.sendIdx["assert:equals:"]=4;
  51872. $16=self._collection();
  51873. $ctx1.sendIdx["collection"]=5;
  51874. $15=$recv($16)._select_((function(each){
  51875. return $core.withContext(function($ctx2) {
  51876. $17=self._sampleNewValue();
  51877. $ctx2.sendIdx["sampleNewValue"]=3;
  51878. return $recv(each).__eq($17);
  51879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  51880. }));
  51881. $ctx1.sendIdx["select:"]=5;
  51882. self._assert_equals_($15,$recv(self._collectionClass())._new());
  51883. $ctx1.sendIdx["assert:equals:"]=5;
  51884. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  51885. return $core.withContext(function($ctx2) {
  51886. return $recv(each).__tild_eq(self._sampleNewValue());
  51887. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51888. })),self._collection());
  51889. return self;
  51890. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  51891. },
  51892. args: [],
  51893. 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",
  51894. referencedClasses: [],
  51895. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  51896. }),
  51897. $globals.CollectionTest);
  51898. $core.addMethod(
  51899. $core.method({
  51900. selector: "testSelectThenCollect",
  51901. protocol: "tests",
  51902. fn: function (){
  51903. var self=this;
  51904. return $core.withContext(function($ctx1) {
  51905. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  51906. $2=self._collection();
  51907. $ctx1.sendIdx["collection"]=1;
  51908. $1=$recv($2)._select_thenCollect_((function(){
  51909. return false;
  51910. }),"isString");
  51911. $ctx1.sendIdx["select:thenCollect:"]=1;
  51912. $4=self._collectionClass();
  51913. $ctx1.sendIdx["collectionClass"]=1;
  51914. $3=$recv($4)._new();
  51915. $ctx1.sendIdx["new"]=1;
  51916. self._assert_equals_($1,$3);
  51917. $ctx1.sendIdx["assert:equals:"]=1;
  51918. $6=self._collection();
  51919. $ctx1.sendIdx["collection"]=2;
  51920. $5=$recv($6)._select_thenCollect_((function(){
  51921. return true;
  51922. }),(function(x){
  51923. return x;
  51924. }));
  51925. $ctx1.sendIdx["select:thenCollect:"]=2;
  51926. $7=self._collection();
  51927. $ctx1.sendIdx["collection"]=3;
  51928. self._assert_equals_($5,$7);
  51929. $ctx1.sendIdx["assert:equals:"]=2;
  51930. $8=$recv(self._collection())._select_thenCollect_((function(each){
  51931. return $core.withContext(function($ctx2) {
  51932. $9=self._sampleNewValue();
  51933. $ctx2.sendIdx["sampleNewValue"]=1;
  51934. return $recv(each).__eq($9);
  51935. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  51936. }),(function(x){
  51937. return x;
  51938. }));
  51939. $ctx1.sendIdx["select:thenCollect:"]=3;
  51940. self._assert_equals_($8,$recv(self._collectionClass())._new());
  51941. $ctx1.sendIdx["assert:equals:"]=3;
  51942. self._assert_equals_($recv(self._collectionWithNewValue())._select_thenCollect_((function(each){
  51943. return $core.withContext(function($ctx2) {
  51944. return $recv(each).__tild_eq(self._sampleNewValue());
  51945. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  51946. }),"printString"),self._collectionOfPrintStrings());
  51947. return self;
  51948. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  51949. },
  51950. args: [],
  51951. 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",
  51952. referencedClasses: [],
  51953. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  51954. }),
  51955. $globals.CollectionTest);
  51956. $core.addMethod(
  51957. $core.method({
  51958. selector: "testSingle",
  51959. protocol: "tests",
  51960. fn: function (){
  51961. var self=this;
  51962. return $core.withContext(function($ctx1) {
  51963. self._should_raise_((function(){
  51964. return $core.withContext(function($ctx2) {
  51965. return $recv($recv(self._collectionClass())._new())._single();
  51966. $ctx2.sendIdx["single"]=1;
  51967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51968. }),$globals.Error);
  51969. $ctx1.sendIdx["should:raise:"]=1;
  51970. self._should_raise_((function(){
  51971. return $core.withContext(function($ctx2) {
  51972. return $recv(self._collection())._single();
  51973. $ctx2.sendIdx["single"]=2;
  51974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51975. }),$globals.Error);
  51976. self._assert_equals_($recv(self._sampleNewValueAsCollection())._single(),self._sampleNewValue());
  51977. return self;
  51978. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  51979. },
  51980. args: [],
  51981. 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",
  51982. referencedClasses: ["Error"],
  51983. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  51984. }),
  51985. $globals.CollectionTest);
  51986. $core.addMethod(
  51987. $core.method({
  51988. selector: "testSize",
  51989. protocol: "tests",
  51990. fn: function (){
  51991. var self=this;
  51992. return $core.withContext(function($ctx1) {
  51993. var $1,$2;
  51994. $1=$recv($recv(self._collectionClass())._new())._size();
  51995. $ctx1.sendIdx["size"]=1;
  51996. self._assert_equals_($1,(0));
  51997. $ctx1.sendIdx["assert:equals:"]=1;
  51998. $2=$recv(self._sampleNewValueAsCollection())._size();
  51999. $ctx1.sendIdx["size"]=2;
  52000. self._assert_equals_($2,(1));
  52001. $ctx1.sendIdx["assert:equals:"]=2;
  52002. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  52003. return self;
  52004. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  52005. },
  52006. args: [],
  52007. 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",
  52008. referencedClasses: [],
  52009. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  52010. }),
  52011. $globals.CollectionTest);
  52012. $core.addMethod(
  52013. $core.method({
  52014. selector: "collectionClass",
  52015. protocol: "fixture",
  52016. fn: function (){
  52017. var self=this;
  52018. return nil;
  52019. },
  52020. args: [],
  52021. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  52022. referencedClasses: [],
  52023. messageSends: []
  52024. }),
  52025. $globals.CollectionTest.klass);
  52026. $core.addMethod(
  52027. $core.method({
  52028. selector: "isAbstract",
  52029. protocol: "testing",
  52030. fn: function (){
  52031. var self=this;
  52032. return $core.withContext(function($ctx1) {
  52033. return $recv(self._collectionClass())._isNil();
  52034. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  52035. },
  52036. args: [],
  52037. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  52038. referencedClasses: [],
  52039. messageSends: ["isNil", "collectionClass"]
  52040. }),
  52041. $globals.CollectionTest.klass);
  52042. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  52043. $core.addMethod(
  52044. $core.method({
  52045. selector: "collectionWithNewValue",
  52046. protocol: "fixture",
  52047. fn: function (){
  52048. var self=this;
  52049. return $core.withContext(function($ctx1) {
  52050. self._subclassResponsibility();
  52051. return self;
  52052. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  52053. },
  52054. args: [],
  52055. 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",
  52056. referencedClasses: [],
  52057. messageSends: ["subclassResponsibility"]
  52058. }),
  52059. $globals.IndexableCollectionTest);
  52060. $core.addMethod(
  52061. $core.method({
  52062. selector: "sampleNewIndex",
  52063. protocol: "fixture",
  52064. fn: function (){
  52065. var self=this;
  52066. return $core.withContext(function($ctx1) {
  52067. self._subclassResponsibility();
  52068. return self;
  52069. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  52070. },
  52071. args: [],
  52072. 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",
  52073. referencedClasses: [],
  52074. messageSends: ["subclassResponsibility"]
  52075. }),
  52076. $globals.IndexableCollectionTest);
  52077. $core.addMethod(
  52078. $core.method({
  52079. selector: "sampleNonIndexesDo:",
  52080. protocol: "fixture",
  52081. fn: function (aBlock){
  52082. var self=this;
  52083. return $core.withContext(function($ctx1) {
  52084. self._subclassResponsibility();
  52085. return self;
  52086. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  52087. },
  52088. args: ["aBlock"],
  52089. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  52090. referencedClasses: [],
  52091. messageSends: ["subclassResponsibility"]
  52092. }),
  52093. $globals.IndexableCollectionTest);
  52094. $core.addMethod(
  52095. $core.method({
  52096. selector: "samplesDo:",
  52097. protocol: "fixture",
  52098. fn: function (aBlock){
  52099. var self=this;
  52100. return $core.withContext(function($ctx1) {
  52101. self._subclassResponsibility();
  52102. return self;
  52103. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  52104. },
  52105. args: ["aBlock"],
  52106. 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",
  52107. referencedClasses: [],
  52108. messageSends: ["subclassResponsibility"]
  52109. }),
  52110. $globals.IndexableCollectionTest);
  52111. $core.addMethod(
  52112. $core.method({
  52113. selector: "testAt",
  52114. protocol: "tests",
  52115. fn: function (){
  52116. var self=this;
  52117. return $core.withContext(function($ctx1) {
  52118. var $1;
  52119. self._nonIndexesDo_((function(each){
  52120. return $core.withContext(function($ctx2) {
  52121. return self._should_raise_((function(){
  52122. return $core.withContext(function($ctx3) {
  52123. $1=self._collection();
  52124. $ctx3.sendIdx["collection"]=1;
  52125. return $recv($1)._at_(each);
  52126. $ctx3.sendIdx["at:"]=1;
  52127. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52128. }),$globals.Error);
  52129. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52130. }));
  52131. self._samplesDo_((function(index,value){
  52132. return $core.withContext(function($ctx2) {
  52133. return self._assert_equals_($recv(self._collection())._at_(index),value);
  52134. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  52135. }));
  52136. return self;
  52137. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  52138. },
  52139. args: [],
  52140. 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 ]",
  52141. referencedClasses: ["Error"],
  52142. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  52143. }),
  52144. $globals.IndexableCollectionTest);
  52145. $core.addMethod(
  52146. $core.method({
  52147. selector: "testAtIfAbsent",
  52148. protocol: "tests",
  52149. fn: function (){
  52150. var self=this;
  52151. return $core.withContext(function($ctx1) {
  52152. var $2,$1,$3;
  52153. self._nonIndexesDo_((function(each){
  52154. return $core.withContext(function($ctx2) {
  52155. $2=self._collection();
  52156. $ctx2.sendIdx["collection"]=1;
  52157. $1=$recv($2)._at_ifAbsent_(each,(function(){
  52158. return $core.withContext(function($ctx3) {
  52159. return self._sampleNewValue();
  52160. $ctx3.sendIdx["sampleNewValue"]=1;
  52161. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52162. }));
  52163. $ctx2.sendIdx["at:ifAbsent:"]=1;
  52164. $3=self._sampleNewValue();
  52165. $ctx2.sendIdx["sampleNewValue"]=2;
  52166. return self._assert_equals_($1,$3);
  52167. $ctx2.sendIdx["assert:equals:"]=1;
  52168. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52169. }));
  52170. self._samplesDo_((function(index,value){
  52171. return $core.withContext(function($ctx2) {
  52172. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  52173. return $core.withContext(function($ctx3) {
  52174. return self._sampleNewValue();
  52175. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  52176. })),value);
  52177. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  52178. }));
  52179. return self;
  52180. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  52181. },
  52182. args: [],
  52183. 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 ].",
  52184. referencedClasses: [],
  52185. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  52186. }),
  52187. $globals.IndexableCollectionTest);
  52188. $core.addMethod(
  52189. $core.method({
  52190. selector: "testAtIfAbsentPut",
  52191. protocol: "tests",
  52192. fn: function (){
  52193. var self=this;
  52194. var newCollection;
  52195. return $core.withContext(function($ctx1) {
  52196. var $1;
  52197. newCollection=self._collection();
  52198. $ctx1.sendIdx["collection"]=1;
  52199. self._samplesDo_((function(index,value){
  52200. return $core.withContext(function($ctx2) {
  52201. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  52202. return $core.withContext(function($ctx3) {
  52203. return self._sampleNewValue();
  52204. $ctx3.sendIdx["sampleNewValue"]=1;
  52205. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52206. }));
  52207. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  52208. return self._assert_equals_($1,value);
  52209. $ctx2.sendIdx["assert:equals:"]=1;
  52210. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52211. }));
  52212. self._assert_equals_(newCollection,self._collection());
  52213. $ctx1.sendIdx["assert:equals:"]=2;
  52214. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  52215. return $core.withContext(function($ctx2) {
  52216. return self._sampleNewValue();
  52217. $ctx2.sendIdx["sampleNewValue"]=2;
  52218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  52219. })),self._sampleNewValue());
  52220. $ctx1.sendIdx["assert:equals:"]=3;
  52221. self._assert_equals_(newCollection,self._collectionWithNewValue());
  52222. return self;
  52223. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  52224. },
  52225. args: [],
  52226. 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",
  52227. referencedClasses: [],
  52228. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  52229. }),
  52230. $globals.IndexableCollectionTest);
  52231. $core.addMethod(
  52232. $core.method({
  52233. selector: "testAtIfPresent",
  52234. protocol: "tests",
  52235. fn: function (){
  52236. var self=this;
  52237. var visited,sentinel;
  52238. return $core.withContext(function($ctx1) {
  52239. var $2,$1,$4,$3;
  52240. sentinel=$recv($globals.Object)._new();
  52241. self._nonIndexesDo_((function(each){
  52242. return $core.withContext(function($ctx2) {
  52243. visited=nil;
  52244. visited;
  52245. $2=self._collection();
  52246. $ctx2.sendIdx["collection"]=1;
  52247. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  52248. visited=value1;
  52249. visited;
  52250. return sentinel;
  52251. }));
  52252. $ctx2.sendIdx["at:ifPresent:"]=1;
  52253. self._assert_equals_($1,nil);
  52254. $ctx2.sendIdx["assert:equals:"]=1;
  52255. return self._assert_($recv(visited)._isNil());
  52256. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52257. }));
  52258. self._samplesDo_((function(index,value){
  52259. return $core.withContext(function($ctx2) {
  52260. visited=nil;
  52261. visited;
  52262. $4=self._collection();
  52263. $ctx2.sendIdx["collection"]=2;
  52264. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  52265. visited=value2;
  52266. visited;
  52267. return sentinel;
  52268. }));
  52269. self._assert_equals_($3,sentinel);
  52270. $ctx2.sendIdx["assert:equals:"]=2;
  52271. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  52272. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  52273. }));
  52274. return self;
  52275. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  52276. },
  52277. args: [],
  52278. 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) ]",
  52279. referencedClasses: ["Object"],
  52280. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  52281. }),
  52282. $globals.IndexableCollectionTest);
  52283. $core.addMethod(
  52284. $core.method({
  52285. selector: "testAtIfPresentIfAbsent",
  52286. protocol: "tests",
  52287. fn: function (){
  52288. var self=this;
  52289. var visited,sentinel;
  52290. return $core.withContext(function($ctx1) {
  52291. var $2,$1,$3,$5,$4;
  52292. sentinel=$recv($globals.Object)._new();
  52293. self._nonIndexesDo_((function(each){
  52294. return $core.withContext(function($ctx2) {
  52295. visited=nil;
  52296. visited;
  52297. $2=self._collection();
  52298. $ctx2.sendIdx["collection"]=1;
  52299. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  52300. visited=value1;
  52301. visited;
  52302. return sentinel;
  52303. }),(function(){
  52304. return $core.withContext(function($ctx3) {
  52305. return self._sampleNewValue();
  52306. $ctx3.sendIdx["sampleNewValue"]=1;
  52307. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  52308. }));
  52309. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  52310. $3=self._sampleNewValue();
  52311. $ctx2.sendIdx["sampleNewValue"]=2;
  52312. self._assert_equals_($1,$3);
  52313. $ctx2.sendIdx["assert:equals:"]=1;
  52314. return self._assert_($recv(visited)._isNil());
  52315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52316. }));
  52317. self._samplesDo_((function(index,value){
  52318. return $core.withContext(function($ctx2) {
  52319. visited=nil;
  52320. visited;
  52321. $5=self._collection();
  52322. $ctx2.sendIdx["collection"]=2;
  52323. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  52324. visited=value2;
  52325. visited;
  52326. return sentinel;
  52327. }),(function(){
  52328. return $core.withContext(function($ctx3) {
  52329. return self._sampleNewValue();
  52330. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  52331. }));
  52332. self._assert_equals_($4,sentinel);
  52333. $ctx2.sendIdx["assert:equals:"]=2;
  52334. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  52335. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  52336. }));
  52337. return self;
  52338. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  52339. },
  52340. args: [],
  52341. 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) ]",
  52342. referencedClasses: ["Object"],
  52343. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  52344. }),
  52345. $globals.IndexableCollectionTest);
  52346. $core.addMethod(
  52347. $core.method({
  52348. selector: "testAtPut",
  52349. protocol: "tests",
  52350. fn: function (){
  52351. var self=this;
  52352. var newCollection;
  52353. return $core.withContext(function($ctx1) {
  52354. newCollection=self._collection();
  52355. $ctx1.sendIdx["collection"]=1;
  52356. self._samplesDo_((function(index,value){
  52357. return $core.withContext(function($ctx2) {
  52358. return $recv(newCollection)._at_put_(index,value);
  52359. $ctx2.sendIdx["at:put:"]=1;
  52360. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52361. }));
  52362. self._assert_equals_(newCollection,self._collection());
  52363. $ctx1.sendIdx["assert:equals:"]=1;
  52364. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  52365. self._assert_equals_(newCollection,self._collectionWithNewValue());
  52366. return self;
  52367. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  52368. },
  52369. args: [],
  52370. 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",
  52371. referencedClasses: [],
  52372. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  52373. }),
  52374. $globals.IndexableCollectionTest);
  52375. $core.addMethod(
  52376. $core.method({
  52377. selector: "testIndexOf",
  52378. protocol: "tests",
  52379. fn: function (){
  52380. var self=this;
  52381. return $core.withContext(function($ctx1) {
  52382. var $1;
  52383. self._should_raise_((function(){
  52384. return $core.withContext(function($ctx2) {
  52385. $1=self._collection();
  52386. $ctx2.sendIdx["collection"]=1;
  52387. return $recv($1)._indexOf_(self._sampleNewValue());
  52388. $ctx2.sendIdx["indexOf:"]=1;
  52389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52390. }),$globals.Error);
  52391. self._samplesDo_((function(index,value){
  52392. return $core.withContext(function($ctx2) {
  52393. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  52394. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  52395. }));
  52396. return self;
  52397. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  52398. },
  52399. args: [],
  52400. 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 ]",
  52401. referencedClasses: ["Error"],
  52402. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  52403. }),
  52404. $globals.IndexableCollectionTest);
  52405. $core.addMethod(
  52406. $core.method({
  52407. selector: "testIndexOfWithNull",
  52408. protocol: "tests",
  52409. fn: function (){
  52410. var self=this;
  52411. var jsNull;
  52412. return $core.withContext(function($ctx1) {
  52413. var $2,$1;
  52414. jsNull=$recv($globals.JSON)._parse_("null");
  52415. self._samplesDo_((function(index,value){
  52416. return $core.withContext(function($ctx2) {
  52417. $2=self._collection();
  52418. $recv($2)._at_put_(index,jsNull);
  52419. $1=$recv($2)._indexOf_(jsNull);
  52420. return self._assert_equals_($1,index);
  52421. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52422. }));
  52423. return self;
  52424. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  52425. },
  52426. args: [],
  52427. 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 ]",
  52428. referencedClasses: ["JSON"],
  52429. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  52430. }),
  52431. $globals.IndexableCollectionTest);
  52432. $core.addMethod(
  52433. $core.method({
  52434. selector: "testWithIndexDo",
  52435. protocol: "tests",
  52436. fn: function (){
  52437. var self=this;
  52438. var collection;
  52439. return $core.withContext(function($ctx1) {
  52440. collection=self._collection();
  52441. $ctx1.sendIdx["collection"]=1;
  52442. $recv(self._collection())._withIndexDo_((function(each,index){
  52443. return $core.withContext(function($ctx2) {
  52444. return self._assert_equals_($recv(collection)._at_(index),each);
  52445. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  52446. }));
  52447. return self;
  52448. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  52449. },
  52450. args: [],
  52451. 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 ]",
  52452. referencedClasses: [],
  52453. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  52454. }),
  52455. $globals.IndexableCollectionTest);
  52456. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  52457. $core.addMethod(
  52458. $core.method({
  52459. selector: "collectionKeys",
  52460. protocol: "fixture",
  52461. fn: function (){
  52462. var self=this;
  52463. return $core.withContext(function($ctx1) {
  52464. self._subclassResponsibility();
  52465. return self;
  52466. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  52467. },
  52468. args: [],
  52469. source: "collectionKeys\x0a\x09self subclassResponsibility",
  52470. referencedClasses: [],
  52471. messageSends: ["subclassResponsibility"]
  52472. }),
  52473. $globals.AssociativeCollectionTest);
  52474. $core.addMethod(
  52475. $core.method({
  52476. selector: "collectionValues",
  52477. protocol: "fixture",
  52478. fn: function (){
  52479. var self=this;
  52480. return $core.withContext(function($ctx1) {
  52481. self._subclassResponsibility();
  52482. return self;
  52483. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  52484. },
  52485. args: [],
  52486. source: "collectionValues\x0a\x09self subclassResponsibility",
  52487. referencedClasses: [],
  52488. messageSends: ["subclassResponsibility"]
  52489. }),
  52490. $globals.AssociativeCollectionTest);
  52491. $core.addMethod(
  52492. $core.method({
  52493. selector: "nonIndexesDo:",
  52494. protocol: "fixture",
  52495. fn: function (aBlock){
  52496. var self=this;
  52497. return $core.withContext(function($ctx1) {
  52498. $recv(aBlock)._value_((5));
  52499. $ctx1.sendIdx["value:"]=1;
  52500. $recv(aBlock)._value_((function(){
  52501. }));
  52502. $ctx1.sendIdx["value:"]=2;
  52503. $recv(aBlock)._value_($recv($globals.Object)._new());
  52504. $ctx1.sendIdx["value:"]=3;
  52505. $recv(aBlock)._value_("z");
  52506. return self;
  52507. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  52508. },
  52509. args: ["aBlock"],
  52510. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  52511. referencedClasses: ["Object"],
  52512. messageSends: ["value:", "new"]
  52513. }),
  52514. $globals.AssociativeCollectionTest);
  52515. $core.addMethod(
  52516. $core.method({
  52517. selector: "sampleNewIndex",
  52518. protocol: "fixture",
  52519. fn: function (){
  52520. var self=this;
  52521. return "new";
  52522. },
  52523. args: [],
  52524. source: "sampleNewIndex\x0a\x09^ 'new'",
  52525. referencedClasses: [],
  52526. messageSends: []
  52527. }),
  52528. $globals.AssociativeCollectionTest);
  52529. $core.addMethod(
  52530. $core.method({
  52531. selector: "samplesDo:",
  52532. protocol: "fixture",
  52533. fn: function (aBlock){
  52534. var self=this;
  52535. return $core.withContext(function($ctx1) {
  52536. $recv(aBlock)._value_value_("a",(2));
  52537. return self;
  52538. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  52539. },
  52540. args: ["aBlock"],
  52541. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  52542. referencedClasses: [],
  52543. messageSends: ["value:value:"]
  52544. }),
  52545. $globals.AssociativeCollectionTest);
  52546. $core.addMethod(
  52547. $core.method({
  52548. selector: "testAddAll",
  52549. protocol: "tests",
  52550. fn: function (){
  52551. var self=this;
  52552. return $core.withContext(function($ctx1) {
  52553. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  52554. (
  52555. $ctx1.supercall = true,
  52556. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  52557. $ctx1.supercall = false;
  52558. $2=self._collection();
  52559. $ctx1.sendIdx["collection"]=1;
  52560. $3=self._collection();
  52561. $ctx1.sendIdx["collection"]=2;
  52562. $recv($2)._addAll_($3);
  52563. $ctx1.sendIdx["addAll:"]=1;
  52564. $4=$recv($2)._yourself();
  52565. $ctx1.sendIdx["yourself"]=1;
  52566. $1=$4;
  52567. $5=self._collection();
  52568. $ctx1.sendIdx["collection"]=3;
  52569. self._assert_equals_($1,$5);
  52570. $ctx1.sendIdx["assert:equals:"]=1;
  52571. $7=self._collection();
  52572. $ctx1.sendIdx["collection"]=4;
  52573. $8=self._collectionWithNewValue();
  52574. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52575. $recv($7)._addAll_($8);
  52576. $ctx1.sendIdx["addAll:"]=2;
  52577. $9=$recv($7)._yourself();
  52578. $ctx1.sendIdx["yourself"]=2;
  52579. $6=$9;
  52580. $10=self._collectionWithNewValue();
  52581. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52582. self._assert_equals_($6,$10);
  52583. $ctx1.sendIdx["assert:equals:"]=2;
  52584. $12=self._collectionWithNewValue();
  52585. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52586. $recv($12)._addAll_(self._collection());
  52587. $11=$recv($12)._yourself();
  52588. self._assert_equals_($11,self._collectionWithNewValue());
  52589. return self;
  52590. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  52591. },
  52592. args: [],
  52593. 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",
  52594. referencedClasses: [],
  52595. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  52596. }),
  52597. $globals.AssociativeCollectionTest);
  52598. $core.addMethod(
  52599. $core.method({
  52600. selector: "testAsDictionary",
  52601. protocol: "tests",
  52602. fn: function (){
  52603. var self=this;
  52604. return $core.withContext(function($ctx1) {
  52605. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  52606. return self;
  52607. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  52608. },
  52609. args: [],
  52610. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  52611. referencedClasses: ["Dictionary"],
  52612. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  52613. }),
  52614. $globals.AssociativeCollectionTest);
  52615. $core.addMethod(
  52616. $core.method({
  52617. selector: "testAsHashedCollection",
  52618. protocol: "tests",
  52619. fn: function (){
  52620. var self=this;
  52621. return $core.withContext(function($ctx1) {
  52622. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  52623. return self;
  52624. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  52625. },
  52626. args: [],
  52627. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  52628. referencedClasses: ["HashedCollection"],
  52629. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  52630. }),
  52631. $globals.AssociativeCollectionTest);
  52632. $core.addMethod(
  52633. $core.method({
  52634. selector: "testComma",
  52635. protocol: "tests",
  52636. fn: function (){
  52637. var self=this;
  52638. return $core.withContext(function($ctx1) {
  52639. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  52640. (
  52641. $ctx1.supercall = true,
  52642. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  52643. $ctx1.supercall = false;
  52644. $2=self._collection();
  52645. $ctx1.sendIdx["collection"]=1;
  52646. $3=self._collection();
  52647. $ctx1.sendIdx["collection"]=2;
  52648. $1=$recv($2).__comma($3);
  52649. $ctx1.sendIdx[","]=1;
  52650. $4=self._collection();
  52651. $ctx1.sendIdx["collection"]=3;
  52652. self._assert_equals_($1,$4);
  52653. $ctx1.sendIdx["assert:equals:"]=1;
  52654. $6=self._collection();
  52655. $ctx1.sendIdx["collection"]=4;
  52656. $7=self._collectionWithNewValue();
  52657. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52658. $5=$recv($6).__comma($7);
  52659. $ctx1.sendIdx[","]=2;
  52660. $8=self._collectionWithNewValue();
  52661. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52662. self._assert_equals_($5,$8);
  52663. $ctx1.sendIdx["assert:equals:"]=2;
  52664. $10=self._collectionWithNewValue();
  52665. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52666. $9=$recv($10).__comma(self._collection());
  52667. self._assert_equals_($9,self._collectionWithNewValue());
  52668. return self;
  52669. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  52670. },
  52671. args: [],
  52672. 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",
  52673. referencedClasses: [],
  52674. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  52675. }),
  52676. $globals.AssociativeCollectionTest);
  52677. $core.addMethod(
  52678. $core.method({
  52679. selector: "testFrom",
  52680. protocol: "tests",
  52681. fn: function (){
  52682. var self=this;
  52683. var associations;
  52684. return $core.withContext(function($ctx1) {
  52685. var $1;
  52686. $1="a".__minus_gt((1));
  52687. $ctx1.sendIdx["->"]=1;
  52688. associations=[$1,"b".__minus_gt((2))];
  52689. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  52690. return self;
  52691. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  52692. },
  52693. args: [],
  52694. 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 }.",
  52695. referencedClasses: [],
  52696. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  52697. }),
  52698. $globals.AssociativeCollectionTest);
  52699. $core.addMethod(
  52700. $core.method({
  52701. selector: "testKeys",
  52702. protocol: "tests",
  52703. fn: function (){
  52704. var self=this;
  52705. return $core.withContext(function($ctx1) {
  52706. var $2,$1,$3,$4;
  52707. $2=$recv($recv(self._collectionClass())._new())._keys();
  52708. $ctx1.sendIdx["keys"]=1;
  52709. $1=$recv($2)._isEmpty();
  52710. self._assert_($1);
  52711. $3=$recv(self._collection())._keys();
  52712. $ctx1.sendIdx["keys"]=2;
  52713. $4=self._collectionKeys();
  52714. $ctx1.sendIdx["collectionKeys"]=1;
  52715. self._assertSameContents_as_($3,$4);
  52716. $ctx1.sendIdx["assertSameContents:as:"]=1;
  52717. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  52718. return self;
  52719. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  52720. },
  52721. args: [],
  52722. 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 }",
  52723. referencedClasses: [],
  52724. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  52725. }),
  52726. $globals.AssociativeCollectionTest);
  52727. $core.addMethod(
  52728. $core.method({
  52729. selector: "testNewFromPairs",
  52730. protocol: "tests",
  52731. fn: function (){
  52732. var self=this;
  52733. var flattenedAssociations;
  52734. return $core.withContext(function($ctx1) {
  52735. flattenedAssociations=["a",(1),"b",(2)];
  52736. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  52737. return self;
  52738. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  52739. },
  52740. args: [],
  52741. 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 }.",
  52742. referencedClasses: [],
  52743. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  52744. }),
  52745. $globals.AssociativeCollectionTest);
  52746. $core.addMethod(
  52747. $core.method({
  52748. selector: "testPrintString",
  52749. protocol: "tests",
  52750. fn: function (){
  52751. var self=this;
  52752. return $core.withContext(function($ctx1) {
  52753. var $3,$2,$1,$4;
  52754. $3=self._collectionClass();
  52755. $ctx1.sendIdx["collectionClass"]=1;
  52756. $2=$recv($3)._new();
  52757. $recv($2)._at_put_("firstname","James");
  52758. $ctx1.sendIdx["at:put:"]=1;
  52759. $recv($2)._at_put_("lastname","Bond");
  52760. $1=$recv($2)._printString();
  52761. $4=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  52762. $ctx1.sendIdx[","]=1;
  52763. self._assert_equals_($1,$4);
  52764. return self;
  52765. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  52766. },
  52767. args: [],
  52768. 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'')'",
  52769. referencedClasses: [],
  52770. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  52771. }),
  52772. $globals.AssociativeCollectionTest);
  52773. $core.addMethod(
  52774. $core.method({
  52775. selector: "testRemoveKey",
  52776. protocol: "tests",
  52777. fn: function (){
  52778. var self=this;
  52779. return $core.withContext(function($ctx1) {
  52780. var $1,$2,$3,$5,$6,$4,$8,$7;
  52781. self._nonIndexesDo_((function(each){
  52782. var collection;
  52783. return $core.withContext(function($ctx2) {
  52784. collection=self._collection();
  52785. $ctx2.sendIdx["collection"]=1;
  52786. collection;
  52787. self._should_raise_((function(){
  52788. return $core.withContext(function($ctx3) {
  52789. return $recv(collection)._removeKey_(each);
  52790. $ctx3.sendIdx["removeKey:"]=1;
  52791. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52792. }),$globals.Error);
  52793. $1=collection;
  52794. $2=self._collection();
  52795. $ctx2.sendIdx["collection"]=2;
  52796. return self._assert_equals_($1,$2);
  52797. $ctx2.sendIdx["assert:equals:"]=1;
  52798. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  52799. }));
  52800. self._samplesDo_((function(index,value){
  52801. var collection;
  52802. return $core.withContext(function($ctx2) {
  52803. collection=self._collection();
  52804. $ctx2.sendIdx["collection"]=3;
  52805. collection;
  52806. $3=$recv(collection)._removeKey_(index);
  52807. $ctx2.sendIdx["removeKey:"]=2;
  52808. self._assert_equals_($3,value);
  52809. $ctx2.sendIdx["assert:equals:"]=2;
  52810. $5=collection;
  52811. $6=self._collection();
  52812. $ctx2.sendIdx["collection"]=4;
  52813. $4=$recv($5).__eq($6);
  52814. return self._deny_($4);
  52815. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  52816. }));
  52817. $8=self._collectionWithNewValue();
  52818. $recv($8)._removeKey_(self._sampleNewIndex());
  52819. $7=$recv($8)._yourself();
  52820. self._assert_equals_($7,self._collection());
  52821. return self;
  52822. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  52823. },
  52824. args: [],
  52825. 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",
  52826. referencedClasses: ["Error"],
  52827. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  52828. }),
  52829. $globals.AssociativeCollectionTest);
  52830. $core.addMethod(
  52831. $core.method({
  52832. selector: "testRemoveKeyIfAbsent",
  52833. protocol: "tests",
  52834. fn: function (){
  52835. var self=this;
  52836. return $core.withContext(function($ctx1) {
  52837. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  52838. self._nonIndexesDo_((function(each){
  52839. var collection;
  52840. return $core.withContext(function($ctx2) {
  52841. collection=self._collection();
  52842. $ctx2.sendIdx["collection"]=1;
  52843. collection;
  52844. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  52845. return $core.withContext(function($ctx3) {
  52846. return self._sampleNewValue();
  52847. $ctx3.sendIdx["sampleNewValue"]=1;
  52848. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52849. }));
  52850. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  52851. $2=self._sampleNewValue();
  52852. $ctx2.sendIdx["sampleNewValue"]=2;
  52853. self._assert_equals_($1,$2);
  52854. $ctx2.sendIdx["assert:equals:"]=1;
  52855. $3=collection;
  52856. $4=self._collection();
  52857. $ctx2.sendIdx["collection"]=2;
  52858. return self._assert_equals_($3,$4);
  52859. $ctx2.sendIdx["assert:equals:"]=2;
  52860. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  52861. }));
  52862. self._samplesDo_((function(index,value){
  52863. var collection;
  52864. return $core.withContext(function($ctx2) {
  52865. collection=self._collection();
  52866. $ctx2.sendIdx["collection"]=3;
  52867. collection;
  52868. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  52869. return $core.withContext(function($ctx3) {
  52870. return self._sampleNewValue();
  52871. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  52872. }));
  52873. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  52874. self._assert_equals_($5,value);
  52875. $ctx2.sendIdx["assert:equals:"]=3;
  52876. $7=collection;
  52877. $8=self._collection();
  52878. $ctx2.sendIdx["collection"]=4;
  52879. $6=$recv($7).__eq($8);
  52880. return self._deny_($6);
  52881. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  52882. }));
  52883. $10=self._collectionWithNewValue();
  52884. $recv($10)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  52885. return $core.withContext(function($ctx2) {
  52886. return self._assert_(false);
  52887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  52888. }));
  52889. $9=$recv($10)._yourself();
  52890. self._assert_equals_($9,self._collection());
  52891. return self;
  52892. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  52893. },
  52894. args: [],
  52895. 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",
  52896. referencedClasses: [],
  52897. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  52898. }),
  52899. $globals.AssociativeCollectionTest);
  52900. $core.addMethod(
  52901. $core.method({
  52902. selector: "testValues",
  52903. protocol: "tests",
  52904. fn: function (){
  52905. var self=this;
  52906. return $core.withContext(function($ctx1) {
  52907. var $2,$1,$3,$4;
  52908. $2=$recv($recv(self._collectionClass())._new())._values();
  52909. $ctx1.sendIdx["values"]=1;
  52910. $1=$recv($2)._isEmpty();
  52911. self._assert_($1);
  52912. $3=$recv(self._collection())._values();
  52913. $ctx1.sendIdx["values"]=2;
  52914. $4=self._collectionValues();
  52915. $ctx1.sendIdx["collectionValues"]=1;
  52916. self._assertSameContents_as_($3,$4);
  52917. $ctx1.sendIdx["assertSameContents:as:"]=1;
  52918. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  52919. return self;
  52920. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  52921. },
  52922. args: [],
  52923. 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 }",
  52924. referencedClasses: [],
  52925. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  52926. }),
  52927. $globals.AssociativeCollectionTest);
  52928. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  52929. $core.addMethod(
  52930. $core.method({
  52931. selector: "collection",
  52932. protocol: "fixture",
  52933. fn: function (){
  52934. var self=this;
  52935. return $core.withContext(function($ctx1) {
  52936. var $1;
  52937. $1=$recv($globals.Dictionary)._new();
  52938. $recv($1)._at_put_((1),(1));
  52939. $ctx1.sendIdx["at:put:"]=1;
  52940. $recv($1)._at_put_("a",(2));
  52941. $ctx1.sendIdx["at:put:"]=2;
  52942. $recv($1)._at_put_(true,(3));
  52943. $ctx1.sendIdx["at:put:"]=3;
  52944. $recv($1)._at_put_((1).__at((3)),(-4));
  52945. $ctx1.sendIdx["at:put:"]=4;
  52946. $recv($1)._at_put_(self["@sampleBlock"],(9));
  52947. return $recv($1)._yourself();
  52948. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  52949. },
  52950. args: [],
  52951. 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",
  52952. referencedClasses: ["Dictionary"],
  52953. messageSends: ["at:put:", "new", "@", "yourself"]
  52954. }),
  52955. $globals.DictionaryTest);
  52956. $core.addMethod(
  52957. $core.method({
  52958. selector: "collectionKeys",
  52959. protocol: "fixture",
  52960. fn: function (){
  52961. var self=this;
  52962. return $core.withContext(function($ctx1) {
  52963. return [(1),"a",true,(1).__at((3)),self["@sampleBlock"]];
  52964. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  52965. },
  52966. args: [],
  52967. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  52968. referencedClasses: [],
  52969. messageSends: ["@"]
  52970. }),
  52971. $globals.DictionaryTest);
  52972. $core.addMethod(
  52973. $core.method({
  52974. selector: "collectionOfPrintStrings",
  52975. protocol: "fixture",
  52976. fn: function (){
  52977. var self=this;
  52978. return $core.withContext(function($ctx1) {
  52979. var $1;
  52980. $1=$recv($globals.Dictionary)._new();
  52981. $recv($1)._at_put_((1),"1");
  52982. $ctx1.sendIdx["at:put:"]=1;
  52983. $recv($1)._at_put_("a","2");
  52984. $ctx1.sendIdx["at:put:"]=2;
  52985. $recv($1)._at_put_(true,"3");
  52986. $ctx1.sendIdx["at:put:"]=3;
  52987. $recv($1)._at_put_((1).__at((3)),"-4");
  52988. $ctx1.sendIdx["at:put:"]=4;
  52989. $recv($1)._at_put_(self["@sampleBlock"],"9");
  52990. return $recv($1)._yourself();
  52991. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  52992. },
  52993. args: [],
  52994. 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",
  52995. referencedClasses: ["Dictionary"],
  52996. messageSends: ["at:put:", "new", "@", "yourself"]
  52997. }),
  52998. $globals.DictionaryTest);
  52999. $core.addMethod(
  53000. $core.method({
  53001. selector: "collectionSize",
  53002. protocol: "fixture",
  53003. fn: function (){
  53004. var self=this;
  53005. return (5);
  53006. },
  53007. args: [],
  53008. source: "collectionSize\x0a\x09^ 5",
  53009. referencedClasses: [],
  53010. messageSends: []
  53011. }),
  53012. $globals.DictionaryTest);
  53013. $core.addMethod(
  53014. $core.method({
  53015. selector: "collectionValues",
  53016. protocol: "fixture",
  53017. fn: function (){
  53018. var self=this;
  53019. return [(1),(2),(3),(-4),(9)];
  53020. },
  53021. args: [],
  53022. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  53023. referencedClasses: [],
  53024. messageSends: []
  53025. }),
  53026. $globals.DictionaryTest);
  53027. $core.addMethod(
  53028. $core.method({
  53029. selector: "collectionWithDuplicates",
  53030. protocol: "fixture",
  53031. fn: function (){
  53032. var self=this;
  53033. return $core.withContext(function($ctx1) {
  53034. var $1;
  53035. $1=$recv($globals.Dictionary)._new();
  53036. $recv($1)._at_put_((1),(1));
  53037. $ctx1.sendIdx["at:put:"]=1;
  53038. $recv($1)._at_put_("a",(2));
  53039. $ctx1.sendIdx["at:put:"]=2;
  53040. $recv($1)._at_put_(true,(3));
  53041. $ctx1.sendIdx["at:put:"]=3;
  53042. $recv($1)._at_put_((4),(-4));
  53043. $ctx1.sendIdx["at:put:"]=4;
  53044. $recv($1)._at_put_(self["@sampleBlock"],(9));
  53045. $ctx1.sendIdx["at:put:"]=5;
  53046. $recv($1)._at_put_("b",(1));
  53047. $ctx1.sendIdx["at:put:"]=6;
  53048. $recv($1)._at_put_((3),(3));
  53049. $ctx1.sendIdx["at:put:"]=7;
  53050. $recv($1)._at_put_(false,(12));
  53051. return $recv($1)._yourself();
  53052. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  53053. },
  53054. args: [],
  53055. 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",
  53056. referencedClasses: ["Dictionary"],
  53057. messageSends: ["at:put:", "new", "yourself"]
  53058. }),
  53059. $globals.DictionaryTest);
  53060. $core.addMethod(
  53061. $core.method({
  53062. selector: "collectionWithNewValue",
  53063. protocol: "fixture",
  53064. fn: function (){
  53065. var self=this;
  53066. return $core.withContext(function($ctx1) {
  53067. var $1;
  53068. $1=$recv($globals.Dictionary)._new();
  53069. $recv($1)._at_put_((1),(1));
  53070. $ctx1.sendIdx["at:put:"]=1;
  53071. $recv($1)._at_put_("a",(2));
  53072. $ctx1.sendIdx["at:put:"]=2;
  53073. $recv($1)._at_put_(true,(3));
  53074. $ctx1.sendIdx["at:put:"]=3;
  53075. $recv($1)._at_put_((1).__at((3)),(-4));
  53076. $ctx1.sendIdx["at:put:"]=4;
  53077. $recv($1)._at_put_(self["@sampleBlock"],(9));
  53078. $ctx1.sendIdx["at:put:"]=5;
  53079. $recv($1)._at_put_("new","N");
  53080. return $recv($1)._yourself();
  53081. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  53082. },
  53083. args: [],
  53084. 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",
  53085. referencedClasses: ["Dictionary"],
  53086. messageSends: ["at:put:", "new", "@", "yourself"]
  53087. }),
  53088. $globals.DictionaryTest);
  53089. $core.addMethod(
  53090. $core.method({
  53091. selector: "sampleNewValueAsCollection",
  53092. protocol: "fixture",
  53093. fn: function (){
  53094. var self=this;
  53095. return $core.withContext(function($ctx1) {
  53096. var $1;
  53097. $1=$recv($globals.Dictionary)._new();
  53098. $recv($1)._at_put_("new","N");
  53099. return $recv($1)._yourself();
  53100. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  53101. },
  53102. args: [],
  53103. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  53104. referencedClasses: ["Dictionary"],
  53105. messageSends: ["at:put:", "new", "yourself"]
  53106. }),
  53107. $globals.DictionaryTest);
  53108. $core.addMethod(
  53109. $core.method({
  53110. selector: "samplesDo:",
  53111. protocol: "fixture",
  53112. fn: function (aBlock){
  53113. var self=this;
  53114. return $core.withContext(function($ctx1) {
  53115. (
  53116. $ctx1.supercall = true,
  53117. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  53118. $ctx1.supercall = false;
  53119. $recv(aBlock)._value_value_(true,(3));
  53120. $ctx1.sendIdx["value:value:"]=1;
  53121. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  53122. $ctx1.sendIdx["value:value:"]=2;
  53123. $recv(aBlock)._value_value_(self["@sampleBlock"],(9));
  53124. return self;
  53125. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  53126. },
  53127. args: ["aBlock"],
  53128. 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",
  53129. referencedClasses: [],
  53130. messageSends: ["samplesDo:", "value:value:", "@"]
  53131. }),
  53132. $globals.DictionaryTest);
  53133. $core.addMethod(
  53134. $core.method({
  53135. selector: "testAccessing",
  53136. protocol: "tests",
  53137. fn: function (){
  53138. var self=this;
  53139. var d;
  53140. return $core.withContext(function($ctx1) {
  53141. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  53142. d=$recv($globals.Dictionary)._new();
  53143. $recv(d)._at_put_("hello","world");
  53144. $ctx1.sendIdx["at:put:"]=1;
  53145. $1=$recv(d)._at_("hello");
  53146. $ctx1.sendIdx["at:"]=1;
  53147. self._assert_equals_($1,"world");
  53148. $ctx1.sendIdx["assert:equals:"]=1;
  53149. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  53150. return nil;
  53151. }));
  53152. $ctx1.sendIdx["at:ifAbsent:"]=1;
  53153. self._assert_equals_($2,"world");
  53154. $ctx1.sendIdx["assert:equals:"]=2;
  53155. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  53156. return nil;
  53157. }))).__eq("world"));
  53158. $ctx1.sendIdx["deny:"]=1;
  53159. $3=$recv(d)._includesKey_("hello");
  53160. $ctx1.sendIdx["includesKey:"]=1;
  53161. self._assert_($3);
  53162. $ctx1.sendIdx["assert:"]=1;
  53163. $4=$recv(d)._includesKey_("foo");
  53164. $ctx1.sendIdx["includesKey:"]=2;
  53165. self._deny_($4);
  53166. $ctx1.sendIdx["deny:"]=2;
  53167. $recv(d)._at_put_((1),(2));
  53168. $ctx1.sendIdx["at:put:"]=2;
  53169. $5=$recv(d)._at_((1));
  53170. $ctx1.sendIdx["at:"]=2;
  53171. self._assert_equals_($5,(2));
  53172. $ctx1.sendIdx["assert:equals:"]=3;
  53173. $6=d;
  53174. $7=(1).__at((3));
  53175. $ctx1.sendIdx["@"]=1;
  53176. $recv($6)._at_put_($7,(3));
  53177. $9=d;
  53178. $10=(1).__at((3));
  53179. $ctx1.sendIdx["@"]=2;
  53180. $8=$recv($9)._at_($10);
  53181. self._assert_equals_($8,(3));
  53182. $12=d;
  53183. $13=(1).__at((3));
  53184. $ctx1.sendIdx["@"]=3;
  53185. $11=$recv($12)._includesKey_($13);
  53186. $ctx1.sendIdx["includesKey:"]=3;
  53187. self._assert_($11);
  53188. self._deny_($recv(d)._includesKey_((3).__at((1))));
  53189. return self;
  53190. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  53191. },
  53192. args: [],
  53193. 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)",
  53194. referencedClasses: ["Dictionary"],
  53195. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  53196. }),
  53197. $globals.DictionaryTest);
  53198. $core.addMethod(
  53199. $core.method({
  53200. selector: "testDynamicDictionaries",
  53201. protocol: "tests",
  53202. fn: function (){
  53203. var self=this;
  53204. return $core.withContext(function($ctx1) {
  53205. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  53206. return self;
  53207. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  53208. },
  53209. args: [],
  53210. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  53211. referencedClasses: ["Dictionary"],
  53212. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  53213. }),
  53214. $globals.DictionaryTest);
  53215. $core.addMethod(
  53216. $core.method({
  53217. selector: "collectionClass",
  53218. protocol: "fixture",
  53219. fn: function (){
  53220. var self=this;
  53221. return $globals.Dictionary;
  53222. },
  53223. args: [],
  53224. source: "collectionClass\x0a\x09^ Dictionary",
  53225. referencedClasses: ["Dictionary"],
  53226. messageSends: []
  53227. }),
  53228. $globals.DictionaryTest.klass);
  53229. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  53230. $core.addMethod(
  53231. $core.method({
  53232. selector: "collection",
  53233. protocol: "fixture",
  53234. fn: function (){
  53235. var self=this;
  53236. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  53237. },
  53238. args: [],
  53239. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  53240. referencedClasses: [],
  53241. messageSends: []
  53242. }),
  53243. $globals.HashedCollectionTest);
  53244. $core.addMethod(
  53245. $core.method({
  53246. selector: "collectionKeys",
  53247. protocol: "fixture",
  53248. fn: function (){
  53249. var self=this;
  53250. return ["b","a","c","d"];
  53251. },
  53252. args: [],
  53253. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  53254. referencedClasses: [],
  53255. messageSends: []
  53256. }),
  53257. $globals.HashedCollectionTest);
  53258. $core.addMethod(
  53259. $core.method({
  53260. selector: "collectionOfPrintStrings",
  53261. protocol: "fixture",
  53262. fn: function (){
  53263. var self=this;
  53264. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  53265. },
  53266. args: [],
  53267. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  53268. referencedClasses: [],
  53269. messageSends: []
  53270. }),
  53271. $globals.HashedCollectionTest);
  53272. $core.addMethod(
  53273. $core.method({
  53274. selector: "collectionSize",
  53275. protocol: "fixture",
  53276. fn: function (){
  53277. var self=this;
  53278. return (4);
  53279. },
  53280. args: [],
  53281. source: "collectionSize\x0a\x09^ 4",
  53282. referencedClasses: [],
  53283. messageSends: []
  53284. }),
  53285. $globals.HashedCollectionTest);
  53286. $core.addMethod(
  53287. $core.method({
  53288. selector: "collectionValues",
  53289. protocol: "fixture",
  53290. fn: function (){
  53291. var self=this;
  53292. return [(1),(2),(3),(-4)];
  53293. },
  53294. args: [],
  53295. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  53296. referencedClasses: [],
  53297. messageSends: []
  53298. }),
  53299. $globals.HashedCollectionTest);
  53300. $core.addMethod(
  53301. $core.method({
  53302. selector: "collectionWithDuplicates",
  53303. protocol: "fixture",
  53304. fn: function (){
  53305. var self=this;
  53306. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  53307. },
  53308. args: [],
  53309. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  53310. referencedClasses: [],
  53311. messageSends: []
  53312. }),
  53313. $globals.HashedCollectionTest);
  53314. $core.addMethod(
  53315. $core.method({
  53316. selector: "collectionWithNewValue",
  53317. protocol: "fixture",
  53318. fn: function (){
  53319. var self=this;
  53320. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  53321. },
  53322. args: [],
  53323. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  53324. referencedClasses: [],
  53325. messageSends: []
  53326. }),
  53327. $globals.HashedCollectionTest);
  53328. $core.addMethod(
  53329. $core.method({
  53330. selector: "sampleNewValueAsCollection",
  53331. protocol: "fixture",
  53332. fn: function (){
  53333. var self=this;
  53334. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  53335. },
  53336. args: [],
  53337. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  53338. referencedClasses: [],
  53339. messageSends: []
  53340. }),
  53341. $globals.HashedCollectionTest);
  53342. $core.addMethod(
  53343. $core.method({
  53344. selector: "testDynamicDictionaries",
  53345. protocol: "tests",
  53346. fn: function (){
  53347. var self=this;
  53348. return $core.withContext(function($ctx1) {
  53349. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  53350. return self;
  53351. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  53352. },
  53353. args: [],
  53354. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  53355. referencedClasses: ["HashedCollection"],
  53356. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  53357. }),
  53358. $globals.HashedCollectionTest);
  53359. $core.addMethod(
  53360. $core.method({
  53361. selector: "collectionClass",
  53362. protocol: "fixture",
  53363. fn: function (){
  53364. var self=this;
  53365. return $globals.HashedCollection;
  53366. },
  53367. args: [],
  53368. source: "collectionClass\x0a\x09^ HashedCollection",
  53369. referencedClasses: ["HashedCollection"],
  53370. messageSends: []
  53371. }),
  53372. $globals.HashedCollectionTest.klass);
  53373. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  53374. $core.addMethod(
  53375. $core.method({
  53376. selector: "collectionFirst",
  53377. protocol: "fixture",
  53378. fn: function (){
  53379. var self=this;
  53380. return $core.withContext(function($ctx1) {
  53381. self._subclassResponsibility();
  53382. return self;
  53383. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  53384. },
  53385. args: [],
  53386. source: "collectionFirst\x0a\x09self subclassResponsibility",
  53387. referencedClasses: [],
  53388. messageSends: ["subclassResponsibility"]
  53389. }),
  53390. $globals.SequenceableCollectionTest);
  53391. $core.addMethod(
  53392. $core.method({
  53393. selector: "collectionFirstTwo",
  53394. protocol: "fixture",
  53395. fn: function (){
  53396. var self=this;
  53397. return $core.withContext(function($ctx1) {
  53398. self._subclassResponsibility();
  53399. return self;
  53400. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  53401. },
  53402. args: [],
  53403. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  53404. referencedClasses: [],
  53405. messageSends: ["subclassResponsibility"]
  53406. }),
  53407. $globals.SequenceableCollectionTest);
  53408. $core.addMethod(
  53409. $core.method({
  53410. selector: "collectionLast",
  53411. protocol: "fixture",
  53412. fn: function (){
  53413. var self=this;
  53414. return $core.withContext(function($ctx1) {
  53415. self._subclassResponsibility();
  53416. return self;
  53417. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  53418. },
  53419. args: [],
  53420. source: "collectionLast\x0a\x09self subclassResponsibility",
  53421. referencedClasses: [],
  53422. messageSends: ["subclassResponsibility"]
  53423. }),
  53424. $globals.SequenceableCollectionTest);
  53425. $core.addMethod(
  53426. $core.method({
  53427. selector: "collectionLastTwo",
  53428. protocol: "fixture",
  53429. fn: function (){
  53430. var self=this;
  53431. return $core.withContext(function($ctx1) {
  53432. self._subclassResponsibility();
  53433. return self;
  53434. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  53435. },
  53436. args: [],
  53437. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  53438. referencedClasses: [],
  53439. messageSends: ["subclassResponsibility"]
  53440. }),
  53441. $globals.SequenceableCollectionTest);
  53442. $core.addMethod(
  53443. $core.method({
  53444. selector: "nonIndexesDo:",
  53445. protocol: "fixture",
  53446. fn: function (aBlock){
  53447. var self=this;
  53448. return $core.withContext(function($ctx1) {
  53449. $recv(aBlock)._value_((0));
  53450. $ctx1.sendIdx["value:"]=1;
  53451. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  53452. $ctx1.sendIdx["value:"]=2;
  53453. $recv(aBlock)._value_("z");
  53454. return self;
  53455. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  53456. },
  53457. args: ["aBlock"],
  53458. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  53459. referencedClasses: [],
  53460. messageSends: ["value:", "+", "collectionSize"]
  53461. }),
  53462. $globals.SequenceableCollectionTest);
  53463. $core.addMethod(
  53464. $core.method({
  53465. selector: "samplesDo:",
  53466. protocol: "fixture",
  53467. fn: function (aBlock){
  53468. var self=this;
  53469. return $core.withContext(function($ctx1) {
  53470. $recv(aBlock)._value_value_((1),self._collectionFirst());
  53471. $ctx1.sendIdx["value:value:"]=1;
  53472. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  53473. return self;
  53474. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  53475. },
  53476. args: ["aBlock"],
  53477. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  53478. referencedClasses: [],
  53479. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  53480. }),
  53481. $globals.SequenceableCollectionTest);
  53482. $core.addMethod(
  53483. $core.method({
  53484. selector: "testBeginsWith",
  53485. protocol: "tests",
  53486. fn: function (){
  53487. var self=this;
  53488. return $core.withContext(function($ctx1) {
  53489. var $2,$1,$4,$5,$3,$7,$6;
  53490. $2=self._collection();
  53491. $ctx1.sendIdx["collection"]=1;
  53492. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  53493. $ctx1.sendIdx["beginsWith:"]=1;
  53494. self._assert_($1);
  53495. $ctx1.sendIdx["assert:"]=1;
  53496. $4=self._collection();
  53497. $ctx1.sendIdx["collection"]=2;
  53498. $5=self._collection();
  53499. $ctx1.sendIdx["collection"]=3;
  53500. $3=$recv($4)._beginsWith_($5);
  53501. $ctx1.sendIdx["beginsWith:"]=2;
  53502. self._assert_($3);
  53503. $ctx1.sendIdx["assert:"]=2;
  53504. $7=self._collection();
  53505. $ctx1.sendIdx["collection"]=4;
  53506. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  53507. $ctx1.sendIdx["beginsWith:"]=3;
  53508. self._assert_($6);
  53509. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  53510. return self;
  53511. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  53512. },
  53513. args: [],
  53514. 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)",
  53515. referencedClasses: [],
  53516. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  53517. }),
  53518. $globals.SequenceableCollectionTest);
  53519. $core.addMethod(
  53520. $core.method({
  53521. selector: "testEndsWith",
  53522. protocol: "tests",
  53523. fn: function (){
  53524. var self=this;
  53525. return $core.withContext(function($ctx1) {
  53526. var $2,$1,$4,$5,$3,$7,$6;
  53527. $2=self._collection();
  53528. $ctx1.sendIdx["collection"]=1;
  53529. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  53530. $ctx1.sendIdx["endsWith:"]=1;
  53531. self._assert_($1);
  53532. $ctx1.sendIdx["assert:"]=1;
  53533. $4=self._collection();
  53534. $ctx1.sendIdx["collection"]=2;
  53535. $5=self._collection();
  53536. $ctx1.sendIdx["collection"]=3;
  53537. $3=$recv($4)._endsWith_($5);
  53538. $ctx1.sendIdx["endsWith:"]=2;
  53539. self._assert_($3);
  53540. $ctx1.sendIdx["assert:"]=2;
  53541. $7=self._collection();
  53542. $ctx1.sendIdx["collection"]=4;
  53543. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  53544. $ctx1.sendIdx["endsWith:"]=3;
  53545. self._assert_($6);
  53546. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  53547. return self;
  53548. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  53549. },
  53550. args: [],
  53551. 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)",
  53552. referencedClasses: [],
  53553. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  53554. }),
  53555. $globals.SequenceableCollectionTest);
  53556. $core.addMethod(
  53557. $core.method({
  53558. selector: "testFirst",
  53559. protocol: "tests",
  53560. fn: function (){
  53561. var self=this;
  53562. return $core.withContext(function($ctx1) {
  53563. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  53564. return self;
  53565. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  53566. },
  53567. args: [],
  53568. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  53569. referencedClasses: [],
  53570. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  53571. }),
  53572. $globals.SequenceableCollectionTest);
  53573. $core.addMethod(
  53574. $core.method({
  53575. selector: "testFirstN",
  53576. protocol: "tests",
  53577. fn: function (){
  53578. var self=this;
  53579. return $core.withContext(function($ctx1) {
  53580. var $2,$1,$4,$3,$6,$5,$7;
  53581. $2=self._collection();
  53582. $ctx1.sendIdx["collection"]=1;
  53583. $1=$recv($2)._first_((2));
  53584. $ctx1.sendIdx["first:"]=1;
  53585. self._assert_equals_($1,self._collectionFirstTwo());
  53586. $ctx1.sendIdx["assert:equals:"]=1;
  53587. $4=self._collection();
  53588. $ctx1.sendIdx["collection"]=2;
  53589. $3=$recv($4)._first_((0));
  53590. $ctx1.sendIdx["first:"]=2;
  53591. self._assert_equals_($3,$recv(self._collectionClass())._new());
  53592. $ctx1.sendIdx["assert:equals:"]=2;
  53593. $6=self._collection();
  53594. $ctx1.sendIdx["collection"]=3;
  53595. $5=$recv($6)._first_(self._collectionSize());
  53596. $ctx1.sendIdx["first:"]=3;
  53597. $7=self._collection();
  53598. $ctx1.sendIdx["collection"]=4;
  53599. self._assert_equals_($5,$7);
  53600. self._should_raise_((function(){
  53601. return $core.withContext(function($ctx2) {
  53602. return $recv(self._collection())._first_((33));
  53603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53604. }),$globals.Error);
  53605. return self;
  53606. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  53607. },
  53608. args: [],
  53609. 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",
  53610. referencedClasses: ["Error"],
  53611. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  53612. }),
  53613. $globals.SequenceableCollectionTest);
  53614. $core.addMethod(
  53615. $core.method({
  53616. selector: "testFourth",
  53617. protocol: "tests",
  53618. fn: function (){
  53619. var self=this;
  53620. return $core.withContext(function($ctx1) {
  53621. var $2,$1;
  53622. $2=self._collection();
  53623. $ctx1.sendIdx["collection"]=1;
  53624. $1=$recv($2)._fourth();
  53625. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  53626. return self;
  53627. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  53628. },
  53629. args: [],
  53630. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  53631. referencedClasses: [],
  53632. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  53633. }),
  53634. $globals.SequenceableCollectionTest);
  53635. $core.addMethod(
  53636. $core.method({
  53637. selector: "testIndexOfStartingAt",
  53638. protocol: "tests",
  53639. fn: function (){
  53640. var self=this;
  53641. var jsNull;
  53642. return $core.withContext(function($ctx1) {
  53643. var $2,$1,$4,$3;
  53644. jsNull=$recv($globals.JSON)._parse_("null");
  53645. self._samplesDo_((function(index,value){
  53646. return $core.withContext(function($ctx2) {
  53647. $2=self._collection();
  53648. $ctx2.sendIdx["collection"]=1;
  53649. $1=$recv($2)._indexOf_startingAt_(value,(1));
  53650. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  53651. self._assert_equals_($1,index);
  53652. $ctx2.sendIdx["assert:equals:"]=1;
  53653. $4=self._collection();
  53654. $ctx2.sendIdx["collection"]=2;
  53655. $3=$recv($4)._indexOf_startingAt_(value,index);
  53656. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  53657. self._assert_equals_($3,index);
  53658. $ctx2.sendIdx["assert:equals:"]=2;
  53659. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  53660. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53661. }));
  53662. return self;
  53663. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  53664. },
  53665. args: [],
  53666. 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 ]",
  53667. referencedClasses: ["JSON"],
  53668. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  53669. }),
  53670. $globals.SequenceableCollectionTest);
  53671. $core.addMethod(
  53672. $core.method({
  53673. selector: "testIndexOfStartingAtWithNull",
  53674. protocol: "tests",
  53675. fn: function (){
  53676. var self=this;
  53677. var jsNull;
  53678. return $core.withContext(function($ctx1) {
  53679. var $1,$2;
  53680. jsNull=$recv($globals.JSON)._parse_("null");
  53681. self._samplesDo_((function(index,value){
  53682. var collection;
  53683. return $core.withContext(function($ctx2) {
  53684. collection=self._collection();
  53685. collection;
  53686. $recv(collection)._at_put_(index,jsNull);
  53687. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  53688. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  53689. self._assert_equals_($1,index);
  53690. $ctx2.sendIdx["assert:equals:"]=1;
  53691. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  53692. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  53693. self._assert_equals_($2,index);
  53694. $ctx2.sendIdx["assert:equals:"]=2;
  53695. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  53696. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  53697. }));
  53698. return self;
  53699. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  53700. },
  53701. args: [],
  53702. 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 ]",
  53703. referencedClasses: ["JSON"],
  53704. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  53705. }),
  53706. $globals.SequenceableCollectionTest);
  53707. $core.addMethod(
  53708. $core.method({
  53709. selector: "testLast",
  53710. protocol: "tests",
  53711. fn: function (){
  53712. var self=this;
  53713. return $core.withContext(function($ctx1) {
  53714. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  53715. return self;
  53716. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  53717. },
  53718. args: [],
  53719. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  53720. referencedClasses: [],
  53721. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  53722. }),
  53723. $globals.SequenceableCollectionTest);
  53724. $core.addMethod(
  53725. $core.method({
  53726. selector: "testLastN",
  53727. protocol: "tests",
  53728. fn: function (){
  53729. var self=this;
  53730. return $core.withContext(function($ctx1) {
  53731. var $2,$1,$4,$3,$6,$5,$7;
  53732. $2=self._collection();
  53733. $ctx1.sendIdx["collection"]=1;
  53734. $1=$recv($2)._last_((2));
  53735. $ctx1.sendIdx["last:"]=1;
  53736. self._assert_equals_($1,self._collectionLastTwo());
  53737. $ctx1.sendIdx["assert:equals:"]=1;
  53738. $4=self._collection();
  53739. $ctx1.sendIdx["collection"]=2;
  53740. $3=$recv($4)._last_((0));
  53741. $ctx1.sendIdx["last:"]=2;
  53742. self._assert_equals_($3,$recv(self._collectionClass())._new());
  53743. $ctx1.sendIdx["assert:equals:"]=2;
  53744. $6=self._collection();
  53745. $ctx1.sendIdx["collection"]=3;
  53746. $5=$recv($6)._last_(self._collectionSize());
  53747. $ctx1.sendIdx["last:"]=3;
  53748. $7=self._collection();
  53749. $ctx1.sendIdx["collection"]=4;
  53750. self._assert_equals_($5,$7);
  53751. self._should_raise_((function(){
  53752. return $core.withContext(function($ctx2) {
  53753. return $recv(self._collection())._last_((33));
  53754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53755. }),$globals.Error);
  53756. return self;
  53757. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  53758. },
  53759. args: [],
  53760. 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",
  53761. referencedClasses: ["Error"],
  53762. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  53763. }),
  53764. $globals.SequenceableCollectionTest);
  53765. $core.addMethod(
  53766. $core.method({
  53767. selector: "testSecond",
  53768. protocol: "tests",
  53769. fn: function (){
  53770. var self=this;
  53771. return $core.withContext(function($ctx1) {
  53772. var $2,$1;
  53773. $2=self._collection();
  53774. $ctx1.sendIdx["collection"]=1;
  53775. $1=$recv($2)._second();
  53776. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  53777. return self;
  53778. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  53779. },
  53780. args: [],
  53781. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  53782. referencedClasses: [],
  53783. messageSends: ["assert:equals:", "second", "collection", "at:"]
  53784. }),
  53785. $globals.SequenceableCollectionTest);
  53786. $core.addMethod(
  53787. $core.method({
  53788. selector: "testThird",
  53789. protocol: "tests",
  53790. fn: function (){
  53791. var self=this;
  53792. return $core.withContext(function($ctx1) {
  53793. var $2,$1;
  53794. $2=self._collection();
  53795. $ctx1.sendIdx["collection"]=1;
  53796. $1=$recv($2)._third();
  53797. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  53798. return self;
  53799. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  53800. },
  53801. args: [],
  53802. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  53803. referencedClasses: [],
  53804. messageSends: ["assert:equals:", "third", "collection", "at:"]
  53805. }),
  53806. $globals.SequenceableCollectionTest);
  53807. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  53808. $core.addMethod(
  53809. $core.method({
  53810. selector: "collection",
  53811. protocol: "fixture",
  53812. fn: function (){
  53813. var self=this;
  53814. return [(1), (2), (3), (-4)];
  53815. },
  53816. args: [],
  53817. source: "collection\x0a\x09^ #(1 2 3 -4)",
  53818. referencedClasses: [],
  53819. messageSends: []
  53820. }),
  53821. $globals.ArrayTest);
  53822. $core.addMethod(
  53823. $core.method({
  53824. selector: "collectionFirst",
  53825. protocol: "fixture",
  53826. fn: function (){
  53827. var self=this;
  53828. return (1);
  53829. },
  53830. args: [],
  53831. source: "collectionFirst\x0a\x09^ 1",
  53832. referencedClasses: [],
  53833. messageSends: []
  53834. }),
  53835. $globals.ArrayTest);
  53836. $core.addMethod(
  53837. $core.method({
  53838. selector: "collectionFirstTwo",
  53839. protocol: "fixture",
  53840. fn: function (){
  53841. var self=this;
  53842. return [(1), (2)];
  53843. },
  53844. args: [],
  53845. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  53846. referencedClasses: [],
  53847. messageSends: []
  53848. }),
  53849. $globals.ArrayTest);
  53850. $core.addMethod(
  53851. $core.method({
  53852. selector: "collectionLast",
  53853. protocol: "fixture",
  53854. fn: function (){
  53855. var self=this;
  53856. return (-4);
  53857. },
  53858. args: [],
  53859. source: "collectionLast\x0a\x09^ -4",
  53860. referencedClasses: [],
  53861. messageSends: []
  53862. }),
  53863. $globals.ArrayTest);
  53864. $core.addMethod(
  53865. $core.method({
  53866. selector: "collectionLastTwo",
  53867. protocol: "fixture",
  53868. fn: function (){
  53869. var self=this;
  53870. return [(3), (-4)];
  53871. },
  53872. args: [],
  53873. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  53874. referencedClasses: [],
  53875. messageSends: []
  53876. }),
  53877. $globals.ArrayTest);
  53878. $core.addMethod(
  53879. $core.method({
  53880. selector: "collectionOfPrintStrings",
  53881. protocol: "fixture",
  53882. fn: function (){
  53883. var self=this;
  53884. return ["1", "2", "3", "-4"];
  53885. },
  53886. args: [],
  53887. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  53888. referencedClasses: [],
  53889. messageSends: []
  53890. }),
  53891. $globals.ArrayTest);
  53892. $core.addMethod(
  53893. $core.method({
  53894. selector: "collectionSize",
  53895. protocol: "fixture",
  53896. fn: function (){
  53897. var self=this;
  53898. return (4);
  53899. },
  53900. args: [],
  53901. source: "collectionSize\x0a\x09^ 4",
  53902. referencedClasses: [],
  53903. messageSends: []
  53904. }),
  53905. $globals.ArrayTest);
  53906. $core.addMethod(
  53907. $core.method({
  53908. selector: "collectionWithDuplicates",
  53909. protocol: "fixture",
  53910. fn: function (){
  53911. var self=this;
  53912. return ["a", "b", "c", (1), (2), (1), "a", []];
  53913. },
  53914. args: [],
  53915. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  53916. referencedClasses: [],
  53917. messageSends: []
  53918. }),
  53919. $globals.ArrayTest);
  53920. $core.addMethod(
  53921. $core.method({
  53922. selector: "collectionWithNewValue",
  53923. protocol: "fixture",
  53924. fn: function (){
  53925. var self=this;
  53926. return [(1), (2), (3), (-4), "N"];
  53927. },
  53928. args: [],
  53929. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  53930. referencedClasses: [],
  53931. messageSends: []
  53932. }),
  53933. $globals.ArrayTest);
  53934. $core.addMethod(
  53935. $core.method({
  53936. selector: "sampleNewIndex",
  53937. protocol: "fixture",
  53938. fn: function (){
  53939. var self=this;
  53940. return (5);
  53941. },
  53942. args: [],
  53943. source: "sampleNewIndex\x0a\x09^ 5",
  53944. referencedClasses: [],
  53945. messageSends: []
  53946. }),
  53947. $globals.ArrayTest);
  53948. $core.addMethod(
  53949. $core.method({
  53950. selector: "samplesDo:",
  53951. protocol: "fixture",
  53952. fn: function (aBlock){
  53953. var self=this;
  53954. return $core.withContext(function($ctx1) {
  53955. (
  53956. $ctx1.supercall = true,
  53957. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  53958. $ctx1.supercall = false;
  53959. $recv(aBlock)._value_value_((3),(3));
  53960. return self;
  53961. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  53962. },
  53963. args: ["aBlock"],
  53964. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  53965. referencedClasses: [],
  53966. messageSends: ["samplesDo:", "value:value:"]
  53967. }),
  53968. $globals.ArrayTest);
  53969. $core.addMethod(
  53970. $core.method({
  53971. selector: "testAdd",
  53972. protocol: "tests",
  53973. fn: function (){
  53974. var self=this;
  53975. var array;
  53976. return $core.withContext(function($ctx1) {
  53977. array=self._collection();
  53978. $recv(array)._add_((6));
  53979. self._assert_equals_($recv(array)._last(),(6));
  53980. return self;
  53981. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  53982. },
  53983. args: [],
  53984. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  53985. referencedClasses: [],
  53986. messageSends: ["collection", "add:", "assert:equals:", "last"]
  53987. }),
  53988. $globals.ArrayTest);
  53989. $core.addMethod(
  53990. $core.method({
  53991. selector: "testAddFirst",
  53992. protocol: "tests",
  53993. fn: function (){
  53994. var self=this;
  53995. return $core.withContext(function($ctx1) {
  53996. var $3,$2,$1;
  53997. $3=self._collection();
  53998. $recv($3)._addFirst_((0));
  53999. $2=$recv($3)._yourself();
  54000. $1=$recv($2)._first();
  54001. self._assert_equals_($1,(0));
  54002. return self;
  54003. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  54004. },
  54005. args: [],
  54006. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  54007. referencedClasses: [],
  54008. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  54009. }),
  54010. $globals.ArrayTest);
  54011. $core.addMethod(
  54012. $core.method({
  54013. selector: "testPrintString",
  54014. protocol: "tests",
  54015. fn: function (){
  54016. var self=this;
  54017. var array;
  54018. return $core.withContext(function($ctx1) {
  54019. var $1,$2,$3,$4,$5,$6,$7,$8;
  54020. array=$recv($globals.Array)._new();
  54021. $1=$recv(array)._printString();
  54022. $ctx1.sendIdx["printString"]=1;
  54023. self._assert_equals_($1,"an Array ()");
  54024. $ctx1.sendIdx["assert:equals:"]=1;
  54025. $2=array;
  54026. $recv($2)._add_((1));
  54027. $ctx1.sendIdx["add:"]=1;
  54028. $3=$recv($2)._add_((3));
  54029. $ctx1.sendIdx["add:"]=2;
  54030. $4=$recv(array)._printString();
  54031. $ctx1.sendIdx["printString"]=2;
  54032. self._assert_equals_($4,"an Array (1 3)");
  54033. $ctx1.sendIdx["assert:equals:"]=2;
  54034. $recv(array)._add_("foo");
  54035. $5=$recv(array)._printString();
  54036. $ctx1.sendIdx["printString"]=3;
  54037. self._assert_equals_($5,"an Array (1 3 'foo')");
  54038. $ctx1.sendIdx["assert:equals:"]=3;
  54039. $6=array;
  54040. $recv($6)._remove_((1));
  54041. $ctx1.sendIdx["remove:"]=1;
  54042. $recv($6)._remove_((3));
  54043. $7=$recv(array)._printString();
  54044. $ctx1.sendIdx["printString"]=4;
  54045. self._assert_equals_($7,"an Array ('foo')");
  54046. $ctx1.sendIdx["assert:equals:"]=4;
  54047. $recv(array)._addLast_((3));
  54048. $ctx1.sendIdx["addLast:"]=1;
  54049. $8=$recv(array)._printString();
  54050. $ctx1.sendIdx["printString"]=5;
  54051. self._assert_equals_($8,"an Array ('foo' 3)");
  54052. $ctx1.sendIdx["assert:equals:"]=5;
  54053. $recv(array)._addLast_((3));
  54054. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  54055. return self;
  54056. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  54057. },
  54058. args: [],
  54059. 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)'.",
  54060. referencedClasses: ["Array"],
  54061. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  54062. }),
  54063. $globals.ArrayTest);
  54064. $core.addMethod(
  54065. $core.method({
  54066. selector: "testRemove",
  54067. protocol: "tests",
  54068. fn: function (){
  54069. var self=this;
  54070. var array;
  54071. return $core.withContext(function($ctx1) {
  54072. array=[(1), (2), (3), (4), (5)];
  54073. $recv(array)._remove_((3));
  54074. $ctx1.sendIdx["remove:"]=1;
  54075. self._assert_equals_(array,[(1), (2), (4), (5)]);
  54076. self._should_raise_((function(){
  54077. return $core.withContext(function($ctx2) {
  54078. return $recv(array)._remove_((3));
  54079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54080. }),$globals.Error);
  54081. return self;
  54082. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  54083. },
  54084. args: [],
  54085. 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",
  54086. referencedClasses: ["Error"],
  54087. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  54088. }),
  54089. $globals.ArrayTest);
  54090. $core.addMethod(
  54091. $core.method({
  54092. selector: "testRemoveFromTo",
  54093. protocol: "tests",
  54094. fn: function (){
  54095. var self=this;
  54096. return $core.withContext(function($ctx1) {
  54097. var $1,$2;
  54098. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  54099. $ctx1.sendIdx["removeFrom:to:"]=1;
  54100. self._assert_equals_($1,[(4)]);
  54101. $ctx1.sendIdx["assert:equals:"]=1;
  54102. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  54103. $ctx1.sendIdx["removeFrom:to:"]=2;
  54104. self._assert_equals_($2,[(1), (4)]);
  54105. $ctx1.sendIdx["assert:equals:"]=2;
  54106. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  54107. return self;
  54108. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  54109. },
  54110. args: [],
  54111. 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)",
  54112. referencedClasses: [],
  54113. messageSends: ["assert:equals:", "removeFrom:to:"]
  54114. }),
  54115. $globals.ArrayTest);
  54116. $core.addMethod(
  54117. $core.method({
  54118. selector: "testRemoveIndex",
  54119. protocol: "tests",
  54120. fn: function (){
  54121. var self=this;
  54122. return $core.withContext(function($ctx1) {
  54123. var $1,$2;
  54124. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  54125. $ctx1.sendIdx["removeIndex:"]=1;
  54126. self._assert_equals_($1,[(1), (3), (4)]);
  54127. $ctx1.sendIdx["assert:equals:"]=1;
  54128. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  54129. $ctx1.sendIdx["removeIndex:"]=2;
  54130. self._assert_equals_($2,[(2), (3), (4)]);
  54131. $ctx1.sendIdx["assert:equals:"]=2;
  54132. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  54133. return self;
  54134. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  54135. },
  54136. args: [],
  54137. 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: #()",
  54138. referencedClasses: [],
  54139. messageSends: ["assert:equals:", "removeIndex:"]
  54140. }),
  54141. $globals.ArrayTest);
  54142. $core.addMethod(
  54143. $core.method({
  54144. selector: "testRemoveLast",
  54145. protocol: "tests",
  54146. fn: function (){
  54147. var self=this;
  54148. var array;
  54149. return $core.withContext(function($ctx1) {
  54150. array=[(1), (2)];
  54151. $recv(array)._removeLast();
  54152. self._assert_equals_($recv(array)._last(),(1));
  54153. return self;
  54154. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  54155. },
  54156. args: [],
  54157. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  54158. referencedClasses: [],
  54159. messageSends: ["removeLast", "assert:equals:", "last"]
  54160. }),
  54161. $globals.ArrayTest);
  54162. $core.addMethod(
  54163. $core.method({
  54164. selector: "testReversed",
  54165. protocol: "tests",
  54166. fn: function (){
  54167. var self=this;
  54168. var array;
  54169. return $core.withContext(function($ctx1) {
  54170. array=[(5), (4), (3), (2), (1)];
  54171. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  54172. return self;
  54173. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  54174. },
  54175. args: [],
  54176. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  54177. referencedClasses: [],
  54178. messageSends: ["assert:equals:", "reversed"]
  54179. }),
  54180. $globals.ArrayTest);
  54181. $core.addMethod(
  54182. $core.method({
  54183. selector: "testSort",
  54184. protocol: "tests",
  54185. fn: function (){
  54186. var self=this;
  54187. var array;
  54188. return $core.withContext(function($ctx1) {
  54189. array=[(10), (1), (5)];
  54190. $recv(array)._sort();
  54191. self._assert_equals_(array,[(1), (5), (10)]);
  54192. return self;
  54193. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  54194. },
  54195. args: [],
  54196. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  54197. referencedClasses: [],
  54198. messageSends: ["sort", "assert:equals:"]
  54199. }),
  54200. $globals.ArrayTest);
  54201. $core.addMethod(
  54202. $core.method({
  54203. selector: "collectionClass",
  54204. protocol: "fixture",
  54205. fn: function (){
  54206. var self=this;
  54207. return $globals.Array;
  54208. },
  54209. args: [],
  54210. source: "collectionClass\x0a\x09^ Array",
  54211. referencedClasses: ["Array"],
  54212. messageSends: []
  54213. }),
  54214. $globals.ArrayTest.klass);
  54215. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  54216. $core.addMethod(
  54217. $core.method({
  54218. selector: "collection",
  54219. protocol: "fixture",
  54220. fn: function (){
  54221. var self=this;
  54222. return "helLo";
  54223. },
  54224. args: [],
  54225. source: "collection\x0a\x09^ 'helLo'",
  54226. referencedClasses: [],
  54227. messageSends: []
  54228. }),
  54229. $globals.StringTest);
  54230. $core.addMethod(
  54231. $core.method({
  54232. selector: "collectionFirst",
  54233. protocol: "fixture",
  54234. fn: function (){
  54235. var self=this;
  54236. return "h";
  54237. },
  54238. args: [],
  54239. source: "collectionFirst\x0a\x09^ 'h'",
  54240. referencedClasses: [],
  54241. messageSends: []
  54242. }),
  54243. $globals.StringTest);
  54244. $core.addMethod(
  54245. $core.method({
  54246. selector: "collectionFirstTwo",
  54247. protocol: "fixture",
  54248. fn: function (){
  54249. var self=this;
  54250. return "he";
  54251. },
  54252. args: [],
  54253. source: "collectionFirstTwo\x0a\x09^ 'he'",
  54254. referencedClasses: [],
  54255. messageSends: []
  54256. }),
  54257. $globals.StringTest);
  54258. $core.addMethod(
  54259. $core.method({
  54260. selector: "collectionLast",
  54261. protocol: "fixture",
  54262. fn: function (){
  54263. var self=this;
  54264. return "o";
  54265. },
  54266. args: [],
  54267. source: "collectionLast\x0a\x09^ 'o'",
  54268. referencedClasses: [],
  54269. messageSends: []
  54270. }),
  54271. $globals.StringTest);
  54272. $core.addMethod(
  54273. $core.method({
  54274. selector: "collectionLastTwo",
  54275. protocol: "fixture",
  54276. fn: function (){
  54277. var self=this;
  54278. return "Lo";
  54279. },
  54280. args: [],
  54281. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  54282. referencedClasses: [],
  54283. messageSends: []
  54284. }),
  54285. $globals.StringTest);
  54286. $core.addMethod(
  54287. $core.method({
  54288. selector: "collectionOfPrintStrings",
  54289. protocol: "fixture",
  54290. fn: function (){
  54291. var self=this;
  54292. return "'h''e''l''L''o'";
  54293. },
  54294. args: [],
  54295. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  54296. referencedClasses: [],
  54297. messageSends: []
  54298. }),
  54299. $globals.StringTest);
  54300. $core.addMethod(
  54301. $core.method({
  54302. selector: "collectionSize",
  54303. protocol: "fixture",
  54304. fn: function (){
  54305. var self=this;
  54306. return (5);
  54307. },
  54308. args: [],
  54309. source: "collectionSize\x0a\x09^ 5",
  54310. referencedClasses: [],
  54311. messageSends: []
  54312. }),
  54313. $globals.StringTest);
  54314. $core.addMethod(
  54315. $core.method({
  54316. selector: "collectionWithDuplicates",
  54317. protocol: "fixture",
  54318. fn: function (){
  54319. var self=this;
  54320. return "abbaerten";
  54321. },
  54322. args: [],
  54323. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  54324. referencedClasses: [],
  54325. messageSends: []
  54326. }),
  54327. $globals.StringTest);
  54328. $core.addMethod(
  54329. $core.method({
  54330. selector: "collectionWithNewValue",
  54331. protocol: "fixture",
  54332. fn: function (){
  54333. var self=this;
  54334. return "helLoN";
  54335. },
  54336. args: [],
  54337. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  54338. referencedClasses: [],
  54339. messageSends: []
  54340. }),
  54341. $globals.StringTest);
  54342. $core.addMethod(
  54343. $core.method({
  54344. selector: "sampleNewValueAsCollection",
  54345. protocol: "fixture",
  54346. fn: function (){
  54347. var self=this;
  54348. return "N";
  54349. },
  54350. args: [],
  54351. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  54352. referencedClasses: [],
  54353. messageSends: []
  54354. }),
  54355. $globals.StringTest);
  54356. $core.addMethod(
  54357. $core.method({
  54358. selector: "samplesDo:",
  54359. protocol: "fixture",
  54360. fn: function (aBlock){
  54361. var self=this;
  54362. return $core.withContext(function($ctx1) {
  54363. (
  54364. $ctx1.supercall = true,
  54365. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  54366. $ctx1.supercall = false;
  54367. $recv(aBlock)._value_value_((3),"l");
  54368. return self;
  54369. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  54370. },
  54371. args: ["aBlock"],
  54372. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  54373. referencedClasses: [],
  54374. messageSends: ["samplesDo:", "value:value:"]
  54375. }),
  54376. $globals.StringTest);
  54377. $core.addMethod(
  54378. $core.method({
  54379. selector: "testAddAll",
  54380. protocol: "tests",
  54381. fn: function (){
  54382. var self=this;
  54383. return $core.withContext(function($ctx1) {
  54384. var $1;
  54385. self._should_raise_((function(){
  54386. return $core.withContext(function($ctx2) {
  54387. $1=self._collection();
  54388. $ctx2.sendIdx["collection"]=1;
  54389. return $recv($1)._addAll_(self._collection());
  54390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54391. }),$globals.Error);
  54392. return self;
  54393. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  54394. },
  54395. args: [],
  54396. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  54397. referencedClasses: ["Error"],
  54398. messageSends: ["should:raise:", "addAll:", "collection"]
  54399. }),
  54400. $globals.StringTest);
  54401. $core.addMethod(
  54402. $core.method({
  54403. selector: "testAddRemove",
  54404. protocol: "tests",
  54405. fn: function (){
  54406. var self=this;
  54407. return $core.withContext(function($ctx1) {
  54408. self._should_raise_((function(){
  54409. return $core.withContext(function($ctx2) {
  54410. return "hello"._add_("a");
  54411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54412. }),$globals.Error);
  54413. $ctx1.sendIdx["should:raise:"]=1;
  54414. self._should_raise_((function(){
  54415. return $core.withContext(function($ctx2) {
  54416. return "hello"._remove_("h");
  54417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54418. }),$globals.Error);
  54419. return self;
  54420. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  54421. },
  54422. args: [],
  54423. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  54424. referencedClasses: ["Error"],
  54425. messageSends: ["should:raise:", "add:", "remove:"]
  54426. }),
  54427. $globals.StringTest);
  54428. $core.addMethod(
  54429. $core.method({
  54430. selector: "testAsArray",
  54431. protocol: "tests",
  54432. fn: function (){
  54433. var self=this;
  54434. return $core.withContext(function($ctx1) {
  54435. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  54436. return self;
  54437. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  54438. },
  54439. args: [],
  54440. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  54441. referencedClasses: [],
  54442. messageSends: ["assert:equals:", "asArray"]
  54443. }),
  54444. $globals.StringTest);
  54445. $core.addMethod(
  54446. $core.method({
  54447. selector: "testAsLowerCase",
  54448. protocol: "tests",
  54449. fn: function (){
  54450. var self=this;
  54451. return $core.withContext(function($ctx1) {
  54452. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  54453. return self;
  54454. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  54455. },
  54456. args: [],
  54457. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  54458. referencedClasses: [],
  54459. messageSends: ["assert:equals:", "asLowercase"]
  54460. }),
  54461. $globals.StringTest);
  54462. $core.addMethod(
  54463. $core.method({
  54464. selector: "testAsNumber",
  54465. protocol: "tests",
  54466. fn: function (){
  54467. var self=this;
  54468. return $core.withContext(function($ctx1) {
  54469. var $1,$2;
  54470. $1="3"._asNumber();
  54471. $ctx1.sendIdx["asNumber"]=1;
  54472. self._assert_equals_($1,(3));
  54473. $ctx1.sendIdx["assert:equals:"]=1;
  54474. $2="-3"._asNumber();
  54475. $ctx1.sendIdx["asNumber"]=2;
  54476. self._assert_equals_($2,(-3));
  54477. $ctx1.sendIdx["assert:equals:"]=2;
  54478. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  54479. return self;
  54480. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  54481. },
  54482. args: [],
  54483. 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.",
  54484. referencedClasses: [],
  54485. messageSends: ["assert:equals:", "asNumber"]
  54486. }),
  54487. $globals.StringTest);
  54488. $core.addMethod(
  54489. $core.method({
  54490. selector: "testAsUpperCase",
  54491. protocol: "tests",
  54492. fn: function (){
  54493. var self=this;
  54494. return $core.withContext(function($ctx1) {
  54495. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  54496. return self;
  54497. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  54498. },
  54499. args: [],
  54500. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  54501. referencedClasses: [],
  54502. messageSends: ["assert:equals:", "asUppercase"]
  54503. }),
  54504. $globals.StringTest);
  54505. $core.addMethod(
  54506. $core.method({
  54507. selector: "testAsciiValue",
  54508. protocol: "tests",
  54509. fn: function (){
  54510. var self=this;
  54511. var characterA,characterU;
  54512. return $core.withContext(function($ctx1) {
  54513. var $1;
  54514. characterA="A";
  54515. characterU="U";
  54516. $1=$recv(characterA)._asciiValue();
  54517. $ctx1.sendIdx["asciiValue"]=1;
  54518. self._assert_equals_($1,(65));
  54519. $ctx1.sendIdx["assert:equals:"]=1;
  54520. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  54521. return self;
  54522. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  54523. },
  54524. args: [],
  54525. 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",
  54526. referencedClasses: [],
  54527. messageSends: ["assert:equals:", "asciiValue"]
  54528. }),
  54529. $globals.StringTest);
  54530. $core.addMethod(
  54531. $core.method({
  54532. selector: "testAtIfAbsentPut",
  54533. protocol: "tests",
  54534. fn: function (){
  54535. var self=this;
  54536. return $core.withContext(function($ctx1) {
  54537. self._should_raise_((function(){
  54538. return $core.withContext(function($ctx2) {
  54539. return "hello"._at_ifAbsentPut_((6),(function(){
  54540. return "a";
  54541. }));
  54542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54543. }),$globals.Error);
  54544. return self;
  54545. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  54546. },
  54547. args: [],
  54548. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  54549. referencedClasses: ["Error"],
  54550. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  54551. }),
  54552. $globals.StringTest);
  54553. $core.addMethod(
  54554. $core.method({
  54555. selector: "testAtPut",
  54556. protocol: "tests",
  54557. fn: function (){
  54558. var self=this;
  54559. return $core.withContext(function($ctx1) {
  54560. self._should_raise_((function(){
  54561. return $core.withContext(function($ctx2) {
  54562. return "hello"._at_put_((1),"a");
  54563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54564. }),$globals.Error);
  54565. return self;
  54566. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  54567. },
  54568. args: [],
  54569. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  54570. referencedClasses: ["Error"],
  54571. messageSends: ["should:raise:", "at:put:"]
  54572. }),
  54573. $globals.StringTest);
  54574. $core.addMethod(
  54575. $core.method({
  54576. selector: "testCapitalized",
  54577. protocol: "tests",
  54578. fn: function (){
  54579. var self=this;
  54580. return $core.withContext(function($ctx1) {
  54581. var $1,$2,$3;
  54582. $1="test"._capitalized();
  54583. $ctx1.sendIdx["capitalized"]=1;
  54584. self._assert_equals_($1,"Test");
  54585. $ctx1.sendIdx["assert:equals:"]=1;
  54586. $2="Test"._capitalized();
  54587. $ctx1.sendIdx["capitalized"]=2;
  54588. self._assert_equals_($2,"Test");
  54589. $ctx1.sendIdx["assert:equals:"]=2;
  54590. self._assert_equals_(""._capitalized(),"");
  54591. $ctx1.sendIdx["assert:equals:"]=3;
  54592. $3="Test"._isCapitalized();
  54593. $ctx1.sendIdx["isCapitalized"]=1;
  54594. self._assert_equals_($3,true);
  54595. $ctx1.sendIdx["assert:equals:"]=4;
  54596. self._assert_equals_("test"._isCapitalized(),false);
  54597. return self;
  54598. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  54599. },
  54600. args: [],
  54601. 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.",
  54602. referencedClasses: [],
  54603. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  54604. }),
  54605. $globals.StringTest);
  54606. $core.addMethod(
  54607. $core.method({
  54608. selector: "testCharCodeAt",
  54609. protocol: "tests",
  54610. fn: function (){
  54611. var self=this;
  54612. return $core.withContext(function($ctx1) {
  54613. var $1,$2,$3,$4,$5;
  54614. $1="jackie"._charCodeAt_((1));
  54615. $ctx1.sendIdx["charCodeAt:"]=1;
  54616. self._assert_equals_($1,(106));
  54617. $ctx1.sendIdx["assert:equals:"]=1;
  54618. $2="jackie"._charCodeAt_((2));
  54619. $ctx1.sendIdx["charCodeAt:"]=2;
  54620. self._assert_equals_($2,(97));
  54621. $ctx1.sendIdx["assert:equals:"]=2;
  54622. $3="jackie"._charCodeAt_((3));
  54623. $ctx1.sendIdx["charCodeAt:"]=3;
  54624. self._assert_equals_($3,(99));
  54625. $ctx1.sendIdx["assert:equals:"]=3;
  54626. $4="jackie"._charCodeAt_((4));
  54627. $ctx1.sendIdx["charCodeAt:"]=4;
  54628. self._assert_equals_($4,(107));
  54629. $ctx1.sendIdx["assert:equals:"]=4;
  54630. $5="jackie"._charCodeAt_((5));
  54631. $ctx1.sendIdx["charCodeAt:"]=5;
  54632. self._assert_equals_($5,(105));
  54633. $ctx1.sendIdx["assert:equals:"]=5;
  54634. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  54635. return self;
  54636. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  54637. },
  54638. args: [],
  54639. 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",
  54640. referencedClasses: [],
  54641. messageSends: ["assert:equals:", "charCodeAt:"]
  54642. }),
  54643. $globals.StringTest);
  54644. $core.addMethod(
  54645. $core.method({
  54646. selector: "testCopyFromTo",
  54647. protocol: "tests",
  54648. fn: function (){
  54649. var self=this;
  54650. return $core.withContext(function($ctx1) {
  54651. var $1;
  54652. $1="jackie"._copyFrom_to_((1),(3));
  54653. $ctx1.sendIdx["copyFrom:to:"]=1;
  54654. self._assert_equals_($1,"jac");
  54655. $ctx1.sendIdx["assert:equals:"]=1;
  54656. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  54657. return self;
  54658. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  54659. },
  54660. args: [],
  54661. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  54662. referencedClasses: [],
  54663. messageSends: ["assert:equals:", "copyFrom:to:"]
  54664. }),
  54665. $globals.StringTest);
  54666. $core.addMethod(
  54667. $core.method({
  54668. selector: "testCopySeparates",
  54669. protocol: "tests",
  54670. fn: function (){
  54671. var self=this;
  54672. return $core.withContext(function($ctx1) {
  54673. var $3,$2,$1;
  54674. $3=self._collection();
  54675. $ctx1.sendIdx["collection"]=1;
  54676. $2=$recv($3)._copy();
  54677. $1=$recv($2).__eq_eq(self._collection());
  54678. self._assert_($1);
  54679. return self;
  54680. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  54681. },
  54682. args: [],
  54683. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  54684. referencedClasses: [],
  54685. messageSends: ["assert:", "==", "copy", "collection"]
  54686. }),
  54687. $globals.StringTest);
  54688. $core.addMethod(
  54689. $core.method({
  54690. selector: "testCopyWithoutAll",
  54691. protocol: "tests",
  54692. fn: function (){
  54693. var self=this;
  54694. return $core.withContext(function($ctx1) {
  54695. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  54696. return self;
  54697. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  54698. },
  54699. args: [],
  54700. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  54701. referencedClasses: [],
  54702. messageSends: ["assert:equals:", "copyWithoutAll:"]
  54703. }),
  54704. $globals.StringTest);
  54705. $core.addMethod(
  54706. $core.method({
  54707. selector: "testEquality",
  54708. protocol: "tests",
  54709. fn: function (){
  54710. var self=this;
  54711. return $core.withContext(function($ctx1) {
  54712. var $1,$2,$3;
  54713. self._assert_equals_("hello","hello");
  54714. $ctx1.sendIdx["assert:equals:"]=1;
  54715. $1="hello".__eq("world");
  54716. $ctx1.sendIdx["="]=1;
  54717. self._deny_($1);
  54718. $ctx1.sendIdx["deny:"]=1;
  54719. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  54720. })));
  54721. $ctx1.sendIdx["="]=2;
  54722. self._deny_($2);
  54723. $ctx1.sendIdx["deny:"]=2;
  54724. $3="hello"._yourself();
  54725. $ctx1.sendIdx["yourself"]=1;
  54726. self._assert_equals_("hello",$3);
  54727. $ctx1.sendIdx["assert:equals:"]=2;
  54728. self._assert_equals_("hello"._yourself(),"hello");
  54729. self._deny_("".__eq((0)));
  54730. return self;
  54731. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  54732. },
  54733. args: [],
  54734. 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",
  54735. referencedClasses: [],
  54736. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  54737. }),
  54738. $globals.StringTest);
  54739. $core.addMethod(
  54740. $core.method({
  54741. selector: "testIdentity",
  54742. protocol: "tests",
  54743. fn: function (){
  54744. var self=this;
  54745. return $core.withContext(function($ctx1) {
  54746. var $1,$2,$4,$3,$5;
  54747. $1="hello".__eq_eq("hello");
  54748. $ctx1.sendIdx["=="]=1;
  54749. self._assert_($1);
  54750. $ctx1.sendIdx["assert:"]=1;
  54751. $2="hello".__eq_eq("world");
  54752. $ctx1.sendIdx["=="]=2;
  54753. self._deny_($2);
  54754. $ctx1.sendIdx["deny:"]=1;
  54755. $4="hello"._yourself();
  54756. $ctx1.sendIdx["yourself"]=1;
  54757. $3="hello".__eq_eq($4);
  54758. $ctx1.sendIdx["=="]=3;
  54759. self._assert_($3);
  54760. $ctx1.sendIdx["assert:"]=2;
  54761. $5=$recv("hello"._yourself()).__eq_eq("hello");
  54762. $ctx1.sendIdx["=="]=4;
  54763. self._assert_($5);
  54764. self._deny_("".__eq_eq((0)));
  54765. return self;
  54766. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  54767. },
  54768. args: [],
  54769. 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",
  54770. referencedClasses: [],
  54771. messageSends: ["assert:", "==", "deny:", "yourself"]
  54772. }),
  54773. $globals.StringTest);
  54774. $core.addMethod(
  54775. $core.method({
  54776. selector: "testIncludesSubString",
  54777. protocol: "tests",
  54778. fn: function (){
  54779. var self=this;
  54780. return $core.withContext(function($ctx1) {
  54781. var $1;
  54782. $1="amber"._includesSubString_("ber");
  54783. $ctx1.sendIdx["includesSubString:"]=1;
  54784. self._assert_($1);
  54785. self._deny_("amber"._includesSubString_("zork"));
  54786. return self;
  54787. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  54788. },
  54789. args: [],
  54790. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  54791. referencedClasses: [],
  54792. messageSends: ["assert:", "includesSubString:", "deny:"]
  54793. }),
  54794. $globals.StringTest);
  54795. $core.addMethod(
  54796. $core.method({
  54797. selector: "testIndexOfStartingAtWithNull",
  54798. protocol: "tests",
  54799. fn: function (){
  54800. var self=this;
  54801. return self;
  54802. },
  54803. args: [],
  54804. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  54805. referencedClasses: [],
  54806. messageSends: []
  54807. }),
  54808. $globals.StringTest);
  54809. $core.addMethod(
  54810. $core.method({
  54811. selector: "testIndexOfWithNull",
  54812. protocol: "tests",
  54813. fn: function (){
  54814. var self=this;
  54815. return self;
  54816. },
  54817. args: [],
  54818. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  54819. referencedClasses: [],
  54820. messageSends: []
  54821. }),
  54822. $globals.StringTest);
  54823. $core.addMethod(
  54824. $core.method({
  54825. selector: "testIsVowel",
  54826. protocol: "tests",
  54827. fn: function (){
  54828. var self=this;
  54829. var vowel,consonant;
  54830. return $core.withContext(function($ctx1) {
  54831. var $1;
  54832. vowel="u";
  54833. consonant="z";
  54834. $1=$recv(vowel)._isVowel();
  54835. $ctx1.sendIdx["isVowel"]=1;
  54836. self._assert_equals_($1,true);
  54837. $ctx1.sendIdx["assert:equals:"]=1;
  54838. self._assert_equals_($recv(consonant)._isVowel(),false);
  54839. return self;
  54840. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  54841. },
  54842. args: [],
  54843. 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",
  54844. referencedClasses: [],
  54845. messageSends: ["assert:equals:", "isVowel"]
  54846. }),
  54847. $globals.StringTest);
  54848. $core.addMethod(
  54849. $core.method({
  54850. selector: "testJoin",
  54851. protocol: "tests",
  54852. fn: function (){
  54853. var self=this;
  54854. return $core.withContext(function($ctx1) {
  54855. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  54856. return self;
  54857. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  54858. },
  54859. args: [],
  54860. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  54861. referencedClasses: [],
  54862. messageSends: ["assert:equals:", "join:"]
  54863. }),
  54864. $globals.StringTest);
  54865. $core.addMethod(
  54866. $core.method({
  54867. selector: "testRemoveAll",
  54868. protocol: "tests",
  54869. fn: function (){
  54870. var self=this;
  54871. return $core.withContext(function($ctx1) {
  54872. self._should_raise_((function(){
  54873. return $core.withContext(function($ctx2) {
  54874. return $recv(self._collection())._removeAll();
  54875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54876. }),$globals.Error);
  54877. return self;
  54878. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  54879. },
  54880. args: [],
  54881. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  54882. referencedClasses: ["Error"],
  54883. messageSends: ["should:raise:", "removeAll", "collection"]
  54884. }),
  54885. $globals.StringTest);
  54886. $core.addMethod(
  54887. $core.method({
  54888. selector: "testReversed",
  54889. protocol: "tests",
  54890. fn: function (){
  54891. var self=this;
  54892. return $core.withContext(function($ctx1) {
  54893. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  54894. return self;
  54895. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  54896. },
  54897. args: [],
  54898. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  54899. referencedClasses: [],
  54900. messageSends: ["assert:equals:", "reversed"]
  54901. }),
  54902. $globals.StringTest);
  54903. $core.addMethod(
  54904. $core.method({
  54905. selector: "testStreamContents",
  54906. protocol: "tests",
  54907. fn: function (){
  54908. var self=this;
  54909. return $core.withContext(function($ctx1) {
  54910. self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  54911. return $core.withContext(function($ctx2) {
  54912. $recv(aStream)._nextPutAll_("hello");
  54913. $ctx2.sendIdx["nextPutAll:"]=1;
  54914. $recv(aStream)._space();
  54915. return $recv(aStream)._nextPutAll_("world");
  54916. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  54917. })),"hello world");
  54918. return self;
  54919. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  54920. },
  54921. args: [],
  54922. 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'",
  54923. referencedClasses: ["String"],
  54924. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  54925. }),
  54926. $globals.StringTest);
  54927. $core.addMethod(
  54928. $core.method({
  54929. selector: "testSubStrings",
  54930. protocol: "tests",
  54931. fn: function (){
  54932. var self=this;
  54933. return $core.withContext(function($ctx1) {
  54934. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  54935. return self;
  54936. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  54937. },
  54938. args: [],
  54939. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  54940. referencedClasses: [],
  54941. messageSends: ["assert:equals:", "subStrings:"]
  54942. }),
  54943. $globals.StringTest);
  54944. $core.addMethod(
  54945. $core.method({
  54946. selector: "testTrim",
  54947. protocol: "tests",
  54948. fn: function (){
  54949. var self=this;
  54950. return $core.withContext(function($ctx1) {
  54951. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  54952. $ctx1.sendIdx["assert:equals:"]=1;
  54953. self._assert_equals_("jackie "._trimRight(),"jackie");
  54954. return self;
  54955. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  54956. },
  54957. args: [],
  54958. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  54959. referencedClasses: [],
  54960. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  54961. }),
  54962. $globals.StringTest);
  54963. $core.addMethod(
  54964. $core.method({
  54965. selector: "testValue",
  54966. protocol: "tests",
  54967. fn: function (){
  54968. var self=this;
  54969. return $core.withContext(function($ctx1) {
  54970. self._assert_equals_("asString"._value_((1)),"1");
  54971. $ctx1.sendIdx["assert:equals:"]=1;
  54972. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  54973. return self;
  54974. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  54975. },
  54976. args: [],
  54977. 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')",
  54978. referencedClasses: [],
  54979. messageSends: ["assert:equals:", "value:", "collect:"]
  54980. }),
  54981. $globals.StringTest);
  54982. $core.addMethod(
  54983. $core.method({
  54984. selector: "collectionClass",
  54985. protocol: "fixture",
  54986. fn: function (){
  54987. var self=this;
  54988. return $globals.String;
  54989. },
  54990. args: [],
  54991. source: "collectionClass\x0a\x09^ String",
  54992. referencedClasses: ["String"],
  54993. messageSends: []
  54994. }),
  54995. $globals.StringTest.klass);
  54996. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  54997. $core.addMethod(
  54998. $core.method({
  54999. selector: "collection",
  55000. protocol: "fixture",
  55001. fn: function (){
  55002. var self=this;
  55003. return $core.withContext(function($ctx1) {
  55004. var $1;
  55005. $1=$recv($globals.Set)._new();
  55006. $recv($1)._add_($globals.Smalltalk);
  55007. $ctx1.sendIdx["add:"]=1;
  55008. $recv($1)._add_(nil);
  55009. $ctx1.sendIdx["add:"]=2;
  55010. $recv($1)._add_((3).__at((3)));
  55011. $ctx1.sendIdx["add:"]=3;
  55012. $recv($1)._add_(false);
  55013. $ctx1.sendIdx["add:"]=4;
  55014. $recv($1)._add_(self["@sampleBlock"]);
  55015. return $recv($1)._yourself();
  55016. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  55017. },
  55018. args: [],
  55019. 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",
  55020. referencedClasses: ["Set", "Smalltalk"],
  55021. messageSends: ["add:", "new", "@", "yourself"]
  55022. }),
  55023. $globals.SetTest);
  55024. $core.addMethod(
  55025. $core.method({
  55026. selector: "collectionOfPrintStrings",
  55027. protocol: "fixture",
  55028. fn: function (){
  55029. var self=this;
  55030. return $core.withContext(function($ctx1) {
  55031. var $1;
  55032. $1=$recv($globals.Set)._new();
  55033. $recv($1)._add_("a SmalltalkImage");
  55034. $ctx1.sendIdx["add:"]=1;
  55035. $recv($1)._add_("nil");
  55036. $ctx1.sendIdx["add:"]=2;
  55037. $recv($1)._add_("3@3");
  55038. $ctx1.sendIdx["add:"]=3;
  55039. $recv($1)._add_("false");
  55040. $ctx1.sendIdx["add:"]=4;
  55041. $recv($1)._add_("a BlockClosure");
  55042. return $recv($1)._yourself();
  55043. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  55044. },
  55045. args: [],
  55046. 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",
  55047. referencedClasses: ["Set"],
  55048. messageSends: ["add:", "new", "yourself"]
  55049. }),
  55050. $globals.SetTest);
  55051. $core.addMethod(
  55052. $core.method({
  55053. selector: "collectionSize",
  55054. protocol: "fixture",
  55055. fn: function (){
  55056. var self=this;
  55057. return (5);
  55058. },
  55059. args: [],
  55060. source: "collectionSize\x0a\x09^ 5",
  55061. referencedClasses: [],
  55062. messageSends: []
  55063. }),
  55064. $globals.SetTest);
  55065. $core.addMethod(
  55066. $core.method({
  55067. selector: "collectionWithDuplicates",
  55068. protocol: "fixture",
  55069. fn: function (){
  55070. var self=this;
  55071. return $core.withContext(function($ctx1) {
  55072. var $1;
  55073. $1=self._collection();
  55074. $recv($1)._add_((0));
  55075. return $recv($1)._yourself();
  55076. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  55077. },
  55078. args: [],
  55079. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  55080. referencedClasses: [],
  55081. messageSends: ["add:", "collection", "yourself"]
  55082. }),
  55083. $globals.SetTest);
  55084. $core.addMethod(
  55085. $core.method({
  55086. selector: "collectionWithNewValue",
  55087. protocol: "fixture",
  55088. fn: function (){
  55089. var self=this;
  55090. return $core.withContext(function($ctx1) {
  55091. var $1;
  55092. $1=$recv($globals.Set)._new();
  55093. $recv($1)._add_($globals.Smalltalk);
  55094. $ctx1.sendIdx["add:"]=1;
  55095. $recv($1)._add_(nil);
  55096. $ctx1.sendIdx["add:"]=2;
  55097. $recv($1)._add_((3).__at((3)));
  55098. $ctx1.sendIdx["add:"]=3;
  55099. $recv($1)._add_("N");
  55100. $ctx1.sendIdx["add:"]=4;
  55101. $recv($1)._add_(false);
  55102. $ctx1.sendIdx["add:"]=5;
  55103. $recv($1)._add_(self["@sampleBlock"]);
  55104. return $recv($1)._yourself();
  55105. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  55106. },
  55107. args: [],
  55108. 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",
  55109. referencedClasses: ["Set", "Smalltalk"],
  55110. messageSends: ["add:", "new", "@", "yourself"]
  55111. }),
  55112. $globals.SetTest);
  55113. $core.addMethod(
  55114. $core.method({
  55115. selector: "testAddAll",
  55116. protocol: "tests",
  55117. fn: function (){
  55118. var self=this;
  55119. return $core.withContext(function($ctx1) {
  55120. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  55121. (
  55122. $ctx1.supercall = true,
  55123. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  55124. $ctx1.supercall = false;
  55125. $2=self._collection();
  55126. $ctx1.sendIdx["collection"]=1;
  55127. $3=self._collection();
  55128. $ctx1.sendIdx["collection"]=2;
  55129. $recv($2)._addAll_($3);
  55130. $ctx1.sendIdx["addAll:"]=1;
  55131. $4=$recv($2)._yourself();
  55132. $ctx1.sendIdx["yourself"]=1;
  55133. $1=$4;
  55134. $5=self._collection();
  55135. $ctx1.sendIdx["collection"]=3;
  55136. self._assert_equals_($1,$5);
  55137. $ctx1.sendIdx["assert:equals:"]=1;
  55138. $7=self._collection();
  55139. $ctx1.sendIdx["collection"]=4;
  55140. $8=self._collectionWithNewValue();
  55141. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55142. $recv($7)._addAll_($8);
  55143. $ctx1.sendIdx["addAll:"]=2;
  55144. $9=$recv($7)._yourself();
  55145. $ctx1.sendIdx["yourself"]=2;
  55146. $6=$9;
  55147. $10=self._collectionWithNewValue();
  55148. $ctx1.sendIdx["collectionWithNewValue"]=2;
  55149. self._assert_equals_($6,$10);
  55150. $ctx1.sendIdx["assert:equals:"]=2;
  55151. $12=self._collectionWithNewValue();
  55152. $ctx1.sendIdx["collectionWithNewValue"]=3;
  55153. $recv($12)._addAll_(self._collection());
  55154. $11=$recv($12)._yourself();
  55155. self._assert_equals_($11,self._collectionWithNewValue());
  55156. return self;
  55157. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  55158. },
  55159. args: [],
  55160. 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",
  55161. referencedClasses: [],
  55162. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  55163. }),
  55164. $globals.SetTest);
  55165. $core.addMethod(
  55166. $core.method({
  55167. selector: "testAddRemove",
  55168. protocol: "tests",
  55169. fn: function (){
  55170. var self=this;
  55171. var set;
  55172. return $core.withContext(function($ctx1) {
  55173. var $1,$2;
  55174. set=$recv($globals.Set)._new();
  55175. self._assert_($recv(set)._isEmpty());
  55176. $ctx1.sendIdx["assert:"]=1;
  55177. $recv(set)._add_((3));
  55178. $ctx1.sendIdx["add:"]=1;
  55179. $1=$recv(set)._includes_((3));
  55180. $ctx1.sendIdx["includes:"]=1;
  55181. self._assert_($1);
  55182. $ctx1.sendIdx["assert:"]=2;
  55183. $recv(set)._add_((5));
  55184. $2=$recv(set)._includes_((5));
  55185. $ctx1.sendIdx["includes:"]=2;
  55186. self._assert_($2);
  55187. $recv(set)._remove_((3));
  55188. self._deny_($recv(set)._includes_((3)));
  55189. return self;
  55190. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  55191. },
  55192. args: [],
  55193. 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)",
  55194. referencedClasses: ["Set"],
  55195. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  55196. }),
  55197. $globals.SetTest);
  55198. $core.addMethod(
  55199. $core.method({
  55200. selector: "testAt",
  55201. protocol: "tests",
  55202. fn: function (){
  55203. var self=this;
  55204. return $core.withContext(function($ctx1) {
  55205. self._should_raise_((function(){
  55206. return $core.withContext(function($ctx2) {
  55207. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  55208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55209. }),$globals.Error);
  55210. return self;
  55211. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  55212. },
  55213. args: [],
  55214. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  55215. referencedClasses: ["Set", "Error"],
  55216. messageSends: ["should:raise:", "at:put:", "new"]
  55217. }),
  55218. $globals.SetTest);
  55219. $core.addMethod(
  55220. $core.method({
  55221. selector: "testCollect",
  55222. protocol: "tests",
  55223. fn: function (){
  55224. var self=this;
  55225. return $core.withContext(function($ctx1) {
  55226. var $2,$1;
  55227. (
  55228. $ctx1.supercall = true,
  55229. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($recv(self), []));
  55230. $ctx1.supercall = false;
  55231. $2=[(5), (6), (8)]._asSet();
  55232. $ctx1.sendIdx["asSet"]=1;
  55233. $1=$recv($2)._collect_((function(x){
  55234. return $core.withContext(function($ctx2) {
  55235. return $recv(x).__backslash_backslash((3));
  55236. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55237. }));
  55238. self._assert_equals_($1,[(0), (2)]._asSet());
  55239. return self;
  55240. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  55241. },
  55242. args: [],
  55243. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  55244. referencedClasses: [],
  55245. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  55246. }),
  55247. $globals.SetTest);
  55248. $core.addMethod(
  55249. $core.method({
  55250. selector: "testComma",
  55251. protocol: "tests",
  55252. fn: function (){
  55253. var self=this;
  55254. return $core.withContext(function($ctx1) {
  55255. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  55256. (
  55257. $ctx1.supercall = true,
  55258. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  55259. $ctx1.supercall = false;
  55260. $2=self._collection();
  55261. $ctx1.sendIdx["collection"]=1;
  55262. $3=self._collection();
  55263. $ctx1.sendIdx["collection"]=2;
  55264. $1=$recv($2).__comma($3);
  55265. $ctx1.sendIdx[","]=1;
  55266. $4=self._collection();
  55267. $ctx1.sendIdx["collection"]=3;
  55268. self._assert_equals_($1,$4);
  55269. $ctx1.sendIdx["assert:equals:"]=1;
  55270. $6=self._collection();
  55271. $ctx1.sendIdx["collection"]=4;
  55272. $7=self._collectionWithNewValue();
  55273. $ctx1.sendIdx["collectionWithNewValue"]=1;
  55274. $5=$recv($6).__comma($7);
  55275. $ctx1.sendIdx[","]=2;
  55276. $8=self._collectionWithNewValue();
  55277. $ctx1.sendIdx["collectionWithNewValue"]=2;
  55278. self._assert_equals_($5,$8);
  55279. $ctx1.sendIdx["assert:equals:"]=2;
  55280. $10=self._collectionWithNewValue();
  55281. $ctx1.sendIdx["collectionWithNewValue"]=3;
  55282. $9=$recv($10).__comma(self._collection());
  55283. self._assert_equals_($9,self._collectionWithNewValue());
  55284. return self;
  55285. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  55286. },
  55287. args: [],
  55288. 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",
  55289. referencedClasses: [],
  55290. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  55291. }),
  55292. $globals.SetTest);
  55293. $core.addMethod(
  55294. $core.method({
  55295. selector: "testComparing",
  55296. protocol: "tests",
  55297. fn: function (){
  55298. var self=this;
  55299. return $core.withContext(function($ctx1) {
  55300. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  55301. $1=[(0), (2)]._asSet();
  55302. $ctx1.sendIdx["asSet"]=1;
  55303. $2=[(0), (2)]._asSet();
  55304. $ctx1.sendIdx["asSet"]=2;
  55305. self._assert_equals_($1,$2);
  55306. $ctx1.sendIdx["assert:equals:"]=1;
  55307. $3=[(2), (0)]._asSet();
  55308. $ctx1.sendIdx["asSet"]=3;
  55309. $4=[(0), (2)]._asSet();
  55310. $ctx1.sendIdx["asSet"]=4;
  55311. self._assert_equals_($3,$4);
  55312. $6=[(0), (2), (3)]._asSet();
  55313. $ctx1.sendIdx["asSet"]=5;
  55314. $7=[(0), (2)]._asSet();
  55315. $ctx1.sendIdx["asSet"]=6;
  55316. $5=$recv($6).__eq($7);
  55317. $ctx1.sendIdx["="]=1;
  55318. self._deny_($5);
  55319. $ctx1.sendIdx["deny:"]=1;
  55320. $9=[(1), (2)]._asSet();
  55321. $ctx1.sendIdx["asSet"]=7;
  55322. $8=$recv($9).__eq([(0), (2)]._asSet());
  55323. self._deny_($8);
  55324. return self;
  55325. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  55326. },
  55327. args: [],
  55328. 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",
  55329. referencedClasses: [],
  55330. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  55331. }),
  55332. $globals.SetTest);
  55333. $core.addMethod(
  55334. $core.method({
  55335. selector: "testPrintString",
  55336. protocol: "tests",
  55337. fn: function (){
  55338. var self=this;
  55339. var set;
  55340. return $core.withContext(function($ctx1) {
  55341. var $1,$2,$3,$4,$5,$6,$7,$8;
  55342. set=$recv($globals.Set)._new();
  55343. $1=$recv(set)._printString();
  55344. $ctx1.sendIdx["printString"]=1;
  55345. self._assert_equals_($1,"a Set ()");
  55346. $ctx1.sendIdx["assert:equals:"]=1;
  55347. $2=set;
  55348. $recv($2)._add_((1));
  55349. $ctx1.sendIdx["add:"]=1;
  55350. $3=$recv($2)._add_((3));
  55351. $ctx1.sendIdx["add:"]=2;
  55352. $4=$recv(set)._printString();
  55353. $ctx1.sendIdx["printString"]=2;
  55354. self._assert_equals_($4,"a Set (1 3)");
  55355. $ctx1.sendIdx["assert:equals:"]=2;
  55356. $recv(set)._add_("foo");
  55357. $ctx1.sendIdx["add:"]=3;
  55358. $5=$recv(set)._printString();
  55359. $ctx1.sendIdx["printString"]=3;
  55360. self._assert_equals_($5,"a Set (1 3 'foo')");
  55361. $ctx1.sendIdx["assert:equals:"]=3;
  55362. $6=set;
  55363. $recv($6)._remove_((1));
  55364. $ctx1.sendIdx["remove:"]=1;
  55365. $recv($6)._remove_((3));
  55366. $7=$recv(set)._printString();
  55367. $ctx1.sendIdx["printString"]=4;
  55368. self._assert_equals_($7,"a Set ('foo')");
  55369. $ctx1.sendIdx["assert:equals:"]=4;
  55370. $recv(set)._add_((3));
  55371. $ctx1.sendIdx["add:"]=4;
  55372. $8=$recv(set)._printString();
  55373. $ctx1.sendIdx["printString"]=5;
  55374. self._assert_equals_($8,"a Set (3 'foo')");
  55375. $ctx1.sendIdx["assert:equals:"]=5;
  55376. $recv(set)._add_((3));
  55377. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  55378. return self;
  55379. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  55380. },
  55381. args: [],
  55382. 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'')'",
  55383. referencedClasses: ["Set"],
  55384. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  55385. }),
  55386. $globals.SetTest);
  55387. $core.addMethod(
  55388. $core.method({
  55389. selector: "testUnboxedObjects",
  55390. protocol: "tests",
  55391. fn: function (){
  55392. var self=this;
  55393. return $core.withContext(function($ctx1) {
  55394. var $4,$3,$2,$1;
  55395. $4="foo"._yourself();
  55396. $ctx1.sendIdx["yourself"]=1;
  55397. $3=[$4,"foo"._yourself()];
  55398. $2=$recv($3)._asSet();
  55399. $1=$recv($2)._asArray();
  55400. self._assert_equals_($1,["foo"]);
  55401. return self;
  55402. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  55403. },
  55404. args: [],
  55405. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  55406. referencedClasses: [],
  55407. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  55408. }),
  55409. $globals.SetTest);
  55410. $core.addMethod(
  55411. $core.method({
  55412. selector: "testUnicity",
  55413. protocol: "tests",
  55414. fn: function (){
  55415. var self=this;
  55416. var set;
  55417. return $core.withContext(function($ctx1) {
  55418. var $1;
  55419. set=$recv($globals.Set)._new();
  55420. $recv(set)._add_((21));
  55421. $ctx1.sendIdx["add:"]=1;
  55422. $recv(set)._add_("hello");
  55423. $ctx1.sendIdx["add:"]=2;
  55424. $recv(set)._add_((21));
  55425. $ctx1.sendIdx["add:"]=3;
  55426. $1=$recv(set)._size();
  55427. $ctx1.sendIdx["size"]=1;
  55428. self._assert_equals_($1,(2));
  55429. $ctx1.sendIdx["assert:equals:"]=1;
  55430. $recv(set)._add_("hello");
  55431. self._assert_equals_($recv(set)._size(),(2));
  55432. $ctx1.sendIdx["assert:equals:"]=2;
  55433. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  55434. return self;
  55435. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  55436. },
  55437. args: [],
  55438. 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')",
  55439. referencedClasses: ["Set"],
  55440. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  55441. }),
  55442. $globals.SetTest);
  55443. $core.addMethod(
  55444. $core.method({
  55445. selector: "collectionClass",
  55446. protocol: "fixture",
  55447. fn: function (){
  55448. var self=this;
  55449. return $globals.Set;
  55450. },
  55451. args: [],
  55452. source: "collectionClass\x0a\x09^ Set",
  55453. referencedClasses: ["Set"],
  55454. messageSends: []
  55455. }),
  55456. $globals.SetTest.klass);
  55457. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  55458. $core.addMethod(
  55459. $core.method({
  55460. selector: "testShow",
  55461. protocol: "tests",
  55462. fn: function (){
  55463. var self=this;
  55464. var originalTranscript;
  55465. return $core.withContext(function($ctx1) {
  55466. originalTranscript=$recv($globals.Transcript)._current();
  55467. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  55468. $ctx1.sendIdx["register:"]=1;
  55469. self._shouldnt_raise_((function(){
  55470. return $core.withContext(function($ctx2) {
  55471. return $recv($globals.Transcript)._show_("Hello console!");
  55472. $ctx2.sendIdx["show:"]=1;
  55473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55474. }),$globals.Error);
  55475. $ctx1.sendIdx["shouldnt:raise:"]=1;
  55476. self._shouldnt_raise_((function(){
  55477. return $core.withContext(function($ctx2) {
  55478. return $recv($globals.Transcript)._show_(console);
  55479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55480. }),$globals.Error);
  55481. $recv($globals.Transcript)._register_(originalTranscript);
  55482. return self;
  55483. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  55484. },
  55485. args: [],
  55486. 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.",
  55487. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  55488. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  55489. }),
  55490. $globals.ConsoleTranscriptTest);
  55491. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  55492. $core.addMethod(
  55493. $core.method({
  55494. selector: "testEquality",
  55495. protocol: "tests",
  55496. fn: function (){
  55497. var self=this;
  55498. var now;
  55499. return $core.withContext(function($ctx1) {
  55500. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  55501. now=$recv($globals.Date)._new();
  55502. $1=$recv(now).__eq(now);
  55503. $ctx1.sendIdx["="]=1;
  55504. self._assert_($1);
  55505. $ctx1.sendIdx["assert:"]=1;
  55506. $3=now;
  55507. $4=$recv($globals.Date)._fromMilliseconds_((0));
  55508. $ctx1.sendIdx["fromMilliseconds:"]=1;
  55509. $2=$recv($3).__eq($4);
  55510. $ctx1.sendIdx["="]=2;
  55511. self._deny_($2);
  55512. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  55513. $ctx1.sendIdx["fromMilliseconds:"]=2;
  55514. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  55515. $ctx1.sendIdx["fromMilliseconds:"]=3;
  55516. $5=$recv($6).__eq($7);
  55517. $ctx1.sendIdx["="]=3;
  55518. self._assert_($5);
  55519. $ctx1.sendIdx["assert:"]=2;
  55520. $9=now;
  55521. $11=$recv(now)._asMilliseconds();
  55522. $ctx1.sendIdx["asMilliseconds"]=1;
  55523. $10=$recv($globals.Date)._fromMilliseconds_($11);
  55524. $ctx1.sendIdx["fromMilliseconds:"]=4;
  55525. $8=$recv($9).__eq($10);
  55526. $ctx1.sendIdx["="]=4;
  55527. self._assert_($8);
  55528. $ctx1.sendIdx["assert:"]=3;
  55529. self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  55530. return self;
  55531. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  55532. },
  55533. args: [],
  55534. 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",
  55535. referencedClasses: ["Date"],
  55536. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  55537. }),
  55538. $globals.DateTest);
  55539. $core.addMethod(
  55540. $core.method({
  55541. selector: "testIdentity",
  55542. protocol: "tests",
  55543. fn: function (){
  55544. var self=this;
  55545. var now;
  55546. return $core.withContext(function($ctx1) {
  55547. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  55548. now=$recv($globals.Date)._new();
  55549. $1=$recv(now).__eq_eq(now);
  55550. $ctx1.sendIdx["=="]=1;
  55551. self._assert_($1);
  55552. $3=now;
  55553. $4=$recv($globals.Date)._fromMilliseconds_((0));
  55554. $ctx1.sendIdx["fromMilliseconds:"]=1;
  55555. $2=$recv($3).__eq_eq($4);
  55556. $ctx1.sendIdx["=="]=2;
  55557. self._deny_($2);
  55558. $ctx1.sendIdx["deny:"]=1;
  55559. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  55560. $ctx1.sendIdx["fromMilliseconds:"]=2;
  55561. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  55562. $ctx1.sendIdx["fromMilliseconds:"]=3;
  55563. $5=$recv($6).__eq_eq($7);
  55564. $ctx1.sendIdx["=="]=3;
  55565. self._deny_($5);
  55566. $ctx1.sendIdx["deny:"]=2;
  55567. $9=now;
  55568. $11=$recv(now)._asMilliseconds();
  55569. $ctx1.sendIdx["asMilliseconds"]=1;
  55570. $10=$recv($globals.Date)._fromMilliseconds_($11);
  55571. $ctx1.sendIdx["fromMilliseconds:"]=4;
  55572. $8=$recv($9).__eq_eq($10);
  55573. $ctx1.sendIdx["=="]=4;
  55574. self._deny_($8);
  55575. $ctx1.sendIdx["deny:"]=3;
  55576. self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  55577. return self;
  55578. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  55579. },
  55580. args: [],
  55581. 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",
  55582. referencedClasses: ["Date"],
  55583. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  55584. }),
  55585. $globals.DateTest);
  55586. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  55587. $core.addMethod(
  55588. $core.method({
  55589. selector: "jsNull",
  55590. protocol: "accessing",
  55591. fn: function (){
  55592. var self=this;
  55593. return $core.withContext(function($ctx1) {
  55594. return null;
  55595. return self;
  55596. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  55597. },
  55598. args: [],
  55599. source: "jsNull\x0a\x09<inlineJS: 'return null'>",
  55600. referencedClasses: [],
  55601. messageSends: []
  55602. }),
  55603. $globals.JSObjectProxyTest);
  55604. $core.addMethod(
  55605. $core.method({
  55606. selector: "jsObject",
  55607. protocol: "accessing",
  55608. fn: function (){
  55609. var self=this;
  55610. return $core.withContext(function($ctx1) {
  55611. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  55612. return self;
  55613. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  55614. },
  55615. args: [],
  55616. 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}'>",
  55617. referencedClasses: [],
  55618. messageSends: []
  55619. }),
  55620. $globals.JSObjectProxyTest);
  55621. $core.addMethod(
  55622. $core.method({
  55623. selector: "jsUndefined",
  55624. protocol: "accessing",
  55625. fn: function (){
  55626. var self=this;
  55627. return $core.withContext(function($ctx1) {
  55628. return;
  55629. return self;
  55630. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  55631. },
  55632. args: [],
  55633. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  55634. referencedClasses: [],
  55635. messageSends: []
  55636. }),
  55637. $globals.JSObjectProxyTest);
  55638. $core.addMethod(
  55639. $core.method({
  55640. selector: "testAtIfAbsent",
  55641. protocol: "tests",
  55642. fn: function (){
  55643. var self=this;
  55644. var testObject;
  55645. return $core.withContext(function($ctx1) {
  55646. var $1,$2,$3;
  55647. testObject=self._jsObject();
  55648. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  55649. return "Property does not exist";
  55650. }));
  55651. $ctx1.sendIdx["at:ifAbsent:"]=1;
  55652. self._assert_equals_($1,"Property does not exist");
  55653. $ctx1.sendIdx["assert:equals:"]=1;
  55654. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  55655. return "Property does not exist";
  55656. }));
  55657. $ctx1.sendIdx["at:ifAbsent:"]=2;
  55658. self._assert_equals_($2,nil);
  55659. $ctx1.sendIdx["assert:equals:"]=2;
  55660. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  55661. return "Property does not exist";
  55662. }));
  55663. $ctx1.sendIdx["at:ifAbsent:"]=3;
  55664. self._assert_equals_($3,(1));
  55665. $ctx1.sendIdx["assert:equals:"]=3;
  55666. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  55667. return "Property does not exist";
  55668. })),nil);
  55669. return self;
  55670. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  55671. },
  55672. args: [],
  55673. 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.",
  55674. referencedClasses: [],
  55675. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  55676. }),
  55677. $globals.JSObjectProxyTest);
  55678. $core.addMethod(
  55679. $core.method({
  55680. selector: "testAtIfPresent",
  55681. protocol: "tests",
  55682. fn: function (){
  55683. var self=this;
  55684. var testObject;
  55685. return $core.withContext(function($ctx1) {
  55686. var $2,$1,$4,$3,$6,$5;
  55687. testObject=self._jsObject();
  55688. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  55689. return $core.withContext(function($ctx2) {
  55690. $2=$recv(x)._asString();
  55691. $ctx2.sendIdx["asString"]=1;
  55692. return "hello ".__comma($2);
  55693. $ctx2.sendIdx[","]=1;
  55694. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55695. }));
  55696. $ctx1.sendIdx["at:ifPresent:"]=1;
  55697. self._assert_equals_($1,nil);
  55698. $ctx1.sendIdx["assert:equals:"]=1;
  55699. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  55700. return $core.withContext(function($ctx2) {
  55701. $4=$recv(x)._asString();
  55702. $ctx2.sendIdx["asString"]=2;
  55703. return "hello ".__comma($4);
  55704. $ctx2.sendIdx[","]=2;
  55705. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  55706. }));
  55707. $ctx1.sendIdx["at:ifPresent:"]=2;
  55708. self._assert_equals_($3,"hello nil");
  55709. $ctx1.sendIdx["assert:equals:"]=2;
  55710. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  55711. return $core.withContext(function($ctx2) {
  55712. $6=$recv(x)._asString();
  55713. $ctx2.sendIdx["asString"]=3;
  55714. return "hello ".__comma($6);
  55715. $ctx2.sendIdx[","]=3;
  55716. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  55717. }));
  55718. $ctx1.sendIdx["at:ifPresent:"]=3;
  55719. self._assert_equals_($5,"hello 1");
  55720. $ctx1.sendIdx["assert:equals:"]=3;
  55721. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  55722. return $core.withContext(function($ctx2) {
  55723. return "hello ".__comma($recv(x)._asString());
  55724. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  55725. })),"hello nil");
  55726. return self;
  55727. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  55728. },
  55729. args: [],
  55730. 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'.",
  55731. referencedClasses: [],
  55732. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  55733. }),
  55734. $globals.JSObjectProxyTest);
  55735. $core.addMethod(
  55736. $core.method({
  55737. selector: "testAtIfPresentIfAbsent",
  55738. protocol: "tests",
  55739. fn: function (){
  55740. var self=this;
  55741. var testObject;
  55742. return $core.withContext(function($ctx1) {
  55743. var $2,$1,$4,$3,$6,$5;
  55744. testObject=self._jsObject();
  55745. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  55746. return $core.withContext(function($ctx2) {
  55747. $2=$recv(x)._asString();
  55748. $ctx2.sendIdx["asString"]=1;
  55749. return "hello ".__comma($2);
  55750. $ctx2.sendIdx[","]=1;
  55751. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55752. }),(function(){
  55753. return "not present";
  55754. }));
  55755. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  55756. self._assert_equals_($1,"not present");
  55757. $ctx1.sendIdx["assert:equals:"]=1;
  55758. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  55759. return $core.withContext(function($ctx2) {
  55760. $4=$recv(x)._asString();
  55761. $ctx2.sendIdx["asString"]=2;
  55762. return "hello ".__comma($4);
  55763. $ctx2.sendIdx[","]=2;
  55764. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  55765. }),(function(){
  55766. return "not present";
  55767. }));
  55768. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  55769. self._assert_equals_($3,"hello nil");
  55770. $ctx1.sendIdx["assert:equals:"]=2;
  55771. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  55772. return $core.withContext(function($ctx2) {
  55773. $6=$recv(x)._asString();
  55774. $ctx2.sendIdx["asString"]=3;
  55775. return "hello ".__comma($6);
  55776. $ctx2.sendIdx[","]=3;
  55777. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  55778. }),(function(){
  55779. return "not present";
  55780. }));
  55781. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  55782. self._assert_equals_($5,"hello 1");
  55783. $ctx1.sendIdx["assert:equals:"]=3;
  55784. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  55785. return $core.withContext(function($ctx2) {
  55786. return "hello ".__comma($recv(x)._asString());
  55787. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  55788. }),(function(){
  55789. return "not present";
  55790. })),"hello nil");
  55791. return self;
  55792. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  55793. },
  55794. args: [],
  55795. 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'.",
  55796. referencedClasses: [],
  55797. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  55798. }),
  55799. $globals.JSObjectProxyTest);
  55800. $core.addMethod(
  55801. $core.method({
  55802. selector: "testAtPut",
  55803. protocol: "tests",
  55804. fn: function (){
  55805. var self=this;
  55806. var testObject;
  55807. return $core.withContext(function($ctx1) {
  55808. var $2,$1;
  55809. testObject=self._jsObject();
  55810. $2=$recv(testObject)._at_("abc");
  55811. $ctx1.sendIdx["at:"]=1;
  55812. $1=$recv($2).__tild_eq("xyz");
  55813. self._assert_($1);
  55814. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  55815. $ctx1.sendIdx["assert:equals:"]=1;
  55816. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  55817. return self;
  55818. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  55819. },
  55820. args: [],
  55821. 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'",
  55822. referencedClasses: [],
  55823. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  55824. }),
  55825. $globals.JSObjectProxyTest);
  55826. $core.addMethod(
  55827. $core.method({
  55828. selector: "testComparison",
  55829. protocol: "tests",
  55830. fn: function (){
  55831. var self=this;
  55832. return $core.withContext(function($ctx1) {
  55833. var $1,$2;
  55834. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  55835. $1=$recv(console).__eq(console);
  55836. $ctx1.sendIdx["="]=1;
  55837. self._assert_($1);
  55838. $2=$recv(console).__eq($recv($globals.Object)._new());
  55839. $ctx1.sendIdx["="]=2;
  55840. self._deny_($2);
  55841. $ctx1.sendIdx["deny:"]=1;
  55842. self._deny_($recv(console).__eq(self._jsObject()));
  55843. return self;
  55844. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  55845. },
  55846. args: [],
  55847. 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",
  55848. referencedClasses: ["Object"],
  55849. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  55850. }),
  55851. $globals.JSObjectProxyTest);
  55852. $core.addMethod(
  55853. $core.method({
  55854. selector: "testDNU",
  55855. protocol: "tests",
  55856. fn: function (){
  55857. var self=this;
  55858. return $core.withContext(function($ctx1) {
  55859. self._should_raise_((function(){
  55860. return $core.withContext(function($ctx2) {
  55861. return $recv(self._jsObject())._foo();
  55862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55863. }),$globals.MessageNotUnderstood);
  55864. return self;
  55865. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  55866. },
  55867. args: [],
  55868. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  55869. referencedClasses: ["MessageNotUnderstood"],
  55870. messageSends: ["should:raise:", "foo", "jsObject"]
  55871. }),
  55872. $globals.JSObjectProxyTest);
  55873. $core.addMethod(
  55874. $core.method({
  55875. selector: "testDNURegression1057",
  55876. protocol: "tests",
  55877. fn: function (){
  55878. var self=this;
  55879. var jsObject;
  55880. return $core.withContext(function($ctx1) {
  55881. var $1;
  55882. jsObject=[];
  55883. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  55884. $ctx1.sendIdx["basicAt:put:"]=1;
  55885. $recv(jsObject)._basicAt_put_("foo",(3));
  55886. self._shouldnt_raise_((function(){
  55887. return $core.withContext(function($ctx2) {
  55888. return $recv(jsObject)._foo();
  55889. $ctx2.sendIdx["foo"]=1;
  55890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55891. }),$globals.Error);
  55892. $ctx1.sendIdx["shouldnt:raise:"]=1;
  55893. $1=$recv(jsObject)._foo();
  55894. $ctx1.sendIdx["foo"]=2;
  55895. self._assert_equals_($1,(3));
  55896. $ctx1.sendIdx["assert:equals:"]=1;
  55897. self._shouldnt_raise_((function(){
  55898. return $core.withContext(function($ctx2) {
  55899. return $recv(jsObject)._foo_((4));
  55900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55901. }),$globals.Error);
  55902. self._assert_equals_($recv(jsObject)._foo(),(4));
  55903. return self;
  55904. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55905. },
  55906. args: [],
  55907. source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4",
  55908. referencedClasses: ["Error"],
  55909. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  55910. }),
  55911. $globals.JSObjectProxyTest);
  55912. $core.addMethod(
  55913. $core.method({
  55914. selector: "testDNURegression1059",
  55915. protocol: "tests",
  55916. fn: function (){
  55917. var self=this;
  55918. var jsObject;
  55919. return $core.withContext(function($ctx1) {
  55920. jsObject=[];
  55921. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  55922. $ctx1.sendIdx["basicAt:put:"]=1;
  55923. $recv(jsObject)._basicAt_put_("x",(3));
  55924. $ctx1.sendIdx["basicAt:put:"]=2;
  55925. $recv(jsObject)._basicAt_put_("x:",(function(){
  55926. return $core.withContext(function($ctx2) {
  55927. return self._error();
  55928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55929. }));
  55930. self._shouldnt_raise_((function(){
  55931. return $core.withContext(function($ctx2) {
  55932. return $recv(jsObject)._x_((4));
  55933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55934. }),$globals.Error);
  55935. self._assert_equals_($recv(jsObject)._x(),(4));
  55936. return self;
  55937. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55938. },
  55939. args: [],
  55940. source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4",
  55941. referencedClasses: ["Error"],
  55942. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  55943. }),
  55944. $globals.JSObjectProxyTest);
  55945. $core.addMethod(
  55946. $core.method({
  55947. selector: "testDNURegression1062",
  55948. protocol: "tests",
  55949. fn: function (){
  55950. var self=this;
  55951. var jsObject,stored;
  55952. return $core.withContext(function($ctx1) {
  55953. jsObject=[];
  55954. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  55955. $ctx1.sendIdx["basicAt:put:"]=1;
  55956. $recv(jsObject)._basicAt_put_("x",(function(v){
  55957. stored=v;
  55958. return stored;
  55959. }));
  55960. self._shouldnt_raise_((function(){
  55961. return $core.withContext(function($ctx2) {
  55962. return $recv(jsObject)._x_((4));
  55963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55964. }),$globals.Error);
  55965. self._assert_equals_(stored,(4));
  55966. return self;
  55967. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  55968. },
  55969. args: [],
  55970. source: "testDNURegression1062\x0a\x09| jsObject stored |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: [ :v | stored := v ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: stored equals: 4",
  55971. referencedClasses: ["Error"],
  55972. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  55973. }),
  55974. $globals.JSObjectProxyTest);
  55975. $core.addMethod(
  55976. $core.method({
  55977. selector: "testDNUWithAllowJavaScriptCalls",
  55978. protocol: "tests",
  55979. fn: function (){
  55980. var self=this;
  55981. var jsObject;
  55982. return $core.withContext(function($ctx1) {
  55983. jsObject=[];
  55984. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  55985. self._should_raise_((function(){
  55986. return $core.withContext(function($ctx2) {
  55987. return $recv(jsObject)._foo();
  55988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55989. }),$globals.MessageNotUnderstood);
  55990. return self;
  55991. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55992. },
  55993. args: [],
  55994. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  55995. referencedClasses: ["MessageNotUnderstood"],
  55996. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  55997. }),
  55998. $globals.JSObjectProxyTest);
  55999. $core.addMethod(
  56000. $core.method({
  56001. selector: "testMessageSend",
  56002. protocol: "tests",
  56003. fn: function (){
  56004. var self=this;
  56005. return $core.withContext(function($ctx1) {
  56006. var $2,$1,$4,$3;
  56007. $2=self._jsObject();
  56008. $ctx1.sendIdx["jsObject"]=1;
  56009. $1=$recv($2)._a();
  56010. self._assert_equals_($1,(1));
  56011. $ctx1.sendIdx["assert:equals:"]=1;
  56012. $4=self._jsObject();
  56013. $ctx1.sendIdx["jsObject"]=2;
  56014. $3=$recv($4)._b();
  56015. self._assert_equals_($3,(2));
  56016. $ctx1.sendIdx["assert:equals:"]=2;
  56017. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  56018. return self;
  56019. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  56020. },
  56021. args: [],
  56022. 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",
  56023. referencedClasses: [],
  56024. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  56025. }),
  56026. $globals.JSObjectProxyTest);
  56027. $core.addMethod(
  56028. $core.method({
  56029. selector: "testMethodWithArguments",
  56030. protocol: "tests",
  56031. fn: function (){
  56032. var self=this;
  56033. return $core.withContext(function($ctx1) {
  56034. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  56035. return self;
  56036. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  56037. },
  56038. args: [],
  56039. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  56040. referencedClasses: [],
  56041. messageSends: ["assert:equals:", "c:", "jsObject"]
  56042. }),
  56043. $globals.JSObjectProxyTest);
  56044. $core.addMethod(
  56045. $core.method({
  56046. selector: "testPrinting",
  56047. protocol: "tests",
  56048. fn: function (){
  56049. var self=this;
  56050. return $core.withContext(function($ctx1) {
  56051. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  56052. return self;
  56053. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  56054. },
  56055. args: [],
  56056. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  56057. referencedClasses: [],
  56058. messageSends: ["assert:equals:", "printString", "jsObject"]
  56059. }),
  56060. $globals.JSObjectProxyTest);
  56061. $core.addMethod(
  56062. $core.method({
  56063. selector: "testPropertyThatReturnsEmptyString",
  56064. protocol: "tests",
  56065. fn: function (){
  56066. var self=this;
  56067. var object;
  56068. return $core.withContext(function($ctx1) {
  56069. var $1;
  56070. object=self._jsObject();
  56071. $1=$recv(object)._d();
  56072. $ctx1.sendIdx["d"]=1;
  56073. self._assert_equals_($1,"");
  56074. $ctx1.sendIdx["assert:equals:"]=1;
  56075. $recv(object)._d_("hello");
  56076. self._assert_equals_($recv(object)._d(),"hello");
  56077. return self;
  56078. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  56079. },
  56080. args: [],
  56081. 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'",
  56082. referencedClasses: [],
  56083. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  56084. }),
  56085. $globals.JSObjectProxyTest);
  56086. $core.addMethod(
  56087. $core.method({
  56088. selector: "testPropertyThatReturnsUndefined",
  56089. protocol: "tests",
  56090. fn: function (){
  56091. var self=this;
  56092. var object;
  56093. return $core.withContext(function($ctx1) {
  56094. object=self._jsObject();
  56095. self._shouldnt_raise_((function(){
  56096. return $core.withContext(function($ctx2) {
  56097. return $recv(object)._e();
  56098. $ctx2.sendIdx["e"]=1;
  56099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56100. }),$globals.MessageNotUnderstood);
  56101. self._assert_($recv($recv(object)._e())._isNil());
  56102. return self;
  56103. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  56104. },
  56105. args: [],
  56106. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  56107. referencedClasses: ["MessageNotUnderstood"],
  56108. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  56109. }),
  56110. $globals.JSObjectProxyTest);
  56111. $core.addMethod(
  56112. $core.method({
  56113. selector: "testSetPropertyWithFalsyValue",
  56114. protocol: "tests",
  56115. fn: function (){
  56116. var self=this;
  56117. var jsObject;
  56118. return $core.withContext(function($ctx1) {
  56119. var $1,$2,$3,$4,$5;
  56120. jsObject=self._jsObject();
  56121. $1=$recv(jsObject)._a();
  56122. $ctx1.sendIdx["a"]=1;
  56123. self._assert_equals_($1,(1));
  56124. $ctx1.sendIdx["assert:equals:"]=1;
  56125. $recv(jsObject)._a_(self._jsNull());
  56126. $ctx1.sendIdx["a:"]=1;
  56127. $2=$recv(jsObject)._a();
  56128. $ctx1.sendIdx["a"]=2;
  56129. self._assert_equals_($2,nil);
  56130. $ctx1.sendIdx["assert:equals:"]=2;
  56131. $recv(jsObject)._a_((0));
  56132. $ctx1.sendIdx["a:"]=2;
  56133. $3=$recv(jsObject)._a();
  56134. $ctx1.sendIdx["a"]=3;
  56135. self._assert_equals_($3,(0));
  56136. $ctx1.sendIdx["assert:equals:"]=3;
  56137. $recv(jsObject)._a_(self._jsUndefined());
  56138. $ctx1.sendIdx["a:"]=3;
  56139. $4=$recv(jsObject)._a();
  56140. $ctx1.sendIdx["a"]=4;
  56141. self._assert_equals_($4,nil);
  56142. $ctx1.sendIdx["assert:equals:"]=4;
  56143. $recv(jsObject)._a_("");
  56144. $ctx1.sendIdx["a:"]=4;
  56145. $5=$recv(jsObject)._a();
  56146. $ctx1.sendIdx["a"]=5;
  56147. self._assert_equals_($5,"");
  56148. $ctx1.sendIdx["assert:equals:"]=5;
  56149. $recv(jsObject)._a_(false);
  56150. self._assert_equals_($recv(jsObject)._a(),false);
  56151. return self;
  56152. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  56153. },
  56154. args: [],
  56155. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  56156. referencedClasses: [],
  56157. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  56158. }),
  56159. $globals.JSObjectProxyTest);
  56160. $core.addMethod(
  56161. $core.method({
  56162. selector: "testValue",
  56163. protocol: "tests",
  56164. fn: function (){
  56165. var self=this;
  56166. var testObject;
  56167. return $core.withContext(function($ctx1) {
  56168. testObject=self._jsObject();
  56169. $recv(testObject)._at_put_("value","aValue");
  56170. self._assert_equals_($recv(testObject)._value(),"aValue");
  56171. return self;
  56172. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  56173. },
  56174. args: [],
  56175. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  56176. referencedClasses: [],
  56177. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  56178. }),
  56179. $globals.JSObjectProxyTest);
  56180. $core.addMethod(
  56181. $core.method({
  56182. selector: "testYourself",
  56183. protocol: "tests",
  56184. fn: function (){
  56185. var self=this;
  56186. var object;
  56187. return $core.withContext(function($ctx1) {
  56188. var $1;
  56189. $1=self._jsObject();
  56190. $recv($1)._d_("test");
  56191. object=$recv($1)._yourself();
  56192. self._assert_equals_($recv(object)._d(),"test");
  56193. return self;
  56194. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  56195. },
  56196. args: [],
  56197. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  56198. referencedClasses: [],
  56199. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  56200. }),
  56201. $globals.JSObjectProxyTest);
  56202. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  56203. $core.addMethod(
  56204. $core.method({
  56205. selector: "testCatchingException",
  56206. protocol: "tests",
  56207. fn: function (){
  56208. var self=this;
  56209. return $core.withContext(function($ctx1) {
  56210. $recv((function(){
  56211. return $core.withContext(function($ctx2) {
  56212. return self._throwException();
  56213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56214. }))._on_do_($globals.Error,(function(error){
  56215. return $core.withContext(function($ctx2) {
  56216. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  56217. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  56218. }));
  56219. return self;
  56220. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  56221. },
  56222. args: [],
  56223. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  56224. referencedClasses: ["Error"],
  56225. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  56226. }),
  56227. $globals.JavaScriptExceptionTest);
  56228. $core.addMethod(
  56229. $core.method({
  56230. selector: "testRaisingException",
  56231. protocol: "tests",
  56232. fn: function (){
  56233. var self=this;
  56234. return $core.withContext(function($ctx1) {
  56235. self._should_raise_((function(){
  56236. return $core.withContext(function($ctx2) {
  56237. return self._throwException();
  56238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56239. }),$globals.JavaScriptException);
  56240. return self;
  56241. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  56242. },
  56243. args: [],
  56244. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  56245. referencedClasses: ["JavaScriptException"],
  56246. messageSends: ["should:raise:", "throwException"]
  56247. }),
  56248. $globals.JavaScriptExceptionTest);
  56249. $core.addMethod(
  56250. $core.method({
  56251. selector: "throwException",
  56252. protocol: "helpers",
  56253. fn: function (){
  56254. var self=this;
  56255. return $core.withContext(function($ctx1) {
  56256. throw "test";
  56257. return self;
  56258. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  56259. },
  56260. args: [],
  56261. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  56262. referencedClasses: [],
  56263. messageSends: []
  56264. }),
  56265. $globals.JavaScriptExceptionTest);
  56266. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  56267. $core.addMethod(
  56268. $core.method({
  56269. selector: "testValue",
  56270. protocol: "tests",
  56271. fn: function (){
  56272. var self=this;
  56273. var messageSend;
  56274. return $core.withContext(function($ctx1) {
  56275. var $1;
  56276. $1=$recv($globals.MessageSend)._new();
  56277. $ctx1.sendIdx["new"]=1;
  56278. $recv($1)._receiver_($recv($globals.Object)._new());
  56279. $recv($1)._selector_("asString");
  56280. messageSend=$recv($1)._yourself();
  56281. self._assert_equals_($recv(messageSend)._value(),"an Object");
  56282. return self;
  56283. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  56284. },
  56285. args: [],
  56286. 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'",
  56287. referencedClasses: ["MessageSend", "Object"],
  56288. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  56289. }),
  56290. $globals.MessageSendTest);
  56291. $core.addMethod(
  56292. $core.method({
  56293. selector: "testValueWithArguments",
  56294. protocol: "tests",
  56295. fn: function (){
  56296. var self=this;
  56297. var messageSend;
  56298. return $core.withContext(function($ctx1) {
  56299. var $1;
  56300. $1=$recv($globals.MessageSend)._new();
  56301. $recv($1)._receiver_((2));
  56302. $recv($1)._selector_("+");
  56303. messageSend=$recv($1)._yourself();
  56304. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  56305. $ctx1.sendIdx["assert:equals:"]=1;
  56306. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  56307. return self;
  56308. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  56309. },
  56310. args: [],
  56311. 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",
  56312. referencedClasses: ["MessageSend"],
  56313. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  56314. }),
  56315. $globals.MessageSendTest);
  56316. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  56317. $core.addMethod(
  56318. $core.method({
  56319. selector: "codeGeneratorClass",
  56320. protocol: "accessing",
  56321. fn: function (){
  56322. var self=this;
  56323. return $globals.CodeGenerator;
  56324. },
  56325. args: [],
  56326. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  56327. referencedClasses: ["CodeGenerator"],
  56328. messageSends: []
  56329. }),
  56330. $globals.MethodInheritanceTest);
  56331. $core.addMethod(
  56332. $core.method({
  56333. selector: "compiler",
  56334. protocol: "factory",
  56335. fn: function (){
  56336. var self=this;
  56337. return $core.withContext(function($ctx1) {
  56338. var $1;
  56339. $1=$recv($globals.Compiler)._new();
  56340. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  56341. return $recv($1)._yourself();
  56342. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  56343. },
  56344. args: [],
  56345. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  56346. referencedClasses: ["Compiler"],
  56347. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  56348. }),
  56349. $globals.MethodInheritanceTest);
  56350. $core.addMethod(
  56351. $core.method({
  56352. selector: "deinstallBottom",
  56353. protocol: "testing",
  56354. fn: function (){
  56355. var self=this;
  56356. return $core.withContext(function($ctx1) {
  56357. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  56358. return self;
  56359. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  56360. },
  56361. args: [],
  56362. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  56363. referencedClasses: [],
  56364. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  56365. }),
  56366. $globals.MethodInheritanceTest);
  56367. $core.addMethod(
  56368. $core.method({
  56369. selector: "deinstallMiddle",
  56370. protocol: "testing",
  56371. fn: function (){
  56372. var self=this;
  56373. return $core.withContext(function($ctx1) {
  56374. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  56375. return self;
  56376. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  56377. },
  56378. args: [],
  56379. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  56380. referencedClasses: [],
  56381. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  56382. }),
  56383. $globals.MethodInheritanceTest);
  56384. $core.addMethod(
  56385. $core.method({
  56386. selector: "deinstallTop",
  56387. protocol: "testing",
  56388. fn: function (){
  56389. var self=this;
  56390. return $core.withContext(function($ctx1) {
  56391. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  56392. return self;
  56393. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  56394. },
  56395. args: [],
  56396. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  56397. referencedClasses: [],
  56398. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  56399. }),
  56400. $globals.MethodInheritanceTest);
  56401. $core.addMethod(
  56402. $core.method({
  56403. selector: "installBottom:",
  56404. protocol: "testing",
  56405. fn: function (aString){
  56406. var self=this;
  56407. return $core.withContext(function($ctx1) {
  56408. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  56409. return self;
  56410. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  56411. },
  56412. args: ["aString"],
  56413. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  56414. referencedClasses: [],
  56415. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  56416. }),
  56417. $globals.MethodInheritanceTest);
  56418. $core.addMethod(
  56419. $core.method({
  56420. selector: "installMiddle:",
  56421. protocol: "testing",
  56422. fn: function (aString){
  56423. var self=this;
  56424. return $core.withContext(function($ctx1) {
  56425. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  56426. return self;
  56427. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  56428. },
  56429. args: ["aString"],
  56430. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  56431. referencedClasses: [],
  56432. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  56433. }),
  56434. $globals.MethodInheritanceTest);
  56435. $core.addMethod(
  56436. $core.method({
  56437. selector: "installTop:",
  56438. protocol: "testing",
  56439. fn: function (aString){
  56440. var self=this;
  56441. return $core.withContext(function($ctx1) {
  56442. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  56443. return self;
  56444. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  56445. },
  56446. args: ["aString"],
  56447. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  56448. referencedClasses: [],
  56449. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  56450. }),
  56451. $globals.MethodInheritanceTest);
  56452. $core.addMethod(
  56453. $core.method({
  56454. selector: "setUp",
  56455. protocol: "initialization",
  56456. fn: function (){
  56457. var self=this;
  56458. return $core.withContext(function($ctx1) {
  56459. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  56460. $ctx1.sendIdx["new"]=1;
  56461. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  56462. $ctx1.sendIdx["new"]=2;
  56463. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  56464. self["@method"]=nil;
  56465. self["@performBlock"]=(function(){
  56466. return $core.withContext(function($ctx2) {
  56467. return self._error_("performBlock not initialized");
  56468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56469. });
  56470. return self;
  56471. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  56472. },
  56473. args: [],
  56474. 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' ]",
  56475. referencedClasses: [],
  56476. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  56477. }),
  56478. $globals.MethodInheritanceTest);
  56479. $core.addMethod(
  56480. $core.method({
  56481. selector: "shouldMNU",
  56482. protocol: "testing",
  56483. fn: function (){
  56484. var self=this;
  56485. return $core.withContext(function($ctx1) {
  56486. self._shouldMNUTop();
  56487. self._shouldMNUMiddle();
  56488. self._shouldMNUBottom();
  56489. return self;
  56490. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  56491. },
  56492. args: [],
  56493. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  56494. referencedClasses: [],
  56495. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  56496. }),
  56497. $globals.MethodInheritanceTest);
  56498. $core.addMethod(
  56499. $core.method({
  56500. selector: "shouldMNUBottom",
  56501. protocol: "testing",
  56502. fn: function (){
  56503. var self=this;
  56504. return $core.withContext(function($ctx1) {
  56505. self._should_raise_((function(){
  56506. return $core.withContext(function($ctx2) {
  56507. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  56508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56509. }),$globals.MessageNotUnderstood);
  56510. return self;
  56511. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  56512. },
  56513. args: [],
  56514. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  56515. referencedClasses: ["MessageNotUnderstood"],
  56516. messageSends: ["should:raise:", "value:"]
  56517. }),
  56518. $globals.MethodInheritanceTest);
  56519. $core.addMethod(
  56520. $core.method({
  56521. selector: "shouldMNUMiddle",
  56522. protocol: "testing",
  56523. fn: function (){
  56524. var self=this;
  56525. return $core.withContext(function($ctx1) {
  56526. self._should_raise_((function(){
  56527. return $core.withContext(function($ctx2) {
  56528. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  56529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56530. }),$globals.MessageNotUnderstood);
  56531. return self;
  56532. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  56533. },
  56534. args: [],
  56535. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  56536. referencedClasses: ["MessageNotUnderstood"],
  56537. messageSends: ["should:raise:", "value:"]
  56538. }),
  56539. $globals.MethodInheritanceTest);
  56540. $core.addMethod(
  56541. $core.method({
  56542. selector: "shouldMNUTop",
  56543. protocol: "testing",
  56544. fn: function (){
  56545. var self=this;
  56546. return $core.withContext(function($ctx1) {
  56547. self._should_raise_((function(){
  56548. return $core.withContext(function($ctx2) {
  56549. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  56550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56551. }),$globals.MessageNotUnderstood);
  56552. return self;
  56553. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  56554. },
  56555. args: [],
  56556. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  56557. referencedClasses: ["MessageNotUnderstood"],
  56558. messageSends: ["should:raise:", "value:"]
  56559. }),
  56560. $globals.MethodInheritanceTest);
  56561. $core.addMethod(
  56562. $core.method({
  56563. selector: "shouldReturn:",
  56564. protocol: "testing",
  56565. fn: function (anObject){
  56566. var self=this;
  56567. var result;
  56568. return $core.withContext(function($ctx1) {
  56569. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  56570. $ctx1.sendIdx["value:"]=1;
  56571. self._assert_equals_(["top",anObject],["top",result]);
  56572. $ctx1.sendIdx["assert:equals:"]=1;
  56573. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  56574. $ctx1.sendIdx["value:"]=2;
  56575. self._assert_equals_(["middle",anObject],["middle",result]);
  56576. $ctx1.sendIdx["assert:equals:"]=2;
  56577. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  56578. self._assert_equals_(["bottom",anObject],["bottom",result]);
  56579. return self;
  56580. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  56581. },
  56582. args: ["anObject"],
  56583. 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 }",
  56584. referencedClasses: [],
  56585. messageSends: ["value:", "assert:equals:"]
  56586. }),
  56587. $globals.MethodInheritanceTest);
  56588. $core.addMethod(
  56589. $core.method({
  56590. selector: "shouldReturn:and:and:",
  56591. protocol: "testing",
  56592. fn: function (anObject,anObject2,anObject3){
  56593. var self=this;
  56594. var result;
  56595. return $core.withContext(function($ctx1) {
  56596. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  56597. $ctx1.sendIdx["value:"]=1;
  56598. self._assert_equals_(["top",anObject],["top",result]);
  56599. $ctx1.sendIdx["assert:equals:"]=1;
  56600. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  56601. $ctx1.sendIdx["value:"]=2;
  56602. self._assert_equals_(["middle",anObject2],["middle",result]);
  56603. $ctx1.sendIdx["assert:equals:"]=2;
  56604. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  56605. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  56606. return self;
  56607. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  56608. },
  56609. args: ["anObject", "anObject2", "anObject3"],
  56610. 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 }",
  56611. referencedClasses: [],
  56612. messageSends: ["value:", "assert:equals:"]
  56613. }),
  56614. $globals.MethodInheritanceTest);
  56615. $core.addMethod(
  56616. $core.method({
  56617. selector: "targetClassBottom",
  56618. protocol: "accessing",
  56619. fn: function (){
  56620. var self=this;
  56621. return $globals.JavaScriptException;
  56622. },
  56623. args: [],
  56624. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  56625. referencedClasses: ["JavaScriptException"],
  56626. messageSends: []
  56627. }),
  56628. $globals.MethodInheritanceTest);
  56629. $core.addMethod(
  56630. $core.method({
  56631. selector: "targetClassMiddle",
  56632. protocol: "accessing",
  56633. fn: function (){
  56634. var self=this;
  56635. return $globals.Error;
  56636. },
  56637. args: [],
  56638. source: "targetClassMiddle\x0a\x09^ Error",
  56639. referencedClasses: ["Error"],
  56640. messageSends: []
  56641. }),
  56642. $globals.MethodInheritanceTest);
  56643. $core.addMethod(
  56644. $core.method({
  56645. selector: "targetClassTop",
  56646. protocol: "accessing",
  56647. fn: function (){
  56648. var self=this;
  56649. return $globals.Object;
  56650. },
  56651. args: [],
  56652. source: "targetClassTop\x0a\x09^ Object",
  56653. referencedClasses: ["Object"],
  56654. messageSends: []
  56655. }),
  56656. $globals.MethodInheritanceTest);
  56657. $core.addMethod(
  56658. $core.method({
  56659. selector: "tearDown",
  56660. protocol: "initialization",
  56661. fn: function (){
  56662. var self=this;
  56663. return $core.withContext(function($ctx1) {
  56664. $recv((function(){
  56665. return $core.withContext(function($ctx2) {
  56666. return self._deinstallTop();
  56667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56668. }))._on_do_($globals.Error,(function(){
  56669. }));
  56670. $ctx1.sendIdx["on:do:"]=1;
  56671. $recv((function(){
  56672. return $core.withContext(function($ctx2) {
  56673. return self._deinstallMiddle();
  56674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56675. }))._on_do_($globals.Error,(function(){
  56676. }));
  56677. $ctx1.sendIdx["on:do:"]=2;
  56678. $recv((function(){
  56679. return $core.withContext(function($ctx2) {
  56680. return self._deinstallBottom();
  56681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  56682. }))._on_do_($globals.Error,(function(){
  56683. }));
  56684. return self;
  56685. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  56686. },
  56687. args: [],
  56688. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  56689. referencedClasses: ["Error"],
  56690. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  56691. }),
  56692. $globals.MethodInheritanceTest);
  56693. $core.addMethod(
  56694. $core.method({
  56695. selector: "testMNU11",
  56696. protocol: "tests",
  56697. fn: function (){
  56698. var self=this;
  56699. return $core.withContext(function($ctx1) {
  56700. self["@performBlock"]=(function(x){
  56701. return $core.withContext(function($ctx2) {
  56702. return $recv(x)._foo();
  56703. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56704. });
  56705. self._shouldMNU();
  56706. $ctx1.sendIdx["shouldMNU"]=1;
  56707. self._installTop_("foo ^ false");
  56708. $ctx1.sendIdx["installTop:"]=1;
  56709. self._installTop_("foo ^ true");
  56710. self._deinstallTop();
  56711. self._shouldMNU();
  56712. return self;
  56713. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  56714. },
  56715. args: [],
  56716. 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",
  56717. referencedClasses: [],
  56718. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  56719. }),
  56720. $globals.MethodInheritanceTest);
  56721. $core.addMethod(
  56722. $core.method({
  56723. selector: "testMNU22",
  56724. protocol: "tests",
  56725. fn: function (){
  56726. var self=this;
  56727. return $core.withContext(function($ctx1) {
  56728. self["@performBlock"]=(function(x){
  56729. return $core.withContext(function($ctx2) {
  56730. return $recv(x)._foo();
  56731. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56732. });
  56733. self._shouldMNU();
  56734. $ctx1.sendIdx["shouldMNU"]=1;
  56735. self._installMiddle_("foo ^ false");
  56736. $ctx1.sendIdx["installMiddle:"]=1;
  56737. self._installMiddle_("foo ^ true");
  56738. self._deinstallMiddle();
  56739. self._shouldMNU();
  56740. return self;
  56741. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  56742. },
  56743. args: [],
  56744. 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",
  56745. referencedClasses: [],
  56746. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  56747. }),
  56748. $globals.MethodInheritanceTest);
  56749. $core.addMethod(
  56750. $core.method({
  56751. selector: "testReturns1",
  56752. protocol: "tests",
  56753. fn: function (){
  56754. var self=this;
  56755. return $core.withContext(function($ctx1) {
  56756. self["@performBlock"]=(function(x){
  56757. return $core.withContext(function($ctx2) {
  56758. return $recv(x)._foo();
  56759. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56760. });
  56761. self._installTop_("foo ^ false");
  56762. $ctx1.sendIdx["installTop:"]=1;
  56763. self._shouldReturn_(false);
  56764. $ctx1.sendIdx["shouldReturn:"]=1;
  56765. self._installTop_("foo ^ true");
  56766. self._shouldReturn_(true);
  56767. return self;
  56768. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  56769. },
  56770. args: [],
  56771. 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",
  56772. referencedClasses: [],
  56773. messageSends: ["foo", "installTop:", "shouldReturn:"]
  56774. }),
  56775. $globals.MethodInheritanceTest);
  56776. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  56777. $core.addMethod(
  56778. $core.method({
  56779. selector: "testAbs",
  56780. protocol: "tests",
  56781. fn: function (){
  56782. var self=this;
  56783. return $core.withContext(function($ctx1) {
  56784. var $1;
  56785. $1=(4)._abs();
  56786. $ctx1.sendIdx["abs"]=1;
  56787. self._assert_equals_($1,(4));
  56788. $ctx1.sendIdx["assert:equals:"]=1;
  56789. self._assert_equals_((-4)._abs(),(4));
  56790. return self;
  56791. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  56792. },
  56793. args: [],
  56794. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  56795. referencedClasses: [],
  56796. messageSends: ["assert:equals:", "abs"]
  56797. }),
  56798. $globals.NumberTest);
  56799. $core.addMethod(
  56800. $core.method({
  56801. selector: "testArithmetic",
  56802. protocol: "tests",
  56803. fn: function (){
  56804. var self=this;
  56805. return $core.withContext(function($ctx1) {
  56806. var $1,$2,$3,$5,$4;
  56807. $1=(1.5).__plus((1));
  56808. $ctx1.sendIdx["+"]=1;
  56809. self._assert_equals_($1,(2.5));
  56810. $ctx1.sendIdx["assert:equals:"]=1;
  56811. $2=(2).__minus((1));
  56812. $ctx1.sendIdx["-"]=1;
  56813. self._assert_equals_($2,(1));
  56814. $ctx1.sendIdx["assert:equals:"]=2;
  56815. self._assert_equals_((-2).__minus((1)),(-3));
  56816. $ctx1.sendIdx["assert:equals:"]=3;
  56817. self._assert_equals_((12).__slash((2)),(6));
  56818. $ctx1.sendIdx["assert:equals:"]=4;
  56819. $3=(3).__star((4));
  56820. $ctx1.sendIdx["*"]=1;
  56821. self._assert_equals_($3,(12));
  56822. $ctx1.sendIdx["assert:equals:"]=5;
  56823. self._assert_equals_((7).__slash_slash((2)),(3));
  56824. $ctx1.sendIdx["assert:equals:"]=6;
  56825. self._assert_equals_((7).__backslash_backslash((2)),(1));
  56826. $ctx1.sendIdx["assert:equals:"]=7;
  56827. $5=(1).__plus((2));
  56828. $ctx1.sendIdx["+"]=2;
  56829. $4=$recv($5).__star((3));
  56830. $ctx1.sendIdx["*"]=2;
  56831. self._assert_equals_($4,(9));
  56832. $ctx1.sendIdx["assert:equals:"]=8;
  56833. self._assert_equals_((1).__plus((2).__star((3))),(7));
  56834. return self;
  56835. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  56836. },
  56837. args: [],
  56838. 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",
  56839. referencedClasses: [],
  56840. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  56841. }),
  56842. $globals.NumberTest);
  56843. $core.addMethod(
  56844. $core.method({
  56845. selector: "testAsNumber",
  56846. protocol: "tests",
  56847. fn: function (){
  56848. var self=this;
  56849. return $core.withContext(function($ctx1) {
  56850. self._assert_equals_((3)._asNumber(),(3));
  56851. return self;
  56852. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  56853. },
  56854. args: [],
  56855. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  56856. referencedClasses: [],
  56857. messageSends: ["assert:equals:", "asNumber"]
  56858. }),
  56859. $globals.NumberTest);
  56860. $core.addMethod(
  56861. $core.method({
  56862. selector: "testCeiling",
  56863. protocol: "tests",
  56864. fn: function (){
  56865. var self=this;
  56866. return $core.withContext(function($ctx1) {
  56867. var $1,$2;
  56868. $1=(1.2)._ceiling();
  56869. $ctx1.sendIdx["ceiling"]=1;
  56870. self._assert_equals_($1,(2));
  56871. $ctx1.sendIdx["assert:equals:"]=1;
  56872. $2=(-1.2)._ceiling();
  56873. $ctx1.sendIdx["ceiling"]=2;
  56874. self._assert_equals_($2,(-1));
  56875. $ctx1.sendIdx["assert:equals:"]=2;
  56876. self._assert_equals_((1)._ceiling(),(1));
  56877. return self;
  56878. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  56879. },
  56880. args: [],
  56881. 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.",
  56882. referencedClasses: [],
  56883. messageSends: ["assert:equals:", "ceiling"]
  56884. }),
  56885. $globals.NumberTest);
  56886. $core.addMethod(
  56887. $core.method({
  56888. selector: "testComparison",
  56889. protocol: "tests",
  56890. fn: function (){
  56891. var self=this;
  56892. return $core.withContext(function($ctx1) {
  56893. var $1,$2,$3,$4;
  56894. $1=(3).__gt((2));
  56895. $ctx1.sendIdx[">"]=1;
  56896. self._assert_($1);
  56897. $ctx1.sendIdx["assert:"]=1;
  56898. $2=(2).__lt((3));
  56899. $ctx1.sendIdx["<"]=1;
  56900. self._assert_($2);
  56901. $ctx1.sendIdx["assert:"]=2;
  56902. self._deny_((3).__lt((2)));
  56903. $ctx1.sendIdx["deny:"]=1;
  56904. self._deny_((2).__gt((3)));
  56905. $3=(3).__gt_eq((3));
  56906. $ctx1.sendIdx[">="]=1;
  56907. self._assert_($3);
  56908. $ctx1.sendIdx["assert:"]=3;
  56909. self._assert_((3.1).__gt_eq((3)));
  56910. $ctx1.sendIdx["assert:"]=4;
  56911. $4=(3).__lt_eq((3));
  56912. $ctx1.sendIdx["<="]=1;
  56913. self._assert_($4);
  56914. $ctx1.sendIdx["assert:"]=5;
  56915. self._assert_((3).__lt_eq((3.1)));
  56916. return self;
  56917. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  56918. },
  56919. args: [],
  56920. 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",
  56921. referencedClasses: [],
  56922. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  56923. }),
  56924. $globals.NumberTest);
  56925. $core.addMethod(
  56926. $core.method({
  56927. selector: "testCopying",
  56928. protocol: "tests",
  56929. fn: function (){
  56930. var self=this;
  56931. return $core.withContext(function($ctx1) {
  56932. var $1;
  56933. $1=$recv((1)._copy()).__eq_eq((1));
  56934. $ctx1.sendIdx["=="]=1;
  56935. self._assert_($1);
  56936. $ctx1.sendIdx["assert:"]=1;
  56937. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  56938. return self;
  56939. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  56940. },
  56941. args: [],
  56942. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  56943. referencedClasses: [],
  56944. messageSends: ["assert:", "==", "copy", "deepCopy"]
  56945. }),
  56946. $globals.NumberTest);
  56947. $core.addMethod(
  56948. $core.method({
  56949. selector: "testEquality",
  56950. protocol: "tests",
  56951. fn: function (){
  56952. var self=this;
  56953. return $core.withContext(function($ctx1) {
  56954. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  56955. $1=(1).__eq((1));
  56956. $ctx1.sendIdx["="]=1;
  56957. self._assert_($1);
  56958. $ctx1.sendIdx["assert:"]=1;
  56959. $2=(0).__eq((0));
  56960. $ctx1.sendIdx["="]=2;
  56961. self._assert_($2);
  56962. $ctx1.sendIdx["assert:"]=2;
  56963. $3=(1).__eq((0));
  56964. $ctx1.sendIdx["="]=3;
  56965. self._deny_($3);
  56966. $ctx1.sendIdx["deny:"]=1;
  56967. $5=(1)._yourself();
  56968. $ctx1.sendIdx["yourself"]=1;
  56969. $4=$recv($5).__eq((1));
  56970. $ctx1.sendIdx["="]=4;
  56971. self._assert_($4);
  56972. $ctx1.sendIdx["assert:"]=3;
  56973. $7=(1)._yourself();
  56974. $ctx1.sendIdx["yourself"]=2;
  56975. $6=(1).__eq($7);
  56976. $ctx1.sendIdx["="]=5;
  56977. self._assert_($6);
  56978. $ctx1.sendIdx["assert:"]=4;
  56979. $9=(1)._yourself();
  56980. $ctx1.sendIdx["yourself"]=3;
  56981. $8=$recv($9).__eq((1)._yourself());
  56982. $ctx1.sendIdx["="]=6;
  56983. self._assert_($8);
  56984. $10=(0).__eq(false);
  56985. $ctx1.sendIdx["="]=7;
  56986. self._deny_($10);
  56987. $ctx1.sendIdx["deny:"]=2;
  56988. $11=false.__eq((0));
  56989. $ctx1.sendIdx["="]=8;
  56990. self._deny_($11);
  56991. $ctx1.sendIdx["deny:"]=3;
  56992. $12="".__eq((0));
  56993. $ctx1.sendIdx["="]=9;
  56994. self._deny_($12);
  56995. $ctx1.sendIdx["deny:"]=4;
  56996. self._deny_((0).__eq(""));
  56997. return self;
  56998. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  56999. },
  57000. args: [],
  57001. 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 = ''",
  57002. referencedClasses: [],
  57003. messageSends: ["assert:", "=", "deny:", "yourself"]
  57004. }),
  57005. $globals.NumberTest);
  57006. $core.addMethod(
  57007. $core.method({
  57008. selector: "testFloor",
  57009. protocol: "tests",
  57010. fn: function (){
  57011. var self=this;
  57012. return $core.withContext(function($ctx1) {
  57013. var $1,$2;
  57014. $1=(1.2)._floor();
  57015. $ctx1.sendIdx["floor"]=1;
  57016. self._assert_equals_($1,(1));
  57017. $ctx1.sendIdx["assert:equals:"]=1;
  57018. $2=(-1.2)._floor();
  57019. $ctx1.sendIdx["floor"]=2;
  57020. self._assert_equals_($2,(-2));
  57021. $ctx1.sendIdx["assert:equals:"]=2;
  57022. self._assert_equals_((1)._floor(),(1));
  57023. return self;
  57024. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  57025. },
  57026. args: [],
  57027. 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.",
  57028. referencedClasses: [],
  57029. messageSends: ["assert:equals:", "floor"]
  57030. }),
  57031. $globals.NumberTest);
  57032. $core.addMethod(
  57033. $core.method({
  57034. selector: "testHexNumbers",
  57035. protocol: "tests",
  57036. fn: function (){
  57037. var self=this;
  57038. return $core.withContext(function($ctx1) {
  57039. var $1,$2,$3,$4,$5;
  57040. self._assert_equals_((9),(9));
  57041. $ctx1.sendIdx["assert:equals:"]=1;
  57042. $1=(10)._truncated();
  57043. $ctx1.sendIdx["truncated"]=1;
  57044. self._assert_equals_($1,(10));
  57045. $ctx1.sendIdx["assert:equals:"]=2;
  57046. $2=(11)._truncated();
  57047. $ctx1.sendIdx["truncated"]=2;
  57048. self._assert_equals_($2,(11));
  57049. $ctx1.sendIdx["assert:equals:"]=3;
  57050. $3=(12)._truncated();
  57051. $ctx1.sendIdx["truncated"]=3;
  57052. self._assert_equals_($3,(12));
  57053. $ctx1.sendIdx["assert:equals:"]=4;
  57054. $4=(13)._truncated();
  57055. $ctx1.sendIdx["truncated"]=4;
  57056. self._assert_equals_($4,(13));
  57057. $ctx1.sendIdx["assert:equals:"]=5;
  57058. $5=(14)._truncated();
  57059. $ctx1.sendIdx["truncated"]=5;
  57060. self._assert_equals_($5,(14));
  57061. $ctx1.sendIdx["assert:equals:"]=6;
  57062. self._assert_equals_((15)._truncated(),(15));
  57063. return self;
  57064. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  57065. },
  57066. args: [],
  57067. 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",
  57068. referencedClasses: [],
  57069. messageSends: ["assert:equals:", "truncated"]
  57070. }),
  57071. $globals.NumberTest);
  57072. $core.addMethod(
  57073. $core.method({
  57074. selector: "testIdentity",
  57075. protocol: "tests",
  57076. fn: function (){
  57077. var self=this;
  57078. return $core.withContext(function($ctx1) {
  57079. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  57080. $1=(1).__eq_eq((1));
  57081. $ctx1.sendIdx["=="]=1;
  57082. self._assert_($1);
  57083. $ctx1.sendIdx["assert:"]=1;
  57084. $2=(0).__eq_eq((0));
  57085. $ctx1.sendIdx["=="]=2;
  57086. self._assert_($2);
  57087. $ctx1.sendIdx["assert:"]=2;
  57088. $3=(1).__eq_eq((0));
  57089. $ctx1.sendIdx["=="]=3;
  57090. self._deny_($3);
  57091. $ctx1.sendIdx["deny:"]=1;
  57092. $5=(1)._yourself();
  57093. $ctx1.sendIdx["yourself"]=1;
  57094. $4=$recv($5).__eq_eq((1));
  57095. $ctx1.sendIdx["=="]=4;
  57096. self._assert_($4);
  57097. $ctx1.sendIdx["assert:"]=3;
  57098. $7=(1)._yourself();
  57099. $ctx1.sendIdx["yourself"]=2;
  57100. $6=(1).__eq_eq($7);
  57101. $ctx1.sendIdx["=="]=5;
  57102. self._assert_($6);
  57103. $ctx1.sendIdx["assert:"]=4;
  57104. $9=(1)._yourself();
  57105. $ctx1.sendIdx["yourself"]=3;
  57106. $8=$recv($9).__eq_eq((1)._yourself());
  57107. $ctx1.sendIdx["=="]=6;
  57108. self._assert_($8);
  57109. self._deny_((1).__eq_eq((2)));
  57110. return self;
  57111. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  57112. },
  57113. args: [],
  57114. 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",
  57115. referencedClasses: [],
  57116. messageSends: ["assert:", "==", "deny:", "yourself"]
  57117. }),
  57118. $globals.NumberTest);
  57119. $core.addMethod(
  57120. $core.method({
  57121. selector: "testInvalidHexNumbers",
  57122. protocol: "tests",
  57123. fn: function (){
  57124. var self=this;
  57125. return $core.withContext(function($ctx1) {
  57126. self._should_raise_((function(){
  57127. return $core.withContext(function($ctx2) {
  57128. return (16)._rG();
  57129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57130. }),$globals.MessageNotUnderstood);
  57131. $ctx1.sendIdx["should:raise:"]=1;
  57132. self._should_raise_((function(){
  57133. return $core.withContext(function($ctx2) {
  57134. return (16)._rg();
  57135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57136. }),$globals.MessageNotUnderstood);
  57137. $ctx1.sendIdx["should:raise:"]=2;
  57138. self._should_raise_((function(){
  57139. return $core.withContext(function($ctx2) {
  57140. return (16)._rH();
  57141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57142. }),$globals.MessageNotUnderstood);
  57143. $ctx1.sendIdx["should:raise:"]=3;
  57144. self._should_raise_((function(){
  57145. return $core.withContext(function($ctx2) {
  57146. return (16)._rh();
  57147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  57148. }),$globals.MessageNotUnderstood);
  57149. $ctx1.sendIdx["should:raise:"]=4;
  57150. self._should_raise_((function(){
  57151. return $core.withContext(function($ctx2) {
  57152. return (16)._rI();
  57153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57154. }),$globals.MessageNotUnderstood);
  57155. $ctx1.sendIdx["should:raise:"]=5;
  57156. self._should_raise_((function(){
  57157. return $core.withContext(function($ctx2) {
  57158. return (16)._ri();
  57159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  57160. }),$globals.MessageNotUnderstood);
  57161. $ctx1.sendIdx["should:raise:"]=6;
  57162. self._should_raise_((function(){
  57163. return $core.withContext(function($ctx2) {
  57164. return (16)._rJ();
  57165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  57166. }),$globals.MessageNotUnderstood);
  57167. $ctx1.sendIdx["should:raise:"]=7;
  57168. self._should_raise_((function(){
  57169. return $core.withContext(function($ctx2) {
  57170. return (16)._rj();
  57171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  57172. }),$globals.MessageNotUnderstood);
  57173. $ctx1.sendIdx["should:raise:"]=8;
  57174. self._should_raise_((function(){
  57175. return $core.withContext(function($ctx2) {
  57176. return (16)._rK();
  57177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  57178. }),$globals.MessageNotUnderstood);
  57179. $ctx1.sendIdx["should:raise:"]=9;
  57180. self._should_raise_((function(){
  57181. return $core.withContext(function($ctx2) {
  57182. return (16)._rk();
  57183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  57184. }),$globals.MessageNotUnderstood);
  57185. $ctx1.sendIdx["should:raise:"]=10;
  57186. self._should_raise_((function(){
  57187. return $core.withContext(function($ctx2) {
  57188. return (16)._rL();
  57189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  57190. }),$globals.MessageNotUnderstood);
  57191. $ctx1.sendIdx["should:raise:"]=11;
  57192. self._should_raise_((function(){
  57193. return $core.withContext(function($ctx2) {
  57194. return (16)._rl();
  57195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  57196. }),$globals.MessageNotUnderstood);
  57197. $ctx1.sendIdx["should:raise:"]=12;
  57198. self._should_raise_((function(){
  57199. return $core.withContext(function($ctx2) {
  57200. return (16)._rM();
  57201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  57202. }),$globals.MessageNotUnderstood);
  57203. $ctx1.sendIdx["should:raise:"]=13;
  57204. self._should_raise_((function(){
  57205. return $core.withContext(function($ctx2) {
  57206. return (16)._rm();
  57207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  57208. }),$globals.MessageNotUnderstood);
  57209. $ctx1.sendIdx["should:raise:"]=14;
  57210. self._should_raise_((function(){
  57211. return $core.withContext(function($ctx2) {
  57212. return (16)._rN();
  57213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  57214. }),$globals.MessageNotUnderstood);
  57215. $ctx1.sendIdx["should:raise:"]=15;
  57216. self._should_raise_((function(){
  57217. return $core.withContext(function($ctx2) {
  57218. return (16)._rn();
  57219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  57220. }),$globals.MessageNotUnderstood);
  57221. $ctx1.sendIdx["should:raise:"]=16;
  57222. self._should_raise_((function(){
  57223. return $core.withContext(function($ctx2) {
  57224. return (16)._rO();
  57225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  57226. }),$globals.MessageNotUnderstood);
  57227. $ctx1.sendIdx["should:raise:"]=17;
  57228. self._should_raise_((function(){
  57229. return $core.withContext(function($ctx2) {
  57230. return (16)._ro();
  57231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  57232. }),$globals.MessageNotUnderstood);
  57233. $ctx1.sendIdx["should:raise:"]=18;
  57234. self._should_raise_((function(){
  57235. return $core.withContext(function($ctx2) {
  57236. return (16)._rP();
  57237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  57238. }),$globals.MessageNotUnderstood);
  57239. $ctx1.sendIdx["should:raise:"]=19;
  57240. self._should_raise_((function(){
  57241. return $core.withContext(function($ctx2) {
  57242. return (16)._rp();
  57243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  57244. }),$globals.MessageNotUnderstood);
  57245. $ctx1.sendIdx["should:raise:"]=20;
  57246. self._should_raise_((function(){
  57247. return $core.withContext(function($ctx2) {
  57248. return (16)._rQ();
  57249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  57250. }),$globals.MessageNotUnderstood);
  57251. $ctx1.sendIdx["should:raise:"]=21;
  57252. self._should_raise_((function(){
  57253. return $core.withContext(function($ctx2) {
  57254. return (16)._rq();
  57255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  57256. }),$globals.MessageNotUnderstood);
  57257. $ctx1.sendIdx["should:raise:"]=22;
  57258. self._should_raise_((function(){
  57259. return $core.withContext(function($ctx2) {
  57260. return (16)._rR();
  57261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  57262. }),$globals.MessageNotUnderstood);
  57263. $ctx1.sendIdx["should:raise:"]=23;
  57264. self._should_raise_((function(){
  57265. return $core.withContext(function($ctx2) {
  57266. return (16)._rr();
  57267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  57268. }),$globals.MessageNotUnderstood);
  57269. $ctx1.sendIdx["should:raise:"]=24;
  57270. self._should_raise_((function(){
  57271. return $core.withContext(function($ctx2) {
  57272. return (16)._rS();
  57273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  57274. }),$globals.MessageNotUnderstood);
  57275. $ctx1.sendIdx["should:raise:"]=25;
  57276. self._should_raise_((function(){
  57277. return $core.withContext(function($ctx2) {
  57278. return (16)._rs();
  57279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  57280. }),$globals.MessageNotUnderstood);
  57281. $ctx1.sendIdx["should:raise:"]=26;
  57282. self._should_raise_((function(){
  57283. return $core.withContext(function($ctx2) {
  57284. return (16)._rT();
  57285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  57286. }),$globals.MessageNotUnderstood);
  57287. $ctx1.sendIdx["should:raise:"]=27;
  57288. self._should_raise_((function(){
  57289. return $core.withContext(function($ctx2) {
  57290. return (16)._rt();
  57291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  57292. }),$globals.MessageNotUnderstood);
  57293. $ctx1.sendIdx["should:raise:"]=28;
  57294. self._should_raise_((function(){
  57295. return $core.withContext(function($ctx2) {
  57296. return (16)._rU();
  57297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  57298. }),$globals.MessageNotUnderstood);
  57299. $ctx1.sendIdx["should:raise:"]=29;
  57300. self._should_raise_((function(){
  57301. return $core.withContext(function($ctx2) {
  57302. return (16)._ru();
  57303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  57304. }),$globals.MessageNotUnderstood);
  57305. $ctx1.sendIdx["should:raise:"]=30;
  57306. self._should_raise_((function(){
  57307. return $core.withContext(function($ctx2) {
  57308. return (16)._rV();
  57309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  57310. }),$globals.MessageNotUnderstood);
  57311. $ctx1.sendIdx["should:raise:"]=31;
  57312. self._should_raise_((function(){
  57313. return $core.withContext(function($ctx2) {
  57314. return (16)._rv();
  57315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  57316. }),$globals.MessageNotUnderstood);
  57317. $ctx1.sendIdx["should:raise:"]=32;
  57318. self._should_raise_((function(){
  57319. return $core.withContext(function($ctx2) {
  57320. return (16)._rW();
  57321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  57322. }),$globals.MessageNotUnderstood);
  57323. $ctx1.sendIdx["should:raise:"]=33;
  57324. self._should_raise_((function(){
  57325. return $core.withContext(function($ctx2) {
  57326. return (16)._rw();
  57327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  57328. }),$globals.MessageNotUnderstood);
  57329. $ctx1.sendIdx["should:raise:"]=34;
  57330. self._should_raise_((function(){
  57331. return $core.withContext(function($ctx2) {
  57332. return (16)._rX();
  57333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  57334. }),$globals.MessageNotUnderstood);
  57335. $ctx1.sendIdx["should:raise:"]=35;
  57336. self._should_raise_((function(){
  57337. return $core.withContext(function($ctx2) {
  57338. return (16)._rx();
  57339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  57340. }),$globals.MessageNotUnderstood);
  57341. $ctx1.sendIdx["should:raise:"]=36;
  57342. self._should_raise_((function(){
  57343. return $core.withContext(function($ctx2) {
  57344. return (16)._rY();
  57345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  57346. }),$globals.MessageNotUnderstood);
  57347. $ctx1.sendIdx["should:raise:"]=37;
  57348. self._should_raise_((function(){
  57349. return $core.withContext(function($ctx2) {
  57350. return (16)._ry();
  57351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  57352. }),$globals.MessageNotUnderstood);
  57353. $ctx1.sendIdx["should:raise:"]=38;
  57354. self._should_raise_((function(){
  57355. return $core.withContext(function($ctx2) {
  57356. return (16)._rZ();
  57357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  57358. }),$globals.MessageNotUnderstood);
  57359. $ctx1.sendIdx["should:raise:"]=39;
  57360. self._should_raise_((function(){
  57361. return $core.withContext(function($ctx2) {
  57362. return (16)._rz();
  57363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  57364. }),$globals.MessageNotUnderstood);
  57365. $ctx1.sendIdx["should:raise:"]=40;
  57366. self._should_raise_((function(){
  57367. return $core.withContext(function($ctx2) {
  57368. return (11259375)._Z();
  57369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  57370. }),$globals.MessageNotUnderstood);
  57371. return self;
  57372. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  57373. },
  57374. args: [],
  57375. 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.",
  57376. referencedClasses: ["MessageNotUnderstood"],
  57377. 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"]
  57378. }),
  57379. $globals.NumberTest);
  57380. $core.addMethod(
  57381. $core.method({
  57382. selector: "testLog",
  57383. protocol: "tests",
  57384. fn: function (){
  57385. var self=this;
  57386. return $core.withContext(function($ctx1) {
  57387. self._assert_equals_((10000)._log(),(4));
  57388. $ctx1.sendIdx["assert:equals:"]=1;
  57389. self._assert_equals_((512)._log_((2)),(9));
  57390. $ctx1.sendIdx["assert:equals:"]=2;
  57391. self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  57392. return self;
  57393. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  57394. },
  57395. args: [],
  57396. 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.",
  57397. referencedClasses: ["Number"],
  57398. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  57399. }),
  57400. $globals.NumberTest);
  57401. $core.addMethod(
  57402. $core.method({
  57403. selector: "testMinMax",
  57404. protocol: "tests",
  57405. fn: function (){
  57406. var self=this;
  57407. return $core.withContext(function($ctx1) {
  57408. self._assert_equals_((2)._max_((5)),(5));
  57409. $ctx1.sendIdx["assert:equals:"]=1;
  57410. self._assert_equals_((2)._min_((5)),(2));
  57411. return self;
  57412. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  57413. },
  57414. args: [],
  57415. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  57416. referencedClasses: [],
  57417. messageSends: ["assert:equals:", "max:", "min:"]
  57418. }),
  57419. $globals.NumberTest);
  57420. $core.addMethod(
  57421. $core.method({
  57422. selector: "testNegated",
  57423. protocol: "tests",
  57424. fn: function (){
  57425. var self=this;
  57426. return $core.withContext(function($ctx1) {
  57427. var $1;
  57428. $1=(3)._negated();
  57429. $ctx1.sendIdx["negated"]=1;
  57430. self._assert_equals_($1,(-3));
  57431. $ctx1.sendIdx["assert:equals:"]=1;
  57432. self._assert_equals_((-3)._negated(),(3));
  57433. return self;
  57434. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  57435. },
  57436. args: [],
  57437. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  57438. referencedClasses: [],
  57439. messageSends: ["assert:equals:", "negated"]
  57440. }),
  57441. $globals.NumberTest);
  57442. $core.addMethod(
  57443. $core.method({
  57444. selector: "testPrintShowingDecimalPlaces",
  57445. protocol: "tests",
  57446. fn: function (){
  57447. var self=this;
  57448. return $core.withContext(function($ctx1) {
  57449. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  57450. $1=(23)._printShowingDecimalPlaces_((2));
  57451. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  57452. self._assert_equals_($1,"23.00");
  57453. $ctx1.sendIdx["assert:equals:"]=1;
  57454. $2=(23.5698)._printShowingDecimalPlaces_((2));
  57455. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  57456. self._assert_equals_($2,"23.57");
  57457. $ctx1.sendIdx["assert:equals:"]=2;
  57458. $4=(234.567)._negated();
  57459. $ctx1.sendIdx["negated"]=1;
  57460. $3=$recv($4)._printShowingDecimalPlaces_((5));
  57461. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  57462. self._assert_equals_($3,"-234.56700");
  57463. $ctx1.sendIdx["assert:equals:"]=3;
  57464. $5=(23.4567)._printShowingDecimalPlaces_((0));
  57465. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  57466. self._assert_equals_($5,"23");
  57467. $ctx1.sendIdx["assert:equals:"]=4;
  57468. $6=(23.5567)._printShowingDecimalPlaces_((0));
  57469. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  57470. self._assert_equals_($6,"24");
  57471. $ctx1.sendIdx["assert:equals:"]=5;
  57472. $8=(23.4567)._negated();
  57473. $ctx1.sendIdx["negated"]=2;
  57474. $7=$recv($8)._printShowingDecimalPlaces_((0));
  57475. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  57476. self._assert_equals_($7,"-23");
  57477. $ctx1.sendIdx["assert:equals:"]=6;
  57478. $10=(23.5567)._negated();
  57479. $ctx1.sendIdx["negated"]=3;
  57480. $9=$recv($10)._printShowingDecimalPlaces_((0));
  57481. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  57482. self._assert_equals_($9,"-24");
  57483. $ctx1.sendIdx["assert:equals:"]=7;
  57484. $11=(100000000)._printShowingDecimalPlaces_((1));
  57485. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  57486. self._assert_equals_($11,"100000000.0");
  57487. $ctx1.sendIdx["assert:equals:"]=8;
  57488. $12=(0.98)._printShowingDecimalPlaces_((5));
  57489. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  57490. self._assert_equals_($12,"0.98000");
  57491. $ctx1.sendIdx["assert:equals:"]=9;
  57492. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  57493. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  57494. self._assert_equals_($13,"-0.98");
  57495. $ctx1.sendIdx["assert:equals:"]=10;
  57496. $14=(2.567)._printShowingDecimalPlaces_((2));
  57497. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  57498. self._assert_equals_($14,"2.57");
  57499. $ctx1.sendIdx["assert:equals:"]=11;
  57500. $15=(-2.567)._printShowingDecimalPlaces_((2));
  57501. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  57502. self._assert_equals_($15,"-2.57");
  57503. $ctx1.sendIdx["assert:equals:"]=12;
  57504. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  57505. return self;
  57506. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  57507. },
  57508. args: [],
  57509. 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'.",
  57510. referencedClasses: [],
  57511. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  57512. }),
  57513. $globals.NumberTest);
  57514. $core.addMethod(
  57515. $core.method({
  57516. selector: "testRaisedTo",
  57517. protocol: "tests",
  57518. fn: function (){
  57519. var self=this;
  57520. return $core.withContext(function($ctx1) {
  57521. var $1,$2,$3;
  57522. $1=(2)._raisedTo_((4));
  57523. $ctx1.sendIdx["raisedTo:"]=1;
  57524. self._assert_equals_($1,(16));
  57525. $ctx1.sendIdx["assert:equals:"]=1;
  57526. $2=(2)._raisedTo_((0));
  57527. $ctx1.sendIdx["raisedTo:"]=2;
  57528. self._assert_equals_($2,(1));
  57529. $ctx1.sendIdx["assert:equals:"]=2;
  57530. $3=(2)._raisedTo_((-3));
  57531. $ctx1.sendIdx["raisedTo:"]=3;
  57532. self._assert_equals_($3,(0.125));
  57533. $ctx1.sendIdx["assert:equals:"]=3;
  57534. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  57535. $ctx1.sendIdx["assert:equals:"]=4;
  57536. self._assert_equals_((2).__star_star((4)),(16));
  57537. return self;
  57538. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  57539. },
  57540. args: [],
  57541. 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.",
  57542. referencedClasses: [],
  57543. messageSends: ["assert:equals:", "raisedTo:", "**"]
  57544. }),
  57545. $globals.NumberTest);
  57546. $core.addMethod(
  57547. $core.method({
  57548. selector: "testRounded",
  57549. protocol: "tests",
  57550. fn: function (){
  57551. var self=this;
  57552. return $core.withContext(function($ctx1) {
  57553. var $1,$2;
  57554. $1=(3)._rounded();
  57555. $ctx1.sendIdx["rounded"]=1;
  57556. self._assert_equals_($1,(3));
  57557. $ctx1.sendIdx["assert:equals:"]=1;
  57558. $2=(3.212)._rounded();
  57559. $ctx1.sendIdx["rounded"]=2;
  57560. self._assert_equals_($2,(3));
  57561. $ctx1.sendIdx["assert:equals:"]=2;
  57562. self._assert_equals_((3.51)._rounded(),(4));
  57563. return self;
  57564. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  57565. },
  57566. args: [],
  57567. 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",
  57568. referencedClasses: [],
  57569. messageSends: ["assert:equals:", "rounded"]
  57570. }),
  57571. $globals.NumberTest);
  57572. $core.addMethod(
  57573. $core.method({
  57574. selector: "testSign",
  57575. protocol: "tests",
  57576. fn: function (){
  57577. var self=this;
  57578. return $core.withContext(function($ctx1) {
  57579. var $1,$2;
  57580. $1=(5)._sign();
  57581. $ctx1.sendIdx["sign"]=1;
  57582. self._assert_equals_($1,(1));
  57583. $ctx1.sendIdx["assert:equals:"]=1;
  57584. $2=(0)._sign();
  57585. $ctx1.sendIdx["sign"]=2;
  57586. self._assert_equals_($2,(0));
  57587. $ctx1.sendIdx["assert:equals:"]=2;
  57588. self._assert_equals_((-1.4)._sign(),(-1));
  57589. return self;
  57590. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  57591. },
  57592. args: [],
  57593. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  57594. referencedClasses: [],
  57595. messageSends: ["assert:equals:", "sign"]
  57596. }),
  57597. $globals.NumberTest);
  57598. $core.addMethod(
  57599. $core.method({
  57600. selector: "testSqrt",
  57601. protocol: "tests",
  57602. fn: function (){
  57603. var self=this;
  57604. return $core.withContext(function($ctx1) {
  57605. var $1;
  57606. $1=(4)._sqrt();
  57607. $ctx1.sendIdx["sqrt"]=1;
  57608. self._assert_equals_($1,(2));
  57609. $ctx1.sendIdx["assert:equals:"]=1;
  57610. self._assert_equals_((16)._sqrt(),(4));
  57611. return self;
  57612. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  57613. },
  57614. args: [],
  57615. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  57616. referencedClasses: [],
  57617. messageSends: ["assert:equals:", "sqrt"]
  57618. }),
  57619. $globals.NumberTest);
  57620. $core.addMethod(
  57621. $core.method({
  57622. selector: "testSquared",
  57623. protocol: "tests",
  57624. fn: function (){
  57625. var self=this;
  57626. return $core.withContext(function($ctx1) {
  57627. self._assert_equals_((4)._squared(),(16));
  57628. return self;
  57629. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  57630. },
  57631. args: [],
  57632. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  57633. referencedClasses: [],
  57634. messageSends: ["assert:equals:", "squared"]
  57635. }),
  57636. $globals.NumberTest);
  57637. $core.addMethod(
  57638. $core.method({
  57639. selector: "testTimesRepeat",
  57640. protocol: "tests",
  57641. fn: function (){
  57642. var self=this;
  57643. var i;
  57644. return $core.withContext(function($ctx1) {
  57645. i=(0);
  57646. (0)._timesRepeat_((function(){
  57647. return $core.withContext(function($ctx2) {
  57648. i=$recv(i).__plus((1));
  57649. $ctx2.sendIdx["+"]=1;
  57650. return i;
  57651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57652. }));
  57653. $ctx1.sendIdx["timesRepeat:"]=1;
  57654. self._assert_equals_(i,(0));
  57655. $ctx1.sendIdx["assert:equals:"]=1;
  57656. (5)._timesRepeat_((function(){
  57657. return $core.withContext(function($ctx2) {
  57658. i=$recv(i).__plus((1));
  57659. return i;
  57660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57661. }));
  57662. self._assert_equals_(i,(5));
  57663. return self;
  57664. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  57665. },
  57666. args: [],
  57667. 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",
  57668. referencedClasses: [],
  57669. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  57670. }),
  57671. $globals.NumberTest);
  57672. $core.addMethod(
  57673. $core.method({
  57674. selector: "testTo",
  57675. protocol: "tests",
  57676. fn: function (){
  57677. var self=this;
  57678. return $core.withContext(function($ctx1) {
  57679. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  57680. return self;
  57681. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  57682. },
  57683. args: [],
  57684. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  57685. referencedClasses: [],
  57686. messageSends: ["assert:equals:", "to:"]
  57687. }),
  57688. $globals.NumberTest);
  57689. $core.addMethod(
  57690. $core.method({
  57691. selector: "testToBy",
  57692. protocol: "tests",
  57693. fn: function (){
  57694. var self=this;
  57695. return $core.withContext(function($ctx1) {
  57696. var $1;
  57697. $1=(0)._to_by_((6),(2));
  57698. $ctx1.sendIdx["to:by:"]=1;
  57699. self._assert_equals_($1,[(0), (2), (4), (6)]);
  57700. self._should_raise_((function(){
  57701. return $core.withContext(function($ctx2) {
  57702. return (1)._to_by_((4),(0));
  57703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57704. }),$globals.Error);
  57705. return self;
  57706. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  57707. },
  57708. args: [],
  57709. 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",
  57710. referencedClasses: ["Error"],
  57711. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  57712. }),
  57713. $globals.NumberTest);
  57714. $core.addMethod(
  57715. $core.method({
  57716. selector: "testTrigonometry",
  57717. protocol: "tests",
  57718. fn: function (){
  57719. var self=this;
  57720. return $core.withContext(function($ctx1) {
  57721. self._assert_equals_((0)._cos(),(1));
  57722. $ctx1.sendIdx["assert:equals:"]=1;
  57723. self._assert_equals_((0)._sin(),(0));
  57724. $ctx1.sendIdx["assert:equals:"]=2;
  57725. self._assert_equals_((0)._tan(),(0));
  57726. $ctx1.sendIdx["assert:equals:"]=3;
  57727. self._assert_equals_((1)._arcCos(),(0));
  57728. $ctx1.sendIdx["assert:equals:"]=4;
  57729. self._assert_equals_((0)._arcSin(),(0));
  57730. $ctx1.sendIdx["assert:equals:"]=5;
  57731. self._assert_equals_((0)._arcTan(),(0));
  57732. return self;
  57733. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  57734. },
  57735. args: [],
  57736. 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.",
  57737. referencedClasses: [],
  57738. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  57739. }),
  57740. $globals.NumberTest);
  57741. $core.addMethod(
  57742. $core.method({
  57743. selector: "testTruncated",
  57744. protocol: "tests",
  57745. fn: function (){
  57746. var self=this;
  57747. return $core.withContext(function($ctx1) {
  57748. var $1,$2;
  57749. $1=(3)._truncated();
  57750. $ctx1.sendIdx["truncated"]=1;
  57751. self._assert_equals_($1,(3));
  57752. $ctx1.sendIdx["assert:equals:"]=1;
  57753. $2=(3.212)._truncated();
  57754. $ctx1.sendIdx["truncated"]=2;
  57755. self._assert_equals_($2,(3));
  57756. $ctx1.sendIdx["assert:equals:"]=2;
  57757. self._assert_equals_((3.51)._truncated(),(3));
  57758. return self;
  57759. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  57760. },
  57761. args: [],
  57762. 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",
  57763. referencedClasses: [],
  57764. messageSends: ["assert:equals:", "truncated"]
  57765. }),
  57766. $globals.NumberTest);
  57767. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  57768. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  57769. $core.addMethod(
  57770. $core.method({
  57771. selector: "foo",
  57772. protocol: "not yet classified",
  57773. fn: function (){
  57774. var self=this;
  57775. return self["@foo"];
  57776. },
  57777. args: [],
  57778. source: "foo\x0a\x09^ foo",
  57779. referencedClasses: [],
  57780. messageSends: []
  57781. }),
  57782. $globals.ObjectMock);
  57783. $core.addMethod(
  57784. $core.method({
  57785. selector: "foo:",
  57786. protocol: "not yet classified",
  57787. fn: function (anObject){
  57788. var self=this;
  57789. self["@foo"]=anObject;
  57790. return self;
  57791. },
  57792. args: ["anObject"],
  57793. source: "foo: anObject\x0a\x09foo := anObject",
  57794. referencedClasses: [],
  57795. messageSends: []
  57796. }),
  57797. $globals.ObjectMock);
  57798. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  57799. $core.addMethod(
  57800. $core.method({
  57801. selector: "notDefined",
  57802. protocol: "tests",
  57803. fn: function (){
  57804. var self=this;
  57805. return $core.withContext(function($ctx1) {
  57806. return void 0;;
  57807. return self;
  57808. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  57809. },
  57810. args: [],
  57811. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  57812. referencedClasses: [],
  57813. messageSends: []
  57814. }),
  57815. $globals.ObjectTest);
  57816. $core.addMethod(
  57817. $core.method({
  57818. selector: "testBasicAccess",
  57819. protocol: "tests",
  57820. fn: function (){
  57821. var self=this;
  57822. var o;
  57823. return $core.withContext(function($ctx1) {
  57824. var $1;
  57825. o=$recv($globals.Object)._new();
  57826. $recv(o)._basicAt_put_("a",(1));
  57827. $1=$recv(o)._basicAt_("a");
  57828. $ctx1.sendIdx["basicAt:"]=1;
  57829. self._assert_equals_($1,(1));
  57830. $ctx1.sendIdx["assert:equals:"]=1;
  57831. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  57832. return self;
  57833. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  57834. },
  57835. args: [],
  57836. 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",
  57837. referencedClasses: ["Object"],
  57838. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  57839. }),
  57840. $globals.ObjectTest);
  57841. $core.addMethod(
  57842. $core.method({
  57843. selector: "testBasicPerform",
  57844. protocol: "tests",
  57845. fn: function (){
  57846. var self=this;
  57847. var o;
  57848. return $core.withContext(function($ctx1) {
  57849. o=$recv($globals.Object)._new();
  57850. $recv(o)._basicAt_put_("func",(function(){
  57851. return "hello";
  57852. }));
  57853. $ctx1.sendIdx["basicAt:put:"]=1;
  57854. $recv(o)._basicAt_put_("func2",(function(a){
  57855. return $core.withContext(function($ctx2) {
  57856. return $recv(a).__plus((1));
  57857. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  57858. }));
  57859. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  57860. $ctx1.sendIdx["assert:equals:"]=1;
  57861. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  57862. return self;
  57863. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  57864. },
  57865. args: [],
  57866. 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",
  57867. referencedClasses: ["Object"],
  57868. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  57869. }),
  57870. $globals.ObjectTest);
  57871. $core.addMethod(
  57872. $core.method({
  57873. selector: "testDNU",
  57874. protocol: "tests",
  57875. fn: function (){
  57876. var self=this;
  57877. return $core.withContext(function($ctx1) {
  57878. self._should_raise_((function(){
  57879. return $core.withContext(function($ctx2) {
  57880. return $recv($recv($globals.Object)._new())._foo();
  57881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57882. }),$globals.MessageNotUnderstood);
  57883. return self;
  57884. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  57885. },
  57886. args: [],
  57887. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  57888. referencedClasses: ["Object", "MessageNotUnderstood"],
  57889. messageSends: ["should:raise:", "foo", "new"]
  57890. }),
  57891. $globals.ObjectTest);
  57892. $core.addMethod(
  57893. $core.method({
  57894. selector: "testEquality",
  57895. protocol: "tests",
  57896. fn: function (){
  57897. var self=this;
  57898. var o;
  57899. return $core.withContext(function($ctx1) {
  57900. var $1,$2,$4,$3;
  57901. o=$recv($globals.Object)._new();
  57902. $ctx1.sendIdx["new"]=1;
  57903. $1=$recv(o).__eq($recv($globals.Object)._new());
  57904. $ctx1.sendIdx["="]=1;
  57905. self._deny_($1);
  57906. $2=$recv(o).__eq(o);
  57907. $ctx1.sendIdx["="]=2;
  57908. self._assert_($2);
  57909. $ctx1.sendIdx["assert:"]=1;
  57910. $4=$recv(o)._yourself();
  57911. $ctx1.sendIdx["yourself"]=1;
  57912. $3=$recv($4).__eq(o);
  57913. $ctx1.sendIdx["="]=3;
  57914. self._assert_($3);
  57915. $ctx1.sendIdx["assert:"]=2;
  57916. self._assert_($recv(o).__eq($recv(o)._yourself()));
  57917. return self;
  57918. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  57919. },
  57920. args: [],
  57921. 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)",
  57922. referencedClasses: ["Object"],
  57923. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  57924. }),
  57925. $globals.ObjectTest);
  57926. $core.addMethod(
  57927. $core.method({
  57928. selector: "testHalt",
  57929. protocol: "tests",
  57930. fn: function (){
  57931. var self=this;
  57932. return $core.withContext(function($ctx1) {
  57933. self._should_raise_((function(){
  57934. return $core.withContext(function($ctx2) {
  57935. return $recv($recv($globals.Object)._new())._halt();
  57936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57937. }),$globals.Error);
  57938. return self;
  57939. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  57940. },
  57941. args: [],
  57942. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  57943. referencedClasses: ["Object", "Error"],
  57944. messageSends: ["should:raise:", "halt", "new"]
  57945. }),
  57946. $globals.ObjectTest);
  57947. $core.addMethod(
  57948. $core.method({
  57949. selector: "testIdentity",
  57950. protocol: "tests",
  57951. fn: function (){
  57952. var self=this;
  57953. var o;
  57954. return $core.withContext(function($ctx1) {
  57955. var $1,$2,$4,$3;
  57956. o=$recv($globals.Object)._new();
  57957. $ctx1.sendIdx["new"]=1;
  57958. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  57959. $ctx1.sendIdx["=="]=1;
  57960. self._deny_($1);
  57961. $2=$recv(o).__eq_eq(o);
  57962. $ctx1.sendIdx["=="]=2;
  57963. self._assert_($2);
  57964. $ctx1.sendIdx["assert:"]=1;
  57965. $4=$recv(o)._yourself();
  57966. $ctx1.sendIdx["yourself"]=1;
  57967. $3=$recv($4).__eq_eq(o);
  57968. $ctx1.sendIdx["=="]=3;
  57969. self._assert_($3);
  57970. $ctx1.sendIdx["assert:"]=2;
  57971. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  57972. return self;
  57973. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  57974. },
  57975. args: [],
  57976. 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",
  57977. referencedClasses: ["Object"],
  57978. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  57979. }),
  57980. $globals.ObjectTest);
  57981. $core.addMethod(
  57982. $core.method({
  57983. selector: "testIfNil",
  57984. protocol: "tests",
  57985. fn: function (){
  57986. var self=this;
  57987. return $core.withContext(function($ctx1) {
  57988. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  57989. $2=$recv($globals.Object)._new();
  57990. $ctx1.sendIdx["new"]=1;
  57991. $1=$recv($2)._isNil();
  57992. self._deny_($1);
  57993. $ctx1.sendIdx["deny:"]=1;
  57994. $5=$recv($globals.Object)._new();
  57995. $ctx1.sendIdx["new"]=2;
  57996. if(($receiver = $5) == null || $receiver.isNil){
  57997. $4=true;
  57998. } else {
  57999. $4=$5;
  58000. }
  58001. $3=$recv($4).__eq(true);
  58002. self._deny_($3);
  58003. $7=$recv($globals.Object)._new();
  58004. $ctx1.sendIdx["new"]=3;
  58005. if(($receiver = $7) == null || $receiver.isNil){
  58006. $6=$7;
  58007. } else {
  58008. $6=true;
  58009. }
  58010. self._assert_equals_($6,true);
  58011. $ctx1.sendIdx["assert:equals:"]=1;
  58012. $9=$recv($globals.Object)._new();
  58013. $ctx1.sendIdx["new"]=4;
  58014. if(($receiver = $9) == null || $receiver.isNil){
  58015. $8=false;
  58016. } else {
  58017. $8=true;
  58018. }
  58019. self._assert_equals_($8,true);
  58020. $ctx1.sendIdx["assert:equals:"]=2;
  58021. $11=$recv($globals.Object)._new();
  58022. if(($receiver = $11) == null || $receiver.isNil){
  58023. $10=false;
  58024. } else {
  58025. $10=true;
  58026. }
  58027. self._assert_equals_($10,true);
  58028. return self;
  58029. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  58030. },
  58031. args: [],
  58032. 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",
  58033. referencedClasses: ["Object"],
  58034. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  58035. }),
  58036. $globals.ObjectTest);
  58037. $core.addMethod(
  58038. $core.method({
  58039. selector: "testInstVars",
  58040. protocol: "tests",
  58041. fn: function (){
  58042. var self=this;
  58043. var o;
  58044. return $core.withContext(function($ctx1) {
  58045. var $1,$2;
  58046. o=$recv($globals.ObjectMock)._new();
  58047. $1=$recv(o)._instVarAt_("foo");
  58048. $ctx1.sendIdx["instVarAt:"]=1;
  58049. self._assert_equals_($1,nil);
  58050. $ctx1.sendIdx["assert:equals:"]=1;
  58051. $recv(o)._instVarAt_put_("foo",(1));
  58052. $2=$recv(o)._instVarAt_("foo");
  58053. $ctx1.sendIdx["instVarAt:"]=2;
  58054. self._assert_equals_($2,(1));
  58055. $ctx1.sendIdx["assert:equals:"]=2;
  58056. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  58057. return self;
  58058. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  58059. },
  58060. args: [],
  58061. 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",
  58062. referencedClasses: ["ObjectMock"],
  58063. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  58064. }),
  58065. $globals.ObjectTest);
  58066. $core.addMethod(
  58067. $core.method({
  58068. selector: "testNilUndefined",
  58069. protocol: "tests",
  58070. fn: function (){
  58071. var self=this;
  58072. return $core.withContext(function($ctx1) {
  58073. self._assert_equals_(self._notDefined(),nil);
  58074. return self;
  58075. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  58076. },
  58077. args: [],
  58078. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  58079. referencedClasses: [],
  58080. messageSends: ["assert:equals:", "notDefined"]
  58081. }),
  58082. $globals.ObjectTest);
  58083. $core.addMethod(
  58084. $core.method({
  58085. selector: "testYourself",
  58086. protocol: "tests",
  58087. fn: function (){
  58088. var self=this;
  58089. var o;
  58090. return $core.withContext(function($ctx1) {
  58091. o=$recv($globals.ObjectMock)._new();
  58092. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  58093. return self;
  58094. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  58095. },
  58096. args: [],
  58097. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  58098. referencedClasses: ["ObjectMock"],
  58099. messageSends: ["new", "assert:", "==", "yourself"]
  58100. }),
  58101. $globals.ObjectTest);
  58102. $core.addMethod(
  58103. $core.method({
  58104. selector: "testidentityHash",
  58105. protocol: "tests",
  58106. fn: function (){
  58107. var self=this;
  58108. var o1,o2;
  58109. return $core.withContext(function($ctx1) {
  58110. var $2,$3,$1,$5,$4;
  58111. o1=$recv($globals.Object)._new();
  58112. $ctx1.sendIdx["new"]=1;
  58113. o2=$recv($globals.Object)._new();
  58114. $2=$recv(o1)._identityHash();
  58115. $ctx1.sendIdx["identityHash"]=1;
  58116. $3=$recv(o1)._identityHash();
  58117. $ctx1.sendIdx["identityHash"]=2;
  58118. $1=$recv($2).__eq_eq($3);
  58119. $ctx1.sendIdx["=="]=1;
  58120. self._assert_($1);
  58121. $5=$recv(o1)._identityHash();
  58122. $ctx1.sendIdx["identityHash"]=3;
  58123. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  58124. self._deny_($4);
  58125. return self;
  58126. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  58127. },
  58128. args: [],
  58129. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  58130. referencedClasses: ["Object"],
  58131. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  58132. }),
  58133. $globals.ObjectTest);
  58134. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  58135. $core.addMethod(
  58136. $core.method({
  58137. selector: "testAccessing",
  58138. protocol: "tests",
  58139. fn: function (){
  58140. var self=this;
  58141. return $core.withContext(function($ctx1) {
  58142. var $2,$1,$3,$6,$5,$4;
  58143. $2=$recv($globals.Point)._x_y_((3),(4));
  58144. $ctx1.sendIdx["x:y:"]=1;
  58145. $1=$recv($2)._x();
  58146. $ctx1.sendIdx["x"]=1;
  58147. self._assert_equals_($1,(3));
  58148. $ctx1.sendIdx["assert:equals:"]=1;
  58149. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  58150. $ctx1.sendIdx["y"]=1;
  58151. self._assert_equals_($3,(4));
  58152. $ctx1.sendIdx["assert:equals:"]=2;
  58153. $6=$recv($globals.Point)._new();
  58154. $ctx1.sendIdx["new"]=1;
  58155. $5=$recv($6)._x_((3));
  58156. $4=$recv($5)._x();
  58157. self._assert_equals_($4,(3));
  58158. $ctx1.sendIdx["assert:equals:"]=3;
  58159. self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  58160. return self;
  58161. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  58162. },
  58163. args: [],
  58164. 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",
  58165. referencedClasses: ["Point"],
  58166. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  58167. }),
  58168. $globals.PointTest);
  58169. $core.addMethod(
  58170. $core.method({
  58171. selector: "testArithmetic",
  58172. protocol: "tests",
  58173. fn: function (){
  58174. var self=this;
  58175. return $core.withContext(function($ctx1) {
  58176. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  58177. $2=(3).__at((4));
  58178. $ctx1.sendIdx["@"]=1;
  58179. $3=(3).__at((4));
  58180. $ctx1.sendIdx["@"]=2;
  58181. $1=$recv($2).__star($3);
  58182. $4=$recv($globals.Point)._x_y_((9),(16));
  58183. $ctx1.sendIdx["x:y:"]=1;
  58184. self._assert_equals_($1,$4);
  58185. $ctx1.sendIdx["assert:equals:"]=1;
  58186. $6=(3).__at((4));
  58187. $ctx1.sendIdx["@"]=3;
  58188. $7=(3).__at((4));
  58189. $ctx1.sendIdx["@"]=4;
  58190. $5=$recv($6).__plus($7);
  58191. $8=$recv($globals.Point)._x_y_((6),(8));
  58192. $ctx1.sendIdx["x:y:"]=2;
  58193. self._assert_equals_($5,$8);
  58194. $ctx1.sendIdx["assert:equals:"]=2;
  58195. $10=(3).__at((4));
  58196. $ctx1.sendIdx["@"]=5;
  58197. $11=(3).__at((4));
  58198. $ctx1.sendIdx["@"]=6;
  58199. $9=$recv($10).__minus($11);
  58200. $12=$recv($globals.Point)._x_y_((0),(0));
  58201. $ctx1.sendIdx["x:y:"]=3;
  58202. self._assert_equals_($9,$12);
  58203. $ctx1.sendIdx["assert:equals:"]=3;
  58204. $14=(6).__at((8));
  58205. $ctx1.sendIdx["@"]=7;
  58206. $13=$recv($14).__slash((3).__at((4)));
  58207. self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  58208. return self;
  58209. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  58210. },
  58211. args: [],
  58212. 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)",
  58213. referencedClasses: ["Point"],
  58214. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  58215. }),
  58216. $globals.PointTest);
  58217. $core.addMethod(
  58218. $core.method({
  58219. selector: "testAt",
  58220. protocol: "tests",
  58221. fn: function (){
  58222. var self=this;
  58223. return $core.withContext(function($ctx1) {
  58224. self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  58225. return self;
  58226. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  58227. },
  58228. args: [],
  58229. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  58230. referencedClasses: ["Point"],
  58231. messageSends: ["assert:equals:", "@", "x:y:"]
  58232. }),
  58233. $globals.PointTest);
  58234. $core.addMethod(
  58235. $core.method({
  58236. selector: "testComparison",
  58237. protocol: "tests",
  58238. fn: function (){
  58239. var self=this;
  58240. return $core.withContext(function($ctx1) {
  58241. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  58242. $2=(3).__at((4));
  58243. $ctx1.sendIdx["@"]=1;
  58244. $3=(4).__at((5));
  58245. $ctx1.sendIdx["@"]=2;
  58246. $1=$recv($2).__lt($3);
  58247. $ctx1.sendIdx["<"]=1;
  58248. self._assert_($1);
  58249. $ctx1.sendIdx["assert:"]=1;
  58250. $5=(3).__at((4));
  58251. $ctx1.sendIdx["@"]=3;
  58252. $6=(4).__at((4));
  58253. $ctx1.sendIdx["@"]=4;
  58254. $4=$recv($5).__lt($6);
  58255. self._deny_($4);
  58256. $ctx1.sendIdx["deny:"]=1;
  58257. $8=(4).__at((5));
  58258. $ctx1.sendIdx["@"]=5;
  58259. $9=(4).__at((5));
  58260. $ctx1.sendIdx["@"]=6;
  58261. $7=$recv($8).__lt_eq($9);
  58262. $ctx1.sendIdx["<="]=1;
  58263. self._assert_($7);
  58264. $ctx1.sendIdx["assert:"]=2;
  58265. $11=(4).__at((5));
  58266. $ctx1.sendIdx["@"]=7;
  58267. $12=(3).__at((5));
  58268. $ctx1.sendIdx["@"]=8;
  58269. $10=$recv($11).__lt_eq($12);
  58270. self._deny_($10);
  58271. $ctx1.sendIdx["deny:"]=2;
  58272. $14=(5).__at((6));
  58273. $ctx1.sendIdx["@"]=9;
  58274. $15=(4).__at((5));
  58275. $ctx1.sendIdx["@"]=10;
  58276. $13=$recv($14).__gt($15);
  58277. $ctx1.sendIdx[">"]=1;
  58278. self._assert_($13);
  58279. $ctx1.sendIdx["assert:"]=3;
  58280. $17=(5).__at((6));
  58281. $ctx1.sendIdx["@"]=11;
  58282. $18=(6).__at((6));
  58283. $ctx1.sendIdx["@"]=12;
  58284. $16=$recv($17).__gt($18);
  58285. self._deny_($16);
  58286. $ctx1.sendIdx["deny:"]=3;
  58287. $20=(4).__at((5));
  58288. $ctx1.sendIdx["@"]=13;
  58289. $21=(4).__at((5));
  58290. $ctx1.sendIdx["@"]=14;
  58291. $19=$recv($20).__gt_eq($21);
  58292. $ctx1.sendIdx[">="]=1;
  58293. self._assert_($19);
  58294. $23=(4).__at((5));
  58295. $ctx1.sendIdx["@"]=15;
  58296. $22=$recv($23).__gt_eq((5).__at((5)));
  58297. self._deny_($22);
  58298. return self;
  58299. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  58300. },
  58301. args: [],
  58302. 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)",
  58303. referencedClasses: [],
  58304. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  58305. }),
  58306. $globals.PointTest);
  58307. $core.addMethod(
  58308. $core.method({
  58309. selector: "testEgality",
  58310. protocol: "tests",
  58311. fn: function (){
  58312. var self=this;
  58313. return $core.withContext(function($ctx1) {
  58314. var $2,$3,$1,$5,$4;
  58315. $2=(3).__at((4));
  58316. $ctx1.sendIdx["@"]=1;
  58317. $3=(3).__at((4));
  58318. $ctx1.sendIdx["@"]=2;
  58319. $1=$recv($2).__eq($3);
  58320. $ctx1.sendIdx["="]=1;
  58321. self._assert_($1);
  58322. $5=(3).__at((5));
  58323. $ctx1.sendIdx["@"]=3;
  58324. $4=$recv($5).__eq((3).__at((6)));
  58325. self._deny_($4);
  58326. return self;
  58327. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  58328. },
  58329. args: [],
  58330. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  58331. referencedClasses: [],
  58332. messageSends: ["assert:", "=", "@", "deny:"]
  58333. }),
  58334. $globals.PointTest);
  58335. $core.addMethod(
  58336. $core.method({
  58337. selector: "testNew",
  58338. protocol: "tests",
  58339. fn: function (){
  58340. var self=this;
  58341. return $core.withContext(function($ctx1) {
  58342. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  58343. $3=$recv($globals.Point)._new();
  58344. $ctx1.sendIdx["new"]=1;
  58345. $2=$recv($3)._x_((3));
  58346. $ctx1.sendIdx["x:"]=1;
  58347. $1=$recv($2)._y();
  58348. $ctx1.sendIdx["y"]=1;
  58349. self._assert_equals_($1,nil);
  58350. $ctx1.sendIdx["assert:equals:"]=1;
  58351. $7=$recv($globals.Point)._new();
  58352. $ctx1.sendIdx["new"]=2;
  58353. $6=$recv($7)._x_((3));
  58354. $5=$recv($6)._x();
  58355. $ctx1.sendIdx["x"]=1;
  58356. $4=$recv($5).__eq((0));
  58357. $ctx1.sendIdx["="]=1;
  58358. self._deny_($4);
  58359. $ctx1.sendIdx["deny:"]=1;
  58360. $10=$recv($globals.Point)._new();
  58361. $ctx1.sendIdx["new"]=3;
  58362. $9=$recv($10)._y_((4));
  58363. $ctx1.sendIdx["y:"]=1;
  58364. $8=$recv($9)._x();
  58365. self._assert_equals_($8,nil);
  58366. self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  58367. return self;
  58368. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  58369. },
  58370. args: [],
  58371. 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",
  58372. referencedClasses: ["Point"],
  58373. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  58374. }),
  58375. $globals.PointTest);
  58376. $core.addMethod(
  58377. $core.method({
  58378. selector: "testTranslateBy",
  58379. protocol: "tests",
  58380. fn: function (){
  58381. var self=this;
  58382. return $core.withContext(function($ctx1) {
  58383. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  58384. $2=(3).__at((3));
  58385. $ctx1.sendIdx["@"]=1;
  58386. $3=(0).__at((1));
  58387. $ctx1.sendIdx["@"]=2;
  58388. $1=$recv($2)._translateBy_($3);
  58389. $ctx1.sendIdx["translateBy:"]=1;
  58390. $4=(3).__at((4));
  58391. $ctx1.sendIdx["@"]=3;
  58392. self._assert_equals_($1,$4);
  58393. $ctx1.sendIdx["assert:equals:"]=1;
  58394. $6=(3).__at((3));
  58395. $ctx1.sendIdx["@"]=4;
  58396. $8=(1)._negated();
  58397. $ctx1.sendIdx["negated"]=1;
  58398. $7=(0).__at($8);
  58399. $ctx1.sendIdx["@"]=5;
  58400. $5=$recv($6)._translateBy_($7);
  58401. $ctx1.sendIdx["translateBy:"]=2;
  58402. $9=(3).__at((2));
  58403. $ctx1.sendIdx["@"]=6;
  58404. self._assert_equals_($5,$9);
  58405. $ctx1.sendIdx["assert:equals:"]=2;
  58406. $11=(3).__at((3));
  58407. $ctx1.sendIdx["@"]=7;
  58408. $12=(2).__at((3));
  58409. $ctx1.sendIdx["@"]=8;
  58410. $10=$recv($11)._translateBy_($12);
  58411. $ctx1.sendIdx["translateBy:"]=3;
  58412. $13=(5).__at((6));
  58413. $ctx1.sendIdx["@"]=9;
  58414. self._assert_equals_($10,$13);
  58415. $ctx1.sendIdx["assert:equals:"]=3;
  58416. $15=(3).__at((3));
  58417. $ctx1.sendIdx["@"]=10;
  58418. $16=$recv((3)._negated()).__at((0));
  58419. $ctx1.sendIdx["@"]=11;
  58420. $14=$recv($15)._translateBy_($16);
  58421. self._assert_equals_($14,(0).__at((3)));
  58422. return self;
  58423. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  58424. },
  58425. args: [],
  58426. 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.",
  58427. referencedClasses: [],
  58428. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  58429. }),
  58430. $globals.PointTest);
  58431. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  58432. $core.addMethod(
  58433. $core.method({
  58434. selector: "testNextIfAbsent",
  58435. protocol: "tests",
  58436. fn: function (){
  58437. var self=this;
  58438. var queue;
  58439. return $core.withContext(function($ctx1) {
  58440. var $2,$1;
  58441. queue=$recv($globals.Queue)._new();
  58442. $recv(queue)._nextPut_("index1");
  58443. $2=$recv(queue)._nextIfAbsent_("empty");
  58444. $ctx1.sendIdx["nextIfAbsent:"]=1;
  58445. $1=$recv($2).__eq("index1");
  58446. $ctx1.sendIdx["="]=1;
  58447. self._assert_($1);
  58448. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  58449. return self;
  58450. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  58451. },
  58452. args: [],
  58453. 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'",
  58454. referencedClasses: ["Queue"],
  58455. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  58456. }),
  58457. $globals.QueueTest);
  58458. $core.addMethod(
  58459. $core.method({
  58460. selector: "testQueueNext",
  58461. protocol: "tests",
  58462. fn: function (){
  58463. var self=this;
  58464. var queue;
  58465. return $core.withContext(function($ctx1) {
  58466. var $1,$3,$2,$5,$4;
  58467. queue=$recv($globals.Queue)._new();
  58468. $1=queue;
  58469. $recv($1)._nextPut_("index1");
  58470. $ctx1.sendIdx["nextPut:"]=1;
  58471. $recv($1)._nextPut_("index2");
  58472. $3=$recv(queue)._next();
  58473. $ctx1.sendIdx["next"]=1;
  58474. $2=$recv($3).__eq("index1");
  58475. $ctx1.sendIdx["="]=1;
  58476. self._assert_($2);
  58477. $5=$recv(queue)._next();
  58478. $ctx1.sendIdx["next"]=2;
  58479. $4=$recv($5).__eq("index");
  58480. self._deny_($4);
  58481. self._should_raise_((function(){
  58482. return $core.withContext(function($ctx2) {
  58483. return $recv(queue)._next();
  58484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58485. }),$globals.Error);
  58486. return self;
  58487. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  58488. },
  58489. args: [],
  58490. 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",
  58491. referencedClasses: ["Queue", "Error"],
  58492. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  58493. }),
  58494. $globals.QueueTest);
  58495. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  58496. $core.addMethod(
  58497. $core.method({
  58498. selector: "testAtRandomNumber",
  58499. protocol: "tests",
  58500. fn: function (){
  58501. var self=this;
  58502. var val;
  58503. return $core.withContext(function($ctx1) {
  58504. (100)._timesRepeat_((function(){
  58505. return $core.withContext(function($ctx2) {
  58506. val=(10)._atRandom();
  58507. val;
  58508. self._assert_($recv(val).__gt((0)));
  58509. $ctx2.sendIdx["assert:"]=1;
  58510. return self._assert_($recv(val).__lt((11)));
  58511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58512. }));
  58513. return self;
  58514. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  58515. },
  58516. args: [],
  58517. 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]",
  58518. referencedClasses: [],
  58519. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  58520. }),
  58521. $globals.RandomTest);
  58522. $core.addMethod(
  58523. $core.method({
  58524. selector: "testAtRandomSequenceableCollection",
  58525. protocol: "tests",
  58526. fn: function (){
  58527. var self=this;
  58528. var val;
  58529. return $core.withContext(function($ctx1) {
  58530. var $3,$4,$2,$1;
  58531. (100)._timesRepeat_((function(){
  58532. return $core.withContext(function($ctx2) {
  58533. val="abc"._atRandom();
  58534. val;
  58535. $3=$recv(val).__eq("a");
  58536. $ctx2.sendIdx["="]=1;
  58537. $4=$recv(val).__eq("b");
  58538. $ctx2.sendIdx["="]=2;
  58539. $2=$recv($3).__or($4);
  58540. $1=$recv($2).__or($recv(val).__eq("c"));
  58541. $ctx2.sendIdx["|"]=1;
  58542. return self._assert_($1);
  58543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58544. }));
  58545. return self;
  58546. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  58547. },
  58548. args: [],
  58549. 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].",
  58550. referencedClasses: [],
  58551. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  58552. }),
  58553. $globals.RandomTest);
  58554. $core.addMethod(
  58555. $core.method({
  58556. selector: "textNext",
  58557. protocol: "tests",
  58558. fn: function (){
  58559. var self=this;
  58560. return $core.withContext(function($ctx1) {
  58561. var $1;
  58562. (10000)._timesRepeat_((function(){
  58563. var current,next;
  58564. return $core.withContext(function($ctx2) {
  58565. next=$recv($recv($globals.Random)._new())._next();
  58566. next;
  58567. self._assert_($recv(next).__gt_eq((0)));
  58568. $ctx2.sendIdx["assert:"]=1;
  58569. self._assert_($recv(next).__lt((1)));
  58570. $1=$recv(current).__eq(next);
  58571. $ctx2.sendIdx["="]=1;
  58572. self._deny_($1);
  58573. return $recv(next).__eq(current);
  58574. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  58575. }));
  58576. return self;
  58577. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  58578. },
  58579. args: [],
  58580. 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 ]",
  58581. referencedClasses: ["Random"],
  58582. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  58583. }),
  58584. $globals.RandomTest);
  58585. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  58586. $core.addMethod(
  58587. $core.method({
  58588. selector: "collectionClass",
  58589. protocol: "accessing",
  58590. fn: function (){
  58591. var self=this;
  58592. return $core.withContext(function($ctx1) {
  58593. return $recv(self._class())._collectionClass();
  58594. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  58595. },
  58596. args: [],
  58597. source: "collectionClass\x0a\x09^ self class collectionClass",
  58598. referencedClasses: [],
  58599. messageSends: ["collectionClass", "class"]
  58600. }),
  58601. $globals.StreamTest);
  58602. $core.addMethod(
  58603. $core.method({
  58604. selector: "newCollection",
  58605. protocol: "accessing",
  58606. fn: function (){
  58607. var self=this;
  58608. return $core.withContext(function($ctx1) {
  58609. return $recv(self._collectionClass())._new();
  58610. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  58611. },
  58612. args: [],
  58613. source: "newCollection\x0a\x09^ self collectionClass new",
  58614. referencedClasses: [],
  58615. messageSends: ["new", "collectionClass"]
  58616. }),
  58617. $globals.StreamTest);
  58618. $core.addMethod(
  58619. $core.method({
  58620. selector: "newStream",
  58621. protocol: "accessing",
  58622. fn: function (){
  58623. var self=this;
  58624. return $core.withContext(function($ctx1) {
  58625. return $recv($recv(self._collectionClass())._new())._stream();
  58626. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  58627. },
  58628. args: [],
  58629. source: "newStream\x0a\x09^ self collectionClass new stream",
  58630. referencedClasses: [],
  58631. messageSends: ["stream", "new", "collectionClass"]
  58632. }),
  58633. $globals.StreamTest);
  58634. $core.addMethod(
  58635. $core.method({
  58636. selector: "testAtStartAtEnd",
  58637. protocol: "tests",
  58638. fn: function (){
  58639. var self=this;
  58640. var stream;
  58641. return $core.withContext(function($ctx1) {
  58642. var $1,$2,$3,$4;
  58643. stream=self._newStream();
  58644. $1=$recv(stream)._atStart();
  58645. $ctx1.sendIdx["atStart"]=1;
  58646. self._assert_($1);
  58647. $ctx1.sendIdx["assert:"]=1;
  58648. $2=$recv(stream)._atEnd();
  58649. $ctx1.sendIdx["atEnd"]=1;
  58650. self._assert_($2);
  58651. $ctx1.sendIdx["assert:"]=2;
  58652. $recv(stream)._nextPutAll_(self._newCollection());
  58653. $3=$recv(stream)._atEnd();
  58654. $ctx1.sendIdx["atEnd"]=2;
  58655. self._assert_($3);
  58656. $4=$recv(stream)._atStart();
  58657. $ctx1.sendIdx["atStart"]=2;
  58658. self._deny_($4);
  58659. $ctx1.sendIdx["deny:"]=1;
  58660. $recv(stream)._position_((1));
  58661. self._deny_($recv(stream)._atEnd());
  58662. $ctx1.sendIdx["deny:"]=2;
  58663. self._deny_($recv(stream)._atStart());
  58664. return self;
  58665. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  58666. },
  58667. args: [],
  58668. 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",
  58669. referencedClasses: [],
  58670. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  58671. }),
  58672. $globals.StreamTest);
  58673. $core.addMethod(
  58674. $core.method({
  58675. selector: "testContents",
  58676. protocol: "tests",
  58677. fn: function (){
  58678. var self=this;
  58679. var stream;
  58680. return $core.withContext(function($ctx1) {
  58681. var $1,$2;
  58682. stream=self._newStream();
  58683. $1=stream;
  58684. $2=self._newCollection();
  58685. $ctx1.sendIdx["newCollection"]=1;
  58686. $recv($1)._nextPutAll_($2);
  58687. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  58688. return self;
  58689. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  58690. },
  58691. args: [],
  58692. 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",
  58693. referencedClasses: [],
  58694. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  58695. }),
  58696. $globals.StreamTest);
  58697. $core.addMethod(
  58698. $core.method({
  58699. selector: "testIsEmpty",
  58700. protocol: "tests",
  58701. fn: function (){
  58702. var self=this;
  58703. var stream;
  58704. return $core.withContext(function($ctx1) {
  58705. var $1;
  58706. stream=self._newStream();
  58707. $1=$recv(stream)._isEmpty();
  58708. $ctx1.sendIdx["isEmpty"]=1;
  58709. self._assert_($1);
  58710. $recv(stream)._nextPutAll_(self._newCollection());
  58711. self._deny_($recv(stream)._isEmpty());
  58712. return self;
  58713. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  58714. },
  58715. args: [],
  58716. 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",
  58717. referencedClasses: [],
  58718. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  58719. }),
  58720. $globals.StreamTest);
  58721. $core.addMethod(
  58722. $core.method({
  58723. selector: "testPosition",
  58724. protocol: "tests",
  58725. fn: function (){
  58726. var self=this;
  58727. var collection,stream;
  58728. return $core.withContext(function($ctx1) {
  58729. var $1,$2,$3;
  58730. collection=self._newCollection();
  58731. stream=self._newStream();
  58732. $recv(stream)._nextPutAll_(collection);
  58733. $1=$recv(stream)._position();
  58734. $ctx1.sendIdx["position"]=1;
  58735. self._assert_equals_($1,$recv(collection)._size());
  58736. $ctx1.sendIdx["assert:equals:"]=1;
  58737. $recv(stream)._position_((0));
  58738. $2=$recv(stream)._position();
  58739. $ctx1.sendIdx["position"]=2;
  58740. self._assert_equals_($2,(0));
  58741. $ctx1.sendIdx["assert:equals:"]=2;
  58742. $recv(stream)._next();
  58743. $ctx1.sendIdx["next"]=1;
  58744. $3=$recv(stream)._position();
  58745. $ctx1.sendIdx["position"]=3;
  58746. self._assert_equals_($3,(1));
  58747. $ctx1.sendIdx["assert:equals:"]=3;
  58748. $recv(stream)._next();
  58749. self._assert_equals_($recv(stream)._position(),(2));
  58750. return self;
  58751. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  58752. },
  58753. args: [],
  58754. 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",
  58755. referencedClasses: [],
  58756. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  58757. }),
  58758. $globals.StreamTest);
  58759. $core.addMethod(
  58760. $core.method({
  58761. selector: "testReading",
  58762. protocol: "tests",
  58763. fn: function (){
  58764. var self=this;
  58765. var stream,collection;
  58766. return $core.withContext(function($ctx1) {
  58767. var $1,$2;
  58768. collection=self._newCollection();
  58769. stream=self._newStream();
  58770. $1=stream;
  58771. $recv($1)._nextPutAll_(collection);
  58772. $recv($1)._position_((0));
  58773. $recv(collection)._do_((function(each){
  58774. return $core.withContext(function($ctx2) {
  58775. $2=$recv(stream)._next();
  58776. $ctx2.sendIdx["next"]=1;
  58777. return self._assert_equals_($2,each);
  58778. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58779. }));
  58780. self._assert_($recv($recv(stream)._next())._isNil());
  58781. return self;
  58782. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  58783. },
  58784. args: [],
  58785. 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",
  58786. referencedClasses: [],
  58787. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  58788. }),
  58789. $globals.StreamTest);
  58790. $core.addMethod(
  58791. $core.method({
  58792. selector: "testStreamContents",
  58793. protocol: "tests",
  58794. fn: function (){
  58795. var self=this;
  58796. return self;
  58797. },
  58798. args: [],
  58799. source: "testStreamContents",
  58800. referencedClasses: [],
  58801. messageSends: []
  58802. }),
  58803. $globals.StreamTest);
  58804. $core.addMethod(
  58805. $core.method({
  58806. selector: "testWrite",
  58807. protocol: "tests",
  58808. fn: function (){
  58809. var self=this;
  58810. var stream,collection;
  58811. return $core.withContext(function($ctx1) {
  58812. collection=self._newCollection();
  58813. stream=self._newStream();
  58814. $recv(collection)._do_((function(each){
  58815. return $core.withContext(function($ctx2) {
  58816. return $recv(stream).__lt_lt(each);
  58817. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58818. }));
  58819. self._assert_equals_($recv(stream)._contents(),collection);
  58820. return self;
  58821. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  58822. },
  58823. args: [],
  58824. 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",
  58825. referencedClasses: [],
  58826. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  58827. }),
  58828. $globals.StreamTest);
  58829. $core.addMethod(
  58830. $core.method({
  58831. selector: "testWriting",
  58832. protocol: "tests",
  58833. fn: function (){
  58834. var self=this;
  58835. var stream,collection;
  58836. return $core.withContext(function($ctx1) {
  58837. var $1;
  58838. collection=self._newCollection();
  58839. stream=self._newStream();
  58840. $ctx1.sendIdx["newStream"]=1;
  58841. $recv(collection)._do_((function(each){
  58842. return $core.withContext(function($ctx2) {
  58843. return $recv(stream)._nextPut_(each);
  58844. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58845. }));
  58846. $1=$recv(stream)._contents();
  58847. $ctx1.sendIdx["contents"]=1;
  58848. self._assert_equals_($1,collection);
  58849. $ctx1.sendIdx["assert:equals:"]=1;
  58850. stream=self._newStream();
  58851. $recv(stream)._nextPutAll_(collection);
  58852. self._assert_equals_($recv(stream)._contents(),collection);
  58853. return self;
  58854. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  58855. },
  58856. args: [],
  58857. 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",
  58858. referencedClasses: [],
  58859. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  58860. }),
  58861. $globals.StreamTest);
  58862. $core.addMethod(
  58863. $core.method({
  58864. selector: "collectionClass",
  58865. protocol: "accessing",
  58866. fn: function (){
  58867. var self=this;
  58868. return nil;
  58869. },
  58870. args: [],
  58871. source: "collectionClass\x0a\x09^ nil",
  58872. referencedClasses: [],
  58873. messageSends: []
  58874. }),
  58875. $globals.StreamTest.klass);
  58876. $core.addMethod(
  58877. $core.method({
  58878. selector: "isAbstract",
  58879. protocol: "testing",
  58880. fn: function (){
  58881. var self=this;
  58882. return $core.withContext(function($ctx1) {
  58883. return $recv(self._collectionClass())._isNil();
  58884. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  58885. },
  58886. args: [],
  58887. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  58888. referencedClasses: [],
  58889. messageSends: ["isNil", "collectionClass"]
  58890. }),
  58891. $globals.StreamTest.klass);
  58892. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  58893. $core.addMethod(
  58894. $core.method({
  58895. selector: "newCollection",
  58896. protocol: "accessing",
  58897. fn: function (){
  58898. var self=this;
  58899. return $core.withContext(function($ctx1) {
  58900. return [true,(1),(3).__at((4)),"foo"];
  58901. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  58902. },
  58903. args: [],
  58904. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  58905. referencedClasses: [],
  58906. messageSends: ["@"]
  58907. }),
  58908. $globals.ArrayStreamTest);
  58909. $core.addMethod(
  58910. $core.method({
  58911. selector: "collectionClass",
  58912. protocol: "accessing",
  58913. fn: function (){
  58914. var self=this;
  58915. return $globals.Array;
  58916. },
  58917. args: [],
  58918. source: "collectionClass\x0a\x09^ Array",
  58919. referencedClasses: ["Array"],
  58920. messageSends: []
  58921. }),
  58922. $globals.ArrayStreamTest.klass);
  58923. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  58924. $core.addMethod(
  58925. $core.method({
  58926. selector: "newCollection",
  58927. protocol: "accessing",
  58928. fn: function (){
  58929. var self=this;
  58930. return "hello world";
  58931. },
  58932. args: [],
  58933. source: "newCollection\x0a\x09^ 'hello world'",
  58934. referencedClasses: [],
  58935. messageSends: []
  58936. }),
  58937. $globals.StringStreamTest);
  58938. $core.addMethod(
  58939. $core.method({
  58940. selector: "collectionClass",
  58941. protocol: "accessing",
  58942. fn: function (){
  58943. var self=this;
  58944. return $globals.String;
  58945. },
  58946. args: [],
  58947. source: "collectionClass\x0a\x09^ String",
  58948. referencedClasses: ["String"],
  58949. messageSends: []
  58950. }),
  58951. $globals.StringStreamTest.klass);
  58952. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  58953. $core.addMethod(
  58954. $core.method({
  58955. selector: "testCopying",
  58956. protocol: "tests",
  58957. fn: function (){
  58958. var self=this;
  58959. return $core.withContext(function($ctx1) {
  58960. self._assert_equals_(nil._copy(),nil);
  58961. return self;
  58962. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  58963. },
  58964. args: [],
  58965. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  58966. referencedClasses: [],
  58967. messageSends: ["assert:equals:", "copy"]
  58968. }),
  58969. $globals.UndefinedTest);
  58970. $core.addMethod(
  58971. $core.method({
  58972. selector: "testDeepCopy",
  58973. protocol: "tests",
  58974. fn: function (){
  58975. var self=this;
  58976. return $core.withContext(function($ctx1) {
  58977. self._assert_($recv(nil._deepCopy()).__eq(nil));
  58978. return self;
  58979. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  58980. },
  58981. args: [],
  58982. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  58983. referencedClasses: [],
  58984. messageSends: ["assert:", "=", "deepCopy"]
  58985. }),
  58986. $globals.UndefinedTest);
  58987. $core.addMethod(
  58988. $core.method({
  58989. selector: "testIfNil",
  58990. protocol: "tests",
  58991. fn: function (){
  58992. var self=this;
  58993. return $core.withContext(function($ctx1) {
  58994. var $1,$3,$2,$4,$6,$5,$receiver;
  58995. if(($receiver = nil) == null || $receiver.isNil){
  58996. $1=true;
  58997. } else {
  58998. $1=nil;
  58999. }
  59000. self._assert_equals_($1,true);
  59001. $ctx1.sendIdx["assert:equals:"]=1;
  59002. if(($receiver = nil) == null || $receiver.isNil){
  59003. $3=nil;
  59004. } else {
  59005. $3=true;
  59006. }
  59007. $2=$recv($3).__eq(true);
  59008. $ctx1.sendIdx["="]=1;
  59009. self._deny_($2);
  59010. $ctx1.sendIdx["deny:"]=1;
  59011. if(($receiver = nil) == null || $receiver.isNil){
  59012. $4=true;
  59013. } else {
  59014. $4=false;
  59015. }
  59016. self._assert_equals_($4,true);
  59017. if(($receiver = nil) == null || $receiver.isNil){
  59018. $6=false;
  59019. } else {
  59020. $6=true;
  59021. }
  59022. $5=$recv($6).__eq(true);
  59023. self._deny_($5);
  59024. return self;
  59025. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  59026. },
  59027. args: [],
  59028. 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",
  59029. referencedClasses: [],
  59030. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59031. }),
  59032. $globals.UndefinedTest);
  59033. $core.addMethod(
  59034. $core.method({
  59035. selector: "testIsNil",
  59036. protocol: "tests",
  59037. fn: function (){
  59038. var self=this;
  59039. return $core.withContext(function($ctx1) {
  59040. self._assert_(nil._isNil());
  59041. self._deny_(nil._notNil());
  59042. return self;
  59043. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  59044. },
  59045. args: [],
  59046. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  59047. referencedClasses: [],
  59048. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  59049. }),
  59050. $globals.UndefinedTest);
  59051. });
  59052. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  59053. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  59054. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  59055. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  59056. $core.addPackage("Platform-DOM-Tests");
  59057. $core.packages["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  59058. $core.packages["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  59059. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  59060. $core.addMethod(
  59061. $core.method({
  59062. selector: "testEntityConversion",
  59063. protocol: "testing",
  59064. fn: function (){
  59065. var self=this;
  59066. return $core.withContext(function($ctx1) {
  59067. var $1;
  59068. $1=$recv($globals.PlatformDom)._isFeasible();
  59069. if($core.assert($1)){
  59070. self._assert_equals_("&copy;"._htmlTextContent(),"©");
  59071. }
  59072. return self;
  59073. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  59074. },
  59075. args: [],
  59076. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  59077. referencedClasses: ["PlatformDom"],
  59078. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  59079. }),
  59080. $globals.PlatformDomTest);
  59081. $core.addMethod(
  59082. $core.method({
  59083. selector: "testTextContentDoesNotRunScript",
  59084. protocol: "testing",
  59085. fn: function (){
  59086. var self=this;
  59087. return $core.withContext(function($ctx1) {
  59088. var $1;
  59089. $1=$recv($globals.PlatformDom)._isFeasible();
  59090. if($core.assert($1)){
  59091. self._shouldnt_raise_((function(){
  59092. return $core.withContext(function($ctx2) {
  59093. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  59094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59095. }),$globals.Error);
  59096. }
  59097. return self;
  59098. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  59099. },
  59100. args: [],
  59101. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  59102. referencedClasses: ["PlatformDom", "Error"],
  59103. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  59104. }),
  59105. $globals.PlatformDomTest);
  59106. });
  59107. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  59108. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  59109. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  59110. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  59111. $core.addPackage("SUnit-Tests");
  59112. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  59113. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  59114. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  59115. $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.";
  59116. $core.addMethod(
  59117. $core.method({
  59118. selector: "setUp",
  59119. protocol: "running",
  59120. fn: function (){
  59121. var self=this;
  59122. return $core.withContext(function($ctx1) {
  59123. self["@empty"]=$recv($globals.Set)._new();
  59124. self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  59125. return self;
  59126. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  59127. },
  59128. args: [],
  59129. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  59130. referencedClasses: ["Set"],
  59131. messageSends: ["new", "with:with:"]
  59132. }),
  59133. $globals.ExampleSetTest);
  59134. $core.addMethod(
  59135. $core.method({
  59136. selector: "testAdd",
  59137. protocol: "tests",
  59138. fn: function (){
  59139. var self=this;
  59140. return $core.withContext(function($ctx1) {
  59141. $recv(self["@empty"])._add_((5));
  59142. self._assert_($recv(self["@empty"])._includes_((5)));
  59143. return self;
  59144. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  59145. },
  59146. args: [],
  59147. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  59148. referencedClasses: [],
  59149. messageSends: ["add:", "assert:", "includes:"]
  59150. }),
  59151. $globals.ExampleSetTest);
  59152. $core.addMethod(
  59153. $core.method({
  59154. selector: "testGrow",
  59155. protocol: "tests",
  59156. fn: function (){
  59157. var self=this;
  59158. return $core.withContext(function($ctx1) {
  59159. $recv(self["@empty"])._addAll_((1)._to_((100)));
  59160. self._assert_equals_($recv(self["@empty"])._size(),(100));
  59161. return self;
  59162. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  59163. },
  59164. args: [],
  59165. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  59166. referencedClasses: [],
  59167. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  59168. }),
  59169. $globals.ExampleSetTest);
  59170. $core.addMethod(
  59171. $core.method({
  59172. selector: "testIllegal",
  59173. protocol: "tests",
  59174. fn: function (){
  59175. var self=this;
  59176. return $core.withContext(function($ctx1) {
  59177. self._should_raise_((function(){
  59178. return $core.withContext(function($ctx2) {
  59179. return $recv(self["@empty"])._at_((5));
  59180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59181. }),$globals.Error);
  59182. $ctx1.sendIdx["should:raise:"]=1;
  59183. self._should_raise_((function(){
  59184. return $core.withContext(function($ctx2) {
  59185. return $recv(self["@empty"])._at_put_((5),"abc");
  59186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59187. }),$globals.Error);
  59188. return self;
  59189. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  59190. },
  59191. args: [],
  59192. 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",
  59193. referencedClasses: ["Error"],
  59194. messageSends: ["should:raise:", "at:", "at:put:"]
  59195. }),
  59196. $globals.ExampleSetTest);
  59197. $core.addMethod(
  59198. $core.method({
  59199. selector: "testIncludes",
  59200. protocol: "tests",
  59201. fn: function (){
  59202. var self=this;
  59203. return $core.withContext(function($ctx1) {
  59204. var $1;
  59205. $1=$recv(self["@full"])._includes_((5));
  59206. $ctx1.sendIdx["includes:"]=1;
  59207. self._assert_($1);
  59208. $ctx1.sendIdx["assert:"]=1;
  59209. self._assert_($recv(self["@full"])._includes_("abc"));
  59210. return self;
  59211. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  59212. },
  59213. args: [],
  59214. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  59215. referencedClasses: [],
  59216. messageSends: ["assert:", "includes:"]
  59217. }),
  59218. $globals.ExampleSetTest);
  59219. $core.addMethod(
  59220. $core.method({
  59221. selector: "testOccurrences",
  59222. protocol: "tests",
  59223. fn: function (){
  59224. var self=this;
  59225. return $core.withContext(function($ctx1) {
  59226. var $1,$2;
  59227. $1=$recv(self["@empty"])._occurrencesOf_((0));
  59228. $ctx1.sendIdx["occurrencesOf:"]=1;
  59229. self._assert_equals_($1,(0));
  59230. $ctx1.sendIdx["assert:equals:"]=1;
  59231. $2=$recv(self["@full"])._occurrencesOf_((5));
  59232. $ctx1.sendIdx["occurrencesOf:"]=2;
  59233. self._assert_equals_($2,(1));
  59234. $ctx1.sendIdx["assert:equals:"]=2;
  59235. $recv(self["@full"])._add_((5));
  59236. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  59237. return self;
  59238. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  59239. },
  59240. args: [],
  59241. 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",
  59242. referencedClasses: [],
  59243. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  59244. }),
  59245. $globals.ExampleSetTest);
  59246. $core.addMethod(
  59247. $core.method({
  59248. selector: "testRemove",
  59249. protocol: "tests",
  59250. fn: function (){
  59251. var self=this;
  59252. return $core.withContext(function($ctx1) {
  59253. var $1;
  59254. $recv(self["@full"])._remove_((5));
  59255. $1=$recv(self["@full"])._includes_("abc");
  59256. $ctx1.sendIdx["includes:"]=1;
  59257. self._assert_($1);
  59258. self._deny_($recv(self["@full"])._includes_((5)));
  59259. return self;
  59260. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  59261. },
  59262. args: [],
  59263. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  59264. referencedClasses: [],
  59265. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  59266. }),
  59267. $globals.ExampleSetTest);
  59268. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  59269. $core.addMethod(
  59270. $core.method({
  59271. selector: "fakeError",
  59272. protocol: "helpers",
  59273. fn: function (){
  59274. var self=this;
  59275. return $core.withContext(function($ctx1) {
  59276. self["@flag"]="bad";
  59277. self._timeout_((30));
  59278. self["@flag"]=$recv(self._async_((function(){
  59279. return $core.withContext(function($ctx2) {
  59280. self["@flag"]="ok";
  59281. self["@flag"];
  59282. return self._error_("Intentional");
  59283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59284. })))._valueWithTimeout_((20));
  59285. return self;
  59286. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  59287. },
  59288. args: [],
  59289. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  59290. referencedClasses: [],
  59291. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  59292. }),
  59293. $globals.SUnitAsyncTest);
  59294. $core.addMethod(
  59295. $core.method({
  59296. selector: "fakeErrorFailingInTearDown",
  59297. protocol: "helpers",
  59298. fn: function (){
  59299. var self=this;
  59300. return $core.withContext(function($ctx1) {
  59301. self["@flag"]="bad";
  59302. self._timeout_((30));
  59303. self["@flag"]=$recv(self._async_((function(){
  59304. return $core.withContext(function($ctx2) {
  59305. return self._error_("Intentional");
  59306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59307. })))._valueWithTimeout_((20));
  59308. return self;
  59309. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  59310. },
  59311. args: [],
  59312. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  59313. referencedClasses: [],
  59314. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  59315. }),
  59316. $globals.SUnitAsyncTest);
  59317. $core.addMethod(
  59318. $core.method({
  59319. selector: "fakeFailure",
  59320. protocol: "helpers",
  59321. fn: function (){
  59322. var self=this;
  59323. return $core.withContext(function($ctx1) {
  59324. self["@flag"]="bad";
  59325. self._timeout_((30));
  59326. self["@flag"]=$recv(self._async_((function(){
  59327. return $core.withContext(function($ctx2) {
  59328. self["@flag"]="ok";
  59329. self["@flag"];
  59330. return self._assert_(false);
  59331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59332. })))._valueWithTimeout_((20));
  59333. return self;
  59334. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  59335. },
  59336. args: [],
  59337. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  59338. referencedClasses: [],
  59339. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  59340. }),
  59341. $globals.SUnitAsyncTest);
  59342. $core.addMethod(
  59343. $core.method({
  59344. selector: "fakeMultipleTimeoutFailing",
  59345. protocol: "helpers",
  59346. fn: function (){
  59347. var self=this;
  59348. return $core.withContext(function($ctx1) {
  59349. var $1;
  59350. self._timeout_((100));
  59351. $ctx1.sendIdx["timeout:"]=1;
  59352. $1=self._async_((function(){
  59353. return $core.withContext(function($ctx2) {
  59354. self._timeout_((20));
  59355. return $recv(self._async_((function(){
  59356. return $core.withContext(function($ctx3) {
  59357. return self._finished();
  59358. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59359. })))._valueWithTimeout_((30));
  59360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59361. }));
  59362. $ctx1.sendIdx["async:"]=1;
  59363. $recv($1)._valueWithTimeout_((20));
  59364. $ctx1.sendIdx["valueWithTimeout:"]=1;
  59365. return self;
  59366. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  59367. },
  59368. args: [],
  59369. 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",
  59370. referencedClasses: [],
  59371. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  59372. }),
  59373. $globals.SUnitAsyncTest);
  59374. $core.addMethod(
  59375. $core.method({
  59376. selector: "fakeMultipleTimeoutPassing",
  59377. protocol: "helpers",
  59378. fn: function (){
  59379. var self=this;
  59380. return $core.withContext(function($ctx1) {
  59381. var $1;
  59382. self._timeout_((20));
  59383. $ctx1.sendIdx["timeout:"]=1;
  59384. $1=self._async_((function(){
  59385. return $core.withContext(function($ctx2) {
  59386. self._timeout_((40));
  59387. return $recv(self._async_((function(){
  59388. return $core.withContext(function($ctx3) {
  59389. return self._finished();
  59390. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59391. })))._valueWithTimeout_((20));
  59392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59393. }));
  59394. $ctx1.sendIdx["async:"]=1;
  59395. $recv($1)._valueWithTimeout_((10));
  59396. $ctx1.sendIdx["valueWithTimeout:"]=1;
  59397. return self;
  59398. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  59399. },
  59400. args: [],
  59401. 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",
  59402. referencedClasses: [],
  59403. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  59404. }),
  59405. $globals.SUnitAsyncTest);
  59406. $core.addMethod(
  59407. $core.method({
  59408. selector: "fakeTimeout",
  59409. protocol: "helpers",
  59410. fn: function (){
  59411. var self=this;
  59412. return $core.withContext(function($ctx1) {
  59413. self._timeout_((10));
  59414. $recv(self._async_((function(){
  59415. return $core.withContext(function($ctx2) {
  59416. return self._finished();
  59417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59418. })))._valueWithTimeout_((20));
  59419. return self;
  59420. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  59421. },
  59422. args: [],
  59423. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  59424. referencedClasses: [],
  59425. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  59426. }),
  59427. $globals.SUnitAsyncTest);
  59428. $core.addMethod(
  59429. $core.method({
  59430. selector: "selectorSetOf:",
  59431. protocol: "private",
  59432. fn: function (aCollection){
  59433. var self=this;
  59434. return $core.withContext(function($ctx1) {
  59435. return $recv($recv(aCollection)._collect_((function(each){
  59436. return $core.withContext(function($ctx2) {
  59437. return $recv(each)._selector();
  59438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59439. })))._asSet();
  59440. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  59441. },
  59442. args: ["aCollection"],
  59443. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  59444. referencedClasses: [],
  59445. messageSends: ["asSet", "collect:", "selector"]
  59446. }),
  59447. $globals.SUnitAsyncTest);
  59448. $core.addMethod(
  59449. $core.method({
  59450. selector: "setUp",
  59451. protocol: "running",
  59452. fn: function (){
  59453. var self=this;
  59454. self["@flag"]="ok";
  59455. return self;
  59456. },
  59457. args: [],
  59458. source: "setUp\x0a\x09flag := 'ok'",
  59459. referencedClasses: [],
  59460. messageSends: []
  59461. }),
  59462. $globals.SUnitAsyncTest);
  59463. $core.addMethod(
  59464. $core.method({
  59465. selector: "tearDown",
  59466. protocol: "running",
  59467. fn: function (){
  59468. var self=this;
  59469. return $core.withContext(function($ctx1) {
  59470. self._assert_equals_("ok",self["@flag"]);
  59471. return self;
  59472. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  59473. },
  59474. args: [],
  59475. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  59476. referencedClasses: [],
  59477. messageSends: ["assert:equals:"]
  59478. }),
  59479. $globals.SUnitAsyncTest);
  59480. $core.addMethod(
  59481. $core.method({
  59482. selector: "testAsyncErrorsAndFailures",
  59483. protocol: "tests",
  59484. fn: function (){
  59485. var self=this;
  59486. var suite,runner,result,assertBlock;
  59487. return $core.withContext(function($ctx1) {
  59488. var $1,$2,$3,$4;
  59489. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  59490. return $core.withContext(function($ctx2) {
  59491. return $recv(self._class())._selector_(each);
  59492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59493. }));
  59494. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  59495. self._timeout_((200));
  59496. result=$recv(runner)._result();
  59497. $ctx1.sendIdx["result"]=1;
  59498. assertBlock=self._async_((function(){
  59499. return $core.withContext(function($ctx2) {
  59500. $1=self._selectorSetOf_($recv(result)._errors());
  59501. $ctx2.sendIdx["selectorSetOf:"]=1;
  59502. $2=["fakeError"]._asSet();
  59503. $ctx2.sendIdx["asSet"]=1;
  59504. self._assert_equals_($1,$2);
  59505. $ctx2.sendIdx["assert:equals:"]=1;
  59506. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  59507. return self._finished();
  59508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59509. }));
  59510. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  59511. return $core.withContext(function($ctx2) {
  59512. $3=$recv($recv(ann)._result()).__eq_eq(result);
  59513. if($core.assert($3)){
  59514. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  59515. return $recv($4)._ifTrue_(assertBlock);
  59516. }
  59517. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  59518. }));
  59519. $recv(runner)._run();
  59520. return self;
  59521. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  59522. },
  59523. args: [],
  59524. 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",
  59525. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  59526. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  59527. }),
  59528. $globals.SUnitAsyncTest);
  59529. $core.addMethod(
  59530. $core.method({
  59531. selector: "testAsyncNeedsTimeout",
  59532. protocol: "tests",
  59533. fn: function (){
  59534. var self=this;
  59535. return $core.withContext(function($ctx1) {
  59536. self._should_raise_((function(){
  59537. return $core.withContext(function($ctx2) {
  59538. return self._async_((function(){
  59539. }));
  59540. $ctx2.sendIdx["async:"]=1;
  59541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59542. }),$globals.Error);
  59543. self._timeout_((0));
  59544. self._shouldnt_raise_((function(){
  59545. return $core.withContext(function($ctx2) {
  59546. return self._async_((function(){
  59547. }));
  59548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59549. }),$globals.Error);
  59550. self._finished();
  59551. return self;
  59552. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  59553. },
  59554. args: [],
  59555. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  59556. referencedClasses: ["Error"],
  59557. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  59558. }),
  59559. $globals.SUnitAsyncTest);
  59560. $core.addMethod(
  59561. $core.method({
  59562. selector: "testFinishedNeedsTimeout",
  59563. protocol: "tests",
  59564. fn: function (){
  59565. var self=this;
  59566. return $core.withContext(function($ctx1) {
  59567. self._should_raise_((function(){
  59568. return $core.withContext(function($ctx2) {
  59569. return self._finished();
  59570. $ctx2.sendIdx["finished"]=1;
  59571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59572. }),$globals.Error);
  59573. self._timeout_((0));
  59574. self._shouldnt_raise_((function(){
  59575. return $core.withContext(function($ctx2) {
  59576. return self._finished();
  59577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59578. }),$globals.Error);
  59579. return self;
  59580. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  59581. },
  59582. args: [],
  59583. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  59584. referencedClasses: ["Error"],
  59585. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  59586. }),
  59587. $globals.SUnitAsyncTest);
  59588. $core.addMethod(
  59589. $core.method({
  59590. selector: "testIsAsyncReturnsCorrectValues",
  59591. protocol: "tests",
  59592. fn: function (){
  59593. var self=this;
  59594. return $core.withContext(function($ctx1) {
  59595. var $1,$2;
  59596. $1=self._isAsync();
  59597. $ctx1.sendIdx["isAsync"]=1;
  59598. self._deny_($1);
  59599. $ctx1.sendIdx["deny:"]=1;
  59600. self._timeout_((0));
  59601. $2=self._isAsync();
  59602. $ctx1.sendIdx["isAsync"]=2;
  59603. self._assert_($2);
  59604. self._finished();
  59605. self._deny_(self._isAsync());
  59606. return self;
  59607. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  59608. },
  59609. args: [],
  59610. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  59611. referencedClasses: [],
  59612. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  59613. }),
  59614. $globals.SUnitAsyncTest);
  59615. $core.addMethod(
  59616. $core.method({
  59617. selector: "testPass",
  59618. protocol: "tests",
  59619. fn: function (){
  59620. var self=this;
  59621. return $core.withContext(function($ctx1) {
  59622. self["@flag"]="bad";
  59623. self._timeout_((10));
  59624. self["@flag"]=$recv(self._async_((function(){
  59625. return $core.withContext(function($ctx2) {
  59626. self._assert_(true);
  59627. self._finished();
  59628. self["@flag"]="ok";
  59629. return self["@flag"];
  59630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59631. })))._valueWithTimeout_((5));
  59632. return self;
  59633. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  59634. },
  59635. args: [],
  59636. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  59637. referencedClasses: [],
  59638. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  59639. }),
  59640. $globals.SUnitAsyncTest);
  59641. $core.addMethod(
  59642. $core.method({
  59643. selector: "testTimeouts",
  59644. protocol: "tests",
  59645. fn: function (){
  59646. var self=this;
  59647. var suite,runner,result,assertBlock;
  59648. return $core.withContext(function($ctx1) {
  59649. var $1,$2,$3;
  59650. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  59651. return $core.withContext(function($ctx2) {
  59652. return $recv(self._class())._selector_(each);
  59653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59654. }));
  59655. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  59656. self._timeout_((200));
  59657. result=$recv(runner)._result();
  59658. $ctx1.sendIdx["result"]=1;
  59659. assertBlock=self._async_((function(){
  59660. return $core.withContext(function($ctx2) {
  59661. $1=self._selectorSetOf_($recv(result)._errors());
  59662. $ctx2.sendIdx["selectorSetOf:"]=1;
  59663. self._assert_equals_($1,$recv($globals.Set)._new());
  59664. $ctx2.sendIdx["assert:equals:"]=1;
  59665. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  59666. return self._finished();
  59667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59668. }));
  59669. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  59670. return $core.withContext(function($ctx2) {
  59671. $2=$recv($recv(ann)._result()).__eq_eq(result);
  59672. if($core.assert($2)){
  59673. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  59674. return $recv($3)._ifTrue_(assertBlock);
  59675. }
  59676. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  59677. }));
  59678. $recv(runner)._run();
  59679. return self;
  59680. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  59681. },
  59682. args: [],
  59683. 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",
  59684. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  59685. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  59686. }),
  59687. $globals.SUnitAsyncTest);
  59688. $core.addMethod(
  59689. $core.method({
  59690. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  59691. protocol: "tests",
  59692. fn: function (){
  59693. var self=this;
  59694. var x;
  59695. return $core.withContext(function($ctx1) {
  59696. var $1;
  59697. self["@flag"]="bad";
  59698. self._timeout_((10));
  59699. x=(0);
  59700. $1=self._async_((function(){
  59701. return $core.withContext(function($ctx2) {
  59702. self._finished();
  59703. $ctx2.sendIdx["finished"]=1;
  59704. self["@flag"]="ok";
  59705. self["@flag"];
  59706. x=$recv(x).__plus((1));
  59707. $ctx2.sendIdx["+"]=1;
  59708. x;
  59709. return self._assert_equals_(x,(1));
  59710. $ctx2.sendIdx["assert:equals:"]=1;
  59711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59712. }));
  59713. $ctx1.sendIdx["async:"]=1;
  59714. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  59715. $ctx1.sendIdx["valueWithTimeout:"]=1;
  59716. self["@flag"]=$recv(self._async_((function(){
  59717. return $core.withContext(function($ctx2) {
  59718. self._finished();
  59719. self["@flag"]="ok";
  59720. self["@flag"];
  59721. x=$recv(x).__plus((1));
  59722. x;
  59723. return self._assert_equals_(x,(1));
  59724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59725. })))._valueWithTimeout_((0));
  59726. return self;
  59727. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  59728. },
  59729. args: [],
  59730. 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.",
  59731. referencedClasses: [],
  59732. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  59733. }),
  59734. $globals.SUnitAsyncTest);
  59735. });
  59736. define('amber/devel',[
  59737. './lang',
  59738. './compatibility', // pre-fetch, dep of ./boot
  59739. './kernel-fundamentals', // pre-fetch, dep of ./boot
  59740. './kernel-language', // pre-fetch, dep of ./boot
  59741. './boot', // pre-fetch, dep of ./helpers
  59742. './helpers', // pre-fetch, dep of ./deploy
  59743. './deploy', // pre-fetch, dep of ./lang
  59744. // --- packages of the development only Amber begin here ---
  59745. 'amber_core/Platform-DOM',
  59746. 'amber_core/SUnit',
  59747. 'amber_core/Compiler-Tests',
  59748. 'amber_core/Kernel-Tests',
  59749. 'amber_core/Platform-DOM-Tests',
  59750. 'amber_core/SUnit-Tests'
  59751. // --- packages of the development only Amber end here ---
  59752. ], function (amber) {
  59753. return amber;
  59754. });
  59755. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  59756. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  59757. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  59758. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  59759. $core.addPackage("AmberCli");
  59760. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  59761. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  59762. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  59763. $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.";
  59764. $core.addMethod(
  59765. $core.method({
  59766. selector: "commandLineSwitches",
  59767. protocol: "commandline",
  59768. fn: function (){
  59769. var self=this;
  59770. var switches;
  59771. return $core.withContext(function($ctx1) {
  59772. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  59773. return $core.withContext(function($ctx2) {
  59774. return $recv(each)._selector();
  59775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59776. }));
  59777. $ctx1.sendIdx["collect:"]=1;
  59778. switches=$recv(switches)._select_((function(each){
  59779. return $core.withContext(function($ctx2) {
  59780. return $recv(each)._match_("^[^:]*:$");
  59781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59782. }));
  59783. switches=$recv(switches)._collect_((function(each){
  59784. return $core.withContext(function($ctx2) {
  59785. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  59786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  59787. }));
  59788. return switches;
  59789. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  59790. },
  59791. args: [],
  59792. 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",
  59793. referencedClasses: [],
  59794. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  59795. }),
  59796. $globals.AmberCli.klass);
  59797. $core.addMethod(
  59798. $core.method({
  59799. selector: "config:",
  59800. protocol: "commands",
  59801. fn: function (args){
  59802. var self=this;
  59803. return $core.withContext(function($ctx1) {
  59804. $recv($recv($globals.Configurator)._new())._start();
  59805. return self;
  59806. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  59807. },
  59808. args: ["args"],
  59809. source: "config: args\x0a\x09Configurator new start",
  59810. referencedClasses: ["Configurator"],
  59811. messageSends: ["start", "new"]
  59812. }),
  59813. $globals.AmberCli.klass);
  59814. $core.addMethod(
  59815. $core.method({
  59816. selector: "handleArguments:",
  59817. protocol: "commandline",
  59818. fn: function (args){
  59819. var self=this;
  59820. var selector;
  59821. return $core.withContext(function($ctx1) {
  59822. var $1;
  59823. $1=$recv(args)._first();
  59824. $ctx1.sendIdx["first"]=1;
  59825. selector=self._selectorForCommandLineSwitch_($1);
  59826. $recv(args)._remove_($recv(args)._first());
  59827. self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  59828. return self;
  59829. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  59830. },
  59831. args: ["args"],
  59832. 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)",
  59833. referencedClasses: ["Array"],
  59834. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  59835. }),
  59836. $globals.AmberCli.klass);
  59837. $core.addMethod(
  59838. $core.method({
  59839. selector: "help:",
  59840. protocol: "commands",
  59841. fn: function (args){
  59842. var self=this;
  59843. return $core.withContext(function($ctx1) {
  59844. $recv($globals.Transcript)._show_("Available commands");
  59845. $recv(self._commandLineSwitches())._do_((function(each){
  59846. return $core.withContext(function($ctx2) {
  59847. return $recv(console)._log_(each);
  59848. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59849. }));
  59850. return self;
  59851. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  59852. },
  59853. args: ["args"],
  59854. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  59855. referencedClasses: ["Transcript"],
  59856. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  59857. }),
  59858. $globals.AmberCli.klass);
  59859. $core.addMethod(
  59860. $core.method({
  59861. selector: "init:",
  59862. protocol: "commands",
  59863. fn: function (args){
  59864. var self=this;
  59865. return $core.withContext(function($ctx1) {
  59866. $recv($recv($globals.Initer)._new())._start();
  59867. return self;
  59868. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  59869. },
  59870. args: ["args"],
  59871. source: "init: args\x0a\x09Initer new start",
  59872. referencedClasses: ["Initer"],
  59873. messageSends: ["start", "new"]
  59874. }),
  59875. $globals.AmberCli.klass);
  59876. $core.addMethod(
  59877. $core.method({
  59878. selector: "main",
  59879. protocol: "startup",
  59880. fn: function (){
  59881. var self=this;
  59882. var args,packageJSON;
  59883. return $core.withContext(function($ctx1) {
  59884. var $7,$6,$5,$4,$3,$2,$1;
  59885. var $early={};
  59886. try {
  59887. packageJSON=$recv(require)._value_("../package.json");
  59888. $7=$recv(packageJSON)._version();
  59889. $ctx1.sendIdx["version"]=1;
  59890. $6="Welcome to Amber CLI version ".__comma($7);
  59891. $5=$recv($6).__comma(" (Amber ");
  59892. $ctx1.sendIdx[","]=5;
  59893. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  59894. $ctx1.sendIdx[","]=4;
  59895. $3=$recv($4).__comma(", NodeJS ");
  59896. $ctx1.sendIdx[","]=3;
  59897. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  59898. $ctx1.sendIdx[","]=2;
  59899. $1=$recv($2).__comma(").");
  59900. $ctx1.sendIdx[","]=1;
  59901. $recv($globals.Transcript)._show_($1);
  59902. args=$recv(process)._argv();
  59903. $recv(args)._removeFrom_to_((1),(2));
  59904. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  59905. return $core.withContext(function($ctx2) {
  59906. return self._help_(nil);
  59907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59908. }),(function(){
  59909. return $core.withContext(function($ctx2) {
  59910. throw $early=[self._handleArguments_(args)];
  59911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59912. }));
  59913. return self;
  59914. }
  59915. catch(e) {if(e===$early)return e[0]; throw e}
  59916. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.klass)});
  59917. },
  59918. args: [],
  59919. 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]",
  59920. referencedClasses: ["Transcript", "Smalltalk"],
  59921. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  59922. }),
  59923. $globals.AmberCli.klass);
  59924. $core.addMethod(
  59925. $core.method({
  59926. selector: "repl:",
  59927. protocol: "commands",
  59928. fn: function (args){
  59929. var self=this;
  59930. return $core.withContext(function($ctx1) {
  59931. return $recv($recv($globals.Repl)._new())._createInterface();
  59932. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  59933. },
  59934. args: ["args"],
  59935. source: "repl: args\x0a\x09^ Repl new createInterface",
  59936. referencedClasses: ["Repl"],
  59937. messageSends: ["createInterface", "new"]
  59938. }),
  59939. $globals.AmberCli.klass);
  59940. $core.addMethod(
  59941. $core.method({
  59942. selector: "selectorForCommandLineSwitch:",
  59943. protocol: "commandline",
  59944. fn: function (aSwitch){
  59945. var self=this;
  59946. var command,selector;
  59947. return $core.withContext(function($ctx1) {
  59948. var $1;
  59949. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  59950. if($core.assert($1)){
  59951. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  59952. return $core.withContext(function($ctx2) {
  59953. return $recv($recv(each)._second())._asUppercase();
  59954. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59955. }))).__comma(":");
  59956. selector;
  59957. } else {
  59958. selector="help:";
  59959. selector;
  59960. }
  59961. return selector;
  59962. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  59963. },
  59964. args: ["aSwitch"],
  59965. 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",
  59966. referencedClasses: [],
  59967. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  59968. }),
  59969. $globals.AmberCli.klass);
  59970. $core.addMethod(
  59971. $core.method({
  59972. selector: "serve:",
  59973. protocol: "commands",
  59974. fn: function (args){
  59975. var self=this;
  59976. return $core.withContext(function($ctx1) {
  59977. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  59978. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  59979. },
  59980. args: ["args"],
  59981. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  59982. referencedClasses: ["FileServer"],
  59983. messageSends: ["start", "createServerWithArguments:"]
  59984. }),
  59985. $globals.AmberCli.klass);
  59986. $core.addMethod(
  59987. $core.method({
  59988. selector: "version:",
  59989. protocol: "commands",
  59990. fn: function (arguments_){
  59991. var self=this;
  59992. return self;
  59993. },
  59994. args: ["arguments"],
  59995. source: "version: arguments",
  59996. referencedClasses: [],
  59997. messageSends: []
  59998. }),
  59999. $globals.AmberCli.klass);
  60000. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  60001. $core.addMethod(
  60002. $core.method({
  60003. selector: "dirname",
  60004. protocol: "private",
  60005. fn: function (){
  60006. var self=this;
  60007. return $core.withContext(function($ctx1) {
  60008. return __dirname;
  60009. return self;
  60010. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  60011. },
  60012. args: [],
  60013. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  60014. referencedClasses: [],
  60015. messageSends: []
  60016. }),
  60017. $globals.BaseFileManipulator);
  60018. $core.addMethod(
  60019. $core.method({
  60020. selector: "initialize",
  60021. protocol: "initialization",
  60022. fn: function (){
  60023. var self=this;
  60024. return $core.withContext(function($ctx1) {
  60025. (
  60026. $ctx1.supercall = true,
  60027. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  60028. $ctx1.supercall = false;
  60029. self["@path"]=$recv(require)._value_("path");
  60030. $ctx1.sendIdx["value:"]=1;
  60031. self["@fs"]=$recv(require)._value_("fs");
  60032. return self;
  60033. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  60034. },
  60035. args: [],
  60036. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  60037. referencedClasses: [],
  60038. messageSends: ["initialize", "value:"]
  60039. }),
  60040. $globals.BaseFileManipulator);
  60041. $core.addMethod(
  60042. $core.method({
  60043. selector: "rootDirname",
  60044. protocol: "private",
  60045. fn: function (){
  60046. var self=this;
  60047. return $core.withContext(function($ctx1) {
  60048. return $recv(self["@path"])._join_with_(self._dirname(),"..");
  60049. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  60050. },
  60051. args: [],
  60052. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  60053. referencedClasses: [],
  60054. messageSends: ["join:with:", "dirname"]
  60055. }),
  60056. $globals.BaseFileManipulator);
  60057. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  60058. $core.addMethod(
  60059. $core.method({
  60060. selector: "initialize",
  60061. protocol: "initialization",
  60062. fn: function (){
  60063. var self=this;
  60064. return $core.withContext(function($ctx1) {
  60065. (
  60066. $ctx1.supercall = true,
  60067. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  60068. $ctx1.supercall = false;
  60069. return self;
  60070. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  60071. },
  60072. args: [],
  60073. source: "initialize\x0a\x09super initialize",
  60074. referencedClasses: [],
  60075. messageSends: ["initialize"]
  60076. }),
  60077. $globals.Configurator);
  60078. $core.addMethod(
  60079. $core.method({
  60080. selector: "start",
  60081. protocol: "action",
  60082. fn: function (){
  60083. var self=this;
  60084. return $core.withContext(function($ctx1) {
  60085. var $receiver;
  60086. self._writeConfigThenDo_((function(err){
  60087. return $core.withContext(function($ctx2) {
  60088. if(($receiver = err) == null || $receiver.isNil){
  60089. return $recv(process)._exit();
  60090. } else {
  60091. return $recv(process)._exit_((111));
  60092. }
  60093. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  60094. }));
  60095. return self;
  60096. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  60097. },
  60098. args: [],
  60099. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  60100. referencedClasses: [],
  60101. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  60102. }),
  60103. $globals.Configurator);
  60104. $core.addMethod(
  60105. $core.method({
  60106. selector: "writeConfigThenDo:",
  60107. protocol: "action",
  60108. fn: function (aBlock){
  60109. var self=this;
  60110. return $core.withContext(function($ctx1) {
  60111. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  60112. return self;
  60113. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  60114. },
  60115. args: ["aBlock"],
  60116. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  60117. referencedClasses: [],
  60118. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  60119. }),
  60120. $globals.Configurator);
  60121. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  60122. $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.";
  60123. $core.addMethod(
  60124. $core.method({
  60125. selector: "base64Decode:",
  60126. protocol: "private",
  60127. fn: function (aString){
  60128. var self=this;
  60129. return $core.withContext(function($ctx1) {
  60130. return (new Buffer(aString, "base64").toString());
  60131. return self;
  60132. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  60133. },
  60134. args: ["aString"],
  60135. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  60136. referencedClasses: [],
  60137. messageSends: []
  60138. }),
  60139. $globals.FileServer);
  60140. $core.addMethod(
  60141. $core.method({
  60142. selector: "basePath",
  60143. protocol: "accessing",
  60144. fn: function (){
  60145. var self=this;
  60146. return $core.withContext(function($ctx1) {
  60147. var $1,$receiver;
  60148. $1=self["@basePath"];
  60149. if(($receiver = $1) == null || $receiver.isNil){
  60150. return $recv(self._class())._defaultBasePath();
  60151. } else {
  60152. return $1;
  60153. }
  60154. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  60155. },
  60156. args: [],
  60157. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  60158. referencedClasses: [],
  60159. messageSends: ["ifNil:", "defaultBasePath", "class"]
  60160. }),
  60161. $globals.FileServer);
  60162. $core.addMethod(
  60163. $core.method({
  60164. selector: "basePath:",
  60165. protocol: "accessing",
  60166. fn: function (aString){
  60167. var self=this;
  60168. return $core.withContext(function($ctx1) {
  60169. self["@basePath"]=aString;
  60170. self._validateBasePath();
  60171. return self;
  60172. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  60173. },
  60174. args: ["aString"],
  60175. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  60176. referencedClasses: [],
  60177. messageSends: ["validateBasePath"]
  60178. }),
  60179. $globals.FileServer);
  60180. $core.addMethod(
  60181. $core.method({
  60182. selector: "checkDirectoryLayout",
  60183. protocol: "initialization",
  60184. fn: function (){
  60185. var self=this;
  60186. return $core.withContext(function($ctx1) {
  60187. var $1;
  60188. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  60189. if(!$core.assert($1)){
  60190. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  60191. $ctx1.sendIdx["warn:"]=1;
  60192. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  60193. $ctx1.sendIdx["warn:"]=2;
  60194. $recv(console)._warn_(" You can also specify a page to be served by default,");
  60195. $ctx1.sendIdx["warn:"]=3;
  60196. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  60197. }
  60198. return self;
  60199. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  60200. },
  60201. args: [],
  60202. 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.'].",
  60203. referencedClasses: [],
  60204. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  60205. }),
  60206. $globals.FileServer);
  60207. $core.addMethod(
  60208. $core.method({
  60209. selector: "fallbackPage",
  60210. protocol: "accessing",
  60211. fn: function (){
  60212. var self=this;
  60213. return self["@fallbackPage"];
  60214. },
  60215. args: [],
  60216. source: "fallbackPage\x0a\x09^ fallbackPage",
  60217. referencedClasses: [],
  60218. messageSends: []
  60219. }),
  60220. $globals.FileServer);
  60221. $core.addMethod(
  60222. $core.method({
  60223. selector: "fallbackPage:",
  60224. protocol: "accessing",
  60225. fn: function (aString){
  60226. var self=this;
  60227. self["@fallbackPage"]=aString;
  60228. return self;
  60229. },
  60230. args: ["aString"],
  60231. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  60232. referencedClasses: [],
  60233. messageSends: []
  60234. }),
  60235. $globals.FileServer);
  60236. $core.addMethod(
  60237. $core.method({
  60238. selector: "handleGETRequest:respondTo:",
  60239. protocol: "request handling",
  60240. fn: function (aRequest,aResponse){
  60241. var self=this;
  60242. var uri,filename;
  60243. return $core.withContext(function($ctx1) {
  60244. var $1;
  60245. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  60246. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  60247. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  60248. return $core.withContext(function($ctx2) {
  60249. if($core.assert(aBoolean)){
  60250. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  60251. if($core.assert($1)){
  60252. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  60253. } else {
  60254. return self._respondFileNamed_to_(filename,aResponse);
  60255. }
  60256. } else {
  60257. return self._respondNotFoundTo_(aResponse);
  60258. }
  60259. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  60260. }));
  60261. return self;
  60262. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  60263. },
  60264. args: ["aRequest", "aResponse"],
  60265. 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]]]",
  60266. referencedClasses: [],
  60267. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  60268. }),
  60269. $globals.FileServer);
  60270. $core.addMethod(
  60271. $core.method({
  60272. selector: "handleOPTIONSRequest:respondTo:",
  60273. protocol: "request handling",
  60274. fn: function (aRequest,aResponse){
  60275. var self=this;
  60276. return $core.withContext(function($ctx1) {
  60277. $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)]));
  60278. $recv(aResponse)._end();
  60279. return self;
  60280. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  60281. },
  60282. args: ["aRequest", "aResponse"],
  60283. 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",
  60284. referencedClasses: [],
  60285. messageSends: ["writeHead:options:", "end"]
  60286. }),
  60287. $globals.FileServer);
  60288. $core.addMethod(
  60289. $core.method({
  60290. selector: "handlePUTRequest:respondTo:",
  60291. protocol: "request handling",
  60292. fn: function (aRequest,aResponse){
  60293. var self=this;
  60294. var file,stream;
  60295. return $core.withContext(function($ctx1) {
  60296. var $1,$2,$3,$4;
  60297. $1=self._isAuthenticated_(aRequest);
  60298. if(!$core.assert($1)){
  60299. self._respondAuthenticationRequiredTo_(aResponse);
  60300. return nil;
  60301. }
  60302. file=".".__comma($recv(aRequest)._url());
  60303. $ctx1.sendIdx[","]=1;
  60304. stream=$recv(self["@fs"])._createWriteStream_(file);
  60305. $recv(stream)._on_do_("error",(function(error){
  60306. return $core.withContext(function($ctx2) {
  60307. $2=console;
  60308. $3="Error creating WriteStream for file ".__comma(file);
  60309. $ctx2.sendIdx[","]=2;
  60310. $recv($2)._warn_($3);
  60311. $ctx2.sendIdx["warn:"]=1;
  60312. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  60313. $ctx2.sendIdx["warn:"]=2;
  60314. $recv(console)._warn_(" The exact error is: ".__comma(error));
  60315. return self._respondNotCreatedTo_(aResponse);
  60316. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  60317. }));
  60318. $ctx1.sendIdx["on:do:"]=1;
  60319. $recv(stream)._on_do_("close",(function(){
  60320. return $core.withContext(function($ctx2) {
  60321. return self._respondCreatedTo_(aResponse);
  60322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60323. }));
  60324. $ctx1.sendIdx["on:do:"]=2;
  60325. $recv(aRequest)._setEncoding_("utf8");
  60326. $recv(aRequest)._on_do_("data",(function(data){
  60327. return $core.withContext(function($ctx2) {
  60328. return $recv(stream)._write_(data);
  60329. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  60330. }));
  60331. $ctx1.sendIdx["on:do:"]=3;
  60332. $recv(aRequest)._on_do_("end",(function(){
  60333. return $core.withContext(function($ctx2) {
  60334. $4=$recv(stream)._writable();
  60335. if($core.assert($4)){
  60336. return $recv(stream)._end();
  60337. }
  60338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  60339. }));
  60340. return self;
  60341. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  60342. },
  60343. args: ["aRequest", "aResponse"],
  60344. 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]]",
  60345. referencedClasses: [],
  60346. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  60347. }),
  60348. $globals.FileServer);
  60349. $core.addMethod(
  60350. $core.method({
  60351. selector: "handleRequest:respondTo:",
  60352. protocol: "request handling",
  60353. fn: function (aRequest,aResponse){
  60354. var self=this;
  60355. return $core.withContext(function($ctx1) {
  60356. var $2,$1,$4,$3,$5;
  60357. $2=$recv(aRequest)._method();
  60358. $ctx1.sendIdx["method"]=1;
  60359. $1=$recv($2).__eq("PUT");
  60360. $ctx1.sendIdx["="]=1;
  60361. if($core.assert($1)){
  60362. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  60363. }
  60364. $4=$recv(aRequest)._method();
  60365. $ctx1.sendIdx["method"]=2;
  60366. $3=$recv($4).__eq("GET");
  60367. $ctx1.sendIdx["="]=2;
  60368. if($core.assert($3)){
  60369. self._handleGETRequest_respondTo_(aRequest,aResponse);
  60370. }
  60371. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  60372. if($core.assert($5)){
  60373. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  60374. }
  60375. return self;
  60376. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  60377. },
  60378. args: ["aRequest", "aResponse"],
  60379. 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]",
  60380. referencedClasses: [],
  60381. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  60382. }),
  60383. $globals.FileServer);
  60384. $core.addMethod(
  60385. $core.method({
  60386. selector: "host",
  60387. protocol: "accessing",
  60388. fn: function (){
  60389. var self=this;
  60390. return self["@host"];
  60391. },
  60392. args: [],
  60393. source: "host\x0a\x09^ host",
  60394. referencedClasses: [],
  60395. messageSends: []
  60396. }),
  60397. $globals.FileServer);
  60398. $core.addMethod(
  60399. $core.method({
  60400. selector: "host:",
  60401. protocol: "accessing",
  60402. fn: function (hostname){
  60403. var self=this;
  60404. self["@host"]=hostname;
  60405. return self;
  60406. },
  60407. args: ["hostname"],
  60408. source: "host: hostname\x0a\x09host := hostname",
  60409. referencedClasses: [],
  60410. messageSends: []
  60411. }),
  60412. $globals.FileServer);
  60413. $core.addMethod(
  60414. $core.method({
  60415. selector: "initialize",
  60416. protocol: "initialization",
  60417. fn: function (){
  60418. var self=this;
  60419. return $core.withContext(function($ctx1) {
  60420. var $1;
  60421. (
  60422. $ctx1.supercall = true,
  60423. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  60424. $ctx1.supercall = false;
  60425. self["@http"]=self._require_("http");
  60426. $ctx1.sendIdx["require:"]=1;
  60427. self["@util"]=self._require_("util");
  60428. $ctx1.sendIdx["require:"]=2;
  60429. self["@url"]=self._require_("url");
  60430. $1=self._class();
  60431. $ctx1.sendIdx["class"]=1;
  60432. self["@host"]=$recv($1)._defaultHost();
  60433. self["@port"]=$recv(self._class())._defaultPort();
  60434. self["@username"]=nil;
  60435. self["@password"]=nil;
  60436. self["@fallbackPage"]=nil;
  60437. return self;
  60438. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  60439. },
  60440. args: [],
  60441. 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.",
  60442. referencedClasses: [],
  60443. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  60444. }),
  60445. $globals.FileServer);
  60446. $core.addMethod(
  60447. $core.method({
  60448. selector: "isAuthenticated:",
  60449. protocol: "private",
  60450. fn: function (aRequest){
  60451. var self=this;
  60452. var header,token,auth,parts;
  60453. return $core.withContext(function($ctx1) {
  60454. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  60455. var $early={};
  60456. try {
  60457. $2=$recv(self["@username"])._isNil();
  60458. $ctx1.sendIdx["isNil"]=1;
  60459. $1=$recv($2)._and_((function(){
  60460. return $core.withContext(function($ctx2) {
  60461. return $recv(self["@password"])._isNil();
  60462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60463. }));
  60464. $ctx1.sendIdx["and:"]=1;
  60465. if($core.assert($1)){
  60466. return true;
  60467. }
  60468. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  60469. $ctx1.sendIdx["at:"]=1;
  60470. if(($receiver = $3) == null || $receiver.isNil){
  60471. header="";
  60472. } else {
  60473. header=$3;
  60474. }
  60475. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  60476. throw $early=[false];
  60477. }),(function(){
  60478. return $core.withContext(function($ctx2) {
  60479. $4=$recv(header)._tokenize_(" ");
  60480. $ctx2.sendIdx["tokenize:"]=1;
  60481. if(($receiver = $4) == null || $receiver.isNil){
  60482. token="";
  60483. } else {
  60484. token=$4;
  60485. }
  60486. token;
  60487. $5=$recv(token)._at_((2));
  60488. $ctx2.sendIdx["at:"]=2;
  60489. auth=self._base64Decode_($5);
  60490. auth;
  60491. parts=$recv(auth)._tokenize_(":");
  60492. parts;
  60493. $8=self["@username"];
  60494. $9=$recv(parts)._at_((1));
  60495. $ctx2.sendIdx["at:"]=3;
  60496. $7=$recv($8).__eq($9);
  60497. $ctx2.sendIdx["="]=1;
  60498. $6=$recv($7)._and_((function(){
  60499. return $core.withContext(function($ctx3) {
  60500. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  60501. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  60502. }));
  60503. if($core.assert($6)){
  60504. throw $early=[true];
  60505. } else {
  60506. throw $early=[false];
  60507. }
  60508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  60509. }));
  60510. return self;
  60511. }
  60512. catch(e) {if(e===$early)return e[0]; throw e}
  60513. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  60514. },
  60515. args: ["aRequest"],
  60516. 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].",
  60517. referencedClasses: [],
  60518. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  60519. }),
  60520. $globals.FileServer);
  60521. $core.addMethod(
  60522. $core.method({
  60523. selector: "password:",
  60524. protocol: "accessing",
  60525. fn: function (aPassword){
  60526. var self=this;
  60527. self["@password"]=aPassword;
  60528. return self;
  60529. },
  60530. args: ["aPassword"],
  60531. source: "password: aPassword\x0a\x09password := aPassword.",
  60532. referencedClasses: [],
  60533. messageSends: []
  60534. }),
  60535. $globals.FileServer);
  60536. $core.addMethod(
  60537. $core.method({
  60538. selector: "port",
  60539. protocol: "accessing",
  60540. fn: function (){
  60541. var self=this;
  60542. return self["@port"];
  60543. },
  60544. args: [],
  60545. source: "port\x0a\x09^ port",
  60546. referencedClasses: [],
  60547. messageSends: []
  60548. }),
  60549. $globals.FileServer);
  60550. $core.addMethod(
  60551. $core.method({
  60552. selector: "port:",
  60553. protocol: "accessing",
  60554. fn: function (aNumber){
  60555. var self=this;
  60556. self["@port"]=aNumber;
  60557. return self;
  60558. },
  60559. args: ["aNumber"],
  60560. source: "port: aNumber\x0a\x09port := aNumber",
  60561. referencedClasses: [],
  60562. messageSends: []
  60563. }),
  60564. $globals.FileServer);
  60565. $core.addMethod(
  60566. $core.method({
  60567. selector: "require:",
  60568. protocol: "private",
  60569. fn: function (aModuleString){
  60570. var self=this;
  60571. return $core.withContext(function($ctx1) {
  60572. return $recv(require)._value_(aModuleString);
  60573. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  60574. },
  60575. args: ["aModuleString"],
  60576. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  60577. referencedClasses: [],
  60578. messageSends: ["value:"]
  60579. }),
  60580. $globals.FileServer);
  60581. $core.addMethod(
  60582. $core.method({
  60583. selector: "respondAuthenticationRequiredTo:",
  60584. protocol: "request handling",
  60585. fn: function (aResponse){
  60586. var self=this;
  60587. return $core.withContext(function($ctx1) {
  60588. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  60589. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  60590. $recv(aResponse)._end();
  60591. return self;
  60592. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  60593. },
  60594. args: ["aResponse"],
  60595. 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.",
  60596. referencedClasses: [],
  60597. messageSends: ["writeHead:options:", "write:", "end"]
  60598. }),
  60599. $globals.FileServer);
  60600. $core.addMethod(
  60601. $core.method({
  60602. selector: "respondCreatedTo:",
  60603. protocol: "request handling",
  60604. fn: function (aResponse){
  60605. var self=this;
  60606. return $core.withContext(function($ctx1) {
  60607. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  60608. $recv(aResponse)._end();
  60609. return self;
  60610. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  60611. },
  60612. args: ["aResponse"],
  60613. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  60614. referencedClasses: [],
  60615. messageSends: ["writeHead:options:", "end"]
  60616. }),
  60617. $globals.FileServer);
  60618. $core.addMethod(
  60619. $core.method({
  60620. selector: "respondDirectoryNamed:from:to:",
  60621. protocol: "request handling",
  60622. fn: function (aDirname,aUrl,aResponse){
  60623. var self=this;
  60624. return $core.withContext(function($ctx1) {
  60625. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  60626. $2=$recv(aUrl)._pathname();
  60627. $ctx1.sendIdx["pathname"]=1;
  60628. $1=$recv($2)._endsWith_("/");
  60629. if($core.assert($1)){
  60630. $3=$recv(aDirname).__comma("index.html");
  60631. $ctx1.sendIdx[","]=1;
  60632. self._respondFileNamed_to_($3,aResponse);
  60633. } else {
  60634. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  60635. $7=$recv(aUrl)._search();
  60636. if(($receiver = $7) == null || $receiver.isNil){
  60637. $6="";
  60638. } else {
  60639. $6=$7;
  60640. }
  60641. $4=$recv($5).__comma($6);
  60642. $ctx1.sendIdx[","]=2;
  60643. self._respondRedirect_to_($4,aResponse);
  60644. }
  60645. return self;
  60646. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  60647. },
  60648. args: ["aDirname", "aUrl", "aResponse"],
  60649. 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]",
  60650. referencedClasses: [],
  60651. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  60652. }),
  60653. $globals.FileServer);
  60654. $core.addMethod(
  60655. $core.method({
  60656. selector: "respondFileNamed:to:",
  60657. protocol: "request handling",
  60658. fn: function (aFilename,aResponse){
  60659. var self=this;
  60660. var type,filename;
  60661. return $core.withContext(function($ctx1) {
  60662. var $1,$2,$3,$4;
  60663. filename=aFilename;
  60664. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  60665. return $core.withContext(function($ctx2) {
  60666. $1=$recv(ex)._notNil();
  60667. if($core.assert($1)){
  60668. $2=console;
  60669. $3=$recv(filename).__comma(" does not exist");
  60670. $ctx2.sendIdx[","]=1;
  60671. $recv($2)._log_($3);
  60672. return self._respondNotFoundTo_(aResponse);
  60673. } else {
  60674. type=$recv(self._class())._mimeTypeFor_(filename);
  60675. type;
  60676. $4=$recv(type).__eq("application/javascript");
  60677. if($core.assert($4)){
  60678. type=$recv(type).__comma(";charset=utf-8");
  60679. type;
  60680. }
  60681. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  60682. $recv(aResponse)._write_encoding_(file,"binary");
  60683. return $recv(aResponse)._end();
  60684. }
  60685. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  60686. }));
  60687. return self;
  60688. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  60689. },
  60690. args: ["aFilename", "aResponse"],
  60691. 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]]",
  60692. referencedClasses: [],
  60693. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  60694. }),
  60695. $globals.FileServer);
  60696. $core.addMethod(
  60697. $core.method({
  60698. selector: "respondInternalErrorTo:",
  60699. protocol: "request handling",
  60700. fn: function (aResponse){
  60701. var self=this;
  60702. return $core.withContext(function($ctx1) {
  60703. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  60704. $recv(aResponse)._write_("500 Internal server error");
  60705. $recv(aResponse)._end();
  60706. return self;
  60707. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  60708. },
  60709. args: ["aResponse"],
  60710. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  60711. referencedClasses: [],
  60712. messageSends: ["writeHead:options:", "write:", "end"]
  60713. }),
  60714. $globals.FileServer);
  60715. $core.addMethod(
  60716. $core.method({
  60717. selector: "respondNotCreatedTo:",
  60718. protocol: "request handling",
  60719. fn: function (aResponse){
  60720. var self=this;
  60721. return $core.withContext(function($ctx1) {
  60722. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  60723. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  60724. $recv(aResponse)._end();
  60725. return self;
  60726. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  60727. },
  60728. args: ["aResponse"],
  60729. 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.",
  60730. referencedClasses: [],
  60731. messageSends: ["writeHead:options:", "write:", "end"]
  60732. }),
  60733. $globals.FileServer);
  60734. $core.addMethod(
  60735. $core.method({
  60736. selector: "respondNotFoundTo:",
  60737. protocol: "request handling",
  60738. fn: function (aResponse){
  60739. var self=this;
  60740. return $core.withContext(function($ctx1) {
  60741. var $2,$1;
  60742. $2=self._fallbackPage();
  60743. $ctx1.sendIdx["fallbackPage"]=1;
  60744. $1=$recv($2)._isNil();
  60745. if(!$core.assert($1)){
  60746. return self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  60747. }
  60748. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  60749. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  60750. $ctx1.sendIdx["write:"]=1;
  60751. $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>");
  60752. $ctx1.sendIdx["write:"]=2;
  60753. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  60754. $ctx1.sendIdx["write:"]=3;
  60755. $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>");
  60756. $ctx1.sendIdx["write:"]=4;
  60757. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  60758. $ctx1.sendIdx["write:"]=5;
  60759. $recv(aResponse)._write_("</ul></p></body></html>");
  60760. $recv(aResponse)._end();
  60761. return self;
  60762. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  60763. },
  60764. args: ["aResponse"],
  60765. 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",
  60766. referencedClasses: [],
  60767. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  60768. }),
  60769. $globals.FileServer);
  60770. $core.addMethod(
  60771. $core.method({
  60772. selector: "respondOKTo:",
  60773. protocol: "request handling",
  60774. fn: function (aResponse){
  60775. var self=this;
  60776. return $core.withContext(function($ctx1) {
  60777. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  60778. $recv(aResponse)._end();
  60779. return self;
  60780. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  60781. },
  60782. args: ["aResponse"],
  60783. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  60784. referencedClasses: [],
  60785. messageSends: ["writeHead:options:", "end"]
  60786. }),
  60787. $globals.FileServer);
  60788. $core.addMethod(
  60789. $core.method({
  60790. selector: "respondRedirect:to:",
  60791. protocol: "request handling",
  60792. fn: function (aString,aResponse){
  60793. var self=this;
  60794. return $core.withContext(function($ctx1) {
  60795. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  60796. $recv(aResponse)._end();
  60797. return self;
  60798. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  60799. },
  60800. args: ["aString", "aResponse"],
  60801. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  60802. referencedClasses: [],
  60803. messageSends: ["writeHead:options:", "end"]
  60804. }),
  60805. $globals.FileServer);
  60806. $core.addMethod(
  60807. $core.method({
  60808. selector: "start",
  60809. protocol: "starting",
  60810. fn: function (){
  60811. var self=this;
  60812. return $core.withContext(function($ctx1) {
  60813. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  60814. self._checkDirectoryLayout();
  60815. $1=$recv(self["@http"])._createServer_((function(request,response){
  60816. return $core.withContext(function($ctx2) {
  60817. return self._handleRequest_respondTo_(request,response);
  60818. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  60819. }));
  60820. $recv($1)._on_do_("error",(function(error){
  60821. return $core.withContext(function($ctx2) {
  60822. $2=console;
  60823. $3="Error starting server: ".__comma(error);
  60824. $ctx2.sendIdx[","]=1;
  60825. return $recv($2)._log_($3);
  60826. $ctx2.sendIdx["log:"]=1;
  60827. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  60828. }));
  60829. $ctx1.sendIdx["on:do:"]=1;
  60830. $recv($1)._on_do_("listening",(function(){
  60831. return $core.withContext(function($ctx2) {
  60832. $4=console;
  60833. $8=self._host();
  60834. $ctx2.sendIdx["host"]=1;
  60835. $7="Starting file server on http://".__comma($8);
  60836. $6=$recv($7).__comma(":");
  60837. $ctx2.sendIdx[","]=3;
  60838. $10=self._port();
  60839. $ctx2.sendIdx["port"]=1;
  60840. $9=$recv($10)._asString();
  60841. $5=$recv($6).__comma($9);
  60842. $ctx2.sendIdx[","]=2;
  60843. return $recv($4)._log_($5);
  60844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60845. }));
  60846. $recv($1)._listen_host_(self._port(),self._host());
  60847. return self;
  60848. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  60849. },
  60850. args: [],
  60851. 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.",
  60852. referencedClasses: [],
  60853. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  60854. }),
  60855. $globals.FileServer);
  60856. $core.addMethod(
  60857. $core.method({
  60858. selector: "startOn:",
  60859. protocol: "starting",
  60860. fn: function (aPort){
  60861. var self=this;
  60862. return $core.withContext(function($ctx1) {
  60863. self._port_(aPort);
  60864. self._start();
  60865. return self;
  60866. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  60867. },
  60868. args: ["aPort"],
  60869. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  60870. referencedClasses: [],
  60871. messageSends: ["port:", "start"]
  60872. }),
  60873. $globals.FileServer);
  60874. $core.addMethod(
  60875. $core.method({
  60876. selector: "username:",
  60877. protocol: "accessing",
  60878. fn: function (aUsername){
  60879. var self=this;
  60880. self["@username"]=aUsername;
  60881. return self;
  60882. },
  60883. args: ["aUsername"],
  60884. source: "username: aUsername\x0a\x09username := aUsername.",
  60885. referencedClasses: [],
  60886. messageSends: []
  60887. }),
  60888. $globals.FileServer);
  60889. $core.addMethod(
  60890. $core.method({
  60891. selector: "validateBasePath",
  60892. protocol: "private",
  60893. fn: function (){
  60894. var self=this;
  60895. return $core.withContext(function($ctx1) {
  60896. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  60897. $1=self["@fs"];
  60898. $2=self._basePath();
  60899. $ctx1.sendIdx["basePath"]=1;
  60900. $recv($1)._stat_then_($2,(function(err,stat){
  60901. return $core.withContext(function($ctx2) {
  60902. if(($receiver = err) == null || $receiver.isNil){
  60903. $3=$recv(stat)._isDirectory();
  60904. if(!$core.assert($3)){
  60905. $4=console;
  60906. $7=self._basePath();
  60907. $ctx2.sendIdx["basePath"]=2;
  60908. $6="Warning: --base-path parameter ".__comma($7);
  60909. $ctx2.sendIdx[","]=2;
  60910. $5=$recv($6).__comma(" is not a directory.");
  60911. $ctx2.sendIdx[","]=1;
  60912. return $recv($4)._warn_($5);
  60913. $ctx2.sendIdx["warn:"]=1;
  60914. }
  60915. } else {
  60916. $8=console;
  60917. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  60918. $ctx2.sendIdx[","]=3;
  60919. return $recv($8)._warn_($9);
  60920. }
  60921. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  60922. }));
  60923. return self;
  60924. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  60925. },
  60926. args: [],
  60927. 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.' ]].",
  60928. referencedClasses: [],
  60929. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  60930. }),
  60931. $globals.FileServer);
  60932. $core.addMethod(
  60933. $core.method({
  60934. selector: "withBasePath:",
  60935. protocol: "private",
  60936. fn: function (aBaseRelativePath){
  60937. var self=this;
  60938. return $core.withContext(function($ctx1) {
  60939. return $recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  60940. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  60941. },
  60942. args: ["aBaseRelativePath"],
  60943. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  60944. referencedClasses: [],
  60945. messageSends: ["join:with:", "basePath"]
  60946. }),
  60947. $globals.FileServer);
  60948. $core.addMethod(
  60949. $core.method({
  60950. selector: "writeData:toFileNamed:",
  60951. protocol: "private",
  60952. fn: function (data,aFilename){
  60953. var self=this;
  60954. return $core.withContext(function($ctx1) {
  60955. $recv(console)._log_(aFilename);
  60956. return self;
  60957. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  60958. },
  60959. args: ["data", "aFilename"],
  60960. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  60961. referencedClasses: [],
  60962. messageSends: ["log:"]
  60963. }),
  60964. $globals.FileServer);
  60965. $globals.FileServer.klass.iVarNames = ["mimeTypes"];
  60966. $core.addMethod(
  60967. $core.method({
  60968. selector: "commandLineSwitches",
  60969. protocol: "accessing",
  60970. fn: function (){
  60971. var self=this;
  60972. var switches;
  60973. return $core.withContext(function($ctx1) {
  60974. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  60975. return $core.withContext(function($ctx2) {
  60976. return $recv(each)._selector();
  60977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60978. }));
  60979. $ctx1.sendIdx["collect:"]=1;
  60980. switches=$recv(switches)._select_((function(each){
  60981. return $core.withContext(function($ctx2) {
  60982. return $recv(each)._match_("^[^:]*:$");
  60983. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  60984. }));
  60985. switches=$recv(switches)._collect_((function(each){
  60986. return $core.withContext(function($ctx2) {
  60987. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  60988. $ctx2.sendIdx["replace:with:"]=1;
  60989. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  60990. }));
  60991. return switches;
  60992. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  60993. },
  60994. args: [],
  60995. 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",
  60996. referencedClasses: [],
  60997. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  60998. }),
  60999. $globals.FileServer.klass);
  61000. $core.addMethod(
  61001. $core.method({
  61002. selector: "createServerWithArguments:",
  61003. protocol: "initialization",
  61004. fn: function (options){
  61005. var self=this;
  61006. var server,popFront,front,optionName,optionValue,switches;
  61007. return $core.withContext(function($ctx1) {
  61008. var $1,$2,$3,$4,$5,$6,$7,$8;
  61009. var $early={};
  61010. try {
  61011. switches=self._commandLineSwitches();
  61012. server=self._new();
  61013. $recv(options)._ifEmpty_((function(){
  61014. throw $early=[server];
  61015. }));
  61016. $1=$recv($recv(options)._size())._even();
  61017. if(!$core.assert($1)){
  61018. $recv(console)._log_("Using default parameters.");
  61019. $ctx1.sendIdx["log:"]=1;
  61020. $2=console;
  61021. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  61022. $ctx1.sendIdx[","]=1;
  61023. $recv($2)._log_($3);
  61024. $ctx1.sendIdx["log:"]=2;
  61025. $4=console;
  61026. $5="Use any of the following ones: ".__comma(switches);
  61027. $ctx1.sendIdx[","]=2;
  61028. $recv($4)._log_($5);
  61029. $ctx1.sendIdx["log:"]=3;
  61030. return server;
  61031. }
  61032. popFront=(function(args){
  61033. return $core.withContext(function($ctx2) {
  61034. front=$recv(args)._first();
  61035. front;
  61036. $recv(args)._remove_(front);
  61037. return front;
  61038. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  61039. });
  61040. $recv((function(){
  61041. return $core.withContext(function($ctx2) {
  61042. return $recv(options)._notEmpty();
  61043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  61044. }))._whileTrue_((function(){
  61045. return $core.withContext(function($ctx2) {
  61046. optionName=$recv(popFront)._value_(options);
  61047. $ctx2.sendIdx["value:"]=1;
  61048. optionName;
  61049. optionValue=$recv(popFront)._value_(options);
  61050. optionValue;
  61051. $6=$recv(switches)._includes_(optionName);
  61052. if($core.assert($6)){
  61053. optionName=self._selectorForCommandLineSwitch_(optionName);
  61054. optionName;
  61055. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  61056. } else {
  61057. $7=console;
  61058. $8=$recv(optionName).__comma(" is not a valid commandline option");
  61059. $ctx2.sendIdx[","]=3;
  61060. $recv($7)._log_($8);
  61061. $ctx2.sendIdx["log:"]=4;
  61062. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  61063. }
  61064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  61065. }));
  61066. return server;
  61067. }
  61068. catch(e) {if(e===$early)return e[0]; throw e}
  61069. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  61070. },
  61071. args: ["options"],
  61072. 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.",
  61073. referencedClasses: ["Array"],
  61074. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  61075. }),
  61076. $globals.FileServer.klass);
  61077. $core.addMethod(
  61078. $core.method({
  61079. selector: "defaultBasePath",
  61080. protocol: "accessing",
  61081. fn: function (){
  61082. var self=this;
  61083. return "./";
  61084. },
  61085. args: [],
  61086. source: "defaultBasePath\x0a\x09^ './'",
  61087. referencedClasses: [],
  61088. messageSends: []
  61089. }),
  61090. $globals.FileServer.klass);
  61091. $core.addMethod(
  61092. $core.method({
  61093. selector: "defaultHost",
  61094. protocol: "accessing",
  61095. fn: function (){
  61096. var self=this;
  61097. return "127.0.0.1";
  61098. },
  61099. args: [],
  61100. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  61101. referencedClasses: [],
  61102. messageSends: []
  61103. }),
  61104. $globals.FileServer.klass);
  61105. $core.addMethod(
  61106. $core.method({
  61107. selector: "defaultMimeTypes",
  61108. protocol: "accessing",
  61109. fn: function (){
  61110. var self=this;
  61111. 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"]);
  61112. },
  61113. args: [],
  61114. 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}",
  61115. referencedClasses: [],
  61116. messageSends: []
  61117. }),
  61118. $globals.FileServer.klass);
  61119. $core.addMethod(
  61120. $core.method({
  61121. selector: "defaultPort",
  61122. protocol: "accessing",
  61123. fn: function (){
  61124. var self=this;
  61125. return (4000);
  61126. },
  61127. args: [],
  61128. source: "defaultPort\x0a\x09^ 4000",
  61129. referencedClasses: [],
  61130. messageSends: []
  61131. }),
  61132. $globals.FileServer.klass);
  61133. $core.addMethod(
  61134. $core.method({
  61135. selector: "main",
  61136. protocol: "initialization",
  61137. fn: function (){
  61138. var self=this;
  61139. var fileServer,args;
  61140. return $core.withContext(function($ctx1) {
  61141. var $1;
  61142. var $early={};
  61143. try {
  61144. args=$recv(process)._argv();
  61145. $recv(args)._removeFrom_to_((1),(3));
  61146. $recv(args)._detect_ifNone_((function(each){
  61147. return $core.withContext(function($ctx2) {
  61148. $1=$recv(each).__eq("--help");
  61149. if($core.assert($1)){
  61150. return $recv($globals.FileServer)._printHelp();
  61151. }
  61152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61153. }),(function(){
  61154. return $core.withContext(function($ctx2) {
  61155. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  61156. fileServer;
  61157. throw $early=[$recv(fileServer)._start()];
  61158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61159. }));
  61160. return self;
  61161. }
  61162. catch(e) {if(e===$early)return e[0]; throw e}
  61163. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  61164. },
  61165. args: [],
  61166. 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]",
  61167. referencedClasses: ["FileServer"],
  61168. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  61169. }),
  61170. $globals.FileServer.klass);
  61171. $core.addMethod(
  61172. $core.method({
  61173. selector: "mimeTypeFor:",
  61174. protocol: "accessing",
  61175. fn: function (aString){
  61176. var self=this;
  61177. return $core.withContext(function($ctx1) {
  61178. return $recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  61179. return "text/plain";
  61180. }));
  61181. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  61182. },
  61183. args: ["aString"],
  61184. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  61185. referencedClasses: [],
  61186. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  61187. }),
  61188. $globals.FileServer.klass);
  61189. $core.addMethod(
  61190. $core.method({
  61191. selector: "mimeTypes",
  61192. protocol: "accessing",
  61193. fn: function (){
  61194. var self=this;
  61195. return $core.withContext(function($ctx1) {
  61196. var $1,$receiver;
  61197. $1=self["@mimeTypes"];
  61198. if(($receiver = $1) == null || $receiver.isNil){
  61199. self["@mimeTypes"]=self._defaultMimeTypes();
  61200. return self["@mimeTypes"];
  61201. } else {
  61202. return $1;
  61203. }
  61204. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  61205. },
  61206. args: [],
  61207. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  61208. referencedClasses: [],
  61209. messageSends: ["ifNil:", "defaultMimeTypes"]
  61210. }),
  61211. $globals.FileServer.klass);
  61212. $core.addMethod(
  61213. $core.method({
  61214. selector: "printHelp",
  61215. protocol: "accessing",
  61216. fn: function (){
  61217. var self=this;
  61218. return $core.withContext(function($ctx1) {
  61219. $recv(console)._log_("Available commandline options are:");
  61220. $ctx1.sendIdx["log:"]=1;
  61221. $recv(console)._log_("--help");
  61222. $ctx1.sendIdx["log:"]=2;
  61223. $recv(self._commandLineSwitches())._do_((function(each){
  61224. return $core.withContext(function($ctx2) {
  61225. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  61226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61227. }));
  61228. return self;
  61229. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  61230. },
  61231. args: [],
  61232. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  61233. referencedClasses: [],
  61234. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  61235. }),
  61236. $globals.FileServer.klass);
  61237. $core.addMethod(
  61238. $core.method({
  61239. selector: "selectorForCommandLineSwitch:",
  61240. protocol: "accessing",
  61241. fn: function (aSwitch){
  61242. var self=this;
  61243. return $core.withContext(function($ctx1) {
  61244. var $1;
  61245. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  61246. return $core.withContext(function($ctx2) {
  61247. return $recv($recv(each)._second())._asUppercase();
  61248. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61249. }));
  61250. $ctx1.sendIdx["replace:with:"]=1;
  61251. return $recv($1).__comma(":");
  61252. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  61253. },
  61254. args: ["aSwitch"],
  61255. 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 ]), ':'",
  61256. referencedClasses: [],
  61257. messageSends: [",", "replace:with:", "asUppercase", "second"]
  61258. }),
  61259. $globals.FileServer.klass);
  61260. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  61261. $core.addMethod(
  61262. $core.method({
  61263. selector: "bowerInstallThenDo:",
  61264. protocol: "action",
  61265. fn: function (aBlock){
  61266. var self=this;
  61267. var child;
  61268. return $core.withContext(function($ctx1) {
  61269. var $1,$3,$2;
  61270. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  61271. $1=child;
  61272. $recv($1)._on_do_("error",aBlock);
  61273. $ctx1.sendIdx["on:do:"]=1;
  61274. $recv($1)._on_do_("close",(function(code){
  61275. return $core.withContext(function($ctx2) {
  61276. $3=$recv(code).__eq((0));
  61277. if($core.assert($3)){
  61278. $2=nil;
  61279. } else {
  61280. $2=code;
  61281. }
  61282. return $recv(aBlock)._value_($2);
  61283. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  61284. }));
  61285. return self;
  61286. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  61287. },
  61288. args: ["aBlock"],
  61289. source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'bower' named: 'bower')\x0a\x09\x09args: #('install').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  61290. referencedClasses: [],
  61291. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  61292. }),
  61293. $globals.Initer);
  61294. $core.addMethod(
  61295. $core.method({
  61296. selector: "finishMessage",
  61297. protocol: "action",
  61298. fn: function (){
  61299. var self=this;
  61300. return $core.withContext(function($ctx1) {
  61301. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  61302. $recv((function(){
  61303. }))._valueWithTimeout_((600));
  61304. return self;
  61305. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  61306. },
  61307. args: [],
  61308. 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",
  61309. referencedClasses: ["String"],
  61310. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  61311. }),
  61312. $globals.Initer);
  61313. $core.addMethod(
  61314. $core.method({
  61315. selector: "gruntInitThenDo:",
  61316. protocol: "action",
  61317. fn: function (aBlock){
  61318. var self=this;
  61319. var child,sanitizedTemplatePath;
  61320. return $core.withContext(function($ctx1) {
  61321. var $1,$3,$2;
  61322. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  61323. $ctx1.sendIdx["replace:with:"]=1;
  61324. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  61325. $1=child;
  61326. $recv($1)._on_do_("error",aBlock);
  61327. $ctx1.sendIdx["on:do:"]=1;
  61328. $recv($1)._on_do_("close",(function(code){
  61329. return $core.withContext(function($ctx2) {
  61330. $3=$recv(code).__eq((0));
  61331. if($core.assert($3)){
  61332. $2=nil;
  61333. } else {
  61334. $2=code;
  61335. }
  61336. return $recv(aBlock)._value_($2);
  61337. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  61338. }));
  61339. return self;
  61340. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  61341. },
  61342. args: ["aBlock"],
  61343. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  61344. referencedClasses: [],
  61345. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  61346. }),
  61347. $globals.Initer);
  61348. $core.addMethod(
  61349. $core.method({
  61350. selector: "gruntThenDo:",
  61351. protocol: "action",
  61352. fn: function (aBlock){
  61353. var self=this;
  61354. var child;
  61355. return $core.withContext(function($ctx1) {
  61356. var $1,$3,$2;
  61357. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  61358. $1=child;
  61359. $recv($1)._on_do_("error",aBlock);
  61360. $ctx1.sendIdx["on:do:"]=1;
  61361. $recv($1)._on_do_("close",(function(code){
  61362. return $core.withContext(function($ctx2) {
  61363. $3=$recv(code).__eq((0));
  61364. if($core.assert($3)){
  61365. $2=nil;
  61366. } else {
  61367. $2=code;
  61368. }
  61369. return $recv(aBlock)._value_($2);
  61370. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  61371. }));
  61372. return self;
  61373. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  61374. },
  61375. args: ["aBlock"],
  61376. source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-cli' named: 'grunt')\x0a\x09\x09args: #('default' 'devel').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  61377. referencedClasses: [],
  61378. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  61379. }),
  61380. $globals.Initer);
  61381. $core.addMethod(
  61382. $core.method({
  61383. selector: "initialize",
  61384. protocol: "initialization",
  61385. fn: function (){
  61386. var self=this;
  61387. return $core.withContext(function($ctx1) {
  61388. (
  61389. $ctx1.supercall = true,
  61390. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  61391. $ctx1.supercall = false;
  61392. self["@childProcess"]=$recv(require)._value_("child_process");
  61393. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  61394. return self;
  61395. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  61396. },
  61397. args: [],
  61398. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  61399. referencedClasses: [],
  61400. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  61401. }),
  61402. $globals.Initer);
  61403. $core.addMethod(
  61404. $core.method({
  61405. selector: "npmInstallThenDo:",
  61406. protocol: "action",
  61407. fn: function (aBlock){
  61408. var self=this;
  61409. var child;
  61410. return $core.withContext(function($ctx1) {
  61411. var $1;
  61412. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  61413. $1=$recv(child)._stdout();
  61414. $ctx1.sendIdx["stdout"]=1;
  61415. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  61416. return self;
  61417. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  61418. },
  61419. args: ["aBlock"],
  61420. source: "npmInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  61421. referencedClasses: [],
  61422. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  61423. }),
  61424. $globals.Initer);
  61425. $core.addMethod(
  61426. $core.method({
  61427. selector: "npmScriptForModule:named:",
  61428. protocol: "npm",
  61429. fn: function (aString,anotherString){
  61430. var self=this;
  61431. var modulePath,packageJson,binSection,scriptPath;
  61432. return $core.withContext(function($ctx1) {
  61433. var $1,$3,$4,$2,$5;
  61434. $1=self["@path"];
  61435. $3=$recv($globals.JSObjectProxy)._on_(require);
  61436. $4=$recv(aString).__comma("/package.json");
  61437. $ctx1.sendIdx[","]=1;
  61438. $2=$recv($3)._resolve_($4);
  61439. modulePath=$recv($1)._dirname_($2);
  61440. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  61441. binSection=$recv(packageJson)._at_("bin");
  61442. $ctx1.sendIdx["at:"]=1;
  61443. $5=$recv(binSection)._isString();
  61444. if($core.assert($5)){
  61445. scriptPath=binSection;
  61446. } else {
  61447. scriptPath=$recv(binSection)._at_(anotherString);
  61448. }
  61449. return $recv(self["@path"])._join_with_(modulePath,scriptPath);
  61450. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  61451. },
  61452. args: ["aString", "anotherString"],
  61453. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  61454. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  61455. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  61456. }),
  61457. $globals.Initer);
  61458. $core.addMethod(
  61459. $core.method({
  61460. selector: "start",
  61461. protocol: "action",
  61462. fn: function (){
  61463. var self=this;
  61464. return $core.withContext(function($ctx1) {
  61465. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  61466. self._gruntInitThenDo_((function(error){
  61467. return $core.withContext(function($ctx2) {
  61468. if(($receiver = error) == null || $receiver.isNil){
  61469. return self._bowerInstallThenDo_((function(error2){
  61470. return $core.withContext(function($ctx3) {
  61471. if(($receiver = error2) == null || $receiver.isNil){
  61472. return self._npmInstallThenDo_((function(error3){
  61473. return $core.withContext(function($ctx4) {
  61474. if(($receiver = error3) == null || $receiver.isNil){
  61475. return self._gruntThenDo_((function(error4){
  61476. return $core.withContext(function($ctx5) {
  61477. if(($receiver = error4) == null || $receiver.isNil){
  61478. self._finishMessage();
  61479. return $recv(process)._exit();
  61480. } else {
  61481. $7=console;
  61482. $recv($7)._log_("grunt exec error:");
  61483. $ctx5.sendIdx["log:"]=7;
  61484. $recv($7)._log_(error4);
  61485. return $recv(process)._exit_((104));
  61486. }
  61487. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  61488. }));
  61489. } else {
  61490. $5=console;
  61491. $recv($5)._log_("npm install exec error:");
  61492. $ctx4.sendIdx["log:"]=5;
  61493. $6=$recv($5)._log_(error3);
  61494. $ctx4.sendIdx["log:"]=6;
  61495. $6;
  61496. return $recv(process)._exit_((103));
  61497. $ctx4.sendIdx["exit:"]=3;
  61498. }
  61499. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  61500. }));
  61501. } else {
  61502. $3=console;
  61503. $recv($3)._log_("bower install exec error:");
  61504. $ctx3.sendIdx["log:"]=3;
  61505. $4=$recv($3)._log_(error2);
  61506. $ctx3.sendIdx["log:"]=4;
  61507. $4;
  61508. return $recv(process)._exit_((102));
  61509. $ctx3.sendIdx["exit:"]=2;
  61510. }
  61511. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  61512. }));
  61513. } else {
  61514. $1=console;
  61515. $recv($1)._log_("grunt-init exec error:");
  61516. $ctx2.sendIdx["log:"]=1;
  61517. $2=$recv($1)._log_(error);
  61518. $ctx2.sendIdx["log:"]=2;
  61519. $2;
  61520. return $recv(process)._exit_((101));
  61521. $ctx2.sendIdx["exit:"]=1;
  61522. }
  61523. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  61524. }));
  61525. return self;
  61526. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  61527. },
  61528. args: [],
  61529. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit: 102 ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit: 103 ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit: 104 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]",
  61530. referencedClasses: [],
  61531. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  61532. }),
  61533. $globals.Initer);
  61534. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  61535. $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.";
  61536. $core.addMethod(
  61537. $core.method({
  61538. selector: "addVariableNamed:to:",
  61539. protocol: "private",
  61540. fn: function (aString,anObject){
  61541. var self=this;
  61542. var newClass,newObject;
  61543. return $core.withContext(function($ctx1) {
  61544. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  61545. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  61546. newObject=$recv(newClass)._new();
  61547. self._setPreviousVariablesFor_from_(newObject,anObject);
  61548. return newObject;
  61549. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  61550. },
  61551. args: ["aString", "anObject"],
  61552. 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",
  61553. referencedClasses: [],
  61554. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  61555. }),
  61556. $globals.Repl);
  61557. $core.addMethod(
  61558. $core.method({
  61559. selector: "assignNewVariable:do:",
  61560. protocol: "private",
  61561. fn: function (buffer,aBlock){
  61562. var self=this;
  61563. return $core.withContext(function($ctx1) {
  61564. var $2,$3,$1,$receiver;
  61565. return self._parseAssignment_do_(buffer,(function(name,expr){
  61566. var varName,value;
  61567. return $core.withContext(function($ctx2) {
  61568. if(($receiver = name) == null || $receiver.isNil){
  61569. varName=self._nextResultName();
  61570. } else {
  61571. varName=name;
  61572. }
  61573. varName;
  61574. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  61575. self["@session"];
  61576. $recv((function(){
  61577. return $core.withContext(function($ctx3) {
  61578. $2=$recv(varName).__comma(" := ");
  61579. if(($receiver = expr) == null || $receiver.isNil){
  61580. $3=buffer;
  61581. } else {
  61582. $3=expr;
  61583. }
  61584. $1=$recv($2).__comma($3);
  61585. $ctx3.sendIdx[","]=1;
  61586. value=self._eval_on_($1,self["@session"]);
  61587. return value;
  61588. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  61589. }))._on_do_($globals.Error,(function(e){
  61590. return $core.withContext(function($ctx3) {
  61591. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  61592. value=nil;
  61593. return value;
  61594. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  61595. }));
  61596. return $recv(aBlock)._value_value_(varName,value);
  61597. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  61598. }));
  61599. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  61600. },
  61601. args: ["buffer", "aBlock"],
  61602. 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]",
  61603. referencedClasses: ["Error", "ConsoleErrorHandler"],
  61604. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  61605. }),
  61606. $globals.Repl);
  61607. $core.addMethod(
  61608. $core.method({
  61609. selector: "clearScreen",
  61610. protocol: "actions",
  61611. fn: function (){
  61612. var self=this;
  61613. var esc,cls;
  61614. return $core.withContext(function($ctx1) {
  61615. var $1;
  61616. esc=$recv($globals.String)._fromCharCode_((27));
  61617. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  61618. $ctx1.sendIdx[","]=2;
  61619. cls=$recv($1).__comma("[0;0f");
  61620. $ctx1.sendIdx[","]=1;
  61621. $recv($recv(process)._stdout())._write_(cls);
  61622. $recv(self["@interface"])._prompt();
  61623. return self;
  61624. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  61625. },
  61626. args: [],
  61627. 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",
  61628. referencedClasses: ["String"],
  61629. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  61630. }),
  61631. $globals.Repl);
  61632. $core.addMethod(
  61633. $core.method({
  61634. selector: "close",
  61635. protocol: "actions",
  61636. fn: function (){
  61637. var self=this;
  61638. return $core.withContext(function($ctx1) {
  61639. $recv($recv(process)._stdin())._destroy();
  61640. return self;
  61641. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  61642. },
  61643. args: [],
  61644. source: "close\x0a\x09process stdin destroy",
  61645. referencedClasses: [],
  61646. messageSends: ["destroy", "stdin"]
  61647. }),
  61648. $globals.Repl);
  61649. $core.addMethod(
  61650. $core.method({
  61651. selector: "commands",
  61652. protocol: "accessing",
  61653. fn: function (){
  61654. var self=this;
  61655. return self["@commands"];
  61656. },
  61657. args: [],
  61658. source: "commands\x0a\x09^ commands",
  61659. referencedClasses: [],
  61660. messageSends: []
  61661. }),
  61662. $globals.Repl);
  61663. $core.addMethod(
  61664. $core.method({
  61665. selector: "createInterface",
  61666. protocol: "actions",
  61667. fn: function (){
  61668. var self=this;
  61669. return $core.withContext(function($ctx1) {
  61670. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  61671. $recv(self["@interface"])._on_do_("line",(function(buffer){
  61672. return $core.withContext(function($ctx2) {
  61673. return self._processLine_(buffer);
  61674. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  61675. }));
  61676. $ctx1.sendIdx["on:do:"]=1;
  61677. $recv(self["@interface"])._on_do_("close",(function(){
  61678. return $core.withContext(function($ctx2) {
  61679. return self._close();
  61680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61681. }));
  61682. self._printWelcome();
  61683. self._setupHotkeys();
  61684. self._setPrompt();
  61685. $recv(self["@interface"])._prompt();
  61686. return self;
  61687. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  61688. },
  61689. args: [],
  61690. 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",
  61691. referencedClasses: [],
  61692. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  61693. }),
  61694. $globals.Repl);
  61695. $core.addMethod(
  61696. $core.method({
  61697. selector: "encapsulateVariable:withValue:in:",
  61698. protocol: "private",
  61699. fn: function (aString,anObject,aClass){
  61700. var self=this;
  61701. var compiler;
  61702. return $core.withContext(function($ctx1) {
  61703. var $1,$4,$3,$2,$5,$6;
  61704. compiler=$recv($globals.Compiler)._new();
  61705. $1=compiler;
  61706. $4=$recv(aString).__comma(": anObject ^ ");
  61707. $ctx1.sendIdx[","]=3;
  61708. $3=$recv($4).__comma(aString);
  61709. $ctx1.sendIdx[","]=2;
  61710. $2=$recv($3).__comma(" := anObject");
  61711. $ctx1.sendIdx[","]=1;
  61712. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  61713. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  61714. $5=compiler;
  61715. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  61716. $ctx1.sendIdx[","]=4;
  61717. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  61718. return self;
  61719. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  61720. },
  61721. args: ["aString", "anObject", "aClass"],
  61722. 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'.",
  61723. referencedClasses: ["Compiler"],
  61724. messageSends: ["new", "install:forClass:protocol:", ","]
  61725. }),
  61726. $globals.Repl);
  61727. $core.addMethod(
  61728. $core.method({
  61729. selector: "eval:",
  61730. protocol: "actions",
  61731. fn: function (buffer){
  61732. var self=this;
  61733. return $core.withContext(function($ctx1) {
  61734. return self._eval_on_(buffer,$recv($globals.DoIt)._new());
  61735. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  61736. },
  61737. args: ["buffer"],
  61738. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  61739. referencedClasses: ["DoIt"],
  61740. messageSends: ["eval:on:", "new"]
  61741. }),
  61742. $globals.Repl);
  61743. $core.addMethod(
  61744. $core.method({
  61745. selector: "eval:on:",
  61746. protocol: "actions",
  61747. fn: function (buffer,anObject){
  61748. var self=this;
  61749. var result;
  61750. return $core.withContext(function($ctx1) {
  61751. var $1;
  61752. $recv(buffer)._ifNotEmpty_((function(){
  61753. return $core.withContext(function($ctx2) {
  61754. return $recv((function(){
  61755. return $core.withContext(function($ctx3) {
  61756. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  61757. return result;
  61758. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61759. }))._tryCatch_((function(e){
  61760. return $core.withContext(function($ctx3) {
  61761. $1=$recv(e)._isSmalltalkError();
  61762. if($core.assert($1)){
  61763. return $recv(e)._resignal();
  61764. } else {
  61765. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  61766. }
  61767. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  61768. }));
  61769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61770. }));
  61771. return result;
  61772. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  61773. },
  61774. args: ["buffer", "anObject"],
  61775. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e resignal ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  61776. referencedClasses: ["Compiler"],
  61777. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  61778. }),
  61779. $globals.Repl);
  61780. $core.addMethod(
  61781. $core.method({
  61782. selector: "executeCommand:",
  61783. protocol: "private",
  61784. fn: function (aString){
  61785. var self=this;
  61786. return $core.withContext(function($ctx1) {
  61787. var $1;
  61788. var $early={};
  61789. try {
  61790. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  61791. return $core.withContext(function($ctx2) {
  61792. $1=$recv(names)._includes_(aString);
  61793. if($core.assert($1)){
  61794. $recv(cmd)._value();
  61795. throw $early=[true];
  61796. }
  61797. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  61798. }));
  61799. return false;
  61800. }
  61801. catch(e) {if(e===$early)return e[0]; throw e}
  61802. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  61803. },
  61804. args: ["aString"],
  61805. 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",
  61806. referencedClasses: [],
  61807. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  61808. }),
  61809. $globals.Repl);
  61810. $core.addMethod(
  61811. $core.method({
  61812. selector: "initialize",
  61813. protocol: "initialization",
  61814. fn: function (){
  61815. var self=this;
  61816. return $core.withContext(function($ctx1) {
  61817. (
  61818. $ctx1.supercall = true,
  61819. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  61820. $ctx1.supercall = false;
  61821. self["@session"]=$recv($globals.DoIt)._new();
  61822. self["@readline"]=$recv(require)._value_("readline");
  61823. $ctx1.sendIdx["value:"]=1;
  61824. self["@util"]=$recv(require)._value_("util");
  61825. self._setupCommands();
  61826. return self;
  61827. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  61828. },
  61829. args: [],
  61830. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  61831. referencedClasses: ["DoIt"],
  61832. messageSends: ["initialize", "new", "value:", "setupCommands"]
  61833. }),
  61834. $globals.Repl);
  61835. $core.addMethod(
  61836. $core.method({
  61837. selector: "instanceVariableNamesFor:",
  61838. protocol: "private",
  61839. fn: function (aClass){
  61840. var self=this;
  61841. return $core.withContext(function($ctx1) {
  61842. var $1,$2,$receiver;
  61843. $1=$recv(aClass)._superclass();
  61844. $ctx1.sendIdx["superclass"]=1;
  61845. if(($receiver = $1) == null || $receiver.isNil){
  61846. return $recv(aClass)._instanceVariableNames();
  61847. } else {
  61848. $2=$recv(aClass)._instanceVariableNames();
  61849. $ctx1.sendIdx["instanceVariableNames"]=1;
  61850. return $recv($2)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  61851. }
  61852. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  61853. },
  61854. args: ["aClass"],
  61855. 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]",
  61856. referencedClasses: [],
  61857. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  61858. }),
  61859. $globals.Repl);
  61860. $core.addMethod(
  61861. $core.method({
  61862. selector: "isIdentifier:",
  61863. protocol: "private",
  61864. fn: function (aString){
  61865. var self=this;
  61866. return $core.withContext(function($ctx1) {
  61867. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  61868. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  61869. },
  61870. args: ["aString"],
  61871. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  61872. referencedClasses: [],
  61873. messageSends: ["match:", "asRegexp"]
  61874. }),
  61875. $globals.Repl);
  61876. $core.addMethod(
  61877. $core.method({
  61878. selector: "isVariableDefined:",
  61879. protocol: "private",
  61880. fn: function (aString){
  61881. var self=this;
  61882. return $core.withContext(function($ctx1) {
  61883. return $recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  61884. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  61885. },
  61886. args: ["aString"],
  61887. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  61888. referencedClasses: [],
  61889. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  61890. }),
  61891. $globals.Repl);
  61892. $core.addMethod(
  61893. $core.method({
  61894. selector: "nextResultName",
  61895. protocol: "private",
  61896. fn: function (){
  61897. var self=this;
  61898. return $core.withContext(function($ctx1) {
  61899. var $1,$receiver;
  61900. $1=self["@resultCount"];
  61901. if(($receiver = $1) == null || $receiver.isNil){
  61902. self["@resultCount"]=(1);
  61903. } else {
  61904. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  61905. }
  61906. return "res".__comma($recv(self["@resultCount"])._asString());
  61907. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  61908. },
  61909. args: [],
  61910. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  61911. referencedClasses: [],
  61912. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  61913. }),
  61914. $globals.Repl);
  61915. $core.addMethod(
  61916. $core.method({
  61917. selector: "onKeyPress:",
  61918. protocol: "private",
  61919. fn: function (key){
  61920. var self=this;
  61921. return $core.withContext(function($ctx1) {
  61922. var $1;
  61923. $1=$recv($recv(key)._ctrl())._and_((function(){
  61924. return $core.withContext(function($ctx2) {
  61925. return $recv($recv(key)._name()).__eq("l");
  61926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61927. }));
  61928. if($core.assert($1)){
  61929. self._clearScreen();
  61930. }
  61931. return self;
  61932. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  61933. },
  61934. args: ["key"],
  61935. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  61936. referencedClasses: [],
  61937. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  61938. }),
  61939. $globals.Repl);
  61940. $core.addMethod(
  61941. $core.method({
  61942. selector: "parseAssignment:do:",
  61943. protocol: "private",
  61944. fn: function (aString,aBlock){
  61945. var self=this;
  61946. var assignment;
  61947. return $core.withContext(function($ctx1) {
  61948. var $2,$1;
  61949. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  61950. return $core.withContext(function($ctx2) {
  61951. return $recv(s)._trimBoth();
  61952. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  61953. }));
  61954. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  61955. return $core.withContext(function($ctx2) {
  61956. $2=$recv(assignment)._first();
  61957. $ctx2.sendIdx["first"]=1;
  61958. return self._isIdentifier_($2);
  61959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61960. }));
  61961. if($core.assert($1)){
  61962. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  61963. $ctx1.sendIdx["value:value:"]=1;
  61964. } else {
  61965. return $recv(aBlock)._value_value_(nil,nil);
  61966. }
  61967. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  61968. },
  61969. args: ["aString", "aBlock"],
  61970. 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 ]",
  61971. referencedClasses: [],
  61972. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  61973. }),
  61974. $globals.Repl);
  61975. $core.addMethod(
  61976. $core.method({
  61977. selector: "presentResultNamed:withValue:",
  61978. protocol: "private",
  61979. fn: function (varName,value){
  61980. var self=this;
  61981. return $core.withContext(function($ctx1) {
  61982. var $3,$2,$1;
  61983. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  61984. $ctx1.sendIdx[","]=3;
  61985. $2=$recv($3).__comma(" = ");
  61986. $ctx1.sendIdx[","]=2;
  61987. $1=$recv($2).__comma($recv(value)._asString());
  61988. $ctx1.sendIdx[","]=1;
  61989. $recv($globals.Transcript)._show_($1);
  61990. $recv($globals.Transcript)._cr();
  61991. $recv(self["@interface"])._prompt();
  61992. return self;
  61993. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  61994. },
  61995. args: ["varName", "value"],
  61996. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  61997. referencedClasses: ["Transcript"],
  61998. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  61999. }),
  62000. $globals.Repl);
  62001. $core.addMethod(
  62002. $core.method({
  62003. selector: "printWelcome",
  62004. protocol: "actions",
  62005. fn: function (){
  62006. var self=this;
  62007. return $core.withContext(function($ctx1) {
  62008. $recv($globals.Transcript)._show_("Type :q to exit.");
  62009. $recv($globals.Transcript)._cr();
  62010. return self;
  62011. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  62012. },
  62013. args: [],
  62014. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  62015. referencedClasses: ["Transcript"],
  62016. messageSends: ["show:", "cr"]
  62017. }),
  62018. $globals.Repl);
  62019. $core.addMethod(
  62020. $core.method({
  62021. selector: "processLine:",
  62022. protocol: "private",
  62023. fn: function (buffer){
  62024. var self=this;
  62025. var show;
  62026. return $core.withContext(function($ctx1) {
  62027. var $1,$2;
  62028. show=(function(varName,value){
  62029. return $core.withContext(function($ctx2) {
  62030. return self._presentResultNamed_withValue_(varName,value);
  62031. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  62032. });
  62033. $1=self._executeCommand_(buffer);
  62034. if(!$core.assert($1)){
  62035. $2=self._isVariableDefined_(buffer);
  62036. if($core.assert($2)){
  62037. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  62038. } else {
  62039. self._assignNewVariable_do_(buffer,show);
  62040. }
  62041. }
  62042. return self;
  62043. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  62044. },
  62045. args: ["buffer"],
  62046. 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]]",
  62047. referencedClasses: [],
  62048. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  62049. }),
  62050. $globals.Repl);
  62051. $core.addMethod(
  62052. $core.method({
  62053. selector: "prompt",
  62054. protocol: "accessing",
  62055. fn: function (){
  62056. var self=this;
  62057. return "amber >> ";
  62058. },
  62059. args: [],
  62060. source: "prompt\x0a\x09^ 'amber >> '",
  62061. referencedClasses: [],
  62062. messageSends: []
  62063. }),
  62064. $globals.Repl);
  62065. $core.addMethod(
  62066. $core.method({
  62067. selector: "setPreviousVariablesFor:from:",
  62068. protocol: "private",
  62069. fn: function (newObject,oldObject){
  62070. var self=this;
  62071. return $core.withContext(function($ctx1) {
  62072. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  62073. return $core.withContext(function($ctx2) {
  62074. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  62075. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62076. }));
  62077. return self;
  62078. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  62079. },
  62080. args: ["newObject", "oldObject"],
  62081. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  62082. referencedClasses: [],
  62083. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  62084. }),
  62085. $globals.Repl);
  62086. $core.addMethod(
  62087. $core.method({
  62088. selector: "setPrompt",
  62089. protocol: "actions",
  62090. fn: function (){
  62091. var self=this;
  62092. return $core.withContext(function($ctx1) {
  62093. $recv(self["@interface"])._setPrompt_(self._prompt());
  62094. return self;
  62095. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  62096. },
  62097. args: [],
  62098. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  62099. referencedClasses: [],
  62100. messageSends: ["setPrompt:", "prompt"]
  62101. }),
  62102. $globals.Repl);
  62103. $core.addMethod(
  62104. $core.method({
  62105. selector: "setupCommands",
  62106. protocol: "initialization",
  62107. fn: function (){
  62108. var self=this;
  62109. return $core.withContext(function($ctx1) {
  62110. var $2,$1;
  62111. $2=$recv([":q"]).__minus_gt((function(){
  62112. return $core.withContext(function($ctx2) {
  62113. return $recv(process)._exit();
  62114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62115. }));
  62116. $ctx1.sendIdx["->"]=1;
  62117. $1=[$2,$recv([""]).__minus_gt((function(){
  62118. return $core.withContext(function($ctx2) {
  62119. return $recv(self["@interface"])._prompt();
  62120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62121. }))];
  62122. self["@commands"]=$recv($globals.Dictionary)._from_($1);
  62123. return self;
  62124. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  62125. },
  62126. args: [],
  62127. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  62128. referencedClasses: ["Dictionary"],
  62129. messageSends: ["from:", "->", "exit", "prompt"]
  62130. }),
  62131. $globals.Repl);
  62132. $core.addMethod(
  62133. $core.method({
  62134. selector: "setupHotkeys",
  62135. protocol: "initialization",
  62136. fn: function (){
  62137. var self=this;
  62138. return $core.withContext(function($ctx1) {
  62139. var $receiver;
  62140. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  62141. return $core.withContext(function($ctx2) {
  62142. if(($receiver = key) == null || $receiver.isNil){
  62143. return key;
  62144. } else {
  62145. return self._onKeyPress_(key);
  62146. }
  62147. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  62148. }));
  62149. return self;
  62150. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  62151. },
  62152. args: [],
  62153. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  62154. referencedClasses: [],
  62155. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  62156. }),
  62157. $globals.Repl);
  62158. $core.addMethod(
  62159. $core.method({
  62160. selector: "subclass:withVariable:",
  62161. protocol: "private",
  62162. fn: function (aClass,varName){
  62163. var self=this;
  62164. return $core.withContext(function($ctx1) {
  62165. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  62166. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  62167. },
  62168. args: ["aClass", "varName"],
  62169. 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'",
  62170. referencedClasses: ["ClassBuilder"],
  62171. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  62172. }),
  62173. $globals.Repl);
  62174. $core.addMethod(
  62175. $core.method({
  62176. selector: "subclassNameFor:",
  62177. protocol: "private",
  62178. fn: function (aClass){
  62179. var self=this;
  62180. return $core.withContext(function($ctx1) {
  62181. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  62182. $2=$recv(aClass)._name();
  62183. $ctx1.sendIdx["name"]=1;
  62184. $1=$recv($2)._matchesOf_("\x5cd+$");
  62185. $ctx1.sendIdx["matchesOf:"]=1;
  62186. if(($receiver = $1) == null || $receiver.isNil){
  62187. return $recv($recv(aClass)._name()).__comma("2");
  62188. } else {
  62189. var counter;
  62190. $6=$recv(aClass)._name();
  62191. $ctx1.sendIdx["name"]=2;
  62192. $5=$recv($6)._matchesOf_("\x5cd+$");
  62193. $4=$recv($5)._first();
  62194. $3=$recv($4)._asNumber();
  62195. counter=$recv($3).__plus((1));
  62196. counter;
  62197. $7=$recv(aClass)._name();
  62198. $ctx1.sendIdx["name"]=3;
  62199. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  62200. }
  62201. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  62202. },
  62203. args: ["aClass"],
  62204. 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'].",
  62205. referencedClasses: [],
  62206. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  62207. }),
  62208. $globals.Repl);
  62209. $core.addMethod(
  62210. $core.method({
  62211. selector: "main",
  62212. protocol: "initialization",
  62213. fn: function (){
  62214. var self=this;
  62215. return $core.withContext(function($ctx1) {
  62216. $recv(self._new())._createInterface();
  62217. return self;
  62218. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  62219. },
  62220. args: [],
  62221. source: "main\x0a\x09self new createInterface",
  62222. referencedClasses: [],
  62223. messageSends: ["createInterface", "new"]
  62224. }),
  62225. $globals.Repl.klass);
  62226. });
  62227. (function () {
  62228. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  62229. amber.initialize().then(function () {
  62230. amber.globals.AmberCli._main();
  62231. });
  62232. });
  62233. }());
  62234. //jshint eqnull:true
  62235. define('amber/kernel-runtime',[],function () {
  62236. "use strict";
  62237. function defineMethod (klass, name, method) {
  62238. Object.defineProperty(klass.prototype, name, {
  62239. value: method,
  62240. enumerable: false, configurable: true, writable: true
  62241. });
  62242. }
  62243. DNUBrik.deps = ["selectors", "messageSend", "manipulation", "classes"];
  62244. function DNUBrik (brikz, st) {
  62245. var selectorsBrik = brikz.selectors;
  62246. var messageNotUnderstood = brikz.messageSend.messageNotUnderstood;
  62247. var installJSMethod = brikz.manipulation.installJSMethod;
  62248. var nilAsClass = brikz.classes.nilAsClass;
  62249. /* Method not implemented handlers */
  62250. function makeDnuHandler (pair, targetClasses) {
  62251. var jsSelector = pair.js;
  62252. var fn = createHandler(pair.st);
  62253. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  62254. targetClasses.forEach(function (target) {
  62255. installJSMethod(target.fn.prototype, jsSelector, fn);
  62256. });
  62257. }
  62258. this.makeDnuHandler = makeDnuHandler;
  62259. /* Dnu handler method */
  62260. function createHandler (stSelector) {
  62261. return function () {
  62262. return messageNotUnderstood(this, stSelector, arguments);
  62263. };
  62264. }
  62265. selectorsBrik.selectorPairs.forEach(function (pair) {
  62266. makeDnuHandler(pair, []);
  62267. });
  62268. }
  62269. function ManipulationBrik (brikz, st) {
  62270. function installJSMethod (obj, jsSelector, fn) {
  62271. Object.defineProperty(obj, jsSelector, {
  62272. value: fn,
  62273. enumerable: false, configurable: true, writable: true
  62274. });
  62275. }
  62276. function installMethod (method, klass) {
  62277. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  62278. }
  62279. this.installMethod = installMethod;
  62280. this.installJSMethod = installJSMethod;
  62281. }
  62282. RuntimeClassesBrik.deps = ["selectors", "dnu", "behaviors", "classes", "manipulation"];
  62283. function RuntimeClassesBrik (brikz, st) {
  62284. var selectors = brikz.selectors;
  62285. var classes = brikz.behaviors.classes;
  62286. var wireKlass = brikz.classes.wireKlass;
  62287. var installMethod = brikz.manipulation.installMethod;
  62288. var installJSMethod = brikz.manipulation.installJSMethod;
  62289. var detachedRootClasses = [];
  62290. function markClassDetachedRoot (klass) {
  62291. klass.detachedRoot = true;
  62292. detachedRootClasses = classes().filter(function (klass) {
  62293. return klass.detachedRoot;
  62294. });
  62295. }
  62296. this.detachedRootClasses = function () {
  62297. return detachedRootClasses;
  62298. };
  62299. /* Initialize a class in its class hierarchy. Handle both classes and
  62300. metaclasses. */
  62301. function initClassAndMetaclass (klass) {
  62302. initClass(klass);
  62303. if (klass.klass && !klass.meta) {
  62304. initClass(klass.klass);
  62305. }
  62306. }
  62307. classes().forEach(function (klass) {
  62308. if (!klass.trait) initClassAndMetaclass(klass);
  62309. });
  62310. st._classAdded = initClassAndMetaclass;
  62311. function initClass (klass) {
  62312. wireKlass(klass);
  62313. if (klass.detachedRoot) {
  62314. copySuperclass(klass);
  62315. }
  62316. installMethods(klass);
  62317. }
  62318. function copySuperclass (klass) {
  62319. var myproto = klass.fn.prototype,
  62320. superproto = klass.superclass.fn.prototype;
  62321. selectors.selectorPairs.forEach(function (selectorPair) {
  62322. var jsSelector = selectorPair.js;
  62323. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  62324. });
  62325. }
  62326. function installMethods (klass) {
  62327. var methods = klass.methods;
  62328. Object.keys(methods).forEach(function (selector) {
  62329. installMethod(methods[selector], klass);
  62330. });
  62331. }
  62332. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  62333. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  62334. markClassDetachedRoot(klass);
  62335. klass.fn = constructor;
  62336. initClass(klass);
  62337. };
  62338. }
  62339. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  62340. function FrameBindingBrik (brikz, st) {
  62341. var globals = brikz.smalltalkGlobals.globals;
  62342. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  62343. setClassConstructor(globals.Number, Number);
  62344. setClassConstructor(globals.BlockClosure, Function);
  62345. setClassConstructor(globals.Boolean, Boolean);
  62346. setClassConstructor(globals.Date, Date);
  62347. setClassConstructor(globals.String, String);
  62348. setClassConstructor(globals.Array, Array);
  62349. setClassConstructor(globals.RegularExpression, RegExp);
  62350. setClassConstructor(globals.Error, Error);
  62351. setClassConstructor(globals.Promise, Promise);
  62352. this.__init__ = function () {
  62353. st.alias(globals.Array, "OrderedCollection");
  62354. st.alias(globals.Date, "Time");
  62355. }
  62356. }
  62357. RuntimeMethodsBrik.deps = ["manipulation", "dnu", "runtimeClasses"];
  62358. function RuntimeMethodsBrik (brikz, st) {
  62359. var installMethod = brikz.manipulation.installMethod;
  62360. var installJSMethod = brikz.manipulation.installJSMethod;
  62361. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  62362. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  62363. st._methodAdded = function (method, klass) {
  62364. installMethod(method, klass);
  62365. propagateMethodChange(klass, method, klass);
  62366. };
  62367. st._selectorsAdded = function (newSelectors) {
  62368. var targetClasses = detachedRootClasses();
  62369. newSelectors.forEach(function (pair) {
  62370. makeDnuHandler(pair, targetClasses);
  62371. });
  62372. };
  62373. st._methodRemoved = function (method, klass) {
  62374. delete klass.fn.prototype[method.jsSelector];
  62375. propagateMethodChange(klass, method, null);
  62376. };
  62377. function propagateMethodChange (klass, method, exclude) {
  62378. var selector = method.selector;
  62379. var jsSelector = method.jsSelector;
  62380. st.traverseClassTree(klass, function (subclass, sentinel) {
  62381. if (subclass != exclude) {
  62382. if (initMethodInClass(subclass, selector, jsSelector)) return sentinel;
  62383. }
  62384. });
  62385. }
  62386. function initMethodInClass (klass, selector, jsSelector) {
  62387. if (klass.methods[selector]) return true;
  62388. if (klass.detachedRoot) {
  62389. installJSMethod(klass.fn.prototype, jsSelector, klass.superclass.fn.prototype[jsSelector]);
  62390. }
  62391. }
  62392. }
  62393. PrimitivesBrik.deps = ["smalltalkGlobals"];
  62394. function PrimitivesBrik (brikz, st) {
  62395. var globals = brikz.smalltalkGlobals.globals;
  62396. var oid = 0;
  62397. /* Unique ID number generator */
  62398. st.nextId = function () {
  62399. oid += 1;
  62400. return oid;
  62401. };
  62402. /* Converts a JavaScript object to valid Smalltalk Object */
  62403. st.readJSObject = function (js) {
  62404. if (js == null)
  62405. return null;
  62406. var readObject = js.constructor === Object;
  62407. var readArray = js.constructor === Array;
  62408. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  62409. for (var i in js) {
  62410. if (readObject) {
  62411. object._at_put_(i, st.readJSObject(js[i]));
  62412. }
  62413. if (readArray) {
  62414. object[i] = st.readJSObject(js[i]);
  62415. }
  62416. }
  62417. return object;
  62418. };
  62419. /* Boolean assertion */
  62420. st.assert = function (shouldBeBoolean) {
  62421. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  62422. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  62423. shouldBeBoolean = shouldBeBoolean.valueOf();
  62424. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  62425. }
  62426. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  62427. };
  62428. /* List of all reserved words in JavaScript. They may not be used as variables
  62429. in Smalltalk. */
  62430. // list of reserved JavaScript keywords as of
  62431. // http://es5.github.com/#x7.6.1.1
  62432. // and
  62433. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  62434. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  62435. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  62436. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  62437. 'try', 'typeof', 'var', 'void', 'while', 'with',
  62438. // Amber protected words: these should not be compiled as-is when in code
  62439. 'arguments',
  62440. // ES5: future use: http://es5.github.com/#x7.6.1.2
  62441. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  62442. // ES5: future use in strict mode
  62443. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  62444. 'public', 'static', 'yield'];
  62445. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  62446. }
  62447. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  62448. function RuntimeBrik (brikz, st) {
  62449. var globals = brikz.smalltalkGlobals.globals;
  62450. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  62451. function SmalltalkMethodContext (home, setup) {
  62452. this.sendIdx = {};
  62453. this.homeContext = home;
  62454. this.setup = setup || function () {
  62455. };
  62456. this.supercall = false;
  62457. }
  62458. // Fallbacks
  62459. SmalltalkMethodContext.prototype.locals = {};
  62460. SmalltalkMethodContext.prototype.receiver = null;
  62461. SmalltalkMethodContext.prototype.selector = null;
  62462. SmalltalkMethodContext.prototype.lookupClass = null;
  62463. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  62464. this.receiver = receiver;
  62465. this.selector = selector;
  62466. this.locals = locals || {};
  62467. this.lookupClass = lookupClass;
  62468. if (this.homeContext) {
  62469. this.homeContext.evaluatedSelector = selector;
  62470. }
  62471. });
  62472. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  62473. this.locals = locals || {};
  62474. this.outerContext = ctx;
  62475. this.index = index || 0;
  62476. });
  62477. defineMethod(SmalltalkMethodContext, "init", function () {
  62478. var home = this.homeContext;
  62479. if (home) {
  62480. home.init();
  62481. }
  62482. this.setup(this);
  62483. });
  62484. defineMethod(SmalltalkMethodContext, "method", function () {
  62485. var method;
  62486. var lookup = this.lookupClass || this.receiver.klass;
  62487. while (!method && lookup) {
  62488. method = lookup.methods[st.js2st(this.selector)];
  62489. lookup = lookup.superclass;
  62490. }
  62491. return method;
  62492. });
  62493. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  62494. /* This is the current call context object.
  62495. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  62496. In JS code, use api.getThisContext() (see below).
  62497. */
  62498. var thisContext = null;
  62499. st.withContext = function (worker, setup) {
  62500. if (thisContext) {
  62501. return inContext(worker, setup);
  62502. } else {
  62503. return inContextWithErrorHandling(worker, setup);
  62504. }
  62505. };
  62506. /*
  62507. Runs worker function so that error handler is not set up
  62508. if there isn't one. This is accomplished by unconditional
  62509. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  62510. which then stops error handler setup (see st.withContext above).
  62511. The effect is, $core.seamless(fn)'s exceptions are not
  62512. handed into ST error handler and caller should process them.
  62513. */
  62514. st.seamless = function (worker) {
  62515. return inContext(worker, function (ctx) {
  62516. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  62517. });
  62518. };
  62519. function inContextWithErrorHandling (worker, setup) {
  62520. try {
  62521. return inContext(worker, setup);
  62522. } catch (error) {
  62523. handleError(error);
  62524. thisContext = null;
  62525. // Rethrow the error in any case.
  62526. error.amberHandled = true;
  62527. throw error;
  62528. }
  62529. }
  62530. function inContext (worker, setup) {
  62531. var oldContext = thisContext;
  62532. thisContext = new SmalltalkMethodContext(thisContext, setup);
  62533. var result = worker(thisContext);
  62534. thisContext = oldContext;
  62535. return result;
  62536. }
  62537. /* Wrap a JavaScript exception in a Smalltalk Exception.
  62538. In case of a RangeError, stub the stack after 100 contexts to
  62539. avoid another RangeError later when the stack is manipulated. */
  62540. function wrappedError (error) {
  62541. var errorWrapper = globals.JavaScriptException._on_(error);
  62542. // Add the error to the context, so it is visible in the stack
  62543. try {
  62544. errorWrapper._signal();
  62545. } catch (ex) {
  62546. }
  62547. var context = st.getThisContext();
  62548. if (isRangeError(error)) {
  62549. stubContextStack(context);
  62550. }
  62551. errorWrapper._context_(context);
  62552. return errorWrapper;
  62553. }
  62554. /* Stub the context stack after 100 contexts */
  62555. function stubContextStack (context) {
  62556. var currentContext = context;
  62557. var contexts = 0;
  62558. while (contexts < 100) {
  62559. if (currentContext) {
  62560. currentContext = currentContext.homeContext;
  62561. }
  62562. contexts++;
  62563. }
  62564. if (currentContext) {
  62565. currentContext.homeContext = undefined;
  62566. }
  62567. }
  62568. function isRangeError (error) {
  62569. return error instanceof RangeError;
  62570. }
  62571. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  62572. (See the Smalltalk class ErrorHandler and its subclasses */
  62573. function handleError (error) {
  62574. if (!error.smalltalkError) {
  62575. error = wrappedError(error);
  62576. }
  62577. globals.ErrorHandler._handleError_(error);
  62578. }
  62579. /* Handle thisContext pseudo variable */
  62580. st.getThisContext = function () {
  62581. if (thisContext) {
  62582. thisContext.init();
  62583. return thisContext;
  62584. } else {
  62585. return null;
  62586. }
  62587. };
  62588. }
  62589. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  62590. function MessageSendBrik (brikz, st) {
  62591. var globals = brikz.smalltalkGlobals.globals;
  62592. var nilAsReceiver = brikz.root.nilAsReceiver;
  62593. /* Send message programmatically. Used to implement #perform: & Co. */
  62594. st.send2 = function (receiver, selector, args, klass) {
  62595. var method, jsSelector = st.st2js(selector);
  62596. if (receiver == null) {
  62597. receiver = nilAsReceiver;
  62598. }
  62599. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  62600. if (method) {
  62601. return method.apply(receiver, args || []);
  62602. } else {
  62603. return messageNotUnderstood(receiver, selector, args);
  62604. }
  62605. };
  62606. function invokeDnuMethod (receiver, stSelector, args) {
  62607. return receiver._doesNotUnderstand_(
  62608. globals.Message._new()
  62609. ._selector_(stSelector)
  62610. ._arguments_([].slice.call(args))
  62611. );
  62612. }
  62613. function wrapJavaScript (o) {
  62614. return globals.JSObjectProxy._on_(o);
  62615. }
  62616. st.wrapJavaScript = wrapJavaScript;
  62617. /* Handles #dnu: *and* JavaScript method calls.
  62618. if the receiver has no klass, we consider it a JS object (outside of the
  62619. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  62620. function messageNotUnderstood (receiver, stSelector, args) {
  62621. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  62622. return invokeDnuMethod(receiver, stSelector, args);
  62623. }
  62624. /* Call a method of a JS object, or answer a property if it exists.
  62625. Converts keyword-based selectors by using the first
  62626. keyword only, but keeping all message arguments.
  62627. Example:
  62628. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)"
  62629. Else try wrapping a JSObjectProxy around the receiver. */
  62630. var propertyName = st.st2prop(stSelector);
  62631. if (!(propertyName in receiver)) {
  62632. return invokeDnuMethod(wrapJavaScript(receiver), stSelector, args);
  62633. }
  62634. return accessJavaScript(receiver, propertyName, args);
  62635. }
  62636. /* If the object property is a function, then call it, except if it starts with
  62637. an uppercase character (we probably want to answer the function itself in this
  62638. case and send it #new from Amber).
  62639. */
  62640. function accessJavaScript (receiver, propertyName, args) {
  62641. var propertyValue = receiver[propertyName];
  62642. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  62643. return propertyValue.apply(receiver, args || []);
  62644. } else if (args.length > 0) {
  62645. receiver[propertyName] = args[0];
  62646. return receiver;
  62647. } else {
  62648. return propertyValue;
  62649. }
  62650. }
  62651. st.accessJavaScript = accessJavaScript;
  62652. this.messageNotUnderstood = messageNotUnderstood;
  62653. }
  62654. StartImageBrik.deps = ["frameBinding", "runtimeMethods", "runtime", "primitives"];
  62655. function StartImageBrik (brikz, st) {
  62656. this.__init__ = function () {
  62657. var classes = brikz.behaviors.classes;
  62658. classes().forEach(function (klass) {
  62659. klass._initialize();
  62660. });
  62661. };
  62662. this.__init__.once = true;
  62663. }
  62664. /* Making smalltalk that can run */
  62665. function configureWithRuntime (brikz) {
  62666. brikz.dnu = DNUBrik;
  62667. brikz.manipulation = ManipulationBrik;
  62668. brikz.runtimeClasses = RuntimeClassesBrik;
  62669. brikz.frameBinding = FrameBindingBrik;
  62670. brikz.runtimeMethods = RuntimeMethodsBrik;
  62671. brikz.messageSend = MessageSendBrik;
  62672. brikz.runtime = RuntimeBrik;
  62673. brikz.primitives = PrimitivesBrik;
  62674. brikz.startImage = StartImageBrik;
  62675. brikz.rebuild();
  62676. }
  62677. return configureWithRuntime;
  62678. });
  62679. // Depend on each module that is loaded lazily.
  62680. // Add to packager tasks as dependency,
  62681. // so the lazy-loaded modules are included.
  62682. define('amber/lazypack',['./kernel-runtime'], {});
  62683. require(["app"]);
  62684. });
  62685. define.require('__wrap__');
  62686. }((function amdefine(module, requireFn) {
  62687. 'use strict';
  62688. var defineCache = {},
  62689. loaderCache = {},
  62690. alreadyCalled = false,
  62691. path = require('path'),
  62692. makeRequire, stringRequire;
  62693. /**
  62694. * Trims the . and .. from an array of path segments.
  62695. * It will keep a leading path segment if a .. will become
  62696. * the first path segment, to help with module name lookups,
  62697. * which act like paths, but can be remapped. But the end result,
  62698. * all paths that use this function should look normalized.
  62699. * NOTE: this method MODIFIES the input array.
  62700. * @param {Array} ary the array of path segments.
  62701. */
  62702. function trimDots(ary) {
  62703. var i, part;
  62704. for (i = 0; ary[i]; i+= 1) {
  62705. part = ary[i];
  62706. if (part === '.') {
  62707. ary.splice(i, 1);
  62708. i -= 1;
  62709. } else if (part === '..') {
  62710. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  62711. //End of the line. Keep at least one non-dot
  62712. //path segment at the front so it can be mapped
  62713. //correctly to disk. Otherwise, there is likely
  62714. //no path mapping for a path starting with '..'.
  62715. //This can still fail, but catches the most reasonable
  62716. //uses of ..
  62717. break;
  62718. } else if (i > 0) {
  62719. ary.splice(i - 1, 2);
  62720. i -= 2;
  62721. }
  62722. }
  62723. }
  62724. }
  62725. function normalize(name, baseName) {
  62726. var baseParts;
  62727. //Adjust any relative paths.
  62728. if (name && name.charAt(0) === '.') {
  62729. //If have a base name, try to normalize against it,
  62730. //otherwise, assume it is a top-level require that will
  62731. //be relative to baseUrl in the end.
  62732. if (baseName) {
  62733. baseParts = baseName.split('/');
  62734. baseParts = baseParts.slice(0, baseParts.length - 1);
  62735. baseParts = baseParts.concat(name.split('/'));
  62736. trimDots(baseParts);
  62737. name = baseParts.join('/');
  62738. }
  62739. }
  62740. return name;
  62741. }
  62742. /**
  62743. * Create the normalize() function passed to a loader plugin's
  62744. * normalize method.
  62745. */
  62746. function makeNormalize(relName) {
  62747. return function (name) {
  62748. return normalize(name, relName);
  62749. };
  62750. }
  62751. function makeLoad(id) {
  62752. function load(value) {
  62753. loaderCache[id] = value;
  62754. }
  62755. load.fromText = function (id, text) {
  62756. //This one is difficult because the text can/probably uses
  62757. //define, and any relative paths and requires should be relative
  62758. //to that id was it would be found on disk. But this would require
  62759. //bootstrapping a module/require fairly deeply from node core.
  62760. //Not sure how best to go about that yet.
  62761. throw new Error('amdefine does not implement load.fromText');
  62762. };
  62763. return load;
  62764. }
  62765. makeRequire = function (systemRequire, exports, module, relId) {
  62766. function amdRequire(deps, callback) {
  62767. if (typeof deps === 'string') {
  62768. //Synchronous, single module require('')
  62769. return stringRequire(systemRequire, exports, module, deps, relId);
  62770. } else {
  62771. //Array of dependencies with a callback.
  62772. //Convert the dependencies to modules.
  62773. deps = deps.map(function (depName) {
  62774. return stringRequire(systemRequire, exports, module, depName, relId);
  62775. });
  62776. //Wait for next tick to call back the require call.
  62777. if (callback) {
  62778. process.nextTick(function () {
  62779. callback.apply(null, deps);
  62780. });
  62781. }
  62782. }
  62783. }
  62784. amdRequire.toUrl = function (filePath) {
  62785. if (filePath.indexOf('.') === 0) {
  62786. return normalize(filePath, path.dirname(module.filename));
  62787. } else {
  62788. return filePath;
  62789. }
  62790. };
  62791. return amdRequire;
  62792. };
  62793. //Favor explicit value, passed in if the module wants to support Node 0.4.
  62794. requireFn = requireFn || function req() {
  62795. return module.require.apply(module, arguments);
  62796. };
  62797. function runFactory(id, deps, factory) {
  62798. var r, e, m, result;
  62799. if (id) {
  62800. e = loaderCache[id] = {};
  62801. m = {
  62802. id: id,
  62803. uri: __filename,
  62804. exports: e
  62805. };
  62806. r = makeRequire(requireFn, e, m, id);
  62807. } else {
  62808. //Only support one define call per file
  62809. if (alreadyCalled) {
  62810. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  62811. }
  62812. alreadyCalled = true;
  62813. //Use the real variables from node
  62814. //Use module.exports for exports, since
  62815. //the exports in here is amdefine exports.
  62816. e = module.exports;
  62817. m = module;
  62818. r = makeRequire(requireFn, e, m, module.id);
  62819. }
  62820. //If there are dependencies, they are strings, so need
  62821. //to convert them to dependency values.
  62822. if (deps) {
  62823. deps = deps.map(function (depName) {
  62824. return r(depName);
  62825. });
  62826. }
  62827. //Call the factory with the right dependencies.
  62828. if (typeof factory === 'function') {
  62829. result = factory.apply(m.exports, deps);
  62830. } else {
  62831. result = factory;
  62832. }
  62833. if (result !== undefined) {
  62834. m.exports = result;
  62835. if (id) {
  62836. loaderCache[id] = m.exports;
  62837. }
  62838. }
  62839. }
  62840. stringRequire = function (systemRequire, exports, module, id, relId) {
  62841. //Split the ID by a ! so that
  62842. var index = id.indexOf('!'),
  62843. originalId = id,
  62844. prefix, plugin;
  62845. if (index === -1) {
  62846. id = normalize(id, relId);
  62847. //Straight module lookup. If it is one of the special dependencies,
  62848. //deal with it, otherwise, delegate to node.
  62849. if (id === 'require') {
  62850. return makeRequire(systemRequire, exports, module, relId);
  62851. } else if (id === 'exports') {
  62852. return exports;
  62853. } else if (id === 'module') {
  62854. return module;
  62855. } else if (loaderCache.hasOwnProperty(id)) {
  62856. return loaderCache[id];
  62857. } else if (defineCache[id]) {
  62858. runFactory.apply(null, defineCache[id]);
  62859. return loaderCache[id];
  62860. } else {
  62861. if(systemRequire) {
  62862. return systemRequire(originalId);
  62863. } else {
  62864. throw new Error('No module with ID: ' + id);
  62865. }
  62866. }
  62867. } else {
  62868. //There is a plugin in play.
  62869. prefix = id.substring(0, index);
  62870. id = id.substring(index + 1, id.length);
  62871. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  62872. if (plugin.normalize) {
  62873. id = plugin.normalize(id, makeNormalize(relId));
  62874. } else {
  62875. //Normalize the ID normally.
  62876. id = normalize(id, relId);
  62877. }
  62878. if (loaderCache[id]) {
  62879. return loaderCache[id];
  62880. } else {
  62881. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  62882. return loaderCache[id];
  62883. }
  62884. }
  62885. };
  62886. //Create a define function specific to the module asking for amdefine.
  62887. function define(id, deps, factory) {
  62888. if (Array.isArray(id)) {
  62889. factory = deps;
  62890. deps = id;
  62891. id = undefined;
  62892. } else if (typeof id !== 'string') {
  62893. factory = id;
  62894. id = deps = undefined;
  62895. }
  62896. if (deps && !Array.isArray(deps)) {
  62897. factory = deps;
  62898. deps = undefined;
  62899. }
  62900. if (!deps) {
  62901. deps = ['require', 'exports', 'module'];
  62902. }
  62903. //Set up properties for this module. If an ID, then use
  62904. //internal cache. If no ID, then use the external variables
  62905. //for this node module.
  62906. if (id) {
  62907. //Put the module in deep freeze until there is a
  62908. //require call for it.
  62909. defineCache[id] = [id, deps, factory];
  62910. } else {
  62911. runFactory(id, deps, factory);
  62912. }
  62913. }
  62914. //define.require, which has access to all the values in the
  62915. //cache. Useful for AMD modules that all have IDs in the file,
  62916. //but need to finally export a value to node based on one of those
  62917. //IDs.
  62918. define.require = function (id) {
  62919. if (loaderCache[id]) {
  62920. return loaderCache[id];
  62921. }
  62922. if (defineCache[id]) {
  62923. runFactory.apply(null, defineCache[id]);
  62924. return loaderCache[id];
  62925. }
  62926. };
  62927. define.amd = {};
  62928. return define;
  62929. }(module)), require));