amber-cli.js 2.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672
  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/boot',['require', './brikz', './compatibility'], function (require, Brikz) {
  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. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1103. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1104. Detached roots (eg. wrapped JS classes like Number or Date)
  1105. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1106. function SmalltalkRoot() {
  1107. }
  1108. function SmalltalkProtoObject() {
  1109. }
  1110. function SmalltalkObject() {
  1111. }
  1112. function SmalltalkNil() {
  1113. }
  1114. inherits(SmalltalkProtoObject, SmalltalkRoot);
  1115. inherits(SmalltalkObject, SmalltalkProtoObject);
  1116. inherits(SmalltalkNil, SmalltalkObject);
  1117. this.Object = SmalltalkObject;
  1118. this.nilAsReceiver = new SmalltalkNil();
  1119. // Adds an `isNil` property to the `nil` object. When sending
  1120. // nil objects from one environment to another, doing
  1121. // `anObject == nil` (in JavaScript) does not always answer
  1122. // true as the referenced nil object might come from the other
  1123. // environment.
  1124. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1125. value: true,
  1126. enumerable: false, configurable: false, writable: false
  1127. });
  1128. // Fake root class of the system.
  1129. // Effective superclass of all classes created with `nil subclass: ...`.
  1130. this.nilAsClass = {fn: SmalltalkRoot};
  1131. this.__init__ = function () {
  1132. var globals = brikz.smalltalkGlobals.globals;
  1133. var addCoupledClass = brikz.classes.addCoupledClass;
  1134. st.addPackage("Kernel-Objects");
  1135. addCoupledClass("ProtoObject", undefined, "Kernel-Objects", SmalltalkProtoObject);
  1136. addCoupledClass("Object", globals.ProtoObject, "Kernel-Objects", SmalltalkObject);
  1137. addCoupledClass("UndefinedObject", globals.Object, "Kernel-Objects", SmalltalkNil);
  1138. };
  1139. this.__init__.once = true;
  1140. }
  1141. OrganizeBrik.deps = ["augments", "root"];
  1142. function OrganizeBrik(brikz, st) {
  1143. var SmalltalkObject = brikz.root.Object;
  1144. function SmalltalkOrganizer() {
  1145. }
  1146. function SmalltalkPackageOrganizer() {
  1147. this.elements = [];
  1148. }
  1149. function SmalltalkClassOrganizer() {
  1150. this.elements = [];
  1151. }
  1152. inherits(SmalltalkOrganizer, SmalltalkObject);
  1153. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  1154. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  1155. this.__init__ = function () {
  1156. var globals = brikz.smalltalkGlobals.globals;
  1157. var addCoupledClass = brikz.classes.addCoupledClass;
  1158. st.addPackage("Kernel-Infrastructure");
  1159. addCoupledClass("Organizer", globals.Object, "Kernel-Infrastructure", SmalltalkOrganizer);
  1160. addCoupledClass("PackageOrganizer", globals.Organizer, "Kernel-Infrastructure", SmalltalkPackageOrganizer);
  1161. addCoupledClass("ClassOrganizer", globals.Organizer, "Kernel-Infrastructure", SmalltalkClassOrganizer);
  1162. };
  1163. this.__init__.once = true;
  1164. this.setupClassOrganization = function (klass) {
  1165. klass.organization = new SmalltalkClassOrganizer();
  1166. klass.organization.theClass = klass;
  1167. };
  1168. this.setupPackageOrganization = function (pkg) {
  1169. pkg.organization = new SmalltalkPackageOrganizer();
  1170. };
  1171. this.addOrganizationElement = function (owner, element) {
  1172. owner.organization.elements.addElement(element);
  1173. };
  1174. this.removeOrganizationElement = function (owner, element) {
  1175. owner.organization.elements.removeElement(element);
  1176. };
  1177. }
  1178. SelectorsBrik.deps = ["selectorConversion"];
  1179. function SelectorsBrik(brikz, st) {
  1180. var selectorSet = Object.create(null);
  1181. var selectors = this.selectors = [];
  1182. var selectorPairs = this.selectorPairs = [];
  1183. this.registerSelector = function (stSelector) {
  1184. if (selectorSet[stSelector]) return null;
  1185. var jsSelector = st.st2js(stSelector);
  1186. selectorSet[stSelector] = true;
  1187. selectors.push(stSelector);
  1188. var pair = {st: stSelector, js: jsSelector};
  1189. selectorPairs.push(pair);
  1190. return pair;
  1191. };
  1192. st.allSelectors = function () {
  1193. return selectors;
  1194. };
  1195. }
  1196. PackagesBrik.deps = ["organize", "root"];
  1197. function PackagesBrik(brikz, st) {
  1198. var setupPackageOrganization = brikz.organize.setupPackageOrganization;
  1199. var SmalltalkObject = brikz.root.Object;
  1200. function SmalltalkPackage() {
  1201. }
  1202. inherits(SmalltalkPackage, SmalltalkObject);
  1203. this.__init__ = function () {
  1204. var globals = brikz.smalltalkGlobals.globals;
  1205. var addCoupledClass = brikz.classes.addCoupledClass;
  1206. st.addPackage("Kernel-Infrastructure");
  1207. addCoupledClass("Package", globals.Object, "Kernel-Infrastructure", SmalltalkPackage);
  1208. };
  1209. this.__init__.once = true;
  1210. st.packages = {};
  1211. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  1212. function pkg(spec) {
  1213. var that = new SmalltalkPackage();
  1214. that.pkgName = spec.pkgName;
  1215. setupPackageOrganization(that);
  1216. that.properties = spec.properties || {};
  1217. return that;
  1218. }
  1219. /* Add a package to the system, creating a new one if needed.
  1220. If pkgName is null or empty we return nil.
  1221. If package already exists we still update the properties of it. */
  1222. st.addPackage = function (pkgName, properties) {
  1223. if (!pkgName) {
  1224. return null;
  1225. }
  1226. if (!(st.packages[pkgName])) {
  1227. st.packages[pkgName] = pkg({
  1228. pkgName: pkgName,
  1229. properties: properties
  1230. });
  1231. } else {
  1232. if (properties) {
  1233. st.packages[pkgName].properties = properties;
  1234. }
  1235. }
  1236. return st.packages[pkgName];
  1237. };
  1238. }
  1239. ClassesBrik.deps = ["organize", "root", "smalltalkGlobals"];
  1240. function ClassesBrik(brikz, st) {
  1241. var setupClassOrganization = brikz.organize.setupClassOrganization;
  1242. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1243. var removeOrganizationElement = brikz.organize.removeOrganizationElement;
  1244. var globals = brikz.smalltalkGlobals.globals;
  1245. var nilAsClass = brikz.root.nilAsClass;
  1246. var SmalltalkObject = brikz.root.Object;
  1247. nilAsClass.klass = {fn: SmalltalkClass};
  1248. function SmalltalkBehavior() {
  1249. }
  1250. function SmalltalkClass() {
  1251. }
  1252. function SmalltalkMetaclass() {
  1253. }
  1254. inherits(SmalltalkBehavior, SmalltalkObject);
  1255. inherits(SmalltalkClass, SmalltalkBehavior);
  1256. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1257. SmalltalkBehavior.prototype.toString = function () {
  1258. return 'Smalltalk ' + this.className;
  1259. };
  1260. SmalltalkMetaclass.prototype.meta = true;
  1261. this.__init__ = function () {
  1262. var globals = brikz.smalltalkGlobals.globals;
  1263. var addCoupledClass = brikz.classes.addCoupledClass;
  1264. st.addPackage("Kernel-Classes");
  1265. addCoupledClass("Behavior", globals.Object, "Kernel-Classes", SmalltalkBehavior);
  1266. addCoupledClass("Metaclass", globals.Behavior, "Kernel-Classes", SmalltalkMetaclass);
  1267. addCoupledClass("Class", globals.Behavior, "Kernel-Classes", SmalltalkClass);
  1268. // Manually bootstrap the metaclass hierarchy
  1269. globals.ProtoObject.klass.superclass = nilAsClass.klass = globals.Class;
  1270. addSubclass(globals.ProtoObject.klass);
  1271. };
  1272. this.__init__.once = true;
  1273. /* Smalltalk classes */
  1274. var classes = [];
  1275. /* Smalltalk class creation. A class is an instance of an automatically
  1276. created metaclass object. Newly created classes (not their metaclass)
  1277. should be added to the system, see smalltalk.addClass().
  1278. Superclass linking is *not* handled here, see api.initialize() */
  1279. function klass(spec) {
  1280. var setSuperClass = spec.superclass;
  1281. if (!spec.superclass) {
  1282. spec.superclass = nilAsClass;
  1283. }
  1284. var meta = metaclass(spec);
  1285. var that = meta.instanceClass;
  1286. that.superclass = setSuperClass;
  1287. that.fn = spec.fn || inherits(function () {
  1288. }, spec.superclass.fn);
  1289. that.subclasses = [];
  1290. setupClass(that, spec);
  1291. that.className = spec.className;
  1292. meta.className = spec.className + ' class';
  1293. meta.superclass = spec.superclass.klass;
  1294. return that;
  1295. }
  1296. function metaclass(spec) {
  1297. var that = new SmalltalkMetaclass();
  1298. that.fn = inherits(function () {
  1299. }, spec.superclass.klass.fn);
  1300. wireKlass(that);
  1301. that.instanceClass = new that.fn();
  1302. setupClass(that, {});
  1303. return that;
  1304. }
  1305. function setupClass(klass, spec) {
  1306. klass.iVarNames = spec.iVarNames || [];
  1307. if (spec.pkg) {
  1308. klass.pkg = spec.pkg;
  1309. }
  1310. setupClassOrganization(klass);
  1311. Object.defineProperty(klass, "methods", {
  1312. value: Object.create(null),
  1313. enumerable: false, configurable: true, writable: true
  1314. });
  1315. }
  1316. function wireKlass(klass) {
  1317. Object.defineProperty(klass.fn.prototype, "klass", {
  1318. value: klass,
  1319. enumerable: false, configurable: true, writable: true
  1320. });
  1321. }
  1322. this.wireKlass = wireKlass;
  1323. /* Add a class to the system, creating a new one if needed.
  1324. A Package is lazily created if one with given name does not exist. */
  1325. st.addClass = function (className, superclass, iVarNames, pkgName) {
  1326. // While subclassing nil is allowed, it might be an error, so
  1327. // warn about it.
  1328. if (typeof superclass == 'undefined' || superclass && superclass.isNil) {
  1329. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1330. }
  1331. return rawAddClass(pkgName, className, superclass, iVarNames, null);
  1332. };
  1333. function rawAddClass(pkgName, className, superclass, iVarNames, fn) {
  1334. var pkg = st.packages[pkgName];
  1335. if (!pkg) {
  1336. throw new Error("Missing package " + pkgName);
  1337. }
  1338. if (superclass == null || superclass.isNil) {
  1339. superclass = null;
  1340. }
  1341. var theClass = globals.hasOwnProperty(className) && globals[className];
  1342. if (theClass && theClass.superclass == superclass && !fn) {
  1343. if (iVarNames) theClass.iVarNames = iVarNames;
  1344. if (pkg) theClass.pkg = pkg;
  1345. } else {
  1346. if (theClass) {
  1347. iVarNames = iVarNames || theClass.iVarNames;
  1348. st.removeClass(theClass);
  1349. }
  1350. theClass = globals[className] = klass({
  1351. className: className,
  1352. superclass: superclass,
  1353. pkg: pkg,
  1354. iVarNames: iVarNames,
  1355. fn: fn
  1356. });
  1357. addSubclass(theClass);
  1358. }
  1359. classes.addElement(theClass);
  1360. addOrganizationElement(pkg, theClass);
  1361. if (st._classAdded) st._classAdded(theClass);
  1362. return theClass;
  1363. }
  1364. st.removeClass = function (klass) {
  1365. removeOrganizationElement(klass.pkg, klass);
  1366. classes.removeElement(klass);
  1367. removeSubclass(klass);
  1368. delete globals[klass.className];
  1369. };
  1370. function addSubclass(klass) {
  1371. if (klass.superclass) {
  1372. klass.superclass.subclasses.addElement(klass);
  1373. }
  1374. }
  1375. function removeSubclass(klass) {
  1376. if (klass.superclass) {
  1377. klass.superclass.subclasses.removeElement(klass);
  1378. }
  1379. }
  1380. /* Create a new class coupling with a JavaScript constructor,
  1381. and add it to the system.*/
  1382. this.addCoupledClass = function (className, superclass, pkgName, fn) {
  1383. return rawAddClass(pkgName, className, superclass, null, fn);
  1384. };
  1385. /* Create an alias for an existing class */
  1386. st.alias = function (klass, alias) {
  1387. globals[alias] = klass;
  1388. };
  1389. /* Answer all registered Smalltalk classes */
  1390. //TODO: remove the function and make smalltalk.classes an array
  1391. st.classes = this.classes = function () {
  1392. return classes;
  1393. };
  1394. function metaSubclasses(metaclass) {
  1395. return metaclass.instanceClass.subclasses
  1396. .filter(function (each) {
  1397. return !each.meta;
  1398. })
  1399. .map(function (each) {
  1400. return each.klass;
  1401. });
  1402. }
  1403. st.metaSubclasses = metaSubclasses;
  1404. st.traverseClassTree = function (klass, fn) {
  1405. var queue = [klass];
  1406. for (var i = 0; i < queue.length; ++i) {
  1407. var item = queue[i];
  1408. fn(item);
  1409. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1410. queue.push.apply(queue, subclasses);
  1411. }
  1412. };
  1413. }
  1414. MethodsBrik.deps = ["organize", "selectors", "root", "selectorConversion"];
  1415. function MethodsBrik(brikz, st) {
  1416. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1417. var registerSelector = brikz.selectors.registerSelector;
  1418. var SmalltalkObject = brikz.root.Object;
  1419. function SmalltalkMethod() {
  1420. }
  1421. inherits(SmalltalkMethod, SmalltalkObject);
  1422. this.__init__ = function () {
  1423. var globals = brikz.smalltalkGlobals.globals;
  1424. var addCoupledClass = brikz.classes.addCoupledClass;
  1425. st.addPackage("Kernel-Methods");
  1426. addCoupledClass("CompiledMethod", globals.Object, "Kernel-Methods", SmalltalkMethod);
  1427. };
  1428. this.__init__.once = true;
  1429. /* Smalltalk method object. To add a method to a class,
  1430. use api.addMethod() */
  1431. st.method = function (spec) {
  1432. var that = new SmalltalkMethod();
  1433. var selector = spec.selector;
  1434. that.selector = selector;
  1435. that.jsSelector = st.st2js(selector);
  1436. that.args = spec.args || {};
  1437. that.protocol = spec.protocol;
  1438. that.source = spec.source;
  1439. that.messageSends = spec.messageSends || [];
  1440. that.referencedClasses = spec.referencedClasses || [];
  1441. that.fn = spec.fn;
  1442. return that;
  1443. };
  1444. /* Add/remove a method to/from a class */
  1445. st.addMethod = function (method, klass) {
  1446. klass.methods[method.selector] = method;
  1447. method.methodClass = klass;
  1448. // During the bootstrap, #addCompiledMethod is not used.
  1449. // Therefore we populate the organizer here too
  1450. addOrganizationElement(klass, method.protocol);
  1451. var newSelectors = [];
  1452. function selectorInUse(stSelector) {
  1453. var pair = registerSelector(stSelector);
  1454. if (pair) {
  1455. newSelectors.push(pair);
  1456. }
  1457. }
  1458. selectorInUse(method.selector);
  1459. method.messageSends.forEach(selectorInUse);
  1460. if (st._methodAdded) st._methodAdded(method, klass);
  1461. if (st._selectorsAdded) st._selectorsAdded(newSelectors);
  1462. };
  1463. st.removeMethod = function (method, klass) {
  1464. if (klass !== method.methodClass) {
  1465. throw new Error(
  1466. "Refusing to remove method " +
  1467. method.methodClass.className + ">>" + method.selector +
  1468. " from different class " +
  1469. klass.className);
  1470. }
  1471. delete klass.methods[method.selector];
  1472. if (st._methodRemoved) st._methodRemoved(method, klass);
  1473. // Do *not* delete protocols from here.
  1474. // This is handled by #removeCompiledMethod
  1475. };
  1476. }
  1477. function AugmentsBrik(brikz, st) {
  1478. /* Array extensions */
  1479. Array.prototype.addElement = function (el) {
  1480. if (typeof el === 'undefined') {
  1481. return;
  1482. }
  1483. if (this.indexOf(el) == -1) {
  1484. this.push(el);
  1485. }
  1486. };
  1487. Array.prototype.removeElement = function (el) {
  1488. var i = this.indexOf(el);
  1489. if (i !== -1) {
  1490. this.splice(i, 1);
  1491. }
  1492. };
  1493. }
  1494. SmalltalkInitBrik.deps = ["globals", "classes"];
  1495. function SmalltalkInitBrik(brikz, st) {
  1496. var globals = brikz.smalltalkGlobals.globals;
  1497. var initialized = false;
  1498. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  1499. require(['./kernel-runtime'], resolve, reject);
  1500. });
  1501. /* Smalltalk initialization. Called on page load */
  1502. st.initialize = function () {
  1503. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  1504. if (initialized) {
  1505. return;
  1506. }
  1507. configureWithRuntime(brikz);
  1508. st.alias(globals.Array, "OrderedCollection");
  1509. st.alias(globals.Date, "Time");
  1510. st.classes().forEach(function (klass) {
  1511. klass._initialize();
  1512. });
  1513. initialized = true;
  1514. });
  1515. };
  1516. }
  1517. function SelectorConversionBrik(brikz, st) {
  1518. /* Convert a Smalltalk selector into a JS selector */
  1519. st.st2js = function (string) {
  1520. return '_' + string
  1521. .replace(/:/g, '_')
  1522. .replace(/[\&]/g, '_and')
  1523. .replace(/[\|]/g, '_or')
  1524. .replace(/[+]/g, '_plus')
  1525. .replace(/-/g, '_minus')
  1526. .replace(/[*]/g, '_star')
  1527. .replace(/[\/]/g, '_slash')
  1528. .replace(/[\\]/g, '_backslash')
  1529. .replace(/[\~]/g, '_tild')
  1530. .replace(/>/g, '_gt')
  1531. .replace(/</g, '_lt')
  1532. .replace(/=/g, '_eq')
  1533. .replace(/,/g, '_comma')
  1534. .replace(/[@]/g, '_at');
  1535. };
  1536. /* Convert a string to a valid smalltalk selector.
  1537. if you modify the following functions, also change st2js
  1538. accordingly */
  1539. st.js2st = function (selector) {
  1540. if (selector.match(/^__/)) {
  1541. return binaryJsToSt(selector);
  1542. } else {
  1543. return keywordJsToSt(selector);
  1544. }
  1545. };
  1546. function keywordJsToSt(selector) {
  1547. return selector.replace(/^_/, '').replace(/_/g, ':');
  1548. }
  1549. function binaryJsToSt(selector) {
  1550. return selector
  1551. .replace(/^_/, '')
  1552. .replace(/_and/g, '&')
  1553. .replace(/_or/g, '|')
  1554. .replace(/_plus/g, '+')
  1555. .replace(/_minus/g, '-')
  1556. .replace(/_star/g, '*')
  1557. .replace(/_slash/g, '/')
  1558. .replace(/_backslash/g, '\\')
  1559. .replace(/_tild/g, '~')
  1560. .replace(/_gt/g, '>')
  1561. .replace(/_lt/g, '<')
  1562. .replace(/_eq/g, '=')
  1563. .replace(/_comma/g, ',')
  1564. .replace(/_at/g, '@');
  1565. }
  1566. st.st2prop = function (stSelector) {
  1567. var colonPosition = stSelector.indexOf(':');
  1568. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1569. };
  1570. }
  1571. /* Adds AMD and requirejs related methods to the api */
  1572. function AMDBrik(brikz, st) {
  1573. st.amdRequire = require;
  1574. st.defaultTransportType = st.defaultTransportType || "amd";
  1575. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1576. }
  1577. /* Defines asReceiver to be present at load time */
  1578. /* (logically it belongs more to PrimitiveBrik) */
  1579. AsReceiverBrik.deps = ["smalltalkGlobals", "root"];
  1580. function AsReceiverBrik(brikz, st) {
  1581. var globals = brikz.smalltalkGlobals.globals;
  1582. var nilAsReceiver = brikz.root.nilAsReceiver;
  1583. /**
  1584. * This function is used all over the compiled amber code.
  1585. * It takes any value (JavaScript or Smalltalk)
  1586. * and returns a proper Amber Smalltalk receiver.
  1587. *
  1588. * null or undefined -> nilAsReceiver,
  1589. * object having Smalltalk signature -> unchanged,
  1590. * otherwise wrapped foreign (JS) object
  1591. */
  1592. this.asReceiver = function (o) {
  1593. if (o == null) return nilAsReceiver;
  1594. else if (o.klass != null) return o;
  1595. else return globals.JSObjectProxy._on_(o);
  1596. };
  1597. }
  1598. var api = {};
  1599. var brikz = new Brikz(api);
  1600. /* Making smalltalk that can load */
  1601. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1602. brikz.root = RootBrik;
  1603. brikz.selectors = SelectorsBrik;
  1604. brikz.organize = OrganizeBrik;
  1605. brikz.selectorConversion = SelectorConversionBrik;
  1606. brikz.packages = PackagesBrik;
  1607. brikz.classes = ClassesBrik;
  1608. brikz.methods = MethodsBrik;
  1609. brikz.stInit = SmalltalkInitBrik;
  1610. brikz.augments = AugmentsBrik;
  1611. brikz.asReceiver = AsReceiverBrik;
  1612. brikz.amd = AMDBrik;
  1613. brikz.rebuild();
  1614. return {
  1615. api: api,
  1616. nil/* TODO deprecate */: brikz.root.nilAsReceiver,
  1617. nilAsReceiver: brikz.root.nilAsReceiver,
  1618. dnu/* TODO deprecate */: brikz.root.nilAsClass,
  1619. nilAsClass: brikz.root.nilAsClass,
  1620. globals: brikz.smalltalkGlobals.globals,
  1621. asReceiver: brikz.asReceiver.asReceiver
  1622. };
  1623. });
  1624. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  1625. var globals = boot.globals,
  1626. exports = {},
  1627. api = boot.api,
  1628. nil = boot.nilAsReceiver;
  1629. // API
  1630. exports.popupHelios = function () {
  1631. require(['helios/index'], function (helios) {
  1632. helios.popup();
  1633. }, function (err) {
  1634. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1635. });
  1636. };
  1637. Object.defineProperty(exports, "api", {
  1638. value: api,
  1639. enumerable: true, configurable: true, writable: false
  1640. });
  1641. Object.defineProperty(exports, "globals", {
  1642. value: globals,
  1643. enumerable: true, configurable: true, writable: false
  1644. });
  1645. Object.defineProperty(exports, "nil", {
  1646. value: nil,
  1647. enumerable: true, configurable: true, writable: false
  1648. });
  1649. function mixinToSettings(source) {
  1650. var settings = globals.SmalltalkSettings;
  1651. Object.keys(source).forEach(function (key) {
  1652. settings[key] = source[key];
  1653. });
  1654. }
  1655. function settingsInLocalStorage() {
  1656. //jshint evil:true
  1657. var global = new Function('return this')(),
  1658. storage = 'localStorage' in global && global.localStorage;
  1659. if (storage) {
  1660. var fromStorage;
  1661. try {
  1662. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1663. } catch (ex) {
  1664. // pass
  1665. }
  1666. mixinToSettings(fromStorage || {});
  1667. if (typeof window !== "undefined") {
  1668. requirejs(['jquery'], function ($) {
  1669. $(window).on('beforeunload', function () {
  1670. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1671. });
  1672. });
  1673. }
  1674. }
  1675. }
  1676. exports.initialize = function (options) {
  1677. return Promise.resolve()
  1678. .then(function () {
  1679. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1680. })
  1681. .then(settingsInLocalStorage)
  1682. .then(function () {
  1683. return options || {};
  1684. })
  1685. .then(mixinToSettings)
  1686. .then(function () {
  1687. return api.initialize();
  1688. });
  1689. };
  1690. // Exports
  1691. return exports;
  1692. });
  1693. define('amber_core/Kernel-Objects',["amber/boot"], function($boot){"use strict";
  1694. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  1695. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  1696. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  1697. $core.addPackage('Kernel-Objects');
  1698. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1699. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1700. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1701. $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.";
  1702. $core.addMethod(
  1703. $core.method({
  1704. selector: "=",
  1705. protocol: 'comparing',
  1706. fn: function (anObject){
  1707. var self=this;
  1708. return $core.withContext(function($ctx1) {
  1709. return self.__eq_eq(anObject);
  1710. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1711. },
  1712. args: ["anObject"],
  1713. source: "= anObject\x0a\x09^ self == anObject",
  1714. referencedClasses: [],
  1715. messageSends: ["=="]
  1716. }),
  1717. $globals.ProtoObject);
  1718. $core.addMethod(
  1719. $core.method({
  1720. selector: "==",
  1721. protocol: 'comparing',
  1722. fn: function (anObject){
  1723. var self=this;
  1724. return $core.withContext(function($ctx1) {
  1725. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1726. return self;
  1727. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1728. },
  1729. args: ["anObject"],
  1730. source: "== anObject\x0a<inlineJS:\x0a\x09'return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)'>",
  1731. referencedClasses: [],
  1732. messageSends: []
  1733. }),
  1734. $globals.ProtoObject);
  1735. $core.addMethod(
  1736. $core.method({
  1737. selector: "asString",
  1738. protocol: 'converting',
  1739. fn: function (){
  1740. var self=this;
  1741. return $core.withContext(function($ctx1) {
  1742. return self._printString();
  1743. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1744. },
  1745. args: [],
  1746. source: "asString\x0a\x09^ self printString",
  1747. referencedClasses: [],
  1748. messageSends: ["printString"]
  1749. }),
  1750. $globals.ProtoObject);
  1751. $core.addMethod(
  1752. $core.method({
  1753. selector: "class",
  1754. protocol: 'accessing',
  1755. fn: function (){
  1756. var self=this;
  1757. return $core.withContext(function($ctx1) {
  1758. return self.klass;
  1759. return self;
  1760. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1761. },
  1762. args: [],
  1763. source: "class\x0a\x09<inlineJS: 'return self.klass'>",
  1764. referencedClasses: [],
  1765. messageSends: []
  1766. }),
  1767. $globals.ProtoObject);
  1768. $core.addMethod(
  1769. $core.method({
  1770. selector: "doesNotUnderstand:",
  1771. protocol: 'error handling',
  1772. fn: function (aMessage){
  1773. var self=this;
  1774. return $core.withContext(function($ctx1) {
  1775. var $1;
  1776. $1=$recv($globals.MessageNotUnderstood)._new();
  1777. $recv($1)._receiver_(self);
  1778. $recv($1)._message_(aMessage);
  1779. $recv($1)._signal();
  1780. return self;
  1781. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1782. },
  1783. args: ["aMessage"],
  1784. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1785. referencedClasses: ["MessageNotUnderstood"],
  1786. messageSends: ["receiver:", "new", "message:", "signal"]
  1787. }),
  1788. $globals.ProtoObject);
  1789. $core.addMethod(
  1790. $core.method({
  1791. selector: "evaluate:on:",
  1792. protocol: 'evaluating',
  1793. fn: function (aString,anEvaluator){
  1794. var self=this;
  1795. return $core.withContext(function($ctx1) {
  1796. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  1797. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1798. },
  1799. args: ["aString", "anEvaluator"],
  1800. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1801. referencedClasses: [],
  1802. messageSends: ["evaluate:receiver:"]
  1803. }),
  1804. $globals.ProtoObject);
  1805. $core.addMethod(
  1806. $core.method({
  1807. selector: "identityHash",
  1808. protocol: 'accessing',
  1809. fn: function (){
  1810. var self=this;
  1811. return $core.withContext(function($ctx1) {
  1812. var hash=self.identityHash;
  1813. if (hash) return hash;
  1814. hash=$core.nextId();
  1815. Object.defineProperty(self, 'identityHash', {value:hash});
  1816. return hash;
  1817. ;
  1818. return self;
  1819. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  1820. },
  1821. args: [],
  1822. 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'>",
  1823. referencedClasses: [],
  1824. messageSends: []
  1825. }),
  1826. $globals.ProtoObject);
  1827. $core.addMethod(
  1828. $core.method({
  1829. selector: "ifNil:",
  1830. protocol: 'testing',
  1831. fn: function (aBlock){
  1832. var self=this;
  1833. return self;
  1834. },
  1835. args: ["aBlock"],
  1836. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1837. referencedClasses: [],
  1838. messageSends: []
  1839. }),
  1840. $globals.ProtoObject);
  1841. $core.addMethod(
  1842. $core.method({
  1843. selector: "ifNil:ifNotNil:",
  1844. protocol: 'testing',
  1845. fn: function (aBlock,anotherBlock){
  1846. var self=this;
  1847. return $core.withContext(function($ctx1) {
  1848. return $recv(anotherBlock)._value_(self);
  1849. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1850. },
  1851. args: ["aBlock", "anotherBlock"],
  1852. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1853. referencedClasses: [],
  1854. messageSends: ["value:"]
  1855. }),
  1856. $globals.ProtoObject);
  1857. $core.addMethod(
  1858. $core.method({
  1859. selector: "ifNotNil:",
  1860. protocol: 'testing',
  1861. fn: function (aBlock){
  1862. var self=this;
  1863. return $core.withContext(function($ctx1) {
  1864. return $recv(aBlock)._value_(self);
  1865. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  1866. },
  1867. args: ["aBlock"],
  1868. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1869. referencedClasses: [],
  1870. messageSends: ["value:"]
  1871. }),
  1872. $globals.ProtoObject);
  1873. $core.addMethod(
  1874. $core.method({
  1875. selector: "ifNotNil:ifNil:",
  1876. protocol: 'testing',
  1877. fn: function (aBlock,anotherBlock){
  1878. var self=this;
  1879. return $core.withContext(function($ctx1) {
  1880. return $recv(aBlock)._value_(self);
  1881. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1882. },
  1883. args: ["aBlock", "anotherBlock"],
  1884. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1885. referencedClasses: [],
  1886. messageSends: ["value:"]
  1887. }),
  1888. $globals.ProtoObject);
  1889. $core.addMethod(
  1890. $core.method({
  1891. selector: "initialize",
  1892. protocol: 'initialization',
  1893. fn: function (){
  1894. var self=this;
  1895. return self;
  1896. },
  1897. args: [],
  1898. source: "initialize",
  1899. referencedClasses: [],
  1900. messageSends: []
  1901. }),
  1902. $globals.ProtoObject);
  1903. $core.addMethod(
  1904. $core.method({
  1905. selector: "inspect",
  1906. protocol: 'inspecting',
  1907. fn: function (){
  1908. var self=this;
  1909. return $core.withContext(function($ctx1) {
  1910. $recv($globals.Inspector)._inspect_(self);
  1911. return self;
  1912. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  1913. },
  1914. args: [],
  1915. source: "inspect\x0a\x09Inspector inspect: self",
  1916. referencedClasses: ["Inspector"],
  1917. messageSends: ["inspect:"]
  1918. }),
  1919. $globals.ProtoObject);
  1920. $core.addMethod(
  1921. $core.method({
  1922. selector: "inspectOn:",
  1923. protocol: 'inspecting',
  1924. fn: function (anInspector){
  1925. var self=this;
  1926. return self;
  1927. },
  1928. args: ["anInspector"],
  1929. source: "inspectOn: anInspector",
  1930. referencedClasses: [],
  1931. messageSends: []
  1932. }),
  1933. $globals.ProtoObject);
  1934. $core.addMethod(
  1935. $core.method({
  1936. selector: "instVarAt:",
  1937. protocol: 'accessing',
  1938. fn: function (aString){
  1939. var self=this;
  1940. return $core.withContext(function($ctx1) {
  1941. return self['@'+aString];
  1942. return self;
  1943. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  1944. },
  1945. args: ["aString"],
  1946. source: "instVarAt: aString\x0a\x09<inlineJS: 'return self[''@''+aString]'>",
  1947. referencedClasses: [],
  1948. messageSends: []
  1949. }),
  1950. $globals.ProtoObject);
  1951. $core.addMethod(
  1952. $core.method({
  1953. selector: "instVarAt:put:",
  1954. protocol: 'accessing',
  1955. fn: function (aString,anObject){
  1956. var self=this;
  1957. return $core.withContext(function($ctx1) {
  1958. self['@' + aString] = anObject;
  1959. return self;
  1960. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  1961. },
  1962. args: ["aString", "anObject"],
  1963. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: 'self[''@'' + aString] = anObject'>",
  1964. referencedClasses: [],
  1965. messageSends: []
  1966. }),
  1967. $globals.ProtoObject);
  1968. $core.addMethod(
  1969. $core.method({
  1970. selector: "isKindOf:",
  1971. protocol: 'testing',
  1972. fn: function (aClass){
  1973. var self=this;
  1974. return $core.withContext(function($ctx1) {
  1975. var $1;
  1976. $1=self._isMemberOf_(aClass);
  1977. if($core.assert($1)){
  1978. return true;
  1979. } else {
  1980. return $recv(self._class())._inheritsFrom_(aClass);
  1981. }
  1982. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  1983. },
  1984. args: ["aClass"],
  1985. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1986. referencedClasses: [],
  1987. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1988. }),
  1989. $globals.ProtoObject);
  1990. $core.addMethod(
  1991. $core.method({
  1992. selector: "isNil",
  1993. protocol: 'testing',
  1994. fn: function (){
  1995. var self=this;
  1996. return false;
  1997. },
  1998. args: [],
  1999. source: "isNil\x0a\x09^ false",
  2000. referencedClasses: [],
  2001. messageSends: []
  2002. }),
  2003. $globals.ProtoObject);
  2004. $core.addMethod(
  2005. $core.method({
  2006. selector: "isSameInstanceAs:",
  2007. protocol: 'comparing',
  2008. fn: function (anObject){
  2009. var self=this;
  2010. return $core.withContext(function($ctx1) {
  2011. var $1;
  2012. $1=self._identityHash();
  2013. $ctx1.sendIdx["identityHash"]=1;
  2014. return $recv($1).__eq($recv(anObject)._identityHash());
  2015. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  2016. },
  2017. args: ["anObject"],
  2018. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  2019. referencedClasses: [],
  2020. messageSends: ["=", "identityHash"]
  2021. }),
  2022. $globals.ProtoObject);
  2023. $core.addMethod(
  2024. $core.method({
  2025. selector: "notNil",
  2026. protocol: 'testing',
  2027. fn: function (){
  2028. var self=this;
  2029. return $core.withContext(function($ctx1) {
  2030. return $recv(self._isNil())._not();
  2031. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2032. },
  2033. args: [],
  2034. source: "notNil\x0a\x09^ self isNil not",
  2035. referencedClasses: [],
  2036. messageSends: ["not", "isNil"]
  2037. }),
  2038. $globals.ProtoObject);
  2039. $core.addMethod(
  2040. $core.method({
  2041. selector: "perform:",
  2042. protocol: 'message handling',
  2043. fn: function (aString){
  2044. var self=this;
  2045. return $core.withContext(function($ctx1) {
  2046. return self._perform_withArguments_(aString,[]);
  2047. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2048. },
  2049. args: ["aString"],
  2050. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2051. referencedClasses: [],
  2052. messageSends: ["perform:withArguments:"]
  2053. }),
  2054. $globals.ProtoObject);
  2055. $core.addMethod(
  2056. $core.method({
  2057. selector: "perform:withArguments:",
  2058. protocol: 'message handling',
  2059. fn: function (aString,aCollection){
  2060. var self=this;
  2061. return $core.withContext(function($ctx1) {
  2062. return $core.send2(self, aString, aCollection);
  2063. return self;
  2064. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2065. },
  2066. args: ["aString", "aCollection"],
  2067. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2068. referencedClasses: [],
  2069. messageSends: []
  2070. }),
  2071. $globals.ProtoObject);
  2072. $core.addMethod(
  2073. $core.method({
  2074. selector: "printOn:",
  2075. protocol: 'printing',
  2076. fn: function (aStream){
  2077. var self=this;
  2078. return $core.withContext(function($ctx1) {
  2079. var $5,$4,$3,$2,$1;
  2080. $5=self._class();
  2081. $ctx1.sendIdx["class"]=1;
  2082. $4=$recv($5)._name();
  2083. $ctx1.sendIdx["name"]=1;
  2084. $3=$recv($4)._first();
  2085. $2=$recv($3)._isVowel();
  2086. if($core.assert($2)){
  2087. $1="an ";
  2088. } else {
  2089. $1="a ";
  2090. }
  2091. $recv(aStream)._nextPutAll_($1);
  2092. $ctx1.sendIdx["nextPutAll:"]=1;
  2093. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  2094. return self;
  2095. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2096. },
  2097. args: ["aStream"],
  2098. 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",
  2099. referencedClasses: [],
  2100. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2101. }),
  2102. $globals.ProtoObject);
  2103. $core.addMethod(
  2104. $core.method({
  2105. selector: "printString",
  2106. protocol: 'printing',
  2107. fn: function (){
  2108. var self=this;
  2109. return $core.withContext(function($ctx1) {
  2110. return $recv($globals.String)._streamContents_((function(str){
  2111. return $core.withContext(function($ctx2) {
  2112. return self._printOn_(str);
  2113. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2114. }));
  2115. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2116. },
  2117. args: [],
  2118. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2119. referencedClasses: ["String"],
  2120. messageSends: ["streamContents:", "printOn:"]
  2121. }),
  2122. $globals.ProtoObject);
  2123. $core.addMethod(
  2124. $core.method({
  2125. selector: "yourself",
  2126. protocol: 'accessing',
  2127. fn: function (){
  2128. var self=this;
  2129. return self;
  2130. },
  2131. args: [],
  2132. source: "yourself\x0a\x09^ self",
  2133. referencedClasses: [],
  2134. messageSends: []
  2135. }),
  2136. $globals.ProtoObject);
  2137. $core.addMethod(
  2138. $core.method({
  2139. selector: "~=",
  2140. protocol: 'comparing',
  2141. fn: function (anObject){
  2142. var self=this;
  2143. return $core.withContext(function($ctx1) {
  2144. var $1;
  2145. $1=$recv(self.__eq(anObject)).__eq(false);
  2146. $ctx1.sendIdx["="]=1;
  2147. return $1;
  2148. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  2149. },
  2150. args: ["anObject"],
  2151. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  2152. referencedClasses: [],
  2153. messageSends: ["="]
  2154. }),
  2155. $globals.ProtoObject);
  2156. $core.addMethod(
  2157. $core.method({
  2158. selector: "~~",
  2159. protocol: 'comparing',
  2160. fn: function (anObject){
  2161. var self=this;
  2162. return $core.withContext(function($ctx1) {
  2163. return $recv(self.__eq_eq(anObject)).__eq(false);
  2164. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  2165. },
  2166. args: ["anObject"],
  2167. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  2168. referencedClasses: [],
  2169. messageSends: ["=", "=="]
  2170. }),
  2171. $globals.ProtoObject);
  2172. $core.addMethod(
  2173. $core.method({
  2174. selector: "initialize",
  2175. protocol: 'initialization',
  2176. fn: function (){
  2177. var self=this;
  2178. return self;
  2179. },
  2180. args: [],
  2181. source: "initialize",
  2182. referencedClasses: [],
  2183. messageSends: []
  2184. }),
  2185. $globals.ProtoObject.klass);
  2186. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  2187. $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.";
  2188. $core.addMethod(
  2189. $core.method({
  2190. selector: "->",
  2191. protocol: 'converting',
  2192. fn: function (anObject){
  2193. var self=this;
  2194. return $core.withContext(function($ctx1) {
  2195. return $recv($globals.Association)._key_value_(self,anObject);
  2196. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  2197. },
  2198. args: ["anObject"],
  2199. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  2200. referencedClasses: ["Association"],
  2201. messageSends: ["key:value:"]
  2202. }),
  2203. $globals.Object);
  2204. $core.addMethod(
  2205. $core.method({
  2206. selector: "asJSON",
  2207. protocol: 'converting',
  2208. fn: function (){
  2209. var self=this;
  2210. var variables;
  2211. return $core.withContext(function($ctx1) {
  2212. variables=$recv($globals.HashedCollection)._new();
  2213. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  2214. return $core.withContext(function($ctx2) {
  2215. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  2216. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2217. }));
  2218. return variables;
  2219. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  2220. },
  2221. args: [],
  2222. source: "asJSON\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJSON ].\x0a\x09^ variables",
  2223. referencedClasses: ["HashedCollection"],
  2224. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  2225. }),
  2226. $globals.Object);
  2227. $core.addMethod(
  2228. $core.method({
  2229. selector: "asJSONString",
  2230. protocol: 'converting',
  2231. fn: function (){
  2232. var self=this;
  2233. return $core.withContext(function($ctx1) {
  2234. return $recv($globals.JSON)._stringify_(self._asJSON());
  2235. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  2236. },
  2237. args: [],
  2238. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  2239. referencedClasses: ["JSON"],
  2240. messageSends: ["stringify:", "asJSON"]
  2241. }),
  2242. $globals.Object);
  2243. $core.addMethod(
  2244. $core.method({
  2245. selector: "asJavascript",
  2246. protocol: 'converting',
  2247. fn: function (){
  2248. var self=this;
  2249. return $core.withContext(function($ctx1) {
  2250. return self._asString();
  2251. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  2252. },
  2253. args: [],
  2254. source: "asJavascript\x0a\x09^ self asString",
  2255. referencedClasses: [],
  2256. messageSends: ["asString"]
  2257. }),
  2258. $globals.Object);
  2259. $core.addMethod(
  2260. $core.method({
  2261. selector: "basicAt:",
  2262. protocol: 'accessing',
  2263. fn: function (aString){
  2264. var self=this;
  2265. return $core.withContext(function($ctx1) {
  2266. return self[aString];
  2267. return self;
  2268. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  2269. },
  2270. args: ["aString"],
  2271. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  2272. referencedClasses: [],
  2273. messageSends: []
  2274. }),
  2275. $globals.Object);
  2276. $core.addMethod(
  2277. $core.method({
  2278. selector: "basicAt:put:",
  2279. protocol: 'accessing',
  2280. fn: function (aString,anObject){
  2281. var self=this;
  2282. return $core.withContext(function($ctx1) {
  2283. return self[aString] = anObject;
  2284. return self;
  2285. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  2286. },
  2287. args: ["aString", "anObject"],
  2288. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  2289. referencedClasses: [],
  2290. messageSends: []
  2291. }),
  2292. $globals.Object);
  2293. $core.addMethod(
  2294. $core.method({
  2295. selector: "basicDelete:",
  2296. protocol: 'accessing',
  2297. fn: function (aString){
  2298. var self=this;
  2299. return $core.withContext(function($ctx1) {
  2300. delete self[aString]; return aString;
  2301. return self;
  2302. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  2303. },
  2304. args: ["aString"],
  2305. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  2306. referencedClasses: [],
  2307. messageSends: []
  2308. }),
  2309. $globals.Object);
  2310. $core.addMethod(
  2311. $core.method({
  2312. selector: "basicPerform:",
  2313. protocol: 'message handling',
  2314. fn: function (aString){
  2315. var self=this;
  2316. return $core.withContext(function($ctx1) {
  2317. return self._basicPerform_withArguments_(aString,[]);
  2318. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  2319. },
  2320. args: ["aString"],
  2321. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  2322. referencedClasses: [],
  2323. messageSends: ["basicPerform:withArguments:"]
  2324. }),
  2325. $globals.Object);
  2326. $core.addMethod(
  2327. $core.method({
  2328. selector: "basicPerform:withArguments:",
  2329. protocol: 'message handling',
  2330. fn: function (aString,aCollection){
  2331. var self=this;
  2332. return $core.withContext(function($ctx1) {
  2333. return self[aString].apply(self, aCollection);;
  2334. return self;
  2335. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  2336. },
  2337. args: ["aString", "aCollection"],
  2338. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  2339. referencedClasses: [],
  2340. messageSends: []
  2341. }),
  2342. $globals.Object);
  2343. $core.addMethod(
  2344. $core.method({
  2345. selector: "browse",
  2346. protocol: 'browsing',
  2347. fn: function (){
  2348. var self=this;
  2349. return $core.withContext(function($ctx1) {
  2350. $recv($globals.Finder)._findClass_(self._class());
  2351. return self;
  2352. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  2353. },
  2354. args: [],
  2355. source: "browse\x0a\x09Finder findClass: self class",
  2356. referencedClasses: ["Finder"],
  2357. messageSends: ["findClass:", "class"]
  2358. }),
  2359. $globals.Object);
  2360. $core.addMethod(
  2361. $core.method({
  2362. selector: "copy",
  2363. protocol: 'copying',
  2364. fn: function (){
  2365. var self=this;
  2366. return $core.withContext(function($ctx1) {
  2367. return $recv(self._shallowCopy())._postCopy();
  2368. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  2369. },
  2370. args: [],
  2371. source: "copy\x0a\x09^ self shallowCopy postCopy",
  2372. referencedClasses: [],
  2373. messageSends: ["postCopy", "shallowCopy"]
  2374. }),
  2375. $globals.Object);
  2376. $core.addMethod(
  2377. $core.method({
  2378. selector: "deepCopy",
  2379. protocol: 'copying',
  2380. fn: function (){
  2381. var self=this;
  2382. return $core.withContext(function($ctx1) {
  2383. var copy = self.klass._new();
  2384. Object.keys(self).forEach(function (i) {
  2385. if(/^@.+/.test(i)) {
  2386. copy[i] = self[i]._deepCopy();
  2387. }
  2388. });
  2389. return copy;
  2390. ;
  2391. return self;
  2392. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  2393. },
  2394. args: [],
  2395. 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'>",
  2396. referencedClasses: [],
  2397. messageSends: []
  2398. }),
  2399. $globals.Object);
  2400. $core.addMethod(
  2401. $core.method({
  2402. selector: "deprecatedAPI",
  2403. protocol: 'error handling',
  2404. fn: function (){
  2405. var self=this;
  2406. return $core.withContext(function($ctx1) {
  2407. var $1,$6,$5,$4,$8,$7,$3,$2;
  2408. $1=console;
  2409. $6=$core.getThisContext()._home();
  2410. $ctx1.sendIdx["home"]=1;
  2411. $5=$recv($6)._asString();
  2412. $ctx1.sendIdx["asString"]=1;
  2413. $4=$recv($5).__comma(" is deprecated! (in ");
  2414. $8=$recv($core.getThisContext()._home())._home();
  2415. $ctx1.sendIdx["home"]=2;
  2416. $7=$recv($8)._asString();
  2417. $3=$recv($4).__comma($7);
  2418. $ctx1.sendIdx[","]=2;
  2419. $2=$recv($3).__comma(")");
  2420. $ctx1.sendIdx[","]=1;
  2421. $recv($1)._warn_($2);
  2422. return self;
  2423. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  2424. },
  2425. args: [],
  2426. 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, ')'.",
  2427. referencedClasses: [],
  2428. messageSends: ["warn:", ",", "asString", "home"]
  2429. }),
  2430. $globals.Object);
  2431. $core.addMethod(
  2432. $core.method({
  2433. selector: "deprecatedAPI:",
  2434. protocol: 'error handling',
  2435. fn: function (aString){
  2436. var self=this;
  2437. return $core.withContext(function($ctx1) {
  2438. var $1,$6,$5,$4,$8,$7,$3,$2;
  2439. $1=console;
  2440. $6=$core.getThisContext()._home();
  2441. $ctx1.sendIdx["home"]=1;
  2442. $5=$recv($6)._asString();
  2443. $ctx1.sendIdx["asString"]=1;
  2444. $4=$recv($5).__comma(" is deprecated! (in ");
  2445. $8=$recv($core.getThisContext()._home())._home();
  2446. $ctx1.sendIdx["home"]=2;
  2447. $7=$recv($8)._asString();
  2448. $3=$recv($4).__comma($7);
  2449. $ctx1.sendIdx[","]=2;
  2450. $2=$recv($3).__comma(")");
  2451. $ctx1.sendIdx[","]=1;
  2452. $recv($1)._warn_($2);
  2453. $ctx1.sendIdx["warn:"]=1;
  2454. $recv(console)._warn_(aString);
  2455. return self;
  2456. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  2457. },
  2458. args: ["aString"],
  2459. 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",
  2460. referencedClasses: [],
  2461. messageSends: ["warn:", ",", "asString", "home"]
  2462. }),
  2463. $globals.Object);
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "error:",
  2467. protocol: 'error handling',
  2468. fn: function (aString){
  2469. var self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. $recv($globals.Error)._signal_(aString);
  2472. return self;
  2473. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  2474. },
  2475. args: ["aString"],
  2476. source: "error: aString\x0a\x09Error signal: aString",
  2477. referencedClasses: ["Error"],
  2478. messageSends: ["signal:"]
  2479. }),
  2480. $globals.Object);
  2481. $core.addMethod(
  2482. $core.method({
  2483. selector: "halt",
  2484. protocol: 'error handling',
  2485. fn: function (){
  2486. var self=this;
  2487. return $core.withContext(function($ctx1) {
  2488. $recv($globals.Halt)._signal();
  2489. return self;
  2490. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  2491. },
  2492. args: [],
  2493. source: "halt\x0a\x09Halt signal",
  2494. referencedClasses: ["Halt"],
  2495. messageSends: ["signal"]
  2496. }),
  2497. $globals.Object);
  2498. $core.addMethod(
  2499. $core.method({
  2500. selector: "in:",
  2501. protocol: 'evaluating',
  2502. fn: function (aValuable){
  2503. var self=this;
  2504. return $core.withContext(function($ctx1) {
  2505. return $recv(aValuable)._value_(self);
  2506. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  2507. },
  2508. args: ["aValuable"],
  2509. source: "in: aValuable\x0a\x09^ aValuable value: self",
  2510. referencedClasses: [],
  2511. messageSends: ["value:"]
  2512. }),
  2513. $globals.Object);
  2514. $core.addMethod(
  2515. $core.method({
  2516. selector: "isBehavior",
  2517. protocol: 'testing',
  2518. fn: function (){
  2519. var self=this;
  2520. return false;
  2521. },
  2522. args: [],
  2523. source: "isBehavior\x0a\x09^ false",
  2524. referencedClasses: [],
  2525. messageSends: []
  2526. }),
  2527. $globals.Object);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "isBoolean",
  2531. protocol: 'testing',
  2532. fn: function (){
  2533. var self=this;
  2534. return false;
  2535. },
  2536. args: [],
  2537. source: "isBoolean\x0a\x09^ false",
  2538. referencedClasses: [],
  2539. messageSends: []
  2540. }),
  2541. $globals.Object);
  2542. $core.addMethod(
  2543. $core.method({
  2544. selector: "isClass",
  2545. protocol: 'testing',
  2546. fn: function (){
  2547. var self=this;
  2548. return false;
  2549. },
  2550. args: [],
  2551. source: "isClass\x0a\x09^ false",
  2552. referencedClasses: [],
  2553. messageSends: []
  2554. }),
  2555. $globals.Object);
  2556. $core.addMethod(
  2557. $core.method({
  2558. selector: "isCompiledMethod",
  2559. protocol: 'testing',
  2560. fn: function (){
  2561. var self=this;
  2562. return false;
  2563. },
  2564. args: [],
  2565. source: "isCompiledMethod\x0a\x09^ false",
  2566. referencedClasses: [],
  2567. messageSends: []
  2568. }),
  2569. $globals.Object);
  2570. $core.addMethod(
  2571. $core.method({
  2572. selector: "isImmutable",
  2573. protocol: 'testing',
  2574. fn: function (){
  2575. var self=this;
  2576. return false;
  2577. },
  2578. args: [],
  2579. source: "isImmutable\x0a\x09^ false",
  2580. referencedClasses: [],
  2581. messageSends: []
  2582. }),
  2583. $globals.Object);
  2584. $core.addMethod(
  2585. $core.method({
  2586. selector: "isMemberOf:",
  2587. protocol: 'testing',
  2588. fn: function (aClass){
  2589. var self=this;
  2590. return $core.withContext(function($ctx1) {
  2591. return $recv(self._class()).__eq(aClass);
  2592. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2593. },
  2594. args: ["aClass"],
  2595. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2596. referencedClasses: [],
  2597. messageSends: ["=", "class"]
  2598. }),
  2599. $globals.Object);
  2600. $core.addMethod(
  2601. $core.method({
  2602. selector: "isMetaclass",
  2603. protocol: 'testing',
  2604. fn: function (){
  2605. var self=this;
  2606. return false;
  2607. },
  2608. args: [],
  2609. source: "isMetaclass\x0a\x09^ false",
  2610. referencedClasses: [],
  2611. messageSends: []
  2612. }),
  2613. $globals.Object);
  2614. $core.addMethod(
  2615. $core.method({
  2616. selector: "isNumber",
  2617. protocol: 'testing',
  2618. fn: function (){
  2619. var self=this;
  2620. return false;
  2621. },
  2622. args: [],
  2623. source: "isNumber\x0a\x09^ false",
  2624. referencedClasses: [],
  2625. messageSends: []
  2626. }),
  2627. $globals.Object);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "isPackage",
  2631. protocol: 'testing',
  2632. fn: function (){
  2633. var self=this;
  2634. return false;
  2635. },
  2636. args: [],
  2637. source: "isPackage\x0a\x09^ false",
  2638. referencedClasses: [],
  2639. messageSends: []
  2640. }),
  2641. $globals.Object);
  2642. $core.addMethod(
  2643. $core.method({
  2644. selector: "isParseFailure",
  2645. protocol: 'testing',
  2646. fn: function (){
  2647. var self=this;
  2648. return false;
  2649. },
  2650. args: [],
  2651. source: "isParseFailure\x0a\x09^ false",
  2652. referencedClasses: [],
  2653. messageSends: []
  2654. }),
  2655. $globals.Object);
  2656. $core.addMethod(
  2657. $core.method({
  2658. selector: "isString",
  2659. protocol: 'testing',
  2660. fn: function (){
  2661. var self=this;
  2662. return false;
  2663. },
  2664. args: [],
  2665. source: "isString\x0a\x09^ false",
  2666. referencedClasses: [],
  2667. messageSends: []
  2668. }),
  2669. $globals.Object);
  2670. $core.addMethod(
  2671. $core.method({
  2672. selector: "isSymbol",
  2673. protocol: 'testing',
  2674. fn: function (){
  2675. var self=this;
  2676. return false;
  2677. },
  2678. args: [],
  2679. source: "isSymbol\x0a\x09^ false",
  2680. referencedClasses: [],
  2681. messageSends: []
  2682. }),
  2683. $globals.Object);
  2684. $core.addMethod(
  2685. $core.method({
  2686. selector: "postCopy",
  2687. protocol: 'copying',
  2688. fn: function (){
  2689. var self=this;
  2690. return self;
  2691. },
  2692. args: [],
  2693. source: "postCopy",
  2694. referencedClasses: [],
  2695. messageSends: []
  2696. }),
  2697. $globals.Object);
  2698. $core.addMethod(
  2699. $core.method({
  2700. selector: "putOn:",
  2701. protocol: 'streaming',
  2702. fn: function (aStream){
  2703. var self=this;
  2704. return $core.withContext(function($ctx1) {
  2705. $recv(aStream)._nextPut_(self);
  2706. return self;
  2707. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2708. },
  2709. args: ["aStream"],
  2710. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2711. referencedClasses: [],
  2712. messageSends: ["nextPut:"]
  2713. }),
  2714. $globals.Object);
  2715. $core.addMethod(
  2716. $core.method({
  2717. selector: "respondsTo:",
  2718. protocol: 'testing',
  2719. fn: function (aSelector){
  2720. var self=this;
  2721. return $core.withContext(function($ctx1) {
  2722. return $recv(self._class())._canUnderstand_(aSelector);
  2723. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2724. },
  2725. args: ["aSelector"],
  2726. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2727. referencedClasses: [],
  2728. messageSends: ["canUnderstand:", "class"]
  2729. }),
  2730. $globals.Object);
  2731. $core.addMethod(
  2732. $core.method({
  2733. selector: "shallowCopy",
  2734. protocol: 'copying',
  2735. fn: function (){
  2736. var self=this;
  2737. return $core.withContext(function($ctx1) {
  2738. var copy = self.klass._new();
  2739. Object.keys(self).forEach(function(i) {
  2740. if(/^@.+/.test(i)) {
  2741. copy[i] = self[i];
  2742. }
  2743. });
  2744. return copy;
  2745. ;
  2746. return self;
  2747. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2748. },
  2749. args: [],
  2750. 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'>",
  2751. referencedClasses: [],
  2752. messageSends: []
  2753. }),
  2754. $globals.Object);
  2755. $core.addMethod(
  2756. $core.method({
  2757. selector: "shouldNotImplement",
  2758. protocol: 'error handling',
  2759. fn: function (){
  2760. var self=this;
  2761. return $core.withContext(function($ctx1) {
  2762. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2763. return self;
  2764. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2765. },
  2766. args: [],
  2767. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2768. referencedClasses: [],
  2769. messageSends: ["error:", ",", "name", "class"]
  2770. }),
  2771. $globals.Object);
  2772. $core.addMethod(
  2773. $core.method({
  2774. selector: "size",
  2775. protocol: 'accessing',
  2776. fn: function (){
  2777. var self=this;
  2778. return $core.withContext(function($ctx1) {
  2779. self._error_("Object not indexable");
  2780. return self;
  2781. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2782. },
  2783. args: [],
  2784. source: "size\x0a\x09self error: 'Object not indexable'",
  2785. referencedClasses: [],
  2786. messageSends: ["error:"]
  2787. }),
  2788. $globals.Object);
  2789. $core.addMethod(
  2790. $core.method({
  2791. selector: "subclassResponsibility",
  2792. protocol: 'error handling',
  2793. fn: function (){
  2794. var self=this;
  2795. return $core.withContext(function($ctx1) {
  2796. self._error_("This method is a responsibility of a subclass");
  2797. return self;
  2798. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2799. },
  2800. args: [],
  2801. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2802. referencedClasses: [],
  2803. messageSends: ["error:"]
  2804. }),
  2805. $globals.Object);
  2806. $core.addMethod(
  2807. $core.method({
  2808. selector: "value",
  2809. protocol: 'evaluating',
  2810. fn: function (){
  2811. var self=this;
  2812. return $core.withContext(function($ctx1) {
  2813. return self.valueOf();
  2814. return self;
  2815. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2816. },
  2817. args: [],
  2818. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  2819. referencedClasses: [],
  2820. messageSends: []
  2821. }),
  2822. $globals.Object);
  2823. $core.addMethod(
  2824. $core.method({
  2825. selector: "accessorProtocolWith:",
  2826. protocol: 'helios',
  2827. fn: function (aGenerator){
  2828. var self=this;
  2829. return $core.withContext(function($ctx1) {
  2830. $recv(aGenerator)._accessorProtocolForObject();
  2831. return self;
  2832. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2833. },
  2834. args: ["aGenerator"],
  2835. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2836. referencedClasses: [],
  2837. messageSends: ["accessorProtocolForObject"]
  2838. }),
  2839. $globals.Object.klass);
  2840. $core.addMethod(
  2841. $core.method({
  2842. selector: "accessorsSourceCodesWith:",
  2843. protocol: 'helios',
  2844. fn: function (aGenerator){
  2845. var self=this;
  2846. return $core.withContext(function($ctx1) {
  2847. $recv(aGenerator)._accessorsForObject();
  2848. return self;
  2849. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2850. },
  2851. args: ["aGenerator"],
  2852. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2853. referencedClasses: [],
  2854. messageSends: ["accessorsForObject"]
  2855. }),
  2856. $globals.Object.klass);
  2857. $core.addMethod(
  2858. $core.method({
  2859. selector: "initialize",
  2860. protocol: 'initialization',
  2861. fn: function (){
  2862. var self=this;
  2863. return self;
  2864. },
  2865. args: [],
  2866. source: "initialize\x0a\x09\x22no op\x22",
  2867. referencedClasses: [],
  2868. messageSends: []
  2869. }),
  2870. $globals.Object.klass);
  2871. $core.addMethod(
  2872. $core.method({
  2873. selector: "initializeProtocolWith:",
  2874. protocol: 'helios',
  2875. fn: function (aGenerator){
  2876. var self=this;
  2877. return $core.withContext(function($ctx1) {
  2878. $recv(aGenerator)._initializeProtocolForObject();
  2879. return self;
  2880. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2881. },
  2882. args: ["aGenerator"],
  2883. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2884. referencedClasses: [],
  2885. messageSends: ["initializeProtocolForObject"]
  2886. }),
  2887. $globals.Object.klass);
  2888. $core.addMethod(
  2889. $core.method({
  2890. selector: "initializeSourceCodesWith:",
  2891. protocol: 'helios',
  2892. fn: function (aGenerator){
  2893. var self=this;
  2894. return $core.withContext(function($ctx1) {
  2895. $recv(aGenerator)._initializeForObject();
  2896. return self;
  2897. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2898. },
  2899. args: ["aGenerator"],
  2900. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2901. referencedClasses: [],
  2902. messageSends: ["initializeForObject"]
  2903. }),
  2904. $globals.Object.klass);
  2905. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2906. $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: [ ... ]";
  2907. $core.addMethod(
  2908. $core.method({
  2909. selector: "&",
  2910. protocol: 'controlling',
  2911. fn: function (aBoolean){
  2912. var self=this;
  2913. return $core.withContext(function($ctx1) {
  2914. if(self == true) {
  2915. return aBoolean;
  2916. } else {
  2917. return false;
  2918. }
  2919. ;
  2920. return self;
  2921. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2922. },
  2923. args: ["aBoolean"],
  2924. 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'>",
  2925. referencedClasses: [],
  2926. messageSends: []
  2927. }),
  2928. $globals.Boolean);
  2929. $core.addMethod(
  2930. $core.method({
  2931. selector: "==",
  2932. protocol: 'comparing',
  2933. fn: function (aBoolean){
  2934. var self=this;
  2935. return $core.withContext(function($ctx1) {
  2936. if (typeof aBoolean === "boolean") return self.valueOf() === aBoolean;
  2937. else if (aBoolean != null && typeof aBoolean === "object") return self.valueOf() === aBoolean.valueOf();
  2938. else return false;;
  2939. return self;
  2940. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2941. },
  2942. args: ["aBoolean"],
  2943. 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'>",
  2944. referencedClasses: [],
  2945. messageSends: []
  2946. }),
  2947. $globals.Boolean);
  2948. $core.addMethod(
  2949. $core.method({
  2950. selector: "and:",
  2951. protocol: 'controlling',
  2952. fn: function (aBlock){
  2953. var self=this;
  2954. return $core.withContext(function($ctx1) {
  2955. if($core.assert(self)){
  2956. return $recv(aBlock)._value();
  2957. } else {
  2958. return false;
  2959. }
  2960. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2961. },
  2962. args: ["aBlock"],
  2963. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  2964. referencedClasses: [],
  2965. messageSends: ["ifTrue:ifFalse:", "value"]
  2966. }),
  2967. $globals.Boolean);
  2968. $core.addMethod(
  2969. $core.method({
  2970. selector: "asBit",
  2971. protocol: 'converting',
  2972. fn: function (){
  2973. var self=this;
  2974. return $core.withContext(function($ctx1) {
  2975. if($core.assert(self)){
  2976. return (1);
  2977. } else {
  2978. return (0);
  2979. }
  2980. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  2981. },
  2982. args: [],
  2983. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2984. referencedClasses: [],
  2985. messageSends: ["ifTrue:ifFalse:"]
  2986. }),
  2987. $globals.Boolean);
  2988. $core.addMethod(
  2989. $core.method({
  2990. selector: "asJSON",
  2991. protocol: 'converting',
  2992. fn: function (){
  2993. var self=this;
  2994. return self;
  2995. },
  2996. args: [],
  2997. source: "asJSON\x0a\x09^ self",
  2998. referencedClasses: [],
  2999. messageSends: []
  3000. }),
  3001. $globals.Boolean);
  3002. $core.addMethod(
  3003. $core.method({
  3004. selector: "asString",
  3005. protocol: 'converting',
  3006. fn: function (){
  3007. var self=this;
  3008. return $core.withContext(function($ctx1) {
  3009. return self.toString();
  3010. return self;
  3011. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3012. },
  3013. args: [],
  3014. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3015. referencedClasses: [],
  3016. messageSends: []
  3017. }),
  3018. $globals.Boolean);
  3019. $core.addMethod(
  3020. $core.method({
  3021. selector: "deepCopy",
  3022. protocol: 'copying',
  3023. fn: function (){
  3024. var self=this;
  3025. return self;
  3026. },
  3027. args: [],
  3028. source: "deepCopy\x0a\x09^ self",
  3029. referencedClasses: [],
  3030. messageSends: []
  3031. }),
  3032. $globals.Boolean);
  3033. $core.addMethod(
  3034. $core.method({
  3035. selector: "ifFalse:",
  3036. protocol: 'controlling',
  3037. fn: function (aBlock){
  3038. var self=this;
  3039. return $core.withContext(function($ctx1) {
  3040. return self._ifTrue_ifFalse_((function(){
  3041. }),aBlock);
  3042. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3043. },
  3044. args: ["aBlock"],
  3045. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3046. referencedClasses: [],
  3047. messageSends: ["ifTrue:ifFalse:"]
  3048. }),
  3049. $globals.Boolean);
  3050. $core.addMethod(
  3051. $core.method({
  3052. selector: "ifFalse:ifTrue:",
  3053. protocol: 'controlling',
  3054. fn: function (aBlock,anotherBlock){
  3055. var self=this;
  3056. return $core.withContext(function($ctx1) {
  3057. return self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3058. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3059. },
  3060. args: ["aBlock", "anotherBlock"],
  3061. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3062. referencedClasses: [],
  3063. messageSends: ["ifTrue:ifFalse:"]
  3064. }),
  3065. $globals.Boolean);
  3066. $core.addMethod(
  3067. $core.method({
  3068. selector: "ifTrue:",
  3069. protocol: 'controlling',
  3070. fn: function (aBlock){
  3071. var self=this;
  3072. return $core.withContext(function($ctx1) {
  3073. return self._ifTrue_ifFalse_(aBlock,(function(){
  3074. }));
  3075. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3076. },
  3077. args: ["aBlock"],
  3078. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3079. referencedClasses: [],
  3080. messageSends: ["ifTrue:ifFalse:"]
  3081. }),
  3082. $globals.Boolean);
  3083. $core.addMethod(
  3084. $core.method({
  3085. selector: "ifTrue:ifFalse:",
  3086. protocol: 'controlling',
  3087. fn: function (aBlock,anotherBlock){
  3088. var self=this;
  3089. return $core.withContext(function($ctx1) {
  3090. if(self == true) {
  3091. return aBlock._value();
  3092. } else {
  3093. return anotherBlock._value();
  3094. }
  3095. ;
  3096. return self;
  3097. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3098. },
  3099. args: ["aBlock", "anotherBlock"],
  3100. 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'>",
  3101. referencedClasses: [],
  3102. messageSends: []
  3103. }),
  3104. $globals.Boolean);
  3105. $core.addMethod(
  3106. $core.method({
  3107. selector: "isBoolean",
  3108. protocol: 'testing',
  3109. fn: function (){
  3110. var self=this;
  3111. return true;
  3112. },
  3113. args: [],
  3114. source: "isBoolean\x0a\x09^ true",
  3115. referencedClasses: [],
  3116. messageSends: []
  3117. }),
  3118. $globals.Boolean);
  3119. $core.addMethod(
  3120. $core.method({
  3121. selector: "isImmutable",
  3122. protocol: 'testing',
  3123. fn: function (){
  3124. var self=this;
  3125. return true;
  3126. },
  3127. args: [],
  3128. source: "isImmutable\x0a\x09^ true",
  3129. referencedClasses: [],
  3130. messageSends: []
  3131. }),
  3132. $globals.Boolean);
  3133. $core.addMethod(
  3134. $core.method({
  3135. selector: "not",
  3136. protocol: 'controlling',
  3137. fn: function (){
  3138. var self=this;
  3139. return $core.withContext(function($ctx1) {
  3140. return self.__eq(false);
  3141. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  3142. },
  3143. args: [],
  3144. source: "not\x0a\x09^ self = false",
  3145. referencedClasses: [],
  3146. messageSends: ["="]
  3147. }),
  3148. $globals.Boolean);
  3149. $core.addMethod(
  3150. $core.method({
  3151. selector: "or:",
  3152. protocol: 'controlling',
  3153. fn: function (aBlock){
  3154. var self=this;
  3155. return $core.withContext(function($ctx1) {
  3156. if($core.assert(self)){
  3157. return true;
  3158. } else {
  3159. return $recv(aBlock)._value();
  3160. }
  3161. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  3162. },
  3163. args: ["aBlock"],
  3164. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  3165. referencedClasses: [],
  3166. messageSends: ["ifTrue:ifFalse:", "value"]
  3167. }),
  3168. $globals.Boolean);
  3169. $core.addMethod(
  3170. $core.method({
  3171. selector: "printOn:",
  3172. protocol: 'printing',
  3173. fn: function (aStream){
  3174. var self=this;
  3175. return $core.withContext(function($ctx1) {
  3176. $recv(aStream)._nextPutAll_(self._asString());
  3177. return self;
  3178. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  3179. },
  3180. args: ["aStream"],
  3181. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3182. referencedClasses: [],
  3183. messageSends: ["nextPutAll:", "asString"]
  3184. }),
  3185. $globals.Boolean);
  3186. $core.addMethod(
  3187. $core.method({
  3188. selector: "shallowCopy",
  3189. protocol: 'copying',
  3190. fn: function (){
  3191. var self=this;
  3192. return self;
  3193. },
  3194. args: [],
  3195. source: "shallowCopy\x0a\x09^ self",
  3196. referencedClasses: [],
  3197. messageSends: []
  3198. }),
  3199. $globals.Boolean);
  3200. $core.addMethod(
  3201. $core.method({
  3202. selector: "|",
  3203. protocol: 'controlling',
  3204. fn: function (aBoolean){
  3205. var self=this;
  3206. return $core.withContext(function($ctx1) {
  3207. if(self == true) {
  3208. return true;
  3209. } else {
  3210. return aBoolean;
  3211. }
  3212. ;
  3213. return self;
  3214. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  3215. },
  3216. args: ["aBoolean"],
  3217. 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'>",
  3218. referencedClasses: [],
  3219. messageSends: []
  3220. }),
  3221. $globals.Boolean);
  3222. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  3223. $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.).";
  3224. $core.addMethod(
  3225. $core.method({
  3226. selector: "+",
  3227. protocol: 'arithmetic',
  3228. fn: function (aDate){
  3229. var self=this;
  3230. return $core.withContext(function($ctx1) {
  3231. return self + aDate;
  3232. return self;
  3233. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  3234. },
  3235. args: ["aDate"],
  3236. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  3237. referencedClasses: [],
  3238. messageSends: []
  3239. }),
  3240. $globals.Date);
  3241. $core.addMethod(
  3242. $core.method({
  3243. selector: "-",
  3244. protocol: 'arithmetic',
  3245. fn: function (aDate){
  3246. var self=this;
  3247. return $core.withContext(function($ctx1) {
  3248. return self - aDate;
  3249. return self;
  3250. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  3251. },
  3252. args: ["aDate"],
  3253. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  3254. referencedClasses: [],
  3255. messageSends: []
  3256. }),
  3257. $globals.Date);
  3258. $core.addMethod(
  3259. $core.method({
  3260. selector: "<",
  3261. protocol: 'comparing',
  3262. fn: function (aDate){
  3263. var self=this;
  3264. return $core.withContext(function($ctx1) {
  3265. return self < aDate;
  3266. return self;
  3267. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  3268. },
  3269. args: ["aDate"],
  3270. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  3271. referencedClasses: [],
  3272. messageSends: []
  3273. }),
  3274. $globals.Date);
  3275. $core.addMethod(
  3276. $core.method({
  3277. selector: "<=",
  3278. protocol: 'comparing',
  3279. fn: function (aDate){
  3280. var self=this;
  3281. return $core.withContext(function($ctx1) {
  3282. return self <= aDate;
  3283. return self;
  3284. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  3285. },
  3286. args: ["aDate"],
  3287. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  3288. referencedClasses: [],
  3289. messageSends: []
  3290. }),
  3291. $globals.Date);
  3292. $core.addMethod(
  3293. $core.method({
  3294. selector: "=",
  3295. protocol: 'comparing',
  3296. fn: function (aDate){
  3297. var self=this;
  3298. return $core.withContext(function($ctx1) {
  3299. var $2,$1,$3;
  3300. $2=$recv(aDate)._class();
  3301. $ctx1.sendIdx["class"]=1;
  3302. $1=$recv($2).__eq_eq(self._class());
  3303. $ctx1.sendIdx["=="]=1;
  3304. return $recv($1)._and_((function(){
  3305. return $core.withContext(function($ctx2) {
  3306. $3=self._asMilliseconds();
  3307. $ctx2.sendIdx["asMilliseconds"]=1;
  3308. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  3309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3310. }));
  3311. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  3312. },
  3313. args: ["aDate"],
  3314. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  3315. referencedClasses: [],
  3316. messageSends: ["and:", "==", "class", "asMilliseconds"]
  3317. }),
  3318. $globals.Date);
  3319. $core.addMethod(
  3320. $core.method({
  3321. selector: ">",
  3322. protocol: 'comparing',
  3323. fn: function (aDate){
  3324. var self=this;
  3325. return $core.withContext(function($ctx1) {
  3326. return self > aDate;
  3327. return self;
  3328. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  3329. },
  3330. args: ["aDate"],
  3331. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  3332. referencedClasses: [],
  3333. messageSends: []
  3334. }),
  3335. $globals.Date);
  3336. $core.addMethod(
  3337. $core.method({
  3338. selector: ">=",
  3339. protocol: 'comparing',
  3340. fn: function (aDate){
  3341. var self=this;
  3342. return $core.withContext(function($ctx1) {
  3343. return self >= aDate;
  3344. return self;
  3345. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  3346. },
  3347. args: ["aDate"],
  3348. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  3349. referencedClasses: [],
  3350. messageSends: []
  3351. }),
  3352. $globals.Date);
  3353. $core.addMethod(
  3354. $core.method({
  3355. selector: "asDateString",
  3356. protocol: 'converting',
  3357. fn: function (){
  3358. var self=this;
  3359. return $core.withContext(function($ctx1) {
  3360. return self.toDateString();
  3361. return self;
  3362. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  3363. },
  3364. args: [],
  3365. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  3366. referencedClasses: [],
  3367. messageSends: []
  3368. }),
  3369. $globals.Date);
  3370. $core.addMethod(
  3371. $core.method({
  3372. selector: "asLocaleString",
  3373. protocol: 'converting',
  3374. fn: function (){
  3375. var self=this;
  3376. return $core.withContext(function($ctx1) {
  3377. return self.toLocaleString();
  3378. return self;
  3379. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  3380. },
  3381. args: [],
  3382. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  3383. referencedClasses: [],
  3384. messageSends: []
  3385. }),
  3386. $globals.Date);
  3387. $core.addMethod(
  3388. $core.method({
  3389. selector: "asMilliseconds",
  3390. protocol: 'converting',
  3391. fn: function (){
  3392. var self=this;
  3393. return $core.withContext(function($ctx1) {
  3394. return self._time();
  3395. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  3396. },
  3397. args: [],
  3398. source: "asMilliseconds\x0a\x09^ self time",
  3399. referencedClasses: [],
  3400. messageSends: ["time"]
  3401. }),
  3402. $globals.Date);
  3403. $core.addMethod(
  3404. $core.method({
  3405. selector: "asNumber",
  3406. protocol: 'converting',
  3407. fn: function (){
  3408. var self=this;
  3409. return $core.withContext(function($ctx1) {
  3410. return self._asMilliseconds();
  3411. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  3412. },
  3413. args: [],
  3414. source: "asNumber\x0a\x09^ self asMilliseconds",
  3415. referencedClasses: [],
  3416. messageSends: ["asMilliseconds"]
  3417. }),
  3418. $globals.Date);
  3419. $core.addMethod(
  3420. $core.method({
  3421. selector: "asString",
  3422. protocol: 'converting',
  3423. fn: function (){
  3424. var self=this;
  3425. return $core.withContext(function($ctx1) {
  3426. return self.toString();
  3427. return self;
  3428. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  3429. },
  3430. args: [],
  3431. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3432. referencedClasses: [],
  3433. messageSends: []
  3434. }),
  3435. $globals.Date);
  3436. $core.addMethod(
  3437. $core.method({
  3438. selector: "asTimeString",
  3439. protocol: 'converting',
  3440. fn: function (){
  3441. var self=this;
  3442. return $core.withContext(function($ctx1) {
  3443. return self.toTimeString();
  3444. return self;
  3445. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  3446. },
  3447. args: [],
  3448. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  3449. referencedClasses: [],
  3450. messageSends: []
  3451. }),
  3452. $globals.Date);
  3453. $core.addMethod(
  3454. $core.method({
  3455. selector: "day",
  3456. protocol: 'accessing',
  3457. fn: function (){
  3458. var self=this;
  3459. return $core.withContext(function($ctx1) {
  3460. return self._dayOfWeek();
  3461. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  3462. },
  3463. args: [],
  3464. source: "day\x0a\x09^ self dayOfWeek",
  3465. referencedClasses: [],
  3466. messageSends: ["dayOfWeek"]
  3467. }),
  3468. $globals.Date);
  3469. $core.addMethod(
  3470. $core.method({
  3471. selector: "day:",
  3472. protocol: 'accessing',
  3473. fn: function (aNumber){
  3474. var self=this;
  3475. return $core.withContext(function($ctx1) {
  3476. self._dayOfWeek_(aNumber);
  3477. return self;
  3478. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  3479. },
  3480. args: ["aNumber"],
  3481. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  3482. referencedClasses: [],
  3483. messageSends: ["dayOfWeek:"]
  3484. }),
  3485. $globals.Date);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "dayOfMonth",
  3489. protocol: 'accessing',
  3490. fn: function (){
  3491. var self=this;
  3492. return $core.withContext(function($ctx1) {
  3493. return self.getDate();
  3494. return self;
  3495. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  3496. },
  3497. args: [],
  3498. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  3499. referencedClasses: [],
  3500. messageSends: []
  3501. }),
  3502. $globals.Date);
  3503. $core.addMethod(
  3504. $core.method({
  3505. selector: "dayOfMonth:",
  3506. protocol: 'accessing',
  3507. fn: function (aNumber){
  3508. var self=this;
  3509. return $core.withContext(function($ctx1) {
  3510. self.setDate(aNumber);
  3511. return self;
  3512. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  3513. },
  3514. args: ["aNumber"],
  3515. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  3516. referencedClasses: [],
  3517. messageSends: []
  3518. }),
  3519. $globals.Date);
  3520. $core.addMethod(
  3521. $core.method({
  3522. selector: "dayOfWeek",
  3523. protocol: 'accessing',
  3524. fn: function (){
  3525. var self=this;
  3526. return $core.withContext(function($ctx1) {
  3527. return self.getDay() + 1;
  3528. return self;
  3529. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  3530. },
  3531. args: [],
  3532. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  3533. referencedClasses: [],
  3534. messageSends: []
  3535. }),
  3536. $globals.Date);
  3537. $core.addMethod(
  3538. $core.method({
  3539. selector: "dayOfWeek:",
  3540. protocol: 'accessing',
  3541. fn: function (aNumber){
  3542. var self=this;
  3543. return $core.withContext(function($ctx1) {
  3544. return self.setDay(aNumber - 1);
  3545. return self;
  3546. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  3547. },
  3548. args: ["aNumber"],
  3549. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  3550. referencedClasses: [],
  3551. messageSends: []
  3552. }),
  3553. $globals.Date);
  3554. $core.addMethod(
  3555. $core.method({
  3556. selector: "hours",
  3557. protocol: 'accessing',
  3558. fn: function (){
  3559. var self=this;
  3560. return $core.withContext(function($ctx1) {
  3561. return self.getHours();
  3562. return self;
  3563. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3564. },
  3565. args: [],
  3566. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  3567. referencedClasses: [],
  3568. messageSends: []
  3569. }),
  3570. $globals.Date);
  3571. $core.addMethod(
  3572. $core.method({
  3573. selector: "hours:",
  3574. protocol: 'accessing',
  3575. fn: function (aNumber){
  3576. var self=this;
  3577. return $core.withContext(function($ctx1) {
  3578. self.setHours(aNumber);
  3579. return self;
  3580. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3581. },
  3582. args: ["aNumber"],
  3583. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  3584. referencedClasses: [],
  3585. messageSends: []
  3586. }),
  3587. $globals.Date);
  3588. $core.addMethod(
  3589. $core.method({
  3590. selector: "milliseconds",
  3591. protocol: 'accessing',
  3592. fn: function (){
  3593. var self=this;
  3594. return $core.withContext(function($ctx1) {
  3595. return self.getMilliseconds();
  3596. return self;
  3597. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3598. },
  3599. args: [],
  3600. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  3601. referencedClasses: [],
  3602. messageSends: []
  3603. }),
  3604. $globals.Date);
  3605. $core.addMethod(
  3606. $core.method({
  3607. selector: "milliseconds:",
  3608. protocol: 'accessing',
  3609. fn: function (aNumber){
  3610. var self=this;
  3611. return $core.withContext(function($ctx1) {
  3612. self.setMilliseconds(aNumber);
  3613. return self;
  3614. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3615. },
  3616. args: ["aNumber"],
  3617. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  3618. referencedClasses: [],
  3619. messageSends: []
  3620. }),
  3621. $globals.Date);
  3622. $core.addMethod(
  3623. $core.method({
  3624. selector: "minutes",
  3625. protocol: 'accessing',
  3626. fn: function (){
  3627. var self=this;
  3628. return $core.withContext(function($ctx1) {
  3629. return self.getMinutes();
  3630. return self;
  3631. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3632. },
  3633. args: [],
  3634. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  3635. referencedClasses: [],
  3636. messageSends: []
  3637. }),
  3638. $globals.Date);
  3639. $core.addMethod(
  3640. $core.method({
  3641. selector: "minutes:",
  3642. protocol: 'accessing',
  3643. fn: function (aNumber){
  3644. var self=this;
  3645. return $core.withContext(function($ctx1) {
  3646. self.setMinutes(aNumber);
  3647. return self;
  3648. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3649. },
  3650. args: ["aNumber"],
  3651. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  3652. referencedClasses: [],
  3653. messageSends: []
  3654. }),
  3655. $globals.Date);
  3656. $core.addMethod(
  3657. $core.method({
  3658. selector: "month",
  3659. protocol: 'accessing',
  3660. fn: function (){
  3661. var self=this;
  3662. return $core.withContext(function($ctx1) {
  3663. return self.getMonth() + 1;
  3664. return self;
  3665. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3666. },
  3667. args: [],
  3668. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  3669. referencedClasses: [],
  3670. messageSends: []
  3671. }),
  3672. $globals.Date);
  3673. $core.addMethod(
  3674. $core.method({
  3675. selector: "month:",
  3676. protocol: 'accessing',
  3677. fn: function (aNumber){
  3678. var self=this;
  3679. return $core.withContext(function($ctx1) {
  3680. self.setMonth(aNumber - 1);
  3681. return self;
  3682. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3683. },
  3684. args: ["aNumber"],
  3685. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  3686. referencedClasses: [],
  3687. messageSends: []
  3688. }),
  3689. $globals.Date);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "printOn:",
  3693. protocol: 'printing',
  3694. fn: function (aStream){
  3695. var self=this;
  3696. return $core.withContext(function($ctx1) {
  3697. $recv(aStream)._nextPutAll_(self._asString());
  3698. return self;
  3699. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3700. },
  3701. args: ["aStream"],
  3702. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3703. referencedClasses: [],
  3704. messageSends: ["nextPutAll:", "asString"]
  3705. }),
  3706. $globals.Date);
  3707. $core.addMethod(
  3708. $core.method({
  3709. selector: "seconds",
  3710. protocol: 'accessing',
  3711. fn: function (){
  3712. var self=this;
  3713. return $core.withContext(function($ctx1) {
  3714. return self.getSeconds();
  3715. return self;
  3716. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3717. },
  3718. args: [],
  3719. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  3720. referencedClasses: [],
  3721. messageSends: []
  3722. }),
  3723. $globals.Date);
  3724. $core.addMethod(
  3725. $core.method({
  3726. selector: "seconds:",
  3727. protocol: 'accessing',
  3728. fn: function (aNumber){
  3729. var self=this;
  3730. return $core.withContext(function($ctx1) {
  3731. self.setSeconds(aNumber);
  3732. return self;
  3733. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3734. },
  3735. args: ["aNumber"],
  3736. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  3737. referencedClasses: [],
  3738. messageSends: []
  3739. }),
  3740. $globals.Date);
  3741. $core.addMethod(
  3742. $core.method({
  3743. selector: "time",
  3744. protocol: 'accessing',
  3745. fn: function (){
  3746. var self=this;
  3747. return $core.withContext(function($ctx1) {
  3748. return self.getTime();
  3749. return self;
  3750. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3751. },
  3752. args: [],
  3753. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  3754. referencedClasses: [],
  3755. messageSends: []
  3756. }),
  3757. $globals.Date);
  3758. $core.addMethod(
  3759. $core.method({
  3760. selector: "time:",
  3761. protocol: 'accessing',
  3762. fn: function (aNumber){
  3763. var self=this;
  3764. return $core.withContext(function($ctx1) {
  3765. self.setTime(aNumber);
  3766. return self;
  3767. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3768. },
  3769. args: ["aNumber"],
  3770. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  3771. referencedClasses: [],
  3772. messageSends: []
  3773. }),
  3774. $globals.Date);
  3775. $core.addMethod(
  3776. $core.method({
  3777. selector: "year",
  3778. protocol: 'accessing',
  3779. fn: function (){
  3780. var self=this;
  3781. return $core.withContext(function($ctx1) {
  3782. return self.getFullYear();
  3783. return self;
  3784. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3785. },
  3786. args: [],
  3787. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  3788. referencedClasses: [],
  3789. messageSends: []
  3790. }),
  3791. $globals.Date);
  3792. $core.addMethod(
  3793. $core.method({
  3794. selector: "year:",
  3795. protocol: 'accessing',
  3796. fn: function (aNumber){
  3797. var self=this;
  3798. return $core.withContext(function($ctx1) {
  3799. self.setFullYear(aNumber);
  3800. return self;
  3801. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3802. },
  3803. args: ["aNumber"],
  3804. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  3805. referencedClasses: [],
  3806. messageSends: []
  3807. }),
  3808. $globals.Date);
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "classTag",
  3812. protocol: 'accessing',
  3813. fn: function (){
  3814. var self=this;
  3815. return "magnitude";
  3816. },
  3817. args: [],
  3818. 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'",
  3819. referencedClasses: [],
  3820. messageSends: []
  3821. }),
  3822. $globals.Date.klass);
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "fromMilliseconds:",
  3826. protocol: 'instance creation',
  3827. fn: function (aNumber){
  3828. var self=this;
  3829. return $core.withContext(function($ctx1) {
  3830. return self._new_(aNumber);
  3831. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3832. },
  3833. args: ["aNumber"],
  3834. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3835. referencedClasses: [],
  3836. messageSends: ["new:"]
  3837. }),
  3838. $globals.Date.klass);
  3839. $core.addMethod(
  3840. $core.method({
  3841. selector: "fromSeconds:",
  3842. protocol: 'instance creation',
  3843. fn: function (aNumber){
  3844. var self=this;
  3845. return $core.withContext(function($ctx1) {
  3846. return self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3847. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3848. },
  3849. args: ["aNumber"],
  3850. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3851. referencedClasses: [],
  3852. messageSends: ["fromMilliseconds:", "*"]
  3853. }),
  3854. $globals.Date.klass);
  3855. $core.addMethod(
  3856. $core.method({
  3857. selector: "fromString:",
  3858. protocol: 'instance creation',
  3859. fn: function (aString){
  3860. var self=this;
  3861. return $core.withContext(function($ctx1) {
  3862. return self._new_(aString);
  3863. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3864. },
  3865. args: ["aString"],
  3866. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3867. referencedClasses: [],
  3868. messageSends: ["new:"]
  3869. }),
  3870. $globals.Date.klass);
  3871. $core.addMethod(
  3872. $core.method({
  3873. selector: "millisecondsToRun:",
  3874. protocol: 'instance creation',
  3875. fn: function (aBlock){
  3876. var self=this;
  3877. var t;
  3878. return $core.withContext(function($ctx1) {
  3879. t=$recv($globals.Date)._now();
  3880. $ctx1.sendIdx["now"]=1;
  3881. $recv(aBlock)._value();
  3882. return $recv($recv($globals.Date)._now()).__minus(t);
  3883. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3884. },
  3885. args: ["aBlock"],
  3886. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3887. referencedClasses: ["Date"],
  3888. messageSends: ["now", "value", "-"]
  3889. }),
  3890. $globals.Date.klass);
  3891. $core.addMethod(
  3892. $core.method({
  3893. selector: "new:",
  3894. protocol: 'instance creation',
  3895. fn: function (anObject){
  3896. var self=this;
  3897. return $core.withContext(function($ctx1) {
  3898. return new Date(anObject);
  3899. return self;
  3900. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3901. },
  3902. args: ["anObject"],
  3903. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  3904. referencedClasses: [],
  3905. messageSends: []
  3906. }),
  3907. $globals.Date.klass);
  3908. $core.addMethod(
  3909. $core.method({
  3910. selector: "now",
  3911. protocol: 'instance creation',
  3912. fn: function (){
  3913. var self=this;
  3914. return $core.withContext(function($ctx1) {
  3915. return self._today();
  3916. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3917. },
  3918. args: [],
  3919. source: "now\x0a\x09^ self today",
  3920. referencedClasses: [],
  3921. messageSends: ["today"]
  3922. }),
  3923. $globals.Date.klass);
  3924. $core.addMethod(
  3925. $core.method({
  3926. selector: "today",
  3927. protocol: 'instance creation',
  3928. fn: function (){
  3929. var self=this;
  3930. return $core.withContext(function($ctx1) {
  3931. return self._new();
  3932. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3933. },
  3934. args: [],
  3935. source: "today\x0a\x09^ self new",
  3936. referencedClasses: [],
  3937. messageSends: ["new"]
  3938. }),
  3939. $globals.Date.klass);
  3940. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3941. $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 ].";
  3942. $core.addMethod(
  3943. $core.method({
  3944. selector: "&",
  3945. protocol: 'converting',
  3946. fn: function (aNumber){
  3947. var self=this;
  3948. return $core.withContext(function($ctx1) {
  3949. return self & aNumber;
  3950. return self;
  3951. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  3952. },
  3953. args: ["aNumber"],
  3954. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  3955. referencedClasses: [],
  3956. messageSends: []
  3957. }),
  3958. $globals.Number);
  3959. $core.addMethod(
  3960. $core.method({
  3961. selector: "*",
  3962. protocol: 'arithmetic',
  3963. fn: function (aNumber){
  3964. var self=this;
  3965. return $core.withContext(function($ctx1) {
  3966. return self * aNumber;
  3967. return self;
  3968. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3969. },
  3970. args: ["aNumber"],
  3971. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  3972. referencedClasses: [],
  3973. messageSends: []
  3974. }),
  3975. $globals.Number);
  3976. $core.addMethod(
  3977. $core.method({
  3978. selector: "**",
  3979. protocol: 'mathematical functions',
  3980. fn: function (exponent){
  3981. var self=this;
  3982. return $core.withContext(function($ctx1) {
  3983. return self._raisedTo_(exponent);
  3984. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  3985. },
  3986. args: ["exponent"],
  3987. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  3988. referencedClasses: [],
  3989. messageSends: ["raisedTo:"]
  3990. }),
  3991. $globals.Number);
  3992. $core.addMethod(
  3993. $core.method({
  3994. selector: "+",
  3995. protocol: 'arithmetic',
  3996. fn: function (aNumber){
  3997. var self=this;
  3998. return $core.withContext(function($ctx1) {
  3999. return self + aNumber;
  4000. return self;
  4001. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4002. },
  4003. args: ["aNumber"],
  4004. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4005. referencedClasses: [],
  4006. messageSends: []
  4007. }),
  4008. $globals.Number);
  4009. $core.addMethod(
  4010. $core.method({
  4011. selector: "-",
  4012. protocol: 'arithmetic',
  4013. fn: function (aNumber){
  4014. var self=this;
  4015. return $core.withContext(function($ctx1) {
  4016. return self - aNumber;
  4017. return self;
  4018. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4019. },
  4020. args: ["aNumber"],
  4021. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4022. referencedClasses: [],
  4023. messageSends: []
  4024. }),
  4025. $globals.Number);
  4026. $core.addMethod(
  4027. $core.method({
  4028. selector: "/",
  4029. protocol: 'arithmetic',
  4030. fn: function (aNumber){
  4031. var self=this;
  4032. return $core.withContext(function($ctx1) {
  4033. return self / aNumber;
  4034. return self;
  4035. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4036. },
  4037. args: ["aNumber"],
  4038. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4039. referencedClasses: [],
  4040. messageSends: []
  4041. }),
  4042. $globals.Number);
  4043. $core.addMethod(
  4044. $core.method({
  4045. selector: "//",
  4046. protocol: 'arithmetic',
  4047. fn: function (aNumber){
  4048. var self=this;
  4049. return $core.withContext(function($ctx1) {
  4050. return $recv(self.__slash(aNumber))._floor();
  4051. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4052. },
  4053. args: ["aNumber"],
  4054. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4055. referencedClasses: [],
  4056. messageSends: ["floor", "/"]
  4057. }),
  4058. $globals.Number);
  4059. $core.addMethod(
  4060. $core.method({
  4061. selector: "<",
  4062. protocol: 'comparing',
  4063. fn: function (aNumber){
  4064. var self=this;
  4065. return $core.withContext(function($ctx1) {
  4066. return self < aNumber;
  4067. return self;
  4068. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4069. },
  4070. args: ["aNumber"],
  4071. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4072. referencedClasses: [],
  4073. messageSends: []
  4074. }),
  4075. $globals.Number);
  4076. $core.addMethod(
  4077. $core.method({
  4078. selector: "<=",
  4079. protocol: 'comparing',
  4080. fn: function (aNumber){
  4081. var self=this;
  4082. return $core.withContext(function($ctx1) {
  4083. return self <= aNumber;
  4084. return self;
  4085. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4086. },
  4087. args: ["aNumber"],
  4088. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4089. referencedClasses: [],
  4090. messageSends: []
  4091. }),
  4092. $globals.Number);
  4093. $core.addMethod(
  4094. $core.method({
  4095. selector: "==",
  4096. protocol: 'comparing',
  4097. fn: function (aNumber){
  4098. var self=this;
  4099. return $core.withContext(function($ctx1) {
  4100. if (typeof aNumber === "number") return Number(self) === aNumber;
  4101. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4102. else return false;;
  4103. return self;
  4104. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4105. },
  4106. args: ["aNumber"],
  4107. 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'>",
  4108. referencedClasses: [],
  4109. messageSends: []
  4110. }),
  4111. $globals.Number);
  4112. $core.addMethod(
  4113. $core.method({
  4114. selector: ">",
  4115. protocol: 'comparing',
  4116. fn: function (aNumber){
  4117. var self=this;
  4118. return $core.withContext(function($ctx1) {
  4119. return self > aNumber;
  4120. return self;
  4121. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4122. },
  4123. args: ["aNumber"],
  4124. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  4125. referencedClasses: [],
  4126. messageSends: []
  4127. }),
  4128. $globals.Number);
  4129. $core.addMethod(
  4130. $core.method({
  4131. selector: ">=",
  4132. protocol: 'comparing',
  4133. fn: function (aNumber){
  4134. var self=this;
  4135. return $core.withContext(function($ctx1) {
  4136. return self >= aNumber;
  4137. return self;
  4138. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  4139. },
  4140. args: ["aNumber"],
  4141. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  4142. referencedClasses: [],
  4143. messageSends: []
  4144. }),
  4145. $globals.Number);
  4146. $core.addMethod(
  4147. $core.method({
  4148. selector: "@",
  4149. protocol: 'converting',
  4150. fn: function (aNumber){
  4151. var self=this;
  4152. return $core.withContext(function($ctx1) {
  4153. return $recv($globals.Point)._x_y_(self,aNumber);
  4154. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  4155. },
  4156. args: ["aNumber"],
  4157. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4158. referencedClasses: ["Point"],
  4159. messageSends: ["x:y:"]
  4160. }),
  4161. $globals.Number);
  4162. $core.addMethod(
  4163. $core.method({
  4164. selector: "\x5c\x5c",
  4165. protocol: 'arithmetic',
  4166. fn: function (aNumber){
  4167. var self=this;
  4168. return $core.withContext(function($ctx1) {
  4169. return self % aNumber;
  4170. return self;
  4171. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  4172. },
  4173. args: ["aNumber"],
  4174. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  4175. referencedClasses: [],
  4176. messageSends: []
  4177. }),
  4178. $globals.Number);
  4179. $core.addMethod(
  4180. $core.method({
  4181. selector: "abs",
  4182. protocol: 'arithmetic',
  4183. fn: function (){
  4184. var self=this;
  4185. return $core.withContext(function($ctx1) {
  4186. return Math.abs(self);;
  4187. return self;
  4188. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  4189. },
  4190. args: [],
  4191. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  4192. referencedClasses: [],
  4193. messageSends: []
  4194. }),
  4195. $globals.Number);
  4196. $core.addMethod(
  4197. $core.method({
  4198. selector: "arcCos",
  4199. protocol: 'mathematical functions',
  4200. fn: function (){
  4201. var self=this;
  4202. return $core.withContext(function($ctx1) {
  4203. return Math.acos(self);;
  4204. return self;
  4205. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  4206. },
  4207. args: [],
  4208. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  4209. referencedClasses: [],
  4210. messageSends: []
  4211. }),
  4212. $globals.Number);
  4213. $core.addMethod(
  4214. $core.method({
  4215. selector: "arcSin",
  4216. protocol: 'mathematical functions',
  4217. fn: function (){
  4218. var self=this;
  4219. return $core.withContext(function($ctx1) {
  4220. return Math.asin(self);;
  4221. return self;
  4222. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  4223. },
  4224. args: [],
  4225. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  4226. referencedClasses: [],
  4227. messageSends: []
  4228. }),
  4229. $globals.Number);
  4230. $core.addMethod(
  4231. $core.method({
  4232. selector: "arcTan",
  4233. protocol: 'mathematical functions',
  4234. fn: function (){
  4235. var self=this;
  4236. return $core.withContext(function($ctx1) {
  4237. return Math.atan(self);;
  4238. return self;
  4239. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  4240. },
  4241. args: [],
  4242. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  4243. referencedClasses: [],
  4244. messageSends: []
  4245. }),
  4246. $globals.Number);
  4247. $core.addMethod(
  4248. $core.method({
  4249. selector: "asJSON",
  4250. protocol: 'converting',
  4251. fn: function (){
  4252. var self=this;
  4253. return self;
  4254. },
  4255. args: [],
  4256. source: "asJSON\x0a\x09^ self",
  4257. referencedClasses: [],
  4258. messageSends: []
  4259. }),
  4260. $globals.Number);
  4261. $core.addMethod(
  4262. $core.method({
  4263. selector: "asJavascript",
  4264. protocol: 'converting',
  4265. fn: function (){
  4266. var self=this;
  4267. return $core.withContext(function($ctx1) {
  4268. var $1;
  4269. $1=$recv("(".__comma(self._printString())).__comma(")");
  4270. $ctx1.sendIdx[","]=1;
  4271. return $1;
  4272. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  4273. },
  4274. args: [],
  4275. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  4276. referencedClasses: [],
  4277. messageSends: [",", "printString"]
  4278. }),
  4279. $globals.Number);
  4280. $core.addMethod(
  4281. $core.method({
  4282. selector: "asNumber",
  4283. protocol: 'converting',
  4284. fn: function (){
  4285. var self=this;
  4286. return self;
  4287. },
  4288. args: [],
  4289. source: "asNumber\x0a\x09^ self",
  4290. referencedClasses: [],
  4291. messageSends: []
  4292. }),
  4293. $globals.Number);
  4294. $core.addMethod(
  4295. $core.method({
  4296. selector: "asPoint",
  4297. protocol: 'converting',
  4298. fn: function (){
  4299. var self=this;
  4300. return $core.withContext(function($ctx1) {
  4301. return $recv($globals.Point)._x_y_(self,self);
  4302. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  4303. },
  4304. args: [],
  4305. source: "asPoint\x0a\x09^ Point x: self y: self",
  4306. referencedClasses: ["Point"],
  4307. messageSends: ["x:y:"]
  4308. }),
  4309. $globals.Number);
  4310. $core.addMethod(
  4311. $core.method({
  4312. selector: "asString",
  4313. protocol: 'converting',
  4314. fn: function (){
  4315. var self=this;
  4316. return $core.withContext(function($ctx1) {
  4317. return String(self);
  4318. return self;
  4319. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  4320. },
  4321. args: [],
  4322. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  4323. referencedClasses: [],
  4324. messageSends: []
  4325. }),
  4326. $globals.Number);
  4327. $core.addMethod(
  4328. $core.method({
  4329. selector: "atRandom",
  4330. protocol: 'converting',
  4331. fn: function (){
  4332. var self=this;
  4333. return $core.withContext(function($ctx1) {
  4334. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  4335. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  4336. },
  4337. args: [],
  4338. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4339. referencedClasses: ["Random"],
  4340. messageSends: ["+", "truncated", "*", "next", "new"]
  4341. }),
  4342. $globals.Number);
  4343. $core.addMethod(
  4344. $core.method({
  4345. selector: "ceiling",
  4346. protocol: 'converting',
  4347. fn: function (){
  4348. var self=this;
  4349. return $core.withContext(function($ctx1) {
  4350. return Math.ceil(self);;
  4351. return self;
  4352. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  4353. },
  4354. args: [],
  4355. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  4356. referencedClasses: [],
  4357. messageSends: []
  4358. }),
  4359. $globals.Number);
  4360. $core.addMethod(
  4361. $core.method({
  4362. selector: "copy",
  4363. protocol: 'copying',
  4364. fn: function (){
  4365. var self=this;
  4366. return self;
  4367. },
  4368. args: [],
  4369. source: "copy\x0a\x09^ self",
  4370. referencedClasses: [],
  4371. messageSends: []
  4372. }),
  4373. $globals.Number);
  4374. $core.addMethod(
  4375. $core.method({
  4376. selector: "cos",
  4377. protocol: 'mathematical functions',
  4378. fn: function (){
  4379. var self=this;
  4380. return $core.withContext(function($ctx1) {
  4381. return Math.cos(self);;
  4382. return self;
  4383. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  4384. },
  4385. args: [],
  4386. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  4387. referencedClasses: [],
  4388. messageSends: []
  4389. }),
  4390. $globals.Number);
  4391. $core.addMethod(
  4392. $core.method({
  4393. selector: "deepCopy",
  4394. protocol: 'copying',
  4395. fn: function (){
  4396. var self=this;
  4397. return $core.withContext(function($ctx1) {
  4398. return self._copy();
  4399. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  4400. },
  4401. args: [],
  4402. source: "deepCopy\x0a\x09^ self copy",
  4403. referencedClasses: [],
  4404. messageSends: ["copy"]
  4405. }),
  4406. $globals.Number);
  4407. $core.addMethod(
  4408. $core.method({
  4409. selector: "even",
  4410. protocol: 'testing',
  4411. fn: function (){
  4412. var self=this;
  4413. return $core.withContext(function($ctx1) {
  4414. return (0).__eq(self.__backslash_backslash((2)));
  4415. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  4416. },
  4417. args: [],
  4418. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4419. referencedClasses: [],
  4420. messageSends: ["=", "\x5c\x5c"]
  4421. }),
  4422. $globals.Number);
  4423. $core.addMethod(
  4424. $core.method({
  4425. selector: "floor",
  4426. protocol: 'converting',
  4427. fn: function (){
  4428. var self=this;
  4429. return $core.withContext(function($ctx1) {
  4430. return Math.floor(self);;
  4431. return self;
  4432. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  4433. },
  4434. args: [],
  4435. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  4436. referencedClasses: [],
  4437. messageSends: []
  4438. }),
  4439. $globals.Number);
  4440. $core.addMethod(
  4441. $core.method({
  4442. selector: "isImmutable",
  4443. protocol: 'testing',
  4444. fn: function (){
  4445. var self=this;
  4446. return true;
  4447. },
  4448. args: [],
  4449. source: "isImmutable\x0a\x09^ true",
  4450. referencedClasses: [],
  4451. messageSends: []
  4452. }),
  4453. $globals.Number);
  4454. $core.addMethod(
  4455. $core.method({
  4456. selector: "isNumber",
  4457. protocol: 'testing',
  4458. fn: function (){
  4459. var self=this;
  4460. return true;
  4461. },
  4462. args: [],
  4463. source: "isNumber\x0a\x09^ true",
  4464. referencedClasses: [],
  4465. messageSends: []
  4466. }),
  4467. $globals.Number);
  4468. $core.addMethod(
  4469. $core.method({
  4470. selector: "isZero",
  4471. protocol: 'testing',
  4472. fn: function (){
  4473. var self=this;
  4474. return $core.withContext(function($ctx1) {
  4475. return self.__eq((0));
  4476. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  4477. },
  4478. args: [],
  4479. source: "isZero\x0a\x09^ self = 0",
  4480. referencedClasses: [],
  4481. messageSends: ["="]
  4482. }),
  4483. $globals.Number);
  4484. $core.addMethod(
  4485. $core.method({
  4486. selector: "ln",
  4487. protocol: 'mathematical functions',
  4488. fn: function (){
  4489. var self=this;
  4490. return $core.withContext(function($ctx1) {
  4491. return Math.log(self);;
  4492. return self;
  4493. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  4494. },
  4495. args: [],
  4496. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  4497. referencedClasses: [],
  4498. messageSends: []
  4499. }),
  4500. $globals.Number);
  4501. $core.addMethod(
  4502. $core.method({
  4503. selector: "log",
  4504. protocol: 'mathematical functions',
  4505. fn: function (){
  4506. var self=this;
  4507. return $core.withContext(function($ctx1) {
  4508. return Math.log(self) / Math.LN10;;
  4509. return self;
  4510. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  4511. },
  4512. args: [],
  4513. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  4514. referencedClasses: [],
  4515. messageSends: []
  4516. }),
  4517. $globals.Number);
  4518. $core.addMethod(
  4519. $core.method({
  4520. selector: "log:",
  4521. protocol: 'mathematical functions',
  4522. fn: function (aNumber){
  4523. var self=this;
  4524. return $core.withContext(function($ctx1) {
  4525. return Math.log(self) / Math.log(aNumber);;
  4526. return self;
  4527. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4528. },
  4529. args: ["aNumber"],
  4530. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  4531. referencedClasses: [],
  4532. messageSends: []
  4533. }),
  4534. $globals.Number);
  4535. $core.addMethod(
  4536. $core.method({
  4537. selector: "max:",
  4538. protocol: 'arithmetic',
  4539. fn: function (aNumber){
  4540. var self=this;
  4541. return $core.withContext(function($ctx1) {
  4542. return Math.max(self, aNumber);;
  4543. return self;
  4544. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4545. },
  4546. args: ["aNumber"],
  4547. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  4548. referencedClasses: [],
  4549. messageSends: []
  4550. }),
  4551. $globals.Number);
  4552. $core.addMethod(
  4553. $core.method({
  4554. selector: "min:",
  4555. protocol: 'arithmetic',
  4556. fn: function (aNumber){
  4557. var self=this;
  4558. return $core.withContext(function($ctx1) {
  4559. return Math.min(self, aNumber);;
  4560. return self;
  4561. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4562. },
  4563. args: ["aNumber"],
  4564. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  4565. referencedClasses: [],
  4566. messageSends: []
  4567. }),
  4568. $globals.Number);
  4569. $core.addMethod(
  4570. $core.method({
  4571. selector: "negated",
  4572. protocol: 'arithmetic',
  4573. fn: function (){
  4574. var self=this;
  4575. return $core.withContext(function($ctx1) {
  4576. return (0).__minus(self);
  4577. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4578. },
  4579. args: [],
  4580. source: "negated\x0a\x09^ 0 - self",
  4581. referencedClasses: [],
  4582. messageSends: ["-"]
  4583. }),
  4584. $globals.Number);
  4585. $core.addMethod(
  4586. $core.method({
  4587. selector: "negative",
  4588. protocol: 'testing',
  4589. fn: function (){
  4590. var self=this;
  4591. return $core.withContext(function($ctx1) {
  4592. return self.__lt((0));
  4593. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4594. },
  4595. args: [],
  4596. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4597. referencedClasses: [],
  4598. messageSends: ["<"]
  4599. }),
  4600. $globals.Number);
  4601. $core.addMethod(
  4602. $core.method({
  4603. selector: "odd",
  4604. protocol: 'testing',
  4605. fn: function (){
  4606. var self=this;
  4607. return $core.withContext(function($ctx1) {
  4608. return $recv(self._even())._not();
  4609. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4610. },
  4611. args: [],
  4612. source: "odd\x0a\x09^ self even not",
  4613. referencedClasses: [],
  4614. messageSends: ["not", "even"]
  4615. }),
  4616. $globals.Number);
  4617. $core.addMethod(
  4618. $core.method({
  4619. selector: "positive",
  4620. protocol: 'testing',
  4621. fn: function (){
  4622. var self=this;
  4623. return $core.withContext(function($ctx1) {
  4624. return self.__gt_eq((0));
  4625. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4626. },
  4627. args: [],
  4628. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4629. referencedClasses: [],
  4630. messageSends: [">="]
  4631. }),
  4632. $globals.Number);
  4633. $core.addMethod(
  4634. $core.method({
  4635. selector: "printOn:",
  4636. protocol: 'printing',
  4637. fn: function (aStream){
  4638. var self=this;
  4639. return $core.withContext(function($ctx1) {
  4640. $recv(aStream)._nextPutAll_(self._asString());
  4641. return self;
  4642. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4643. },
  4644. args: ["aStream"],
  4645. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4646. referencedClasses: [],
  4647. messageSends: ["nextPutAll:", "asString"]
  4648. }),
  4649. $globals.Number);
  4650. $core.addMethod(
  4651. $core.method({
  4652. selector: "printShowingDecimalPlaces:",
  4653. protocol: 'printing',
  4654. fn: function (placesDesired){
  4655. var self=this;
  4656. return $core.withContext(function($ctx1) {
  4657. return self.toFixed(placesDesired);
  4658. return self;
  4659. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4660. },
  4661. args: ["placesDesired"],
  4662. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  4663. referencedClasses: [],
  4664. messageSends: []
  4665. }),
  4666. $globals.Number);
  4667. $core.addMethod(
  4668. $core.method({
  4669. selector: "raisedTo:",
  4670. protocol: 'mathematical functions',
  4671. fn: function (exponent){
  4672. var self=this;
  4673. return $core.withContext(function($ctx1) {
  4674. return Math.pow(self, exponent);;
  4675. return self;
  4676. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4677. },
  4678. args: ["exponent"],
  4679. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  4680. referencedClasses: [],
  4681. messageSends: []
  4682. }),
  4683. $globals.Number);
  4684. $core.addMethod(
  4685. $core.method({
  4686. selector: "rounded",
  4687. protocol: 'converting',
  4688. fn: function (){
  4689. var self=this;
  4690. return $core.withContext(function($ctx1) {
  4691. return Math.round(self);;
  4692. return self;
  4693. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4694. },
  4695. args: [],
  4696. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  4697. referencedClasses: [],
  4698. messageSends: []
  4699. }),
  4700. $globals.Number);
  4701. $core.addMethod(
  4702. $core.method({
  4703. selector: "sign",
  4704. protocol: 'mathematical functions',
  4705. fn: function (){
  4706. var self=this;
  4707. return $core.withContext(function($ctx1) {
  4708. var $1,$2;
  4709. $1=self._isZero();
  4710. if($core.assert($1)){
  4711. return (0);
  4712. }
  4713. $2=self._positive();
  4714. if($core.assert($2)){
  4715. return (1);
  4716. } else {
  4717. return (-1);
  4718. }
  4719. return self;
  4720. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4721. },
  4722. args: [],
  4723. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4724. referencedClasses: [],
  4725. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4726. }),
  4727. $globals.Number);
  4728. $core.addMethod(
  4729. $core.method({
  4730. selector: "sin",
  4731. protocol: 'mathematical functions',
  4732. fn: function (){
  4733. var self=this;
  4734. return $core.withContext(function($ctx1) {
  4735. return Math.sin(self);;
  4736. return self;
  4737. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4738. },
  4739. args: [],
  4740. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  4741. referencedClasses: [],
  4742. messageSends: []
  4743. }),
  4744. $globals.Number);
  4745. $core.addMethod(
  4746. $core.method({
  4747. selector: "sqrt",
  4748. protocol: 'mathematical functions',
  4749. fn: function (){
  4750. var self=this;
  4751. return $core.withContext(function($ctx1) {
  4752. return Math.sqrt(self);
  4753. return self;
  4754. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4755. },
  4756. args: [],
  4757. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  4758. referencedClasses: [],
  4759. messageSends: []
  4760. }),
  4761. $globals.Number);
  4762. $core.addMethod(
  4763. $core.method({
  4764. selector: "squared",
  4765. protocol: 'mathematical functions',
  4766. fn: function (){
  4767. var self=this;
  4768. return $core.withContext(function($ctx1) {
  4769. return self.__star(self);
  4770. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4771. },
  4772. args: [],
  4773. source: "squared\x0a\x09^ self * self",
  4774. referencedClasses: [],
  4775. messageSends: ["*"]
  4776. }),
  4777. $globals.Number);
  4778. $core.addMethod(
  4779. $core.method({
  4780. selector: "tan",
  4781. protocol: 'mathematical functions',
  4782. fn: function (){
  4783. var self=this;
  4784. return $core.withContext(function($ctx1) {
  4785. return Math.tan(self);;
  4786. return self;
  4787. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4788. },
  4789. args: [],
  4790. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  4791. referencedClasses: [],
  4792. messageSends: []
  4793. }),
  4794. $globals.Number);
  4795. $core.addMethod(
  4796. $core.method({
  4797. selector: "timesRepeat:",
  4798. protocol: 'enumerating',
  4799. fn: function (aBlock){
  4800. var self=this;
  4801. var count;
  4802. return $core.withContext(function($ctx1) {
  4803. count=(1);
  4804. $recv((function(){
  4805. return $core.withContext(function($ctx2) {
  4806. return $recv(count).__gt(self);
  4807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4808. }))._whileFalse_((function(){
  4809. return $core.withContext(function($ctx2) {
  4810. $recv(aBlock)._value();
  4811. count=$recv(count).__plus((1));
  4812. return count;
  4813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4814. }));
  4815. return self;
  4816. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4817. },
  4818. args: ["aBlock"],
  4819. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4820. referencedClasses: [],
  4821. messageSends: ["whileFalse:", ">", "value", "+"]
  4822. }),
  4823. $globals.Number);
  4824. $core.addMethod(
  4825. $core.method({
  4826. selector: "to:",
  4827. protocol: 'converting',
  4828. fn: function (aNumber){
  4829. var self=this;
  4830. var array,first,last,count;
  4831. return $core.withContext(function($ctx1) {
  4832. first=self._truncated();
  4833. $ctx1.sendIdx["truncated"]=1;
  4834. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4835. $ctx1.sendIdx["+"]=1;
  4836. count=(1);
  4837. array=$recv($globals.Array)._new();
  4838. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4839. return $core.withContext(function($ctx2) {
  4840. $recv(array)._at_put_(count,first);
  4841. count=$recv(count).__plus((1));
  4842. $ctx2.sendIdx["+"]=2;
  4843. count;
  4844. first=$recv(first).__plus((1));
  4845. return first;
  4846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4847. }));
  4848. return array;
  4849. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4850. },
  4851. args: ["aNumber"],
  4852. 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",
  4853. referencedClasses: ["Array"],
  4854. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4855. }),
  4856. $globals.Number);
  4857. $core.addMethod(
  4858. $core.method({
  4859. selector: "to:by:",
  4860. protocol: 'converting',
  4861. fn: function (stop,step){
  4862. var self=this;
  4863. var array,value,pos;
  4864. return $core.withContext(function($ctx1) {
  4865. var $1,$2;
  4866. value=self;
  4867. array=$recv($globals.Array)._new();
  4868. pos=(1);
  4869. $1=$recv(step).__eq((0));
  4870. if($core.assert($1)){
  4871. self._error_("step must be non-zero");
  4872. }
  4873. $2=$recv(step).__lt((0));
  4874. if($core.assert($2)){
  4875. $recv((function(){
  4876. return $core.withContext(function($ctx2) {
  4877. return $recv(value).__gt_eq(stop);
  4878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4879. }))._whileTrue_((function(){
  4880. return $core.withContext(function($ctx2) {
  4881. $recv(array)._at_put_(pos,value);
  4882. $ctx2.sendIdx["at:put:"]=1;
  4883. pos=$recv(pos).__plus((1));
  4884. $ctx2.sendIdx["+"]=1;
  4885. pos;
  4886. value=$recv(value).__plus(step);
  4887. $ctx2.sendIdx["+"]=2;
  4888. return value;
  4889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4890. }));
  4891. $ctx1.sendIdx["whileTrue:"]=1;
  4892. } else {
  4893. $recv((function(){
  4894. return $core.withContext(function($ctx2) {
  4895. return $recv(value).__lt_eq(stop);
  4896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4897. }))._whileTrue_((function(){
  4898. return $core.withContext(function($ctx2) {
  4899. $recv(array)._at_put_(pos,value);
  4900. pos=$recv(pos).__plus((1));
  4901. $ctx2.sendIdx["+"]=3;
  4902. pos;
  4903. value=$recv(value).__plus(step);
  4904. return value;
  4905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4906. }));
  4907. }
  4908. return array;
  4909. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4910. },
  4911. args: ["stop", "step"],
  4912. 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",
  4913. referencedClasses: ["Array"],
  4914. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4915. }),
  4916. $globals.Number);
  4917. $core.addMethod(
  4918. $core.method({
  4919. selector: "to:by:do:",
  4920. protocol: 'enumerating',
  4921. fn: function (stop,step,aBlock){
  4922. var self=this;
  4923. var value;
  4924. return $core.withContext(function($ctx1) {
  4925. var $1,$2;
  4926. value=self;
  4927. $1=$recv(step).__eq((0));
  4928. if($core.assert($1)){
  4929. self._error_("step must be non-zero");
  4930. }
  4931. $2=$recv(step).__lt((0));
  4932. if($core.assert($2)){
  4933. $recv((function(){
  4934. return $core.withContext(function($ctx2) {
  4935. return $recv(value).__gt_eq(stop);
  4936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4937. }))._whileTrue_((function(){
  4938. return $core.withContext(function($ctx2) {
  4939. $recv(aBlock)._value_(value);
  4940. $ctx2.sendIdx["value:"]=1;
  4941. value=$recv(value).__plus(step);
  4942. $ctx2.sendIdx["+"]=1;
  4943. return value;
  4944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4945. }));
  4946. $ctx1.sendIdx["whileTrue:"]=1;
  4947. } else {
  4948. $recv((function(){
  4949. return $core.withContext(function($ctx2) {
  4950. return $recv(value).__lt_eq(stop);
  4951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4952. }))._whileTrue_((function(){
  4953. return $core.withContext(function($ctx2) {
  4954. $recv(aBlock)._value_(value);
  4955. value=$recv(value).__plus(step);
  4956. return value;
  4957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4958. }));
  4959. }
  4960. return self;
  4961. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4962. },
  4963. args: ["stop", "step", "aBlock"],
  4964. 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 ]]",
  4965. referencedClasses: [],
  4966. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4967. }),
  4968. $globals.Number);
  4969. $core.addMethod(
  4970. $core.method({
  4971. selector: "to:do:",
  4972. protocol: 'enumerating',
  4973. fn: function (stop,aBlock){
  4974. var self=this;
  4975. var nextValue;
  4976. return $core.withContext(function($ctx1) {
  4977. nextValue=self;
  4978. $recv((function(){
  4979. return $core.withContext(function($ctx2) {
  4980. return $recv(nextValue).__lt_eq(stop);
  4981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4982. }))._whileTrue_((function(){
  4983. return $core.withContext(function($ctx2) {
  4984. $recv(aBlock)._value_(nextValue);
  4985. nextValue=$recv(nextValue).__plus((1));
  4986. return nextValue;
  4987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4988. }));
  4989. return self;
  4990. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  4991. },
  4992. args: ["stop", "aBlock"],
  4993. 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 ]",
  4994. referencedClasses: [],
  4995. messageSends: ["whileTrue:", "<=", "value:", "+"]
  4996. }),
  4997. $globals.Number);
  4998. $core.addMethod(
  4999. $core.method({
  5000. selector: "truncated",
  5001. protocol: 'converting',
  5002. fn: function (){
  5003. var self=this;
  5004. return $core.withContext(function($ctx1) {
  5005. if(self >= 0) {
  5006. return Math.floor(self);
  5007. } else {
  5008. return Math.floor(self * (-1)) * (-1);
  5009. };
  5010. ;
  5011. return self;
  5012. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5013. },
  5014. args: [],
  5015. 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'>",
  5016. referencedClasses: [],
  5017. messageSends: []
  5018. }),
  5019. $globals.Number);
  5020. $core.addMethod(
  5021. $core.method({
  5022. selector: "|",
  5023. protocol: 'converting',
  5024. fn: function (aNumber){
  5025. var self=this;
  5026. return $core.withContext(function($ctx1) {
  5027. return self | aNumber;
  5028. return self;
  5029. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  5030. },
  5031. args: ["aNumber"],
  5032. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5033. referencedClasses: [],
  5034. messageSends: []
  5035. }),
  5036. $globals.Number);
  5037. $core.addMethod(
  5038. $core.method({
  5039. selector: "classTag",
  5040. protocol: 'accessing',
  5041. fn: function (){
  5042. var self=this;
  5043. return "magnitude";
  5044. },
  5045. args: [],
  5046. 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'",
  5047. referencedClasses: [],
  5048. messageSends: []
  5049. }),
  5050. $globals.Number.klass);
  5051. $core.addMethod(
  5052. $core.method({
  5053. selector: "e",
  5054. protocol: 'instance creation',
  5055. fn: function (){
  5056. var self=this;
  5057. return $core.withContext(function($ctx1) {
  5058. return Math.E;;
  5059. return self;
  5060. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  5061. },
  5062. args: [],
  5063. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  5064. referencedClasses: [],
  5065. messageSends: []
  5066. }),
  5067. $globals.Number.klass);
  5068. $core.addMethod(
  5069. $core.method({
  5070. selector: "pi",
  5071. protocol: 'instance creation',
  5072. fn: function (){
  5073. var self=this;
  5074. return $core.withContext(function($ctx1) {
  5075. return Math.PI;
  5076. return self;
  5077. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  5078. },
  5079. args: [],
  5080. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  5081. referencedClasses: [],
  5082. messageSends: []
  5083. }),
  5084. $globals.Number.klass);
  5085. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  5086. $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";
  5087. $core.addMethod(
  5088. $core.method({
  5089. selector: "*",
  5090. protocol: 'arithmetic',
  5091. fn: function (aPoint){
  5092. var self=this;
  5093. return $core.withContext(function($ctx1) {
  5094. var $2,$4,$3,$1,$6,$5;
  5095. $2=self._x();
  5096. $ctx1.sendIdx["x"]=1;
  5097. $4=$recv(aPoint)._asPoint();
  5098. $ctx1.sendIdx["asPoint"]=1;
  5099. $3=$recv($4)._x();
  5100. $1=$recv($2).__star($3);
  5101. $ctx1.sendIdx["*"]=1;
  5102. $6=self._y();
  5103. $ctx1.sendIdx["y"]=1;
  5104. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  5105. return $recv($globals.Point)._x_y_($1,$5);
  5106. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  5107. },
  5108. args: ["aPoint"],
  5109. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5110. referencedClasses: ["Point"],
  5111. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5112. }),
  5113. $globals.Point);
  5114. $core.addMethod(
  5115. $core.method({
  5116. selector: "+",
  5117. protocol: 'arithmetic',
  5118. fn: function (aPoint){
  5119. var self=this;
  5120. return $core.withContext(function($ctx1) {
  5121. var $2,$4,$3,$1,$6,$5;
  5122. $2=self._x();
  5123. $ctx1.sendIdx["x"]=1;
  5124. $4=$recv(aPoint)._asPoint();
  5125. $ctx1.sendIdx["asPoint"]=1;
  5126. $3=$recv($4)._x();
  5127. $1=$recv($2).__plus($3);
  5128. $ctx1.sendIdx["+"]=1;
  5129. $6=self._y();
  5130. $ctx1.sendIdx["y"]=1;
  5131. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  5132. return $recv($globals.Point)._x_y_($1,$5);
  5133. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  5134. },
  5135. args: ["aPoint"],
  5136. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5137. referencedClasses: ["Point"],
  5138. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  5139. }),
  5140. $globals.Point);
  5141. $core.addMethod(
  5142. $core.method({
  5143. selector: "-",
  5144. protocol: 'arithmetic',
  5145. fn: function (aPoint){
  5146. var self=this;
  5147. return $core.withContext(function($ctx1) {
  5148. var $2,$4,$3,$1,$6,$5;
  5149. $2=self._x();
  5150. $ctx1.sendIdx["x"]=1;
  5151. $4=$recv(aPoint)._asPoint();
  5152. $ctx1.sendIdx["asPoint"]=1;
  5153. $3=$recv($4)._x();
  5154. $1=$recv($2).__minus($3);
  5155. $ctx1.sendIdx["-"]=1;
  5156. $6=self._y();
  5157. $ctx1.sendIdx["y"]=1;
  5158. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  5159. return $recv($globals.Point)._x_y_($1,$5);
  5160. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  5161. },
  5162. args: ["aPoint"],
  5163. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5164. referencedClasses: ["Point"],
  5165. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  5166. }),
  5167. $globals.Point);
  5168. $core.addMethod(
  5169. $core.method({
  5170. selector: "/",
  5171. protocol: 'arithmetic',
  5172. fn: function (aPoint){
  5173. var self=this;
  5174. return $core.withContext(function($ctx1) {
  5175. var $2,$4,$3,$1,$6,$5;
  5176. $2=self._x();
  5177. $ctx1.sendIdx["x"]=1;
  5178. $4=$recv(aPoint)._asPoint();
  5179. $ctx1.sendIdx["asPoint"]=1;
  5180. $3=$recv($4)._x();
  5181. $1=$recv($2).__slash($3);
  5182. $ctx1.sendIdx["/"]=1;
  5183. $6=self._y();
  5184. $ctx1.sendIdx["y"]=1;
  5185. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  5186. return $recv($globals.Point)._x_y_($1,$5);
  5187. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  5188. },
  5189. args: ["aPoint"],
  5190. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5191. referencedClasses: ["Point"],
  5192. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  5193. }),
  5194. $globals.Point);
  5195. $core.addMethod(
  5196. $core.method({
  5197. selector: "<",
  5198. protocol: 'comparing',
  5199. fn: function (aPoint){
  5200. var self=this;
  5201. return $core.withContext(function($ctx1) {
  5202. var $2,$1,$3;
  5203. $2=self._x();
  5204. $ctx1.sendIdx["x"]=1;
  5205. $1=$recv($2).__lt($recv(aPoint)._x());
  5206. $ctx1.sendIdx["<"]=1;
  5207. return $recv($1)._and_((function(){
  5208. return $core.withContext(function($ctx2) {
  5209. $3=self._y();
  5210. $ctx2.sendIdx["y"]=1;
  5211. return $recv($3).__lt($recv(aPoint)._y());
  5212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5213. }));
  5214. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  5215. },
  5216. args: ["aPoint"],
  5217. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  5218. referencedClasses: [],
  5219. messageSends: ["and:", "<", "x", "y"]
  5220. }),
  5221. $globals.Point);
  5222. $core.addMethod(
  5223. $core.method({
  5224. selector: "<=",
  5225. protocol: 'comparing',
  5226. fn: function (aPoint){
  5227. var self=this;
  5228. return $core.withContext(function($ctx1) {
  5229. var $2,$1,$3;
  5230. $2=self._x();
  5231. $ctx1.sendIdx["x"]=1;
  5232. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  5233. $ctx1.sendIdx["<="]=1;
  5234. return $recv($1)._and_((function(){
  5235. return $core.withContext(function($ctx2) {
  5236. $3=self._y();
  5237. $ctx2.sendIdx["y"]=1;
  5238. return $recv($3).__lt_eq($recv(aPoint)._y());
  5239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5240. }));
  5241. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  5242. },
  5243. args: ["aPoint"],
  5244. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  5245. referencedClasses: [],
  5246. messageSends: ["and:", "<=", "x", "y"]
  5247. }),
  5248. $globals.Point);
  5249. $core.addMethod(
  5250. $core.method({
  5251. selector: "=",
  5252. protocol: 'comparing',
  5253. fn: function (aPoint){
  5254. var self=this;
  5255. return $core.withContext(function($ctx1) {
  5256. var $2,$1,$4,$3,$6,$5;
  5257. $2=$recv(aPoint)._class();
  5258. $ctx1.sendIdx["class"]=1;
  5259. $1=$recv($2).__eq(self._class());
  5260. $ctx1.sendIdx["="]=1;
  5261. return $recv($1)._and_((function(){
  5262. return $core.withContext(function($ctx2) {
  5263. $4=$recv(aPoint)._x();
  5264. $ctx2.sendIdx["x"]=1;
  5265. $3=$recv($4).__eq(self._x());
  5266. $ctx2.sendIdx["="]=2;
  5267. $6=$recv(aPoint)._y();
  5268. $ctx2.sendIdx["y"]=1;
  5269. $5=$recv($6).__eq(self._y());
  5270. return $recv($3).__and($5);
  5271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5272. }));
  5273. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  5274. },
  5275. args: ["aPoint"],
  5276. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  5277. referencedClasses: [],
  5278. messageSends: ["and:", "=", "class", "&", "x", "y"]
  5279. }),
  5280. $globals.Point);
  5281. $core.addMethod(
  5282. $core.method({
  5283. selector: ">",
  5284. protocol: 'comparing',
  5285. fn: function (aPoint){
  5286. var self=this;
  5287. return $core.withContext(function($ctx1) {
  5288. var $2,$1,$3;
  5289. $2=self._x();
  5290. $ctx1.sendIdx["x"]=1;
  5291. $1=$recv($2).__gt($recv(aPoint)._x());
  5292. $ctx1.sendIdx[">"]=1;
  5293. return $recv($1)._and_((function(){
  5294. return $core.withContext(function($ctx2) {
  5295. $3=self._y();
  5296. $ctx2.sendIdx["y"]=1;
  5297. return $recv($3).__gt($recv(aPoint)._y());
  5298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5299. }));
  5300. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  5301. },
  5302. args: ["aPoint"],
  5303. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  5304. referencedClasses: [],
  5305. messageSends: ["and:", ">", "x", "y"]
  5306. }),
  5307. $globals.Point);
  5308. $core.addMethod(
  5309. $core.method({
  5310. selector: ">=",
  5311. protocol: 'comparing',
  5312. fn: function (aPoint){
  5313. var self=this;
  5314. return $core.withContext(function($ctx1) {
  5315. var $2,$1,$3;
  5316. $2=self._x();
  5317. $ctx1.sendIdx["x"]=1;
  5318. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  5319. $ctx1.sendIdx[">="]=1;
  5320. return $recv($1)._and_((function(){
  5321. return $core.withContext(function($ctx2) {
  5322. $3=self._y();
  5323. $ctx2.sendIdx["y"]=1;
  5324. return $recv($3).__gt_eq($recv(aPoint)._y());
  5325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5326. }));
  5327. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  5328. },
  5329. args: ["aPoint"],
  5330. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  5331. referencedClasses: [],
  5332. messageSends: ["and:", ">=", "x", "y"]
  5333. }),
  5334. $globals.Point);
  5335. $core.addMethod(
  5336. $core.method({
  5337. selector: "asPoint",
  5338. protocol: 'converting',
  5339. fn: function (){
  5340. var self=this;
  5341. return self;
  5342. },
  5343. args: [],
  5344. source: "asPoint\x0a\x09^ self",
  5345. referencedClasses: [],
  5346. messageSends: []
  5347. }),
  5348. $globals.Point);
  5349. $core.addMethod(
  5350. $core.method({
  5351. selector: "dist:",
  5352. protocol: 'transforming',
  5353. fn: function (aPoint){
  5354. var self=this;
  5355. var dx,dy;
  5356. return $core.withContext(function($ctx1) {
  5357. var $2,$1;
  5358. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  5359. $ctx1.sendIdx["-"]=1;
  5360. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  5361. $2=$recv(dx).__star(dx);
  5362. $ctx1.sendIdx["*"]=1;
  5363. $1=$recv($2).__plus($recv(dy).__star(dy));
  5364. return $recv($1)._sqrt();
  5365. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  5366. },
  5367. args: ["aPoint"],
  5368. 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",
  5369. referencedClasses: [],
  5370. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  5371. }),
  5372. $globals.Point);
  5373. $core.addMethod(
  5374. $core.method({
  5375. selector: "printOn:",
  5376. protocol: 'printing',
  5377. fn: function (aStream){
  5378. var self=this;
  5379. return $core.withContext(function($ctx1) {
  5380. var $1;
  5381. $recv(self["@x"])._printOn_(aStream);
  5382. $ctx1.sendIdx["printOn:"]=1;
  5383. $recv(aStream)._nextPutAll_("@");
  5384. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  5385. return $core.withContext(function($ctx2) {
  5386. return $recv(self["@y"])._negative();
  5387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5388. }));
  5389. if($core.assert($1)){
  5390. $recv(aStream)._space();
  5391. }
  5392. $recv(self["@y"])._printOn_(aStream);
  5393. return self;
  5394. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  5395. },
  5396. args: ["aStream"],
  5397. 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",
  5398. referencedClasses: [],
  5399. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  5400. }),
  5401. $globals.Point);
  5402. $core.addMethod(
  5403. $core.method({
  5404. selector: "translateBy:",
  5405. protocol: 'transforming',
  5406. fn: function (delta){
  5407. var self=this;
  5408. return $core.withContext(function($ctx1) {
  5409. var $1;
  5410. $1=$recv($recv(delta)._x()).__plus(self["@x"]);
  5411. $ctx1.sendIdx["+"]=1;
  5412. return $recv($1).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  5413. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  5414. },
  5415. args: ["delta"],
  5416. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  5417. referencedClasses: [],
  5418. messageSends: ["@", "+", "x", "y"]
  5419. }),
  5420. $globals.Point);
  5421. $core.addMethod(
  5422. $core.method({
  5423. selector: "x",
  5424. protocol: 'accessing',
  5425. fn: function (){
  5426. var self=this;
  5427. return self["@x"];
  5428. },
  5429. args: [],
  5430. source: "x\x0a\x09^ x",
  5431. referencedClasses: [],
  5432. messageSends: []
  5433. }),
  5434. $globals.Point);
  5435. $core.addMethod(
  5436. $core.method({
  5437. selector: "x:",
  5438. protocol: 'accessing',
  5439. fn: function (aNumber){
  5440. var self=this;
  5441. self["@x"]=aNumber;
  5442. return self;
  5443. },
  5444. args: ["aNumber"],
  5445. source: "x: aNumber\x0a\x09x := aNumber",
  5446. referencedClasses: [],
  5447. messageSends: []
  5448. }),
  5449. $globals.Point);
  5450. $core.addMethod(
  5451. $core.method({
  5452. selector: "y",
  5453. protocol: 'accessing',
  5454. fn: function (){
  5455. var self=this;
  5456. return self["@y"];
  5457. },
  5458. args: [],
  5459. source: "y\x0a\x09^ y",
  5460. referencedClasses: [],
  5461. messageSends: []
  5462. }),
  5463. $globals.Point);
  5464. $core.addMethod(
  5465. $core.method({
  5466. selector: "y:",
  5467. protocol: 'accessing',
  5468. fn: function (aNumber){
  5469. var self=this;
  5470. self["@y"]=aNumber;
  5471. return self;
  5472. },
  5473. args: ["aNumber"],
  5474. source: "y: aNumber\x0a\x09y := aNumber",
  5475. referencedClasses: [],
  5476. messageSends: []
  5477. }),
  5478. $globals.Point);
  5479. $core.addMethod(
  5480. $core.method({
  5481. selector: "classTag",
  5482. protocol: 'accessing',
  5483. fn: function (){
  5484. var self=this;
  5485. return "magnitude";
  5486. },
  5487. args: [],
  5488. 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'",
  5489. referencedClasses: [],
  5490. messageSends: []
  5491. }),
  5492. $globals.Point.klass);
  5493. $core.addMethod(
  5494. $core.method({
  5495. selector: "x:y:",
  5496. protocol: 'instance creation',
  5497. fn: function (aNumber,anotherNumber){
  5498. var self=this;
  5499. return $core.withContext(function($ctx1) {
  5500. var $1;
  5501. $1=self._new();
  5502. $recv($1)._x_(aNumber);
  5503. $recv($1)._y_(anotherNumber);
  5504. return $recv($1)._yourself();
  5505. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5506. },
  5507. args: ["aNumber", "anotherNumber"],
  5508. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5509. referencedClasses: [],
  5510. messageSends: ["x:", "new", "y:", "yourself"]
  5511. }),
  5512. $globals.Point.klass);
  5513. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  5514. $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'`.";
  5515. $core.addMethod(
  5516. $core.method({
  5517. selector: "next",
  5518. protocol: 'accessing',
  5519. fn: function (){
  5520. var self=this;
  5521. return $core.withContext(function($ctx1) {
  5522. return Math.random();
  5523. return self;
  5524. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5525. },
  5526. args: [],
  5527. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  5528. referencedClasses: [],
  5529. messageSends: []
  5530. }),
  5531. $globals.Random);
  5532. $core.addMethod(
  5533. $core.method({
  5534. selector: "next:",
  5535. protocol: 'accessing',
  5536. fn: function (anInteger){
  5537. var self=this;
  5538. return $core.withContext(function($ctx1) {
  5539. return $recv((1)._to_(anInteger))._collect_((function(each){
  5540. return $core.withContext(function($ctx2) {
  5541. return self._next();
  5542. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5543. }));
  5544. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5545. },
  5546. args: ["anInteger"],
  5547. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5548. referencedClasses: [],
  5549. messageSends: ["collect:", "to:", "next"]
  5550. }),
  5551. $globals.Random);
  5552. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  5553. $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`.";
  5554. $core.addMethod(
  5555. $core.method({
  5556. selector: "asJSON",
  5557. protocol: 'converting',
  5558. fn: function (){
  5559. var self=this;
  5560. return null;
  5561. },
  5562. args: [],
  5563. source: "asJSON\x0a\x09^ null",
  5564. referencedClasses: [],
  5565. messageSends: []
  5566. }),
  5567. $globals.UndefinedObject);
  5568. $core.addMethod(
  5569. $core.method({
  5570. selector: "deepCopy",
  5571. protocol: 'copying',
  5572. fn: function (){
  5573. var self=this;
  5574. return self;
  5575. },
  5576. args: [],
  5577. source: "deepCopy\x0a\x09^ self",
  5578. referencedClasses: [],
  5579. messageSends: []
  5580. }),
  5581. $globals.UndefinedObject);
  5582. $core.addMethod(
  5583. $core.method({
  5584. selector: "ifNil:",
  5585. protocol: 'testing',
  5586. fn: function (aBlock){
  5587. var self=this;
  5588. return $core.withContext(function($ctx1) {
  5589. return self._ifNil_ifNotNil_(aBlock,(function(){
  5590. }));
  5591. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5592. },
  5593. args: ["aBlock"],
  5594. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5595. referencedClasses: [],
  5596. messageSends: ["ifNil:ifNotNil:"]
  5597. }),
  5598. $globals.UndefinedObject);
  5599. $core.addMethod(
  5600. $core.method({
  5601. selector: "ifNil:ifNotNil:",
  5602. protocol: 'testing',
  5603. fn: function (aBlock,anotherBlock){
  5604. var self=this;
  5605. return $core.withContext(function($ctx1) {
  5606. return $recv(aBlock)._value();
  5607. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5608. },
  5609. args: ["aBlock", "anotherBlock"],
  5610. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5611. referencedClasses: [],
  5612. messageSends: ["value"]
  5613. }),
  5614. $globals.UndefinedObject);
  5615. $core.addMethod(
  5616. $core.method({
  5617. selector: "ifNotNil:",
  5618. protocol: 'testing',
  5619. fn: function (aBlock){
  5620. var self=this;
  5621. return self;
  5622. },
  5623. args: ["aBlock"],
  5624. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5625. referencedClasses: [],
  5626. messageSends: []
  5627. }),
  5628. $globals.UndefinedObject);
  5629. $core.addMethod(
  5630. $core.method({
  5631. selector: "ifNotNil:ifNil:",
  5632. protocol: 'testing',
  5633. fn: function (aBlock,anotherBlock){
  5634. var self=this;
  5635. return $core.withContext(function($ctx1) {
  5636. return $recv(anotherBlock)._value();
  5637. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5638. },
  5639. args: ["aBlock", "anotherBlock"],
  5640. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5641. referencedClasses: [],
  5642. messageSends: ["value"]
  5643. }),
  5644. $globals.UndefinedObject);
  5645. $core.addMethod(
  5646. $core.method({
  5647. selector: "isImmutable",
  5648. protocol: 'testing',
  5649. fn: function (){
  5650. var self=this;
  5651. return true;
  5652. },
  5653. args: [],
  5654. source: "isImmutable\x0a\x09^ true",
  5655. referencedClasses: [],
  5656. messageSends: []
  5657. }),
  5658. $globals.UndefinedObject);
  5659. $core.addMethod(
  5660. $core.method({
  5661. selector: "isNil",
  5662. protocol: 'testing',
  5663. fn: function (){
  5664. var self=this;
  5665. return true;
  5666. },
  5667. args: [],
  5668. source: "isNil\x0a\x09^ true",
  5669. referencedClasses: [],
  5670. messageSends: []
  5671. }),
  5672. $globals.UndefinedObject);
  5673. $core.addMethod(
  5674. $core.method({
  5675. selector: "notNil",
  5676. protocol: 'testing',
  5677. fn: function (){
  5678. var self=this;
  5679. return false;
  5680. },
  5681. args: [],
  5682. source: "notNil\x0a\x09^ false",
  5683. referencedClasses: [],
  5684. messageSends: []
  5685. }),
  5686. $globals.UndefinedObject);
  5687. $core.addMethod(
  5688. $core.method({
  5689. selector: "printOn:",
  5690. protocol: 'printing',
  5691. fn: function (aStream){
  5692. var self=this;
  5693. return $core.withContext(function($ctx1) {
  5694. $recv(aStream)._nextPutAll_("nil");
  5695. return self;
  5696. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5697. },
  5698. args: ["aStream"],
  5699. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5700. referencedClasses: [],
  5701. messageSends: ["nextPutAll:"]
  5702. }),
  5703. $globals.UndefinedObject);
  5704. $core.addMethod(
  5705. $core.method({
  5706. selector: "shallowCopy",
  5707. protocol: 'copying',
  5708. fn: function (){
  5709. var self=this;
  5710. return self;
  5711. },
  5712. args: [],
  5713. source: "shallowCopy\x0a\x09^ self",
  5714. referencedClasses: [],
  5715. messageSends: []
  5716. }),
  5717. $globals.UndefinedObject);
  5718. $core.addMethod(
  5719. $core.method({
  5720. selector: "subclass:instanceVariableNames:",
  5721. protocol: 'class creation',
  5722. fn: function (aString,anotherString){
  5723. var self=this;
  5724. return $core.withContext(function($ctx1) {
  5725. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5726. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5727. },
  5728. args: ["aString", "anotherString"],
  5729. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5730. referencedClasses: [],
  5731. messageSends: ["subclass:instanceVariableNames:package:"]
  5732. }),
  5733. $globals.UndefinedObject);
  5734. $core.addMethod(
  5735. $core.method({
  5736. selector: "subclass:instanceVariableNames:category:",
  5737. protocol: 'class creation',
  5738. fn: function (aString,aString2,aString3){
  5739. var self=this;
  5740. return $core.withContext(function($ctx1) {
  5741. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5742. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5743. },
  5744. args: ["aString", "aString2", "aString3"],
  5745. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5746. referencedClasses: [],
  5747. messageSends: ["subclass:instanceVariableNames:package:"]
  5748. }),
  5749. $globals.UndefinedObject);
  5750. $core.addMethod(
  5751. $core.method({
  5752. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5753. protocol: 'class creation',
  5754. fn: function (aString,aString2,classVars,pools,aString3){
  5755. var self=this;
  5756. return $core.withContext(function($ctx1) {
  5757. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5758. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5759. },
  5760. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5761. 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",
  5762. referencedClasses: [],
  5763. messageSends: ["subclass:instanceVariableNames:package:"]
  5764. }),
  5765. $globals.UndefinedObject);
  5766. $core.addMethod(
  5767. $core.method({
  5768. selector: "subclass:instanceVariableNames:package:",
  5769. protocol: 'class creation',
  5770. fn: function (aString,aString2,aString3){
  5771. var self=this;
  5772. return $core.withContext(function($ctx1) {
  5773. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5774. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5775. },
  5776. args: ["aString", "aString2", "aString3"],
  5777. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5778. referencedClasses: ["ClassBuilder"],
  5779. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5780. }),
  5781. $globals.UndefinedObject);
  5782. $core.addMethod(
  5783. $core.method({
  5784. selector: "new",
  5785. protocol: 'instance creation',
  5786. fn: function (){
  5787. var self=this;
  5788. return $core.withContext(function($ctx1) {
  5789. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5790. return self;
  5791. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5792. },
  5793. args: [],
  5794. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5795. referencedClasses: [],
  5796. messageSends: ["error:"]
  5797. }),
  5798. $globals.UndefinedObject.klass);
  5799. });
  5800. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  5801. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  5802. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  5803. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  5804. $core.addPackage('Kernel-Classes');
  5805. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5806. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5807. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5808. $globals.Behavior.comment="I am the superclass of all class objects.\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, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
  5809. $core.addMethod(
  5810. $core.method({
  5811. selector: ">>",
  5812. protocol: 'accessing',
  5813. fn: function (aString){
  5814. var self=this;
  5815. return $core.withContext(function($ctx1) {
  5816. return self._methodAt_(aString);
  5817. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5818. },
  5819. args: ["aString"],
  5820. source: ">> aString\x0a\x09^ self methodAt: aString",
  5821. referencedClasses: [],
  5822. messageSends: ["methodAt:"]
  5823. }),
  5824. $globals.Behavior);
  5825. $core.addMethod(
  5826. $core.method({
  5827. selector: "addCompiledMethod:",
  5828. protocol: 'compiling',
  5829. fn: function (aMethod){
  5830. var self=this;
  5831. var oldMethod,announcement;
  5832. return $core.withContext(function($ctx1) {
  5833. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  5834. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5835. return nil;
  5836. }));
  5837. $2=self._protocols();
  5838. $3=$recv(aMethod)._protocol();
  5839. $ctx1.sendIdx["protocol"]=1;
  5840. $1=$recv($2)._includes_($3);
  5841. if(!$core.assert($1)){
  5842. $4=self._organization();
  5843. $5=$recv(aMethod)._protocol();
  5844. $ctx1.sendIdx["protocol"]=2;
  5845. $recv($4)._addElement_($5);
  5846. }
  5847. self._basicAddCompiledMethod_(aMethod);
  5848. $6=oldMethod;
  5849. if(($receiver = $6) == null || $receiver.isNil){
  5850. $6;
  5851. } else {
  5852. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5853. }
  5854. $7=oldMethod;
  5855. if(($receiver = $7) == null || $receiver.isNil){
  5856. $8=$recv($globals.MethodAdded)._new();
  5857. $ctx1.sendIdx["new"]=1;
  5858. $recv($8)._method_(aMethod);
  5859. $ctx1.sendIdx["method:"]=1;
  5860. $9=$recv($8)._yourself();
  5861. $ctx1.sendIdx["yourself"]=1;
  5862. announcement=$9;
  5863. } else {
  5864. $10=$recv($globals.MethodModified)._new();
  5865. $recv($10)._oldMethod_(oldMethod);
  5866. $recv($10)._method_(aMethod);
  5867. announcement=$recv($10)._yourself();
  5868. }
  5869. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  5870. return self;
  5871. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5872. },
  5873. args: ["aMethod"],
  5874. 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",
  5875. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5876. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5877. }),
  5878. $globals.Behavior);
  5879. $core.addMethod(
  5880. $core.method({
  5881. selector: "allInstanceVariableNames",
  5882. protocol: 'accessing',
  5883. fn: function (){
  5884. var self=this;
  5885. var result;
  5886. return $core.withContext(function($ctx1) {
  5887. var $1,$receiver;
  5888. result=$recv(self._instanceVariableNames())._copy();
  5889. $1=self._superclass();
  5890. $ctx1.sendIdx["superclass"]=1;
  5891. if(($receiver = $1) == null || $receiver.isNil){
  5892. $1;
  5893. } else {
  5894. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5895. }
  5896. return result;
  5897. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5898. },
  5899. args: [],
  5900. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5901. referencedClasses: [],
  5902. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5903. }),
  5904. $globals.Behavior);
  5905. $core.addMethod(
  5906. $core.method({
  5907. selector: "allSelectors",
  5908. protocol: 'accessing',
  5909. fn: function (){
  5910. var self=this;
  5911. return $core.withContext(function($ctx1) {
  5912. var $1,$2;
  5913. $1=self._allSuperclasses();
  5914. $2=self._selectors();
  5915. $ctx1.sendIdx["selectors"]=1;
  5916. return $recv($1)._inject_into_($2,(function(acc,each){
  5917. return $core.withContext(function($ctx2) {
  5918. $recv(acc)._addAll_($recv(each)._selectors());
  5919. return $recv(acc)._yourself();
  5920. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5921. }));
  5922. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5923. },
  5924. args: [],
  5925. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5926. referencedClasses: [],
  5927. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5928. }),
  5929. $globals.Behavior);
  5930. $core.addMethod(
  5931. $core.method({
  5932. selector: "allSubclasses",
  5933. protocol: 'accessing',
  5934. fn: function (){
  5935. var self=this;
  5936. return $core.withContext(function($ctx1) {
  5937. return $recv($globals.Array)._streamContents_((function(str){
  5938. return $core.withContext(function($ctx2) {
  5939. return self._allSubclassesDo_((function(each){
  5940. return $core.withContext(function($ctx3) {
  5941. return $recv(str)._nextPut_(each);
  5942. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5943. }));
  5944. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  5945. }));
  5946. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  5947. },
  5948. args: [],
  5949. 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 ] ]",
  5950. referencedClasses: ["Array"],
  5951. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  5952. }),
  5953. $globals.Behavior);
  5954. $core.addMethod(
  5955. $core.method({
  5956. selector: "allSubclassesDo:",
  5957. protocol: 'enumerating',
  5958. fn: function (aBlock){
  5959. var self=this;
  5960. return $core.withContext(function($ctx1) {
  5961. $core.traverseClassTree(self, function(subclass) {
  5962. if (subclass !== self) aBlock._value_(subclass);
  5963. });
  5964. return self;
  5965. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5966. },
  5967. args: ["aBlock"],
  5968. 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})'>",
  5969. referencedClasses: [],
  5970. messageSends: []
  5971. }),
  5972. $globals.Behavior);
  5973. $core.addMethod(
  5974. $core.method({
  5975. selector: "allSuperclasses",
  5976. protocol: 'accessing',
  5977. fn: function (){
  5978. var self=this;
  5979. return $core.withContext(function($ctx1) {
  5980. var $1,$3,$2,$receiver;
  5981. $1=self._superclass();
  5982. $ctx1.sendIdx["superclass"]=1;
  5983. if(($receiver = $1) == null || $receiver.isNil){
  5984. return [];
  5985. } else {
  5986. $1;
  5987. }
  5988. $3=self._superclass();
  5989. $ctx1.sendIdx["superclass"]=2;
  5990. $2=$recv($globals.OrderedCollection)._with_($3);
  5991. $recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
  5992. return $recv($2)._yourself();
  5993. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  5994. },
  5995. args: [],
  5996. 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",
  5997. referencedClasses: ["OrderedCollection"],
  5998. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  5999. }),
  6000. $globals.Behavior);
  6001. $core.addMethod(
  6002. $core.method({
  6003. selector: "basicAddCompiledMethod:",
  6004. protocol: 'private',
  6005. fn: function (aMethod){
  6006. var self=this;
  6007. return $core.withContext(function($ctx1) {
  6008. $core.addMethod(aMethod, self);
  6009. return self;
  6010. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6011. },
  6012. args: ["aMethod"],
  6013. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  6014. referencedClasses: [],
  6015. messageSends: []
  6016. }),
  6017. $globals.Behavior);
  6018. $core.addMethod(
  6019. $core.method({
  6020. selector: "basicNew",
  6021. protocol: 'instance creation',
  6022. fn: function (){
  6023. var self=this;
  6024. return $core.withContext(function($ctx1) {
  6025. return new self.fn();
  6026. return self;
  6027. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  6028. },
  6029. args: [],
  6030. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  6031. referencedClasses: [],
  6032. messageSends: []
  6033. }),
  6034. $globals.Behavior);
  6035. $core.addMethod(
  6036. $core.method({
  6037. selector: "basicRemoveCompiledMethod:",
  6038. protocol: 'private',
  6039. fn: function (aMethod){
  6040. var self=this;
  6041. return $core.withContext(function($ctx1) {
  6042. $core.removeMethod(aMethod,self);
  6043. return self;
  6044. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6045. },
  6046. args: ["aMethod"],
  6047. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  6048. referencedClasses: [],
  6049. messageSends: []
  6050. }),
  6051. $globals.Behavior);
  6052. $core.addMethod(
  6053. $core.method({
  6054. selector: "canUnderstand:",
  6055. protocol: 'testing',
  6056. fn: function (aSelector){
  6057. var self=this;
  6058. return $core.withContext(function($ctx1) {
  6059. var $2,$1;
  6060. return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  6061. return $core.withContext(function($ctx2) {
  6062. $2=self._superclass();
  6063. $ctx2.sendIdx["superclass"]=1;
  6064. $1=$recv($2)._notNil();
  6065. return $recv($1)._and_((function(){
  6066. return $core.withContext(function($ctx3) {
  6067. return $recv(self._superclass())._canUnderstand_(aSelector);
  6068. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6069. }));
  6070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6071. }));
  6072. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  6073. },
  6074. args: ["aSelector"],
  6075. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  6076. referencedClasses: [],
  6077. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  6078. }),
  6079. $globals.Behavior);
  6080. $core.addMethod(
  6081. $core.method({
  6082. selector: "comment",
  6083. protocol: 'accessing',
  6084. fn: function (){
  6085. var self=this;
  6086. return $core.withContext(function($ctx1) {
  6087. var $1,$receiver;
  6088. $1=self._basicAt_("comment");
  6089. if(($receiver = $1) == null || $receiver.isNil){
  6090. return "";
  6091. } else {
  6092. return $1;
  6093. }
  6094. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  6095. },
  6096. args: [],
  6097. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  6098. referencedClasses: [],
  6099. messageSends: ["ifNil:", "basicAt:"]
  6100. }),
  6101. $globals.Behavior);
  6102. $core.addMethod(
  6103. $core.method({
  6104. selector: "comment:",
  6105. protocol: 'accessing',
  6106. fn: function (aString){
  6107. var self=this;
  6108. return $core.withContext(function($ctx1) {
  6109. var $1,$3,$2;
  6110. self._basicAt_put_("comment",aString);
  6111. $1=$recv($globals.SystemAnnouncer)._current();
  6112. $3=$recv($globals.ClassCommentChanged)._new();
  6113. $recv($3)._theClass_(self);
  6114. $2=$recv($3)._yourself();
  6115. $recv($1)._announce_($2);
  6116. return self;
  6117. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  6118. },
  6119. args: ["aString"],
  6120. 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)",
  6121. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  6122. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  6123. }),
  6124. $globals.Behavior);
  6125. $core.addMethod(
  6126. $core.method({
  6127. selector: "compile:protocol:",
  6128. protocol: 'compiling',
  6129. fn: function (aString,anotherString){
  6130. var self=this;
  6131. return $core.withContext(function($ctx1) {
  6132. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  6133. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  6134. },
  6135. args: ["aString", "anotherString"],
  6136. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  6137. referencedClasses: ["Compiler"],
  6138. messageSends: ["install:forClass:protocol:", "new"]
  6139. }),
  6140. $globals.Behavior);
  6141. $core.addMethod(
  6142. $core.method({
  6143. selector: "definition",
  6144. protocol: 'accessing',
  6145. fn: function (){
  6146. var self=this;
  6147. return "";
  6148. },
  6149. args: [],
  6150. source: "definition\x0a\x09^ ''",
  6151. referencedClasses: [],
  6152. messageSends: []
  6153. }),
  6154. $globals.Behavior);
  6155. $core.addMethod(
  6156. $core.method({
  6157. selector: "includesBehavior:",
  6158. protocol: 'testing',
  6159. fn: function (aClass){
  6160. var self=this;
  6161. return $core.withContext(function($ctx1) {
  6162. return $recv(self.__eq_eq(aClass))._or_((function(){
  6163. return $core.withContext(function($ctx2) {
  6164. return self._inheritsFrom_(aClass);
  6165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6166. }));
  6167. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  6168. },
  6169. args: ["aClass"],
  6170. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  6171. referencedClasses: [],
  6172. messageSends: ["or:", "==", "inheritsFrom:"]
  6173. }),
  6174. $globals.Behavior);
  6175. $core.addMethod(
  6176. $core.method({
  6177. selector: "includesSelector:",
  6178. protocol: 'testing',
  6179. fn: function (aString){
  6180. var self=this;
  6181. return $core.withContext(function($ctx1) {
  6182. return $recv(self._methodDictionary())._includesKey_(aString);
  6183. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  6184. },
  6185. args: ["aString"],
  6186. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  6187. referencedClasses: [],
  6188. messageSends: ["includesKey:", "methodDictionary"]
  6189. }),
  6190. $globals.Behavior);
  6191. $core.addMethod(
  6192. $core.method({
  6193. selector: "inheritsFrom:",
  6194. protocol: 'testing',
  6195. fn: function (aClass){
  6196. var self=this;
  6197. return $core.withContext(function($ctx1) {
  6198. var $1,$3,$2,$receiver;
  6199. $1=self._superclass();
  6200. $ctx1.sendIdx["superclass"]=1;
  6201. if(($receiver = $1) == null || $receiver.isNil){
  6202. return false;
  6203. } else {
  6204. $1;
  6205. }
  6206. $3=self._superclass();
  6207. $ctx1.sendIdx["superclass"]=2;
  6208. $2=$recv(aClass).__eq_eq($3);
  6209. return $recv($2)._or_((function(){
  6210. return $core.withContext(function($ctx2) {
  6211. return $recv(self._superclass())._inheritsFrom_(aClass);
  6212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6213. }));
  6214. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  6215. },
  6216. args: ["aClass"],
  6217. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  6218. referencedClasses: [],
  6219. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  6220. }),
  6221. $globals.Behavior);
  6222. $core.addMethod(
  6223. $core.method({
  6224. selector: "instanceVariableNames",
  6225. protocol: 'accessing',
  6226. fn: function (){
  6227. var self=this;
  6228. return $core.withContext(function($ctx1) {
  6229. return self.iVarNames;
  6230. return self;
  6231. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  6232. },
  6233. args: [],
  6234. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  6235. referencedClasses: [],
  6236. messageSends: []
  6237. }),
  6238. $globals.Behavior);
  6239. $core.addMethod(
  6240. $core.method({
  6241. selector: "isBehavior",
  6242. protocol: 'testing',
  6243. fn: function (){
  6244. var self=this;
  6245. return true;
  6246. },
  6247. args: [],
  6248. source: "isBehavior\x0a\x09^ true",
  6249. referencedClasses: [],
  6250. messageSends: []
  6251. }),
  6252. $globals.Behavior);
  6253. $core.addMethod(
  6254. $core.method({
  6255. selector: "javascriptConstructor",
  6256. protocol: 'accessing',
  6257. fn: function (){
  6258. var self=this;
  6259. return $core.withContext(function($ctx1) {
  6260. return self.fn;
  6261. return self;
  6262. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  6263. },
  6264. args: [],
  6265. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  6266. referencedClasses: [],
  6267. messageSends: []
  6268. }),
  6269. $globals.Behavior);
  6270. $core.addMethod(
  6271. $core.method({
  6272. selector: "javascriptConstructor:",
  6273. protocol: 'accessing',
  6274. fn: function (aJavaScriptFunction){
  6275. var self=this;
  6276. return $core.withContext(function($ctx1) {
  6277. $core.setClassConstructor(self, aJavaScriptFunction);;
  6278. return self;
  6279. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  6280. },
  6281. args: ["aJavaScriptFunction"],
  6282. 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);'>",
  6283. referencedClasses: [],
  6284. messageSends: []
  6285. }),
  6286. $globals.Behavior);
  6287. $core.addMethod(
  6288. $core.method({
  6289. selector: "lookupSelector:",
  6290. protocol: 'accessing',
  6291. fn: function (selector){
  6292. var self=this;
  6293. var lookupClass;
  6294. return $core.withContext(function($ctx1) {
  6295. var $1;
  6296. var $early={};
  6297. try {
  6298. lookupClass=self;
  6299. $recv((function(){
  6300. return $core.withContext(function($ctx2) {
  6301. return $recv(lookupClass).__eq(nil);
  6302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6303. }))._whileFalse_((function(){
  6304. return $core.withContext(function($ctx2) {
  6305. $1=$recv(lookupClass)._includesSelector_(selector);
  6306. if($core.assert($1)){
  6307. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  6308. }
  6309. lookupClass=$recv(lookupClass)._superclass();
  6310. return lookupClass;
  6311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6312. }));
  6313. return nil;
  6314. }
  6315. catch(e) {if(e===$early)return e[0]; throw e}
  6316. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  6317. },
  6318. args: ["selector"],
  6319. 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",
  6320. referencedClasses: [],
  6321. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  6322. }),
  6323. $globals.Behavior);
  6324. $core.addMethod(
  6325. $core.method({
  6326. selector: "methodAt:",
  6327. protocol: 'accessing',
  6328. fn: function (aString){
  6329. var self=this;
  6330. return $core.withContext(function($ctx1) {
  6331. return $recv(self._methodDictionary())._at_(aString);
  6332. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  6333. },
  6334. args: ["aString"],
  6335. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  6336. referencedClasses: [],
  6337. messageSends: ["at:", "methodDictionary"]
  6338. }),
  6339. $globals.Behavior);
  6340. $core.addMethod(
  6341. $core.method({
  6342. selector: "methodDictionary",
  6343. protocol: 'accessing',
  6344. fn: function (){
  6345. var self=this;
  6346. return $core.withContext(function($ctx1) {
  6347. var dict = $globals.HashedCollection._new();
  6348. var methods = self.methods;
  6349. Object.keys(methods).forEach(function(i) {
  6350. if(methods[i].selector) {
  6351. dict._at_put_(methods[i].selector, methods[i]);
  6352. }
  6353. });
  6354. return dict;
  6355. return self;
  6356. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  6357. },
  6358. args: [],
  6359. 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'>",
  6360. referencedClasses: [],
  6361. messageSends: []
  6362. }),
  6363. $globals.Behavior);
  6364. $core.addMethod(
  6365. $core.method({
  6366. selector: "methodTemplate",
  6367. protocol: 'accessing',
  6368. fn: function (){
  6369. var self=this;
  6370. return $core.withContext(function($ctx1) {
  6371. var $2,$3,$1,$6,$7,$5,$8,$4;
  6372. return $recv($globals.String)._streamContents_((function(stream){
  6373. return $core.withContext(function($ctx2) {
  6374. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  6375. $ctx2.sendIdx["nextPutAll:"]=1;
  6376. $2=$recv($globals.String)._lf();
  6377. $ctx2.sendIdx["lf"]=1;
  6378. $3=$recv($globals.String)._tab();
  6379. $ctx2.sendIdx["tab"]=1;
  6380. $1=$recv($2).__comma($3);
  6381. $ctx2.sendIdx[","]=1;
  6382. $recv(stream)._nextPutAll_($1);
  6383. $ctx2.sendIdx["nextPutAll:"]=2;
  6384. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  6385. $ctx2.sendIdx["nextPutAll:"]=3;
  6386. $6=$recv($globals.String)._lf();
  6387. $ctx2.sendIdx["lf"]=2;
  6388. $7=$recv($globals.String)._lf();
  6389. $ctx2.sendIdx["lf"]=3;
  6390. $5=$recv($6).__comma($7);
  6391. $ctx2.sendIdx[","]=3;
  6392. $8=$recv($globals.String)._tab();
  6393. $ctx2.sendIdx["tab"]=2;
  6394. $4=$recv($5).__comma($8);
  6395. $ctx2.sendIdx[","]=2;
  6396. $recv(stream)._nextPutAll_($4);
  6397. $ctx2.sendIdx["nextPutAll:"]=4;
  6398. $recv(stream)._nextPutAll_("| temporary variable names |");
  6399. $ctx2.sendIdx["nextPutAll:"]=5;
  6400. $recv(stream)._nextPutAll_($recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab()));
  6401. $ctx2.sendIdx["nextPutAll:"]=6;
  6402. return $recv(stream)._nextPutAll_("statements");
  6403. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6404. }));
  6405. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  6406. },
  6407. args: [],
  6408. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]",
  6409. referencedClasses: ["String"],
  6410. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  6411. }),
  6412. $globals.Behavior);
  6413. $core.addMethod(
  6414. $core.method({
  6415. selector: "methods",
  6416. protocol: 'accessing',
  6417. fn: function (){
  6418. var self=this;
  6419. return $core.withContext(function($ctx1) {
  6420. return $recv(self._methodDictionary())._values();
  6421. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  6422. },
  6423. args: [],
  6424. source: "methods\x0a\x09^ self methodDictionary values",
  6425. referencedClasses: [],
  6426. messageSends: ["values", "methodDictionary"]
  6427. }),
  6428. $globals.Behavior);
  6429. $core.addMethod(
  6430. $core.method({
  6431. selector: "methodsInProtocol:",
  6432. protocol: 'accessing',
  6433. fn: function (aString){
  6434. var self=this;
  6435. return $core.withContext(function($ctx1) {
  6436. return $recv(self._methods())._select_((function(each){
  6437. return $core.withContext(function($ctx2) {
  6438. return $recv($recv(each)._protocol()).__eq(aString);
  6439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6440. }));
  6441. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  6442. },
  6443. args: ["aString"],
  6444. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  6445. referencedClasses: [],
  6446. messageSends: ["select:", "methods", "=", "protocol"]
  6447. }),
  6448. $globals.Behavior);
  6449. $core.addMethod(
  6450. $core.method({
  6451. selector: "name",
  6452. protocol: 'accessing',
  6453. fn: function (){
  6454. var self=this;
  6455. return $core.withContext(function($ctx1) {
  6456. return self.className || nil;
  6457. return self;
  6458. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  6459. },
  6460. args: [],
  6461. source: "name\x0a\x09<inlineJS: 'return self.className || nil'>",
  6462. referencedClasses: [],
  6463. messageSends: []
  6464. }),
  6465. $globals.Behavior);
  6466. $core.addMethod(
  6467. $core.method({
  6468. selector: "new",
  6469. protocol: 'instance creation',
  6470. fn: function (){
  6471. var self=this;
  6472. return $core.withContext(function($ctx1) {
  6473. return $recv(self._basicNew())._initialize();
  6474. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  6475. },
  6476. args: [],
  6477. source: "new\x0a\x09^ self basicNew initialize",
  6478. referencedClasses: [],
  6479. messageSends: ["initialize", "basicNew"]
  6480. }),
  6481. $globals.Behavior);
  6482. $core.addMethod(
  6483. $core.method({
  6484. selector: "organization",
  6485. protocol: 'accessing',
  6486. fn: function (){
  6487. var self=this;
  6488. return $core.withContext(function($ctx1) {
  6489. return self._basicAt_("organization");
  6490. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  6491. },
  6492. args: [],
  6493. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6494. referencedClasses: [],
  6495. messageSends: ["basicAt:"]
  6496. }),
  6497. $globals.Behavior);
  6498. $core.addMethod(
  6499. $core.method({
  6500. selector: "ownMethods",
  6501. protocol: 'accessing',
  6502. fn: function (){
  6503. var self=this;
  6504. return $core.withContext(function($ctx1) {
  6505. var $1;
  6506. return $recv($recv(self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  6507. return $core.withContext(function($ctx2) {
  6508. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6509. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6510. })))._sorted_((function(a,b){
  6511. return $core.withContext(function($ctx2) {
  6512. $1=$recv(a)._selector();
  6513. $ctx2.sendIdx["selector"]=1;
  6514. return $recv($1).__lt_eq($recv(b)._selector());
  6515. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6516. }));
  6517. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6518. },
  6519. args: [],
  6520. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  6521. referencedClasses: ["OrderedCollection"],
  6522. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6523. }),
  6524. $globals.Behavior);
  6525. $core.addMethod(
  6526. $core.method({
  6527. selector: "ownProtocols",
  6528. protocol: 'accessing',
  6529. fn: function (){
  6530. var self=this;
  6531. return $core.withContext(function($ctx1) {
  6532. return $recv(self._protocols())._reject_((function(each){
  6533. return $core.withContext(function($ctx2) {
  6534. return $recv(each)._match_("^\x5c*");
  6535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6536. }));
  6537. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6538. },
  6539. args: [],
  6540. 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*' ]",
  6541. referencedClasses: [],
  6542. messageSends: ["reject:", "protocols", "match:"]
  6543. }),
  6544. $globals.Behavior);
  6545. $core.addMethod(
  6546. $core.method({
  6547. selector: "packageOfProtocol:",
  6548. protocol: 'accessing',
  6549. fn: function (aString){
  6550. var self=this;
  6551. return $core.withContext(function($ctx1) {
  6552. var $1;
  6553. $1=$recv(aString)._beginsWith_("*");
  6554. if(!$core.assert($1)){
  6555. return self._package();
  6556. }
  6557. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6558. return nil;
  6559. }));
  6560. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6561. },
  6562. args: ["aString"],
  6563. 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 ]",
  6564. referencedClasses: ["Package"],
  6565. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6566. }),
  6567. $globals.Behavior);
  6568. $core.addMethod(
  6569. $core.method({
  6570. selector: "protocols",
  6571. protocol: 'accessing',
  6572. fn: function (){
  6573. var self=this;
  6574. return $core.withContext(function($ctx1) {
  6575. return $recv($recv(self._organization())._elements())._sorted();
  6576. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6577. },
  6578. args: [],
  6579. source: "protocols\x0a\x09^ self organization elements sorted",
  6580. referencedClasses: [],
  6581. messageSends: ["sorted", "elements", "organization"]
  6582. }),
  6583. $globals.Behavior);
  6584. $core.addMethod(
  6585. $core.method({
  6586. selector: "protocolsDo:",
  6587. protocol: 'enumerating',
  6588. fn: function (aBlock){
  6589. var self=this;
  6590. var methodsByProtocol;
  6591. return $core.withContext(function($ctx1) {
  6592. methodsByProtocol=$recv($globals.HashedCollection)._new();
  6593. $ctx1.sendIdx["new"]=1;
  6594. $recv(self._methodDictionary())._valuesDo_((function(m){
  6595. return $core.withContext(function($ctx2) {
  6596. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6597. return $core.withContext(function($ctx3) {
  6598. return $recv($globals.Array)._new();
  6599. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6600. })))._add_(m);
  6601. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6602. }));
  6603. $recv(self._protocols())._do_((function(protocol){
  6604. return $core.withContext(function($ctx2) {
  6605. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6606. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6607. }));
  6608. return self;
  6609. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6610. },
  6611. args: ["aBlock"],
  6612. 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) ]",
  6613. referencedClasses: ["HashedCollection", "Array"],
  6614. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6615. }),
  6616. $globals.Behavior);
  6617. $core.addMethod(
  6618. $core.method({
  6619. selector: "prototype",
  6620. protocol: 'accessing',
  6621. fn: function (){
  6622. var self=this;
  6623. return $core.withContext(function($ctx1) {
  6624. return self.fn.prototype;
  6625. return self;
  6626. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6627. },
  6628. args: [],
  6629. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  6630. referencedClasses: [],
  6631. messageSends: []
  6632. }),
  6633. $globals.Behavior);
  6634. $core.addMethod(
  6635. $core.method({
  6636. selector: "recompile",
  6637. protocol: 'compiling',
  6638. fn: function (){
  6639. var self=this;
  6640. return $core.withContext(function($ctx1) {
  6641. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  6642. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6643. },
  6644. args: [],
  6645. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6646. referencedClasses: ["Compiler"],
  6647. messageSends: ["recompile:", "new"]
  6648. }),
  6649. $globals.Behavior);
  6650. $core.addMethod(
  6651. $core.method({
  6652. selector: "removeCompiledMethod:",
  6653. protocol: 'compiling',
  6654. fn: function (aMethod){
  6655. var self=this;
  6656. return $core.withContext(function($ctx1) {
  6657. var $1,$3,$2;
  6658. self._basicRemoveCompiledMethod_(aMethod);
  6659. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6660. $1=$recv($globals.SystemAnnouncer)._current();
  6661. $3=$recv($globals.MethodRemoved)._new();
  6662. $recv($3)._method_(aMethod);
  6663. $2=$recv($3)._yourself();
  6664. $recv($1)._announce_($2);
  6665. return self;
  6666. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6667. },
  6668. args: ["aMethod"],
  6669. 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)",
  6670. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6671. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6672. }),
  6673. $globals.Behavior);
  6674. $core.addMethod(
  6675. $core.method({
  6676. selector: "removeProtocolIfEmpty:",
  6677. protocol: 'accessing',
  6678. fn: function (aString){
  6679. var self=this;
  6680. return $core.withContext(function($ctx1) {
  6681. $recv(self._methods())._detect_ifNone_((function(each){
  6682. return $core.withContext(function($ctx2) {
  6683. return $recv($recv(each)._protocol()).__eq(aString);
  6684. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6685. }),(function(){
  6686. return $core.withContext(function($ctx2) {
  6687. return $recv(self._organization())._removeElement_(aString);
  6688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6689. }));
  6690. return self;
  6691. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6692. },
  6693. args: ["aString"],
  6694. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6695. referencedClasses: [],
  6696. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6697. }),
  6698. $globals.Behavior);
  6699. $core.addMethod(
  6700. $core.method({
  6701. selector: "selectors",
  6702. protocol: 'accessing',
  6703. fn: function (){
  6704. var self=this;
  6705. return $core.withContext(function($ctx1) {
  6706. return $recv(self._methodDictionary())._keys();
  6707. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6708. },
  6709. args: [],
  6710. source: "selectors\x0a\x09^ self methodDictionary keys",
  6711. referencedClasses: [],
  6712. messageSends: ["keys", "methodDictionary"]
  6713. }),
  6714. $globals.Behavior);
  6715. $core.addMethod(
  6716. $core.method({
  6717. selector: "subclasses",
  6718. protocol: 'accessing',
  6719. fn: function (){
  6720. var self=this;
  6721. return $core.withContext(function($ctx1) {
  6722. self._subclassResponsibility();
  6723. return self;
  6724. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6725. },
  6726. args: [],
  6727. source: "subclasses\x0a\x09self subclassResponsibility",
  6728. referencedClasses: [],
  6729. messageSends: ["subclassResponsibility"]
  6730. }),
  6731. $globals.Behavior);
  6732. $core.addMethod(
  6733. $core.method({
  6734. selector: "superclass",
  6735. protocol: 'accessing',
  6736. fn: function (){
  6737. var self=this;
  6738. return $core.withContext(function($ctx1) {
  6739. return self.superclass;
  6740. return self;
  6741. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6742. },
  6743. args: [],
  6744. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  6745. referencedClasses: [],
  6746. messageSends: []
  6747. }),
  6748. $globals.Behavior);
  6749. $core.addMethod(
  6750. $core.method({
  6751. selector: "theMetaClass",
  6752. protocol: 'accessing',
  6753. fn: function (){
  6754. var self=this;
  6755. return $core.withContext(function($ctx1) {
  6756. self._subclassResponsibility();
  6757. return self;
  6758. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6759. },
  6760. args: [],
  6761. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6762. referencedClasses: [],
  6763. messageSends: ["subclassResponsibility"]
  6764. }),
  6765. $globals.Behavior);
  6766. $core.addMethod(
  6767. $core.method({
  6768. selector: "theNonMetaClass",
  6769. protocol: 'accessing',
  6770. fn: function (){
  6771. var self=this;
  6772. return $core.withContext(function($ctx1) {
  6773. self._subclassResponsibility();
  6774. return self;
  6775. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6776. },
  6777. args: [],
  6778. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6779. referencedClasses: [],
  6780. messageSends: ["subclassResponsibility"]
  6781. }),
  6782. $globals.Behavior);
  6783. $core.addMethod(
  6784. $core.method({
  6785. selector: "withAllSubclasses",
  6786. protocol: 'accessing',
  6787. fn: function (){
  6788. var self=this;
  6789. return $core.withContext(function($ctx1) {
  6790. var $1;
  6791. $1=$recv($globals.Array)._with_(self);
  6792. $recv($1)._addAll_(self._allSubclasses());
  6793. return $recv($1)._yourself();
  6794. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6795. },
  6796. args: [],
  6797. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6798. referencedClasses: ["Array"],
  6799. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6800. }),
  6801. $globals.Behavior);
  6802. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6803. $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.";
  6804. $core.addMethod(
  6805. $core.method({
  6806. selector: "asJavascript",
  6807. protocol: 'converting',
  6808. fn: function (){
  6809. var self=this;
  6810. return $core.withContext(function($ctx1) {
  6811. return "$globals.".__comma(self._name());
  6812. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6813. },
  6814. args: [],
  6815. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6816. referencedClasses: [],
  6817. messageSends: [",", "name"]
  6818. }),
  6819. $globals.Class);
  6820. $core.addMethod(
  6821. $core.method({
  6822. selector: "browse",
  6823. protocol: 'browsing',
  6824. fn: function (){
  6825. var self=this;
  6826. return $core.withContext(function($ctx1) {
  6827. $recv($globals.Finder)._findClass_(self);
  6828. return self;
  6829. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6830. },
  6831. args: [],
  6832. source: "browse\x0a\x09Finder findClass: self",
  6833. referencedClasses: ["Finder"],
  6834. messageSends: ["findClass:"]
  6835. }),
  6836. $globals.Class);
  6837. $core.addMethod(
  6838. $core.method({
  6839. selector: "category",
  6840. protocol: 'accessing',
  6841. fn: function (){
  6842. var self=this;
  6843. return $core.withContext(function($ctx1) {
  6844. var $1,$receiver;
  6845. $1=self._package();
  6846. $ctx1.sendIdx["package"]=1;
  6847. if(($receiver = $1) == null || $receiver.isNil){
  6848. return "Unclassified";
  6849. } else {
  6850. return $recv(self._package())._name();
  6851. }
  6852. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6853. },
  6854. args: [],
  6855. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6856. referencedClasses: [],
  6857. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6858. }),
  6859. $globals.Class);
  6860. $core.addMethod(
  6861. $core.method({
  6862. selector: "classTag",
  6863. protocol: 'accessing',
  6864. fn: function (){
  6865. var self=this;
  6866. return "class";
  6867. },
  6868. args: [],
  6869. 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'",
  6870. referencedClasses: [],
  6871. messageSends: []
  6872. }),
  6873. $globals.Class);
  6874. $core.addMethod(
  6875. $core.method({
  6876. selector: "definition",
  6877. protocol: 'accessing',
  6878. fn: function (){
  6879. var self=this;
  6880. return $core.withContext(function($ctx1) {
  6881. var $2,$3,$1,$4,$5;
  6882. return $recv($globals.String)._streamContents_((function(stream){
  6883. return $core.withContext(function($ctx2) {
  6884. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6885. $ctx2.sendIdx["nextPutAll:"]=1;
  6886. $recv(stream)._nextPutAll_(" subclass: #");
  6887. $ctx2.sendIdx["nextPutAll:"]=2;
  6888. $recv(stream)._nextPutAll_(self._name());
  6889. $ctx2.sendIdx["nextPutAll:"]=3;
  6890. $2=$recv($globals.String)._lf();
  6891. $ctx2.sendIdx["lf"]=1;
  6892. $3=$recv($globals.String)._tab();
  6893. $ctx2.sendIdx["tab"]=1;
  6894. $1=$recv($2).__comma($3);
  6895. $ctx2.sendIdx[","]=1;
  6896. $recv(stream)._nextPutAll_($1);
  6897. $ctx2.sendIdx["nextPutAll:"]=4;
  6898. $4=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6899. $ctx2.sendIdx["nextPutAll:"]=5;
  6900. $4;
  6901. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6902. return $core.withContext(function($ctx3) {
  6903. return $recv(stream)._nextPutAll_(each);
  6904. $ctx3.sendIdx["nextPutAll:"]=6;
  6905. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6906. }),(function(){
  6907. return $core.withContext(function($ctx3) {
  6908. return $recv(stream)._nextPutAll_(" ");
  6909. $ctx3.sendIdx["nextPutAll:"]=7;
  6910. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6911. }));
  6912. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  6913. $ctx2.sendIdx[","]=2;
  6914. $recv(stream)._nextPutAll_($5);
  6915. $ctx2.sendIdx["nextPutAll:"]=8;
  6916. $recv(stream)._nextPutAll_("package: '");
  6917. $ctx2.sendIdx["nextPutAll:"]=9;
  6918. $recv(stream)._nextPutAll_(self._category());
  6919. $ctx2.sendIdx["nextPutAll:"]=10;
  6920. return $recv(stream)._nextPutAll_("'");
  6921. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6922. }));
  6923. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6924. },
  6925. args: [],
  6926. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
  6927. referencedClasses: ["String"],
  6928. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6929. }),
  6930. $globals.Class);
  6931. $core.addMethod(
  6932. $core.method({
  6933. selector: "isClass",
  6934. protocol: 'testing',
  6935. fn: function (){
  6936. var self=this;
  6937. return true;
  6938. },
  6939. args: [],
  6940. source: "isClass\x0a\x09^ true",
  6941. referencedClasses: [],
  6942. messageSends: []
  6943. }),
  6944. $globals.Class);
  6945. $core.addMethod(
  6946. $core.method({
  6947. selector: "package",
  6948. protocol: 'accessing',
  6949. fn: function (){
  6950. var self=this;
  6951. return $core.withContext(function($ctx1) {
  6952. return self._basicAt_("pkg");
  6953. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6954. },
  6955. args: [],
  6956. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6957. referencedClasses: [],
  6958. messageSends: ["basicAt:"]
  6959. }),
  6960. $globals.Class);
  6961. $core.addMethod(
  6962. $core.method({
  6963. selector: "package:",
  6964. protocol: 'accessing',
  6965. fn: function (aPackage){
  6966. var self=this;
  6967. var oldPackage;
  6968. return $core.withContext(function($ctx1) {
  6969. var $2,$1,$3,$4,$6,$5;
  6970. $2=self._package();
  6971. $ctx1.sendIdx["package"]=1;
  6972. $1=$recv($2).__eq(aPackage);
  6973. if($core.assert($1)){
  6974. return self;
  6975. }
  6976. oldPackage=self._package();
  6977. self._basicAt_put_("pkg",aPackage);
  6978. $3=$recv(oldPackage)._organization();
  6979. $ctx1.sendIdx["organization"]=1;
  6980. $recv($3)._removeElement_(self);
  6981. $recv($recv(aPackage)._organization())._addElement_(self);
  6982. $4=$recv($globals.SystemAnnouncer)._current();
  6983. $6=$recv($globals.ClassMoved)._new();
  6984. $recv($6)._theClass_(self);
  6985. $recv($6)._oldPackage_(oldPackage);
  6986. $5=$recv($6)._yourself();
  6987. $recv($4)._announce_($5);
  6988. return self;
  6989. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  6990. },
  6991. args: ["aPackage"],
  6992. 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)",
  6993. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  6994. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  6995. }),
  6996. $globals.Class);
  6997. $core.addMethod(
  6998. $core.method({
  6999. selector: "printOn:",
  7000. protocol: 'printing',
  7001. fn: function (aStream){
  7002. var self=this;
  7003. return $core.withContext(function($ctx1) {
  7004. $recv(aStream)._nextPutAll_(self._name());
  7005. return self;
  7006. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  7007. },
  7008. args: ["aStream"],
  7009. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  7010. referencedClasses: [],
  7011. messageSends: ["nextPutAll:", "name"]
  7012. }),
  7013. $globals.Class);
  7014. $core.addMethod(
  7015. $core.method({
  7016. selector: "rename:",
  7017. protocol: 'accessing',
  7018. fn: function (aString){
  7019. var self=this;
  7020. return $core.withContext(function($ctx1) {
  7021. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  7022. return self;
  7023. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  7024. },
  7025. args: ["aString"],
  7026. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  7027. referencedClasses: ["ClassBuilder"],
  7028. messageSends: ["renameClass:to:", "new"]
  7029. }),
  7030. $globals.Class);
  7031. $core.addMethod(
  7032. $core.method({
  7033. selector: "subclass:instanceVariableNames:",
  7034. protocol: 'class creation',
  7035. fn: function (aString,anotherString){
  7036. var self=this;
  7037. return $core.withContext(function($ctx1) {
  7038. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  7039. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  7040. },
  7041. args: ["aString", "anotherString"],
  7042. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  7043. referencedClasses: [],
  7044. messageSends: ["subclass:instanceVariableNames:package:"]
  7045. }),
  7046. $globals.Class);
  7047. $core.addMethod(
  7048. $core.method({
  7049. selector: "subclass:instanceVariableNames:category:",
  7050. protocol: 'class creation',
  7051. fn: function (aString,aString2,aString3){
  7052. var self=this;
  7053. return $core.withContext(function($ctx1) {
  7054. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7055. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7056. },
  7057. args: ["aString", "aString2", "aString3"],
  7058. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  7059. referencedClasses: [],
  7060. messageSends: ["subclass:instanceVariableNames:package:"]
  7061. }),
  7062. $globals.Class);
  7063. $core.addMethod(
  7064. $core.method({
  7065. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  7066. protocol: 'class creation',
  7067. fn: function (aString,aString2,classVars,pools,aString3){
  7068. var self=this;
  7069. return $core.withContext(function($ctx1) {
  7070. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7071. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  7072. },
  7073. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  7074. 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",
  7075. referencedClasses: [],
  7076. messageSends: ["subclass:instanceVariableNames:package:"]
  7077. }),
  7078. $globals.Class);
  7079. $core.addMethod(
  7080. $core.method({
  7081. selector: "subclass:instanceVariableNames:package:",
  7082. protocol: 'class creation',
  7083. fn: function (aString,aString2,aString3){
  7084. var self=this;
  7085. return $core.withContext(function($ctx1) {
  7086. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  7087. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7088. },
  7089. args: ["aString", "aString2", "aString3"],
  7090. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  7091. referencedClasses: ["ClassBuilder"],
  7092. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  7093. }),
  7094. $globals.Class);
  7095. $core.addMethod(
  7096. $core.method({
  7097. selector: "subclasses",
  7098. protocol: 'accessing',
  7099. fn: function (){
  7100. var self=this;
  7101. return $core.withContext(function($ctx1) {
  7102. return self.subclasses._copy();
  7103. return self;
  7104. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  7105. },
  7106. args: [],
  7107. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  7108. referencedClasses: [],
  7109. messageSends: []
  7110. }),
  7111. $globals.Class);
  7112. $core.addMethod(
  7113. $core.method({
  7114. selector: "theMetaClass",
  7115. protocol: 'accessing',
  7116. fn: function (){
  7117. var self=this;
  7118. return $core.withContext(function($ctx1) {
  7119. return self._class();
  7120. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  7121. },
  7122. args: [],
  7123. source: "theMetaClass\x0a\x09^ self class",
  7124. referencedClasses: [],
  7125. messageSends: ["class"]
  7126. }),
  7127. $globals.Class);
  7128. $core.addMethod(
  7129. $core.method({
  7130. selector: "theNonMetaClass",
  7131. protocol: 'accessing',
  7132. fn: function (){
  7133. var self=this;
  7134. return self;
  7135. },
  7136. args: [],
  7137. source: "theNonMetaClass\x0a\x09^ self",
  7138. referencedClasses: [],
  7139. messageSends: []
  7140. }),
  7141. $globals.Class);
  7142. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  7143. $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.";
  7144. $core.addMethod(
  7145. $core.method({
  7146. selector: "asJavascript",
  7147. protocol: 'converting',
  7148. fn: function (){
  7149. var self=this;
  7150. return $core.withContext(function($ctx1) {
  7151. var $1;
  7152. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  7153. $ctx1.sendIdx[","]=1;
  7154. return $1;
  7155. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  7156. },
  7157. args: [],
  7158. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  7159. referencedClasses: [],
  7160. messageSends: [",", "name", "instanceClass"]
  7161. }),
  7162. $globals.Metaclass);
  7163. $core.addMethod(
  7164. $core.method({
  7165. selector: "definition",
  7166. protocol: 'accessing',
  7167. fn: function (){
  7168. var self=this;
  7169. return $core.withContext(function($ctx1) {
  7170. var $1;
  7171. return $recv($globals.String)._streamContents_((function(stream){
  7172. return $core.withContext(function($ctx2) {
  7173. $recv(stream)._nextPutAll_(self._asString());
  7174. $ctx2.sendIdx["nextPutAll:"]=1;
  7175. $1=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  7176. $ctx2.sendIdx["nextPutAll:"]=2;
  7177. $1;
  7178. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  7179. return $core.withContext(function($ctx3) {
  7180. return $recv(stream)._nextPutAll_(each);
  7181. $ctx3.sendIdx["nextPutAll:"]=3;
  7182. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  7183. }),(function(){
  7184. return $core.withContext(function($ctx3) {
  7185. return $recv(stream)._nextPutAll_(" ");
  7186. $ctx3.sendIdx["nextPutAll:"]=4;
  7187. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  7188. }));
  7189. return $recv(stream)._nextPutAll_("'");
  7190. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  7191. }));
  7192. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  7193. },
  7194. args: [],
  7195. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  7196. referencedClasses: ["String"],
  7197. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  7198. }),
  7199. $globals.Metaclass);
  7200. $core.addMethod(
  7201. $core.method({
  7202. selector: "instanceClass",
  7203. protocol: 'accessing',
  7204. fn: function (){
  7205. var self=this;
  7206. return $core.withContext(function($ctx1) {
  7207. return self.instanceClass;
  7208. return self;
  7209. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  7210. },
  7211. args: [],
  7212. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  7213. referencedClasses: [],
  7214. messageSends: []
  7215. }),
  7216. $globals.Metaclass);
  7217. $core.addMethod(
  7218. $core.method({
  7219. selector: "instanceVariableNames:",
  7220. protocol: 'accessing',
  7221. fn: function (aCollection){
  7222. var self=this;
  7223. return $core.withContext(function($ctx1) {
  7224. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  7225. return self;
  7226. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  7227. },
  7228. args: ["aCollection"],
  7229. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  7230. referencedClasses: ["ClassBuilder"],
  7231. messageSends: ["class:instanceVariableNames:", "new"]
  7232. }),
  7233. $globals.Metaclass);
  7234. $core.addMethod(
  7235. $core.method({
  7236. selector: "isMetaclass",
  7237. protocol: 'testing',
  7238. fn: function (){
  7239. var self=this;
  7240. return true;
  7241. },
  7242. args: [],
  7243. source: "isMetaclass\x0a\x09^ true",
  7244. referencedClasses: [],
  7245. messageSends: []
  7246. }),
  7247. $globals.Metaclass);
  7248. $core.addMethod(
  7249. $core.method({
  7250. selector: "package",
  7251. protocol: 'accessing',
  7252. fn: function (){
  7253. var self=this;
  7254. return $core.withContext(function($ctx1) {
  7255. return $recv(self._instanceClass())._package();
  7256. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  7257. },
  7258. args: [],
  7259. source: "package\x0a\x09^ self instanceClass package",
  7260. referencedClasses: [],
  7261. messageSends: ["package", "instanceClass"]
  7262. }),
  7263. $globals.Metaclass);
  7264. $core.addMethod(
  7265. $core.method({
  7266. selector: "printOn:",
  7267. protocol: 'printing',
  7268. fn: function (aStream){
  7269. var self=this;
  7270. return $core.withContext(function($ctx1) {
  7271. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  7272. $ctx1.sendIdx["nextPutAll:"]=1;
  7273. $recv(aStream)._nextPutAll_(" class");
  7274. return self;
  7275. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  7276. },
  7277. args: ["aStream"],
  7278. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  7279. referencedClasses: [],
  7280. messageSends: ["nextPutAll:", "name", "instanceClass"]
  7281. }),
  7282. $globals.Metaclass);
  7283. $core.addMethod(
  7284. $core.method({
  7285. selector: "subclasses",
  7286. protocol: 'accessing',
  7287. fn: function (){
  7288. var self=this;
  7289. return $core.withContext(function($ctx1) {
  7290. return $core.metaSubclasses(self);
  7291. return self;
  7292. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  7293. },
  7294. args: [],
  7295. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  7296. referencedClasses: [],
  7297. messageSends: []
  7298. }),
  7299. $globals.Metaclass);
  7300. $core.addMethod(
  7301. $core.method({
  7302. selector: "theMetaClass",
  7303. protocol: 'accessing',
  7304. fn: function (){
  7305. var self=this;
  7306. return self;
  7307. },
  7308. args: [],
  7309. source: "theMetaClass\x0a\x09^ self",
  7310. referencedClasses: [],
  7311. messageSends: []
  7312. }),
  7313. $globals.Metaclass);
  7314. $core.addMethod(
  7315. $core.method({
  7316. selector: "theNonMetaClass",
  7317. protocol: 'accessing',
  7318. fn: function (){
  7319. var self=this;
  7320. return $core.withContext(function($ctx1) {
  7321. return self._instanceClass();
  7322. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  7323. },
  7324. args: [],
  7325. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  7326. referencedClasses: [],
  7327. messageSends: ["instanceClass"]
  7328. }),
  7329. $globals.Metaclass);
  7330. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  7331. $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:`.";
  7332. $core.addMethod(
  7333. $core.method({
  7334. selector: "addSubclassOf:named:instanceVariableNames:package:",
  7335. protocol: 'class definition',
  7336. fn: function (aClass,className,aCollection,packageName){
  7337. var self=this;
  7338. var theClass,thePackage;
  7339. return $core.withContext(function($ctx1) {
  7340. var $1,$2,$receiver;
  7341. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7342. thePackage=$recv($globals.Package)._named_(packageName);
  7343. $1=theClass;
  7344. if(($receiver = $1) == null || $receiver.isNil){
  7345. $1;
  7346. } else {
  7347. $recv(theClass)._package_(thePackage);
  7348. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  7349. if(!$core.assert($2)){
  7350. return self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  7351. }
  7352. }
  7353. return self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  7354. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  7355. },
  7356. args: ["aClass", "className", "aCollection", "packageName"],
  7357. 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 ifFalse: [\x0a\x09\x09\x09^ 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",
  7358. referencedClasses: ["Smalltalk", "Package"],
  7359. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  7360. }),
  7361. $globals.ClassBuilder);
  7362. $core.addMethod(
  7363. $core.method({
  7364. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7365. protocol: 'private',
  7366. fn: function (aClass,aString,aCollection,packageName){
  7367. var self=this;
  7368. return $core.withContext(function($ctx1) {
  7369. return $core.addClass(aString, aClass, aCollection, packageName);
  7370. ;
  7371. return self;
  7372. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  7373. },
  7374. args: ["aClass", "aString", "aCollection", "packageName"],
  7375. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  7376. referencedClasses: [],
  7377. messageSends: []
  7378. }),
  7379. $globals.ClassBuilder);
  7380. $core.addMethod(
  7381. $core.method({
  7382. selector: "basicClass:instanceVariableNames:",
  7383. protocol: 'private',
  7384. fn: function (aClass,aString){
  7385. var self=this;
  7386. return $core.withContext(function($ctx1) {
  7387. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7388. return self;
  7389. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7390. },
  7391. args: ["aClass", "aString"],
  7392. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7393. referencedClasses: [],
  7394. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  7395. }),
  7396. $globals.ClassBuilder);
  7397. $core.addMethod(
  7398. $core.method({
  7399. selector: "basicClass:instanceVariables:",
  7400. protocol: 'private',
  7401. fn: function (aClass,aCollection){
  7402. var self=this;
  7403. return $core.withContext(function($ctx1) {
  7404. var $1;
  7405. $1=$recv(aClass)._isMetaclass();
  7406. if(!$core.assert($1)){
  7407. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  7408. }
  7409. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  7410. return self;
  7411. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  7412. },
  7413. args: ["aClass", "aCollection"],
  7414. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7415. referencedClasses: [],
  7416. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  7417. }),
  7418. $globals.ClassBuilder);
  7419. $core.addMethod(
  7420. $core.method({
  7421. selector: "basicRemoveClass:",
  7422. protocol: 'private',
  7423. fn: function (aClass){
  7424. var self=this;
  7425. return $core.withContext(function($ctx1) {
  7426. $core.removeClass(aClass);
  7427. return self;
  7428. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  7429. },
  7430. args: ["aClass"],
  7431. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  7432. referencedClasses: [],
  7433. messageSends: []
  7434. }),
  7435. $globals.ClassBuilder);
  7436. $core.addMethod(
  7437. $core.method({
  7438. selector: "basicRenameClass:to:",
  7439. protocol: 'private',
  7440. fn: function (aClass,aString){
  7441. var self=this;
  7442. return $core.withContext(function($ctx1) {
  7443. $globals[aString] = aClass;
  7444. delete $globals[aClass.className];
  7445. aClass.className = aString;
  7446. ;
  7447. return self;
  7448. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7449. },
  7450. args: ["aClass", "aString"],
  7451. 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'>",
  7452. referencedClasses: [],
  7453. messageSends: []
  7454. }),
  7455. $globals.ClassBuilder);
  7456. $core.addMethod(
  7457. $core.method({
  7458. selector: "basicSwapClassNames:with:",
  7459. protocol: 'private',
  7460. fn: function (aClass,anotherClass){
  7461. var self=this;
  7462. return $core.withContext(function($ctx1) {
  7463. var tmp = aClass.className;
  7464. aClass.className = anotherClass.className;
  7465. anotherClass.className = tmp;
  7466. ;
  7467. return self;
  7468. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7469. },
  7470. args: ["aClass", "anotherClass"],
  7471. 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'>",
  7472. referencedClasses: [],
  7473. messageSends: []
  7474. }),
  7475. $globals.ClassBuilder);
  7476. $core.addMethod(
  7477. $core.method({
  7478. selector: "class:instanceVariableNames:",
  7479. protocol: 'class definition',
  7480. fn: function (aClass,ivarNames){
  7481. var self=this;
  7482. return $core.withContext(function($ctx1) {
  7483. var $1,$3,$2;
  7484. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7485. $1=$recv($globals.SystemAnnouncer)._current();
  7486. $3=$recv($globals.ClassDefinitionChanged)._new();
  7487. $recv($3)._theClass_(aClass);
  7488. $2=$recv($3)._yourself();
  7489. $recv($1)._announce_($2);
  7490. return self;
  7491. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7492. },
  7493. args: ["aClass", "ivarNames"],
  7494. 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)",
  7495. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7496. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  7497. }),
  7498. $globals.ClassBuilder);
  7499. $core.addMethod(
  7500. $core.method({
  7501. selector: "copyClass:named:",
  7502. protocol: 'copying',
  7503. fn: function (aClass,className){
  7504. var self=this;
  7505. var newClass;
  7506. return $core.withContext(function($ctx1) {
  7507. var $1,$3,$2;
  7508. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7509. self._copyClass_to_(aClass,newClass);
  7510. $1=$recv($globals.SystemAnnouncer)._current();
  7511. $3=$recv($globals.ClassAdded)._new();
  7512. $recv($3)._theClass_(newClass);
  7513. $2=$recv($3)._yourself();
  7514. $recv($1)._announce_($2);
  7515. return newClass;
  7516. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7517. },
  7518. args: ["aClass", "className"],
  7519. 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",
  7520. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7521. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7522. }),
  7523. $globals.ClassBuilder);
  7524. $core.addMethod(
  7525. $core.method({
  7526. selector: "copyClass:to:",
  7527. protocol: 'copying',
  7528. fn: function (aClass,anotherClass){
  7529. var self=this;
  7530. return $core.withContext(function($ctx1) {
  7531. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7532. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7533. $1=$recv(aClass)._methodDictionary();
  7534. $ctx1.sendIdx["methodDictionary"]=1;
  7535. $recv($1)._valuesDo_((function(each){
  7536. return $core.withContext(function($ctx2) {
  7537. $2=$recv($globals.Compiler)._new();
  7538. $ctx2.sendIdx["new"]=1;
  7539. $3=$recv(each)._source();
  7540. $ctx2.sendIdx["source"]=1;
  7541. $4=$recv(each)._protocol();
  7542. $ctx2.sendIdx["protocol"]=1;
  7543. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7544. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7545. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7546. }));
  7547. $ctx1.sendIdx["valuesDo:"]=1;
  7548. $5=$recv(anotherClass)._class();
  7549. $ctx1.sendIdx["class"]=1;
  7550. $7=$recv(aClass)._class();
  7551. $ctx1.sendIdx["class"]=2;
  7552. $6=$recv($7)._instanceVariableNames();
  7553. self._basicClass_instanceVariables_($5,$6);
  7554. $9=$recv(aClass)._class();
  7555. $ctx1.sendIdx["class"]=3;
  7556. $8=$recv($9)._methodDictionary();
  7557. $recv($8)._valuesDo_((function(each){
  7558. return $core.withContext(function($ctx2) {
  7559. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7560. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7561. }));
  7562. return self;
  7563. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7564. },
  7565. args: ["aClass", "anotherClass"],
  7566. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ]",
  7567. referencedClasses: ["Compiler"],
  7568. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  7569. }),
  7570. $globals.ClassBuilder);
  7571. $core.addMethod(
  7572. $core.method({
  7573. selector: "installMethod:forClass:protocol:",
  7574. protocol: 'method definition',
  7575. fn: function (aCompiledMethod,aBehavior,aString){
  7576. var self=this;
  7577. return $core.withContext(function($ctx1) {
  7578. $recv(aCompiledMethod)._protocol_(aString);
  7579. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7580. return aCompiledMethod;
  7581. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7582. },
  7583. args: ["aCompiledMethod", "aBehavior", "aString"],
  7584. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7585. referencedClasses: [],
  7586. messageSends: ["protocol:", "addCompiledMethod:"]
  7587. }),
  7588. $globals.ClassBuilder);
  7589. $core.addMethod(
  7590. $core.method({
  7591. selector: "instanceVariableNamesFor:",
  7592. protocol: 'accessing',
  7593. fn: function (aString){
  7594. var self=this;
  7595. return $core.withContext(function($ctx1) {
  7596. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7597. return $core.withContext(function($ctx2) {
  7598. return $recv(each)._isEmpty();
  7599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7600. }));
  7601. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7602. },
  7603. args: ["aString"],
  7604. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7605. referencedClasses: [],
  7606. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7607. }),
  7608. $globals.ClassBuilder);
  7609. $core.addMethod(
  7610. $core.method({
  7611. selector: "migrateClass:superclass:",
  7612. protocol: 'class migration',
  7613. fn: function (aClass,anotherClass){
  7614. var self=this;
  7615. return $core.withContext(function($ctx1) {
  7616. var $1;
  7617. $1=$recv(aClass)._name();
  7618. $ctx1.sendIdx["name"]=1;
  7619. return self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7620. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7621. },
  7622. args: ["aClass", "anotherClass"],
  7623. 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",
  7624. referencedClasses: [],
  7625. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7626. }),
  7627. $globals.ClassBuilder);
  7628. $core.addMethod(
  7629. $core.method({
  7630. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7631. protocol: 'class migration',
  7632. fn: function (className,aClass,aCollection,packageName){
  7633. var self=this;
  7634. var oldClass,newClass,tmp;
  7635. return $core.withContext(function($ctx1) {
  7636. var $1,$2,$4,$3;
  7637. tmp="new*".__comma(className);
  7638. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7639. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7640. self._basicSwapClassNames_with_(oldClass,newClass);
  7641. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7642. $recv((function(){
  7643. return $core.withContext(function($ctx2) {
  7644. return self._copyClass_to_(oldClass,newClass);
  7645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7646. }))._on_do_($globals.Error,(function(exception){
  7647. return $core.withContext(function($ctx2) {
  7648. self._basicSwapClassNames_with_(oldClass,newClass);
  7649. $1=self._basicRemoveClass_(newClass);
  7650. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7651. $1;
  7652. return $recv(exception)._resignal();
  7653. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7654. }));
  7655. self._rawRenameClass_to_(oldClass,tmp);
  7656. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7657. self._rawRenameClass_to_(newClass,className);
  7658. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7659. return $core.withContext(function($ctx2) {
  7660. return self._migrateClass_superclass_(each,newClass);
  7661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7662. }));
  7663. self._basicRemoveClass_(oldClass);
  7664. $2=$recv($globals.SystemAnnouncer)._current();
  7665. $4=$recv($globals.ClassMigrated)._new();
  7666. $recv($4)._theClass_(newClass);
  7667. $recv($4)._oldClass_(oldClass);
  7668. $3=$recv($4)._yourself();
  7669. $recv($2)._announce_($3);
  7670. return newClass;
  7671. }, 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)});
  7672. },
  7673. args: ["className", "aClass", "aCollection", "packageName"],
  7674. 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",
  7675. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7676. 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"]
  7677. }),
  7678. $globals.ClassBuilder);
  7679. $core.addMethod(
  7680. $core.method({
  7681. selector: "rawRenameClass:to:",
  7682. protocol: 'private',
  7683. fn: function (aClass,aString){
  7684. var self=this;
  7685. return $core.withContext(function($ctx1) {
  7686. $globals[aString] = aClass;
  7687. ;
  7688. return self;
  7689. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7690. },
  7691. args: ["aClass", "aString"],
  7692. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  7693. referencedClasses: [],
  7694. messageSends: []
  7695. }),
  7696. $globals.ClassBuilder);
  7697. $core.addMethod(
  7698. $core.method({
  7699. selector: "renameClass:to:",
  7700. protocol: 'class migration',
  7701. fn: function (aClass,className){
  7702. var self=this;
  7703. return $core.withContext(function($ctx1) {
  7704. var $1,$3,$2;
  7705. self._basicRenameClass_to_(aClass,className);
  7706. $recv(aClass)._recompile();
  7707. $1=$recv($globals.SystemAnnouncer)._current();
  7708. $3=$recv($globals.ClassRenamed)._new();
  7709. $recv($3)._theClass_(aClass);
  7710. $2=$recv($3)._yourself();
  7711. $recv($1)._announce_($2);
  7712. return self;
  7713. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7714. },
  7715. args: ["aClass", "className"],
  7716. 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)",
  7717. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7718. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7719. }),
  7720. $globals.ClassBuilder);
  7721. $core.addMethod(
  7722. $core.method({
  7723. selector: "setupClass:",
  7724. protocol: 'public',
  7725. fn: function (aClass){
  7726. var self=this;
  7727. return $core.withContext(function($ctx1) {
  7728. self._deprecatedAPI_("Classes are now auto-inited.");
  7729. return self;
  7730. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7731. },
  7732. args: ["aClass"],
  7733. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  7734. referencedClasses: [],
  7735. messageSends: ["deprecatedAPI:"]
  7736. }),
  7737. $globals.ClassBuilder);
  7738. $core.addMethod(
  7739. $core.method({
  7740. selector: "superclass:subclass:",
  7741. protocol: 'class definition',
  7742. fn: function (aClass,className){
  7743. var self=this;
  7744. return $core.withContext(function($ctx1) {
  7745. return self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7746. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7747. },
  7748. args: ["aClass", "className"],
  7749. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7750. referencedClasses: [],
  7751. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7752. }),
  7753. $globals.ClassBuilder);
  7754. $core.addMethod(
  7755. $core.method({
  7756. selector: "superclass:subclass:instanceVariableNames:package:",
  7757. protocol: 'class definition',
  7758. fn: function (aClass,className,ivarNames,packageName){
  7759. var self=this;
  7760. var newClass;
  7761. return $core.withContext(function($ctx1) {
  7762. var $1,$2,$3,$5,$4,$receiver;
  7763. $1=self._instanceVariableNamesFor_(ivarNames);
  7764. if(($receiver = packageName) == null || $receiver.isNil){
  7765. $2="unclassified";
  7766. } else {
  7767. $2=packageName;
  7768. }
  7769. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7770. $3=$recv($globals.SystemAnnouncer)._current();
  7771. $5=$recv($globals.ClassAdded)._new();
  7772. $recv($5)._theClass_(newClass);
  7773. $4=$recv($5)._yourself();
  7774. $recv($3)._announce_($4);
  7775. return newClass;
  7776. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7777. },
  7778. args: ["aClass", "className", "ivarNames", "packageName"],
  7779. 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",
  7780. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7781. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  7782. }),
  7783. $globals.ClassBuilder);
  7784. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7785. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  7786. $core.addMethod(
  7787. $core.method({
  7788. selector: "getNodesFrom:",
  7789. protocol: 'accessing',
  7790. fn: function (aCollection){
  7791. var self=this;
  7792. var children,others;
  7793. return $core.withContext(function($ctx1) {
  7794. var $1;
  7795. children=[];
  7796. others=[];
  7797. $recv(aCollection)._do_((function(each){
  7798. return $core.withContext(function($ctx2) {
  7799. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7800. if($core.assert($1)){
  7801. return $recv(children)._add_(each);
  7802. $ctx2.sendIdx["add:"]=1;
  7803. } else {
  7804. return $recv(others)._add_(each);
  7805. }
  7806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7807. }));
  7808. self["@nodes"]=$recv(children)._collect_((function(each){
  7809. return $core.withContext(function($ctx2) {
  7810. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7811. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7812. }));
  7813. return self;
  7814. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7815. },
  7816. args: ["aCollection"],
  7817. 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 ]",
  7818. referencedClasses: ["ClassSorterNode"],
  7819. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7820. }),
  7821. $globals.ClassSorterNode);
  7822. $core.addMethod(
  7823. $core.method({
  7824. selector: "level",
  7825. protocol: 'accessing',
  7826. fn: function (){
  7827. var self=this;
  7828. return self["@level"];
  7829. },
  7830. args: [],
  7831. source: "level\x0a\x09^ level",
  7832. referencedClasses: [],
  7833. messageSends: []
  7834. }),
  7835. $globals.ClassSorterNode);
  7836. $core.addMethod(
  7837. $core.method({
  7838. selector: "level:",
  7839. protocol: 'accessing',
  7840. fn: function (anInteger){
  7841. var self=this;
  7842. self["@level"]=anInteger;
  7843. return self;
  7844. },
  7845. args: ["anInteger"],
  7846. source: "level: anInteger\x0a\x09level := anInteger",
  7847. referencedClasses: [],
  7848. messageSends: []
  7849. }),
  7850. $globals.ClassSorterNode);
  7851. $core.addMethod(
  7852. $core.method({
  7853. selector: "nodes",
  7854. protocol: 'accessing',
  7855. fn: function (){
  7856. var self=this;
  7857. return self["@nodes"];
  7858. },
  7859. args: [],
  7860. source: "nodes\x0a\x09^ nodes",
  7861. referencedClasses: [],
  7862. messageSends: []
  7863. }),
  7864. $globals.ClassSorterNode);
  7865. $core.addMethod(
  7866. $core.method({
  7867. selector: "theClass",
  7868. protocol: 'accessing',
  7869. fn: function (){
  7870. var self=this;
  7871. return self["@theClass"];
  7872. },
  7873. args: [],
  7874. source: "theClass\x0a\x09^ theClass",
  7875. referencedClasses: [],
  7876. messageSends: []
  7877. }),
  7878. $globals.ClassSorterNode);
  7879. $core.addMethod(
  7880. $core.method({
  7881. selector: "theClass:",
  7882. protocol: 'accessing',
  7883. fn: function (aClass){
  7884. var self=this;
  7885. self["@theClass"]=aClass;
  7886. return self;
  7887. },
  7888. args: ["aClass"],
  7889. source: "theClass: aClass\x0a\x09theClass := aClass",
  7890. referencedClasses: [],
  7891. messageSends: []
  7892. }),
  7893. $globals.ClassSorterNode);
  7894. $core.addMethod(
  7895. $core.method({
  7896. selector: "traverseClassesWith:",
  7897. protocol: 'visiting',
  7898. fn: function (aCollection){
  7899. var self=this;
  7900. return $core.withContext(function($ctx1) {
  7901. var $1,$3,$2;
  7902. $1=self._theClass();
  7903. $ctx1.sendIdx["theClass"]=1;
  7904. $recv(aCollection)._add_($1);
  7905. $recv($recv(self._nodes())._sorted_((function(a,b){
  7906. return $core.withContext(function($ctx2) {
  7907. $3=$recv(a)._theClass();
  7908. $ctx2.sendIdx["theClass"]=2;
  7909. $2=$recv($3)._name();
  7910. $ctx2.sendIdx["name"]=1;
  7911. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7912. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7913. })))._do_((function(aNode){
  7914. return $core.withContext(function($ctx2) {
  7915. return $recv(aNode)._traverseClassesWith_(aCollection);
  7916. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7917. }));
  7918. return self;
  7919. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7920. },
  7921. args: ["aCollection"],
  7922. 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 ].",
  7923. referencedClasses: [],
  7924. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7925. }),
  7926. $globals.ClassSorterNode);
  7927. $core.addMethod(
  7928. $core.method({
  7929. selector: "on:classes:level:",
  7930. protocol: 'instance creation',
  7931. fn: function (aClass,aCollection,anInteger){
  7932. var self=this;
  7933. return $core.withContext(function($ctx1) {
  7934. var $1;
  7935. $1=self._new();
  7936. $recv($1)._theClass_(aClass);
  7937. $recv($1)._level_(anInteger);
  7938. $recv($1)._getNodesFrom_(aCollection);
  7939. return $recv($1)._yourself();
  7940. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7941. },
  7942. args: ["aClass", "aCollection", "anInteger"],
  7943. 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",
  7944. referencedClasses: [],
  7945. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7946. }),
  7947. $globals.ClassSorterNode.klass);
  7948. });
  7949. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7950. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  7951. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7952. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  7953. $core.addPackage('Kernel-Methods');
  7954. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7955. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7956. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7957. $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 | ... ] `";
  7958. $core.addMethod(
  7959. $core.method({
  7960. selector: "applyTo:arguments:",
  7961. protocol: 'evaluating',
  7962. fn: function (anObject,aCollection){
  7963. var self=this;
  7964. return $core.withContext(function($ctx1) {
  7965. return self.apply(anObject, aCollection);
  7966. return self;
  7967. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7968. },
  7969. args: ["anObject", "aCollection"],
  7970. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  7971. referencedClasses: [],
  7972. messageSends: []
  7973. }),
  7974. $globals.BlockClosure);
  7975. $core.addMethod(
  7976. $core.method({
  7977. selector: "asCompiledMethod:",
  7978. protocol: 'converting',
  7979. fn: function (aString){
  7980. var self=this;
  7981. return $core.withContext(function($ctx1) {
  7982. return $core.method({selector:aString, fn:self});;
  7983. return self;
  7984. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  7985. },
  7986. args: ["aString"],
  7987. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  7988. referencedClasses: [],
  7989. messageSends: []
  7990. }),
  7991. $globals.BlockClosure);
  7992. $core.addMethod(
  7993. $core.method({
  7994. selector: "compiledSource",
  7995. protocol: 'accessing',
  7996. fn: function (){
  7997. var self=this;
  7998. return $core.withContext(function($ctx1) {
  7999. return self.toString();
  8000. return self;
  8001. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  8002. },
  8003. args: [],
  8004. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  8005. referencedClasses: [],
  8006. messageSends: []
  8007. }),
  8008. $globals.BlockClosure);
  8009. $core.addMethod(
  8010. $core.method({
  8011. selector: "currySelf",
  8012. protocol: 'converting',
  8013. fn: function (){
  8014. var self=this;
  8015. return $core.withContext(function($ctx1) {
  8016. return function () {
  8017. var args = [ this ];
  8018. args.push.apply(args, arguments);
  8019. return self.apply(null, args);
  8020. }
  8021. ;
  8022. return self;
  8023. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  8024. },
  8025. args: [],
  8026. 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'>",
  8027. referencedClasses: [],
  8028. messageSends: []
  8029. }),
  8030. $globals.BlockClosure);
  8031. $core.addMethod(
  8032. $core.method({
  8033. selector: "ensure:",
  8034. protocol: 'evaluating',
  8035. fn: function (aBlock){
  8036. var self=this;
  8037. return $core.withContext(function($ctx1) {
  8038. try{return self._value()}finally{aBlock._value()};
  8039. return self;
  8040. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  8041. },
  8042. args: ["aBlock"],
  8043. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return self._value()}finally{aBlock._value()}'>",
  8044. referencedClasses: [],
  8045. messageSends: []
  8046. }),
  8047. $globals.BlockClosure);
  8048. $core.addMethod(
  8049. $core.method({
  8050. selector: "fork",
  8051. protocol: 'timeout/interval',
  8052. fn: function (){
  8053. var self=this;
  8054. return $core.withContext(function($ctx1) {
  8055. $recv($recv($globals.ForkPool)._default())._fork_(self);
  8056. return self;
  8057. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  8058. },
  8059. args: [],
  8060. source: "fork\x0a\x09ForkPool default fork: self",
  8061. referencedClasses: ["ForkPool"],
  8062. messageSends: ["fork:", "default"]
  8063. }),
  8064. $globals.BlockClosure);
  8065. $core.addMethod(
  8066. $core.method({
  8067. selector: "new",
  8068. protocol: 'evaluating',
  8069. fn: function (){
  8070. var self=this;
  8071. return $core.withContext(function($ctx1) {
  8072. return new self();
  8073. return self;
  8074. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  8075. },
  8076. args: [],
  8077. 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()'>",
  8078. referencedClasses: [],
  8079. messageSends: []
  8080. }),
  8081. $globals.BlockClosure);
  8082. $core.addMethod(
  8083. $core.method({
  8084. selector: "newValue:",
  8085. protocol: 'evaluating',
  8086. fn: function (anObject){
  8087. var self=this;
  8088. return $core.withContext(function($ctx1) {
  8089. return self._newWithValues_([anObject]);
  8090. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  8091. },
  8092. args: ["anObject"],
  8093. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  8094. referencedClasses: [],
  8095. messageSends: ["newWithValues:"]
  8096. }),
  8097. $globals.BlockClosure);
  8098. $core.addMethod(
  8099. $core.method({
  8100. selector: "newValue:value:",
  8101. protocol: 'evaluating',
  8102. fn: function (anObject,anObject2){
  8103. var self=this;
  8104. return $core.withContext(function($ctx1) {
  8105. return self._newWithValues_([anObject,anObject2]);
  8106. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  8107. },
  8108. args: ["anObject", "anObject2"],
  8109. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  8110. referencedClasses: [],
  8111. messageSends: ["newWithValues:"]
  8112. }),
  8113. $globals.BlockClosure);
  8114. $core.addMethod(
  8115. $core.method({
  8116. selector: "newValue:value:value:",
  8117. protocol: 'evaluating',
  8118. fn: function (anObject,anObject2,anObject3){
  8119. var self=this;
  8120. return $core.withContext(function($ctx1) {
  8121. return self._newWithValues_([anObject,anObject2,anObject3]);
  8122. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  8123. },
  8124. args: ["anObject", "anObject2", "anObject3"],
  8125. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  8126. referencedClasses: [],
  8127. messageSends: ["newWithValues:"]
  8128. }),
  8129. $globals.BlockClosure);
  8130. $core.addMethod(
  8131. $core.method({
  8132. selector: "newWithValues:",
  8133. protocol: 'evaluating',
  8134. fn: function (aCollection){
  8135. var self=this;
  8136. return $core.withContext(function($ctx1) {
  8137. var object = Object.create(self.prototype);
  8138. var result = self.apply(object, aCollection);
  8139. return typeof result === "object" ? result : object;
  8140. ;
  8141. return self;
  8142. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  8143. },
  8144. args: ["aCollection"],
  8145. 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'>",
  8146. referencedClasses: [],
  8147. messageSends: []
  8148. }),
  8149. $globals.BlockClosure);
  8150. $core.addMethod(
  8151. $core.method({
  8152. selector: "numArgs",
  8153. protocol: 'accessing',
  8154. fn: function (){
  8155. var self=this;
  8156. return $core.withContext(function($ctx1) {
  8157. return self.length;
  8158. return self;
  8159. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  8160. },
  8161. args: [],
  8162. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  8163. referencedClasses: [],
  8164. messageSends: []
  8165. }),
  8166. $globals.BlockClosure);
  8167. $core.addMethod(
  8168. $core.method({
  8169. selector: "on:do:",
  8170. protocol: 'error handling',
  8171. fn: function (anErrorClass,aBlock){
  8172. var self=this;
  8173. return $core.withContext(function($ctx1) {
  8174. var $1;
  8175. return self._tryCatch_((function(error){
  8176. var smalltalkError;
  8177. return $core.withContext(function($ctx2) {
  8178. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  8179. smalltalkError;
  8180. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  8181. if($core.assert($1)){
  8182. return $recv(aBlock)._value_(smalltalkError);
  8183. } else {
  8184. return $recv(smalltalkError)._resignal();
  8185. }
  8186. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  8187. }));
  8188. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  8189. },
  8190. args: ["anErrorClass", "aBlock"],
  8191. 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 ] ]",
  8192. referencedClasses: ["Smalltalk"],
  8193. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  8194. }),
  8195. $globals.BlockClosure);
  8196. $core.addMethod(
  8197. $core.method({
  8198. selector: "receiver",
  8199. protocol: 'accessing',
  8200. fn: function (){
  8201. var self=this;
  8202. return nil;
  8203. },
  8204. args: [],
  8205. source: "receiver\x0a\x09^ nil",
  8206. referencedClasses: [],
  8207. messageSends: []
  8208. }),
  8209. $globals.BlockClosure);
  8210. $core.addMethod(
  8211. $core.method({
  8212. selector: "timeToRun",
  8213. protocol: 'evaluating',
  8214. fn: function (){
  8215. var self=this;
  8216. return $core.withContext(function($ctx1) {
  8217. return $recv($globals.Date)._millisecondsToRun_(self);
  8218. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  8219. },
  8220. args: [],
  8221. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  8222. referencedClasses: ["Date"],
  8223. messageSends: ["millisecondsToRun:"]
  8224. }),
  8225. $globals.BlockClosure);
  8226. $core.addMethod(
  8227. $core.method({
  8228. selector: "tryCatch:",
  8229. protocol: 'error handling',
  8230. fn: function (aBlock){
  8231. var self=this;
  8232. return $core.withContext(function($ctx1) {
  8233. try {
  8234. return self._value();
  8235. } catch(error) {
  8236. // pass non-local returns undetected
  8237. if (Array.isArray(error) && error.length === 1) throw error;
  8238. return aBlock._value_(error);
  8239. }
  8240. ;
  8241. return self;
  8242. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  8243. },
  8244. args: ["aBlock"],
  8245. 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'>",
  8246. referencedClasses: [],
  8247. messageSends: []
  8248. }),
  8249. $globals.BlockClosure);
  8250. $core.addMethod(
  8251. $core.method({
  8252. selector: "value",
  8253. protocol: 'evaluating',
  8254. fn: function (){
  8255. var self=this;
  8256. return $core.withContext(function($ctx1) {
  8257. return self();;
  8258. return self;
  8259. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  8260. },
  8261. args: [],
  8262. source: "value\x0a\x09<inlineJS: 'return self();'>",
  8263. referencedClasses: [],
  8264. messageSends: []
  8265. }),
  8266. $globals.BlockClosure);
  8267. $core.addMethod(
  8268. $core.method({
  8269. selector: "value:",
  8270. protocol: 'evaluating',
  8271. fn: function (anArg){
  8272. var self=this;
  8273. return $core.withContext(function($ctx1) {
  8274. return self(anArg);;
  8275. return self;
  8276. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  8277. },
  8278. args: ["anArg"],
  8279. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  8280. referencedClasses: [],
  8281. messageSends: []
  8282. }),
  8283. $globals.BlockClosure);
  8284. $core.addMethod(
  8285. $core.method({
  8286. selector: "value:value:",
  8287. protocol: 'evaluating',
  8288. fn: function (firstArg,secondArg){
  8289. var self=this;
  8290. return $core.withContext(function($ctx1) {
  8291. return self(firstArg, secondArg);;
  8292. return self;
  8293. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  8294. },
  8295. args: ["firstArg", "secondArg"],
  8296. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  8297. referencedClasses: [],
  8298. messageSends: []
  8299. }),
  8300. $globals.BlockClosure);
  8301. $core.addMethod(
  8302. $core.method({
  8303. selector: "value:value:value:",
  8304. protocol: 'evaluating',
  8305. fn: function (firstArg,secondArg,thirdArg){
  8306. var self=this;
  8307. return $core.withContext(function($ctx1) {
  8308. return self(firstArg, secondArg, thirdArg);;
  8309. return self;
  8310. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  8311. },
  8312. args: ["firstArg", "secondArg", "thirdArg"],
  8313. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  8314. referencedClasses: [],
  8315. messageSends: []
  8316. }),
  8317. $globals.BlockClosure);
  8318. $core.addMethod(
  8319. $core.method({
  8320. selector: "valueWithInterval:",
  8321. protocol: 'timeout/interval',
  8322. fn: function (aNumber){
  8323. var self=this;
  8324. return $core.withContext(function($ctx1) {
  8325. var interval = setInterval(self, aNumber);
  8326. return $globals.Timeout._on_(interval);
  8327. ;
  8328. return self;
  8329. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  8330. },
  8331. args: ["aNumber"],
  8332. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  8333. referencedClasses: [],
  8334. messageSends: []
  8335. }),
  8336. $globals.BlockClosure);
  8337. $core.addMethod(
  8338. $core.method({
  8339. selector: "valueWithPossibleArguments:",
  8340. protocol: 'evaluating',
  8341. fn: function (aCollection){
  8342. var self=this;
  8343. return $core.withContext(function($ctx1) {
  8344. return self.apply(null, aCollection);;
  8345. return self;
  8346. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  8347. },
  8348. args: ["aCollection"],
  8349. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  8350. referencedClasses: [],
  8351. messageSends: []
  8352. }),
  8353. $globals.BlockClosure);
  8354. $core.addMethod(
  8355. $core.method({
  8356. selector: "valueWithTimeout:",
  8357. protocol: 'timeout/interval',
  8358. fn: function (aNumber){
  8359. var self=this;
  8360. return $core.withContext(function($ctx1) {
  8361. var timeout = setTimeout(self, aNumber);
  8362. return $globals.Timeout._on_(timeout);
  8363. ;
  8364. return self;
  8365. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  8366. },
  8367. args: ["aNumber"],
  8368. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  8369. referencedClasses: [],
  8370. messageSends: []
  8371. }),
  8372. $globals.BlockClosure);
  8373. $core.addMethod(
  8374. $core.method({
  8375. selector: "whileFalse",
  8376. protocol: 'controlling',
  8377. fn: function (){
  8378. var self=this;
  8379. return $core.withContext(function($ctx1) {
  8380. self._whileFalse_((function(){
  8381. }));
  8382. return self;
  8383. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  8384. },
  8385. args: [],
  8386. source: "whileFalse\x0a\x09self whileFalse: []",
  8387. referencedClasses: [],
  8388. messageSends: ["whileFalse:"]
  8389. }),
  8390. $globals.BlockClosure);
  8391. $core.addMethod(
  8392. $core.method({
  8393. selector: "whileFalse:",
  8394. protocol: 'controlling',
  8395. fn: function (aBlock){
  8396. var self=this;
  8397. return $core.withContext(function($ctx1) {
  8398. while(!$core.assert(self._value())) {aBlock._value()};
  8399. return self;
  8400. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8401. },
  8402. args: ["aBlock"],
  8403. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert(self._value())) {aBlock._value()}'>",
  8404. referencedClasses: [],
  8405. messageSends: []
  8406. }),
  8407. $globals.BlockClosure);
  8408. $core.addMethod(
  8409. $core.method({
  8410. selector: "whileTrue",
  8411. protocol: 'controlling',
  8412. fn: function (){
  8413. var self=this;
  8414. return $core.withContext(function($ctx1) {
  8415. self._whileTrue_((function(){
  8416. }));
  8417. return self;
  8418. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8419. },
  8420. args: [],
  8421. source: "whileTrue\x0a\x09self whileTrue: []",
  8422. referencedClasses: [],
  8423. messageSends: ["whileTrue:"]
  8424. }),
  8425. $globals.BlockClosure);
  8426. $core.addMethod(
  8427. $core.method({
  8428. selector: "whileTrue:",
  8429. protocol: 'controlling',
  8430. fn: function (aBlock){
  8431. var self=this;
  8432. return $core.withContext(function($ctx1) {
  8433. while($core.assert(self._value())) {aBlock._value()};
  8434. return self;
  8435. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8436. },
  8437. args: ["aBlock"],
  8438. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert(self._value())) {aBlock._value()}'>",
  8439. referencedClasses: [],
  8440. messageSends: []
  8441. }),
  8442. $globals.BlockClosure);
  8443. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8444. $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";
  8445. $core.addMethod(
  8446. $core.method({
  8447. selector: "arguments",
  8448. protocol: 'accessing',
  8449. fn: function (){
  8450. var self=this;
  8451. return $core.withContext(function($ctx1) {
  8452. return self.args || [];
  8453. return self;
  8454. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8455. },
  8456. args: [],
  8457. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  8458. referencedClasses: [],
  8459. messageSends: []
  8460. }),
  8461. $globals.CompiledMethod);
  8462. $core.addMethod(
  8463. $core.method({
  8464. selector: "browse",
  8465. protocol: 'browsing',
  8466. fn: function (){
  8467. var self=this;
  8468. return $core.withContext(function($ctx1) {
  8469. $recv($globals.Finder)._findMethod_(self);
  8470. return self;
  8471. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8472. },
  8473. args: [],
  8474. source: "browse\x0a\x09Finder findMethod: self",
  8475. referencedClasses: ["Finder"],
  8476. messageSends: ["findMethod:"]
  8477. }),
  8478. $globals.CompiledMethod);
  8479. $core.addMethod(
  8480. $core.method({
  8481. selector: "category",
  8482. protocol: 'accessing',
  8483. fn: function (){
  8484. var self=this;
  8485. return $core.withContext(function($ctx1) {
  8486. return self._protocol();
  8487. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8488. },
  8489. args: [],
  8490. source: "category\x0a\x09^ self protocol",
  8491. referencedClasses: [],
  8492. messageSends: ["protocol"]
  8493. }),
  8494. $globals.CompiledMethod);
  8495. $core.addMethod(
  8496. $core.method({
  8497. selector: "defaultProtocol",
  8498. protocol: 'defaults',
  8499. fn: function (){
  8500. var self=this;
  8501. return "as yet unclassified";
  8502. },
  8503. args: [],
  8504. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8505. referencedClasses: [],
  8506. messageSends: []
  8507. }),
  8508. $globals.CompiledMethod);
  8509. $core.addMethod(
  8510. $core.method({
  8511. selector: "fn",
  8512. protocol: 'accessing',
  8513. fn: function (){
  8514. var self=this;
  8515. return $core.withContext(function($ctx1) {
  8516. return self._basicAt_("fn");
  8517. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8518. },
  8519. args: [],
  8520. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8521. referencedClasses: [],
  8522. messageSends: ["basicAt:"]
  8523. }),
  8524. $globals.CompiledMethod);
  8525. $core.addMethod(
  8526. $core.method({
  8527. selector: "fn:",
  8528. protocol: 'accessing',
  8529. fn: function (aBlock){
  8530. var self=this;
  8531. return $core.withContext(function($ctx1) {
  8532. self._basicAt_put_("fn",aBlock);
  8533. return self;
  8534. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8535. },
  8536. args: ["aBlock"],
  8537. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8538. referencedClasses: [],
  8539. messageSends: ["basicAt:put:"]
  8540. }),
  8541. $globals.CompiledMethod);
  8542. $core.addMethod(
  8543. $core.method({
  8544. selector: "isCompiledMethod",
  8545. protocol: 'testing',
  8546. fn: function (){
  8547. var self=this;
  8548. return true;
  8549. },
  8550. args: [],
  8551. source: "isCompiledMethod\x0a\x09^ true",
  8552. referencedClasses: [],
  8553. messageSends: []
  8554. }),
  8555. $globals.CompiledMethod);
  8556. $core.addMethod(
  8557. $core.method({
  8558. selector: "isOverridden",
  8559. protocol: 'testing',
  8560. fn: function (){
  8561. var self=this;
  8562. var selector;
  8563. return $core.withContext(function($ctx1) {
  8564. var $1;
  8565. var $early={};
  8566. try {
  8567. selector=self._selector();
  8568. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8569. return $core.withContext(function($ctx2) {
  8570. $1=$recv(each)._includesSelector_(selector);
  8571. if($core.assert($1)){
  8572. throw $early=[true];
  8573. }
  8574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8575. }));
  8576. return false;
  8577. }
  8578. catch(e) {if(e===$early)return e[0]; throw e}
  8579. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8580. },
  8581. args: [],
  8582. 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",
  8583. referencedClasses: [],
  8584. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8585. }),
  8586. $globals.CompiledMethod);
  8587. $core.addMethod(
  8588. $core.method({
  8589. selector: "isOverride",
  8590. protocol: 'testing',
  8591. fn: function (){
  8592. var self=this;
  8593. var superclass;
  8594. return $core.withContext(function($ctx1) {
  8595. var $1,$2,$receiver;
  8596. $1=self._methodClass();
  8597. $ctx1.sendIdx["methodClass"]=1;
  8598. superclass=$recv($1)._superclass();
  8599. $ctx1.sendIdx["superclass"]=1;
  8600. $2=superclass;
  8601. if(($receiver = $2) == null || $receiver.isNil){
  8602. return false;
  8603. } else {
  8604. $2;
  8605. }
  8606. return $recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8607. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8608. },
  8609. args: [],
  8610. 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",
  8611. referencedClasses: [],
  8612. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8613. }),
  8614. $globals.CompiledMethod);
  8615. $core.addMethod(
  8616. $core.method({
  8617. selector: "messageSends",
  8618. protocol: 'accessing',
  8619. fn: function (){
  8620. var self=this;
  8621. return $core.withContext(function($ctx1) {
  8622. return self._basicAt_("messageSends");
  8623. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8624. },
  8625. args: [],
  8626. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8627. referencedClasses: [],
  8628. messageSends: ["basicAt:"]
  8629. }),
  8630. $globals.CompiledMethod);
  8631. $core.addMethod(
  8632. $core.method({
  8633. selector: "methodClass",
  8634. protocol: 'accessing',
  8635. fn: function (){
  8636. var self=this;
  8637. return $core.withContext(function($ctx1) {
  8638. return self._basicAt_("methodClass");
  8639. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8640. },
  8641. args: [],
  8642. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8643. referencedClasses: [],
  8644. messageSends: ["basicAt:"]
  8645. }),
  8646. $globals.CompiledMethod);
  8647. $core.addMethod(
  8648. $core.method({
  8649. selector: "package",
  8650. protocol: 'accessing',
  8651. fn: function (){
  8652. var self=this;
  8653. return $core.withContext(function($ctx1) {
  8654. var $1,$receiver;
  8655. $1=self._methodClass();
  8656. if(($receiver = $1) == null || $receiver.isNil){
  8657. return $1;
  8658. } else {
  8659. var class_;
  8660. class_=$receiver;
  8661. return $recv(class_)._packageOfProtocol_(self._protocol());
  8662. }
  8663. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8664. },
  8665. args: [],
  8666. 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 ]",
  8667. referencedClasses: [],
  8668. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8669. }),
  8670. $globals.CompiledMethod);
  8671. $core.addMethod(
  8672. $core.method({
  8673. selector: "protocol",
  8674. protocol: 'accessing',
  8675. fn: function (){
  8676. var self=this;
  8677. return $core.withContext(function($ctx1) {
  8678. var $1,$receiver;
  8679. $1=self._basicAt_("protocol");
  8680. if(($receiver = $1) == null || $receiver.isNil){
  8681. return self._defaultProtocol();
  8682. } else {
  8683. return $1;
  8684. }
  8685. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8686. },
  8687. args: [],
  8688. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8689. referencedClasses: [],
  8690. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8691. }),
  8692. $globals.CompiledMethod);
  8693. $core.addMethod(
  8694. $core.method({
  8695. selector: "protocol:",
  8696. protocol: 'accessing',
  8697. fn: function (aString){
  8698. var self=this;
  8699. var oldProtocol;
  8700. return $core.withContext(function($ctx1) {
  8701. var $1,$3,$2,$4,$receiver;
  8702. oldProtocol=self._protocol();
  8703. self._basicAt_put_("protocol",aString);
  8704. $1=$recv($globals.SystemAnnouncer)._current();
  8705. $3=$recv($globals.MethodMoved)._new();
  8706. $recv($3)._method_(self);
  8707. $recv($3)._oldProtocol_(oldProtocol);
  8708. $2=$recv($3)._yourself();
  8709. $recv($1)._announce_($2);
  8710. $4=self._methodClass();
  8711. if(($receiver = $4) == null || $receiver.isNil){
  8712. $4;
  8713. } else {
  8714. var methodClass;
  8715. methodClass=$receiver;
  8716. $recv($recv(methodClass)._organization())._addElement_(aString);
  8717. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8718. }
  8719. return self;
  8720. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8721. },
  8722. args: ["aString"],
  8723. 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 ]",
  8724. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8725. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8726. }),
  8727. $globals.CompiledMethod);
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "referencedClasses",
  8731. protocol: 'accessing',
  8732. fn: function (){
  8733. var self=this;
  8734. return $core.withContext(function($ctx1) {
  8735. return self._basicAt_("referencedClasses");
  8736. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8737. },
  8738. args: [],
  8739. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8740. referencedClasses: [],
  8741. messageSends: ["basicAt:"]
  8742. }),
  8743. $globals.CompiledMethod);
  8744. $core.addMethod(
  8745. $core.method({
  8746. selector: "selector",
  8747. protocol: 'accessing',
  8748. fn: function (){
  8749. var self=this;
  8750. return $core.withContext(function($ctx1) {
  8751. return self._basicAt_("selector");
  8752. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8753. },
  8754. args: [],
  8755. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8756. referencedClasses: [],
  8757. messageSends: ["basicAt:"]
  8758. }),
  8759. $globals.CompiledMethod);
  8760. $core.addMethod(
  8761. $core.method({
  8762. selector: "selector:",
  8763. protocol: 'accessing',
  8764. fn: function (aString){
  8765. var self=this;
  8766. return $core.withContext(function($ctx1) {
  8767. self._basicAt_put_("selector",aString);
  8768. return self;
  8769. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8770. },
  8771. args: ["aString"],
  8772. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8773. referencedClasses: [],
  8774. messageSends: ["basicAt:put:"]
  8775. }),
  8776. $globals.CompiledMethod);
  8777. $core.addMethod(
  8778. $core.method({
  8779. selector: "sendTo:arguments:",
  8780. protocol: 'evaluating',
  8781. fn: function (anObject,aCollection){
  8782. var self=this;
  8783. return $core.withContext(function($ctx1) {
  8784. return $recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8785. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8786. },
  8787. args: ["anObject", "aCollection"],
  8788. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8789. referencedClasses: [],
  8790. messageSends: ["applyTo:arguments:", "fn"]
  8791. }),
  8792. $globals.CompiledMethod);
  8793. $core.addMethod(
  8794. $core.method({
  8795. selector: "source",
  8796. protocol: 'accessing',
  8797. fn: function (){
  8798. var self=this;
  8799. return $core.withContext(function($ctx1) {
  8800. var $1,$receiver;
  8801. $1=self._basicAt_("source");
  8802. if(($receiver = $1) == null || $receiver.isNil){
  8803. return "";
  8804. } else {
  8805. return $1;
  8806. }
  8807. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8808. },
  8809. args: [],
  8810. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8811. referencedClasses: [],
  8812. messageSends: ["ifNil:", "basicAt:"]
  8813. }),
  8814. $globals.CompiledMethod);
  8815. $core.addMethod(
  8816. $core.method({
  8817. selector: "source:",
  8818. protocol: 'accessing',
  8819. fn: function (aString){
  8820. var self=this;
  8821. return $core.withContext(function($ctx1) {
  8822. self._basicAt_put_("source",aString);
  8823. return self;
  8824. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8825. },
  8826. args: ["aString"],
  8827. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8828. referencedClasses: [],
  8829. messageSends: ["basicAt:put:"]
  8830. }),
  8831. $globals.CompiledMethod);
  8832. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8833. $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`";
  8834. $core.addMethod(
  8835. $core.method({
  8836. selector: "addWorker",
  8837. protocol: 'private',
  8838. fn: function (){
  8839. var self=this;
  8840. return $core.withContext(function($ctx1) {
  8841. $recv(self["@worker"])._valueWithTimeout_((0));
  8842. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8843. return self;
  8844. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8845. },
  8846. args: [],
  8847. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8848. referencedClasses: [],
  8849. messageSends: ["valueWithTimeout:", "+"]
  8850. }),
  8851. $globals.ForkPool);
  8852. $core.addMethod(
  8853. $core.method({
  8854. selector: "defaultMaxPoolSize",
  8855. protocol: 'defaults',
  8856. fn: function (){
  8857. var self=this;
  8858. return $core.withContext(function($ctx1) {
  8859. return $recv(self._class())._defaultMaxPoolSize();
  8860. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8861. },
  8862. args: [],
  8863. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8864. referencedClasses: [],
  8865. messageSends: ["defaultMaxPoolSize", "class"]
  8866. }),
  8867. $globals.ForkPool);
  8868. $core.addMethod(
  8869. $core.method({
  8870. selector: "fork:",
  8871. protocol: 'actions',
  8872. fn: function (aBlock){
  8873. var self=this;
  8874. return $core.withContext(function($ctx1) {
  8875. var $1;
  8876. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8877. if($core.assert($1)){
  8878. self._addWorker();
  8879. }
  8880. $recv(self["@queue"])._nextPut_(aBlock);
  8881. return self;
  8882. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8883. },
  8884. args: ["aBlock"],
  8885. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8886. referencedClasses: [],
  8887. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8888. }),
  8889. $globals.ForkPool);
  8890. $core.addMethod(
  8891. $core.method({
  8892. selector: "initialize",
  8893. protocol: 'initialization',
  8894. fn: function (){
  8895. var self=this;
  8896. return $core.withContext(function($ctx1) {
  8897. (
  8898. $ctx1.supercall = true,
  8899. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  8900. $ctx1.supercall = false;
  8901. self["@poolSize"]=(0);
  8902. self["@queue"]=$recv($globals.Queue)._new();
  8903. self["@worker"]=self._makeWorker();
  8904. return self;
  8905. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8906. },
  8907. args: [],
  8908. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8909. referencedClasses: ["Queue"],
  8910. messageSends: ["initialize", "new", "makeWorker"]
  8911. }),
  8912. $globals.ForkPool);
  8913. $core.addMethod(
  8914. $core.method({
  8915. selector: "makeWorker",
  8916. protocol: 'initialization',
  8917. fn: function (){
  8918. var self=this;
  8919. var sentinel;
  8920. return $core.withContext(function($ctx1) {
  8921. var $1;
  8922. sentinel=$recv($globals.Object)._new();
  8923. return (function(){
  8924. var block;
  8925. return $core.withContext(function($ctx2) {
  8926. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8927. self["@poolSize"];
  8928. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8929. return sentinel;
  8930. }));
  8931. block;
  8932. $1=$recv(block).__eq_eq(sentinel);
  8933. if(!$core.assert($1)){
  8934. return $recv((function(){
  8935. return $core.withContext(function($ctx3) {
  8936. return $recv(block)._value();
  8937. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8938. }))._ensure_((function(){
  8939. return $core.withContext(function($ctx3) {
  8940. return self._addWorker();
  8941. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8942. }));
  8943. }
  8944. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8945. });
  8946. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8947. },
  8948. args: [],
  8949. 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 ] ]]",
  8950. referencedClasses: ["Object"],
  8951. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8952. }),
  8953. $globals.ForkPool);
  8954. $core.addMethod(
  8955. $core.method({
  8956. selector: "maxPoolSize",
  8957. protocol: 'accessing',
  8958. fn: function (){
  8959. var self=this;
  8960. return $core.withContext(function($ctx1) {
  8961. var $1,$receiver;
  8962. $1=self["@maxPoolSize"];
  8963. if(($receiver = $1) == null || $receiver.isNil){
  8964. return self._defaultMaxPoolSize();
  8965. } else {
  8966. return $1;
  8967. }
  8968. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8969. },
  8970. args: [],
  8971. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8972. referencedClasses: [],
  8973. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8974. }),
  8975. $globals.ForkPool);
  8976. $core.addMethod(
  8977. $core.method({
  8978. selector: "maxPoolSize:",
  8979. protocol: 'accessing',
  8980. fn: function (anInteger){
  8981. var self=this;
  8982. self["@maxPoolSize"]=anInteger;
  8983. return self;
  8984. },
  8985. args: ["anInteger"],
  8986. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8987. referencedClasses: [],
  8988. messageSends: []
  8989. }),
  8990. $globals.ForkPool);
  8991. $globals.ForkPool.klass.iVarNames = ['default'];
  8992. $core.addMethod(
  8993. $core.method({
  8994. selector: "default",
  8995. protocol: 'accessing',
  8996. fn: function (){
  8997. var self=this;
  8998. return $core.withContext(function($ctx1) {
  8999. var $1,$receiver;
  9000. $1=self["@default"];
  9001. if(($receiver = $1) == null || $receiver.isNil){
  9002. self["@default"]=self._new();
  9003. return self["@default"];
  9004. } else {
  9005. return $1;
  9006. }
  9007. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  9008. },
  9009. args: [],
  9010. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  9011. referencedClasses: [],
  9012. messageSends: ["ifNil:", "new"]
  9013. }),
  9014. $globals.ForkPool.klass);
  9015. $core.addMethod(
  9016. $core.method({
  9017. selector: "defaultMaxPoolSize",
  9018. protocol: 'accessing',
  9019. fn: function (){
  9020. var self=this;
  9021. return (100);
  9022. },
  9023. args: [],
  9024. source: "defaultMaxPoolSize\x0a\x09^ 100",
  9025. referencedClasses: [],
  9026. messageSends: []
  9027. }),
  9028. $globals.ForkPool.klass);
  9029. $core.addMethod(
  9030. $core.method({
  9031. selector: "resetDefault",
  9032. protocol: 'accessing',
  9033. fn: function (){
  9034. var self=this;
  9035. self["@default"]=nil;
  9036. return self;
  9037. },
  9038. args: [],
  9039. source: "resetDefault\x0a\x09default := nil",
  9040. referencedClasses: [],
  9041. messageSends: []
  9042. }),
  9043. $globals.ForkPool.klass);
  9044. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  9045. $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.";
  9046. $core.addMethod(
  9047. $core.method({
  9048. selector: "arguments",
  9049. protocol: 'accessing',
  9050. fn: function (){
  9051. var self=this;
  9052. return self["@arguments"];
  9053. },
  9054. args: [],
  9055. source: "arguments\x0a\x09^ arguments",
  9056. referencedClasses: [],
  9057. messageSends: []
  9058. }),
  9059. $globals.Message);
  9060. $core.addMethod(
  9061. $core.method({
  9062. selector: "arguments:",
  9063. protocol: 'accessing',
  9064. fn: function (anArray){
  9065. var self=this;
  9066. self["@arguments"]=anArray;
  9067. return self;
  9068. },
  9069. args: ["anArray"],
  9070. source: "arguments: anArray\x0a\x09arguments := anArray",
  9071. referencedClasses: [],
  9072. messageSends: []
  9073. }),
  9074. $globals.Message);
  9075. $core.addMethod(
  9076. $core.method({
  9077. selector: "printOn:",
  9078. protocol: 'printing',
  9079. fn: function (aStream){
  9080. var self=this;
  9081. return $core.withContext(function($ctx1) {
  9082. (
  9083. $ctx1.supercall = true,
  9084. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9085. $ctx1.supercall = false;
  9086. $recv(aStream)._nextPutAll_("(");
  9087. $ctx1.sendIdx["nextPutAll:"]=1;
  9088. $recv(aStream)._nextPutAll_(self._selector());
  9089. $ctx1.sendIdx["nextPutAll:"]=2;
  9090. $recv(aStream)._nextPutAll_(")");
  9091. return self;
  9092. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  9093. },
  9094. args: ["aStream"],
  9095. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  9096. referencedClasses: [],
  9097. messageSends: ["printOn:", "nextPutAll:", "selector"]
  9098. }),
  9099. $globals.Message);
  9100. $core.addMethod(
  9101. $core.method({
  9102. selector: "selector",
  9103. protocol: 'accessing',
  9104. fn: function (){
  9105. var self=this;
  9106. return self["@selector"];
  9107. },
  9108. args: [],
  9109. source: "selector\x0a\x09^ selector",
  9110. referencedClasses: [],
  9111. messageSends: []
  9112. }),
  9113. $globals.Message);
  9114. $core.addMethod(
  9115. $core.method({
  9116. selector: "selector:",
  9117. protocol: 'accessing',
  9118. fn: function (aString){
  9119. var self=this;
  9120. self["@selector"]=aString;
  9121. return self;
  9122. },
  9123. args: ["aString"],
  9124. source: "selector: aString\x0a\x09selector := aString",
  9125. referencedClasses: [],
  9126. messageSends: []
  9127. }),
  9128. $globals.Message);
  9129. $core.addMethod(
  9130. $core.method({
  9131. selector: "sendTo:",
  9132. protocol: 'actions',
  9133. fn: function (anObject){
  9134. var self=this;
  9135. return $core.withContext(function($ctx1) {
  9136. return $recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  9137. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  9138. },
  9139. args: ["anObject"],
  9140. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  9141. referencedClasses: [],
  9142. messageSends: ["perform:withArguments:", "selector", "arguments"]
  9143. }),
  9144. $globals.Message);
  9145. $core.addMethod(
  9146. $core.method({
  9147. selector: "selector:arguments:",
  9148. protocol: 'instance creation',
  9149. fn: function (aString,anArray){
  9150. var self=this;
  9151. return $core.withContext(function($ctx1) {
  9152. var $1;
  9153. $1=self._new();
  9154. $recv($1)._selector_(aString);
  9155. $recv($1)._arguments_(anArray);
  9156. return $recv($1)._yourself();
  9157. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  9158. },
  9159. args: ["aString", "anArray"],
  9160. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  9161. referencedClasses: [],
  9162. messageSends: ["selector:", "new", "arguments:", "yourself"]
  9163. }),
  9164. $globals.Message.klass);
  9165. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  9166. $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.";
  9167. $core.addMethod(
  9168. $core.method({
  9169. selector: "arguments",
  9170. protocol: 'accessing',
  9171. fn: function (){
  9172. var self=this;
  9173. return $core.withContext(function($ctx1) {
  9174. return $recv(self["@message"])._arguments();
  9175. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  9176. },
  9177. args: [],
  9178. source: "arguments\x0a\x09^ message arguments",
  9179. referencedClasses: [],
  9180. messageSends: ["arguments"]
  9181. }),
  9182. $globals.MessageSend);
  9183. $core.addMethod(
  9184. $core.method({
  9185. selector: "arguments:",
  9186. protocol: 'accessing',
  9187. fn: function (aCollection){
  9188. var self=this;
  9189. return $core.withContext(function($ctx1) {
  9190. $recv(self["@message"])._arguments_(aCollection);
  9191. return self;
  9192. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  9193. },
  9194. args: ["aCollection"],
  9195. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  9196. referencedClasses: [],
  9197. messageSends: ["arguments:"]
  9198. }),
  9199. $globals.MessageSend);
  9200. $core.addMethod(
  9201. $core.method({
  9202. selector: "initialize",
  9203. protocol: 'initialization',
  9204. fn: function (){
  9205. var self=this;
  9206. return $core.withContext(function($ctx1) {
  9207. (
  9208. $ctx1.supercall = true,
  9209. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  9210. $ctx1.supercall = false;
  9211. self["@message"]=$recv($globals.Message)._new();
  9212. return self;
  9213. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  9214. },
  9215. args: [],
  9216. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  9217. referencedClasses: ["Message"],
  9218. messageSends: ["initialize", "new"]
  9219. }),
  9220. $globals.MessageSend);
  9221. $core.addMethod(
  9222. $core.method({
  9223. selector: "printOn:",
  9224. protocol: 'printing',
  9225. fn: function (aStream){
  9226. var self=this;
  9227. return $core.withContext(function($ctx1) {
  9228. (
  9229. $ctx1.supercall = true,
  9230. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9231. $ctx1.supercall = false;
  9232. $recv(aStream)._nextPutAll_("(");
  9233. $ctx1.sendIdx["nextPutAll:"]=1;
  9234. $recv(aStream)._nextPutAll_(self._receiver());
  9235. $ctx1.sendIdx["nextPutAll:"]=2;
  9236. $recv(aStream)._nextPutAll_(" >> ");
  9237. $ctx1.sendIdx["nextPutAll:"]=3;
  9238. $recv(aStream)._nextPutAll_(self._selector());
  9239. $ctx1.sendIdx["nextPutAll:"]=4;
  9240. $recv(aStream)._nextPutAll_(")");
  9241. return self;
  9242. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  9243. },
  9244. args: ["aStream"],
  9245. 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: ')'",
  9246. referencedClasses: [],
  9247. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  9248. }),
  9249. $globals.MessageSend);
  9250. $core.addMethod(
  9251. $core.method({
  9252. selector: "receiver",
  9253. protocol: 'accessing',
  9254. fn: function (){
  9255. var self=this;
  9256. return self["@receiver"];
  9257. },
  9258. args: [],
  9259. source: "receiver\x0a\x09^ receiver",
  9260. referencedClasses: [],
  9261. messageSends: []
  9262. }),
  9263. $globals.MessageSend);
  9264. $core.addMethod(
  9265. $core.method({
  9266. selector: "receiver:",
  9267. protocol: 'accessing',
  9268. fn: function (anObject){
  9269. var self=this;
  9270. self["@receiver"]=anObject;
  9271. return self;
  9272. },
  9273. args: ["anObject"],
  9274. source: "receiver: anObject\x0a\x09receiver := anObject",
  9275. referencedClasses: [],
  9276. messageSends: []
  9277. }),
  9278. $globals.MessageSend);
  9279. $core.addMethod(
  9280. $core.method({
  9281. selector: "selector",
  9282. protocol: 'accessing',
  9283. fn: function (){
  9284. var self=this;
  9285. return $core.withContext(function($ctx1) {
  9286. return $recv(self["@message"])._selector();
  9287. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  9288. },
  9289. args: [],
  9290. source: "selector\x0a\x09^ message selector",
  9291. referencedClasses: [],
  9292. messageSends: ["selector"]
  9293. }),
  9294. $globals.MessageSend);
  9295. $core.addMethod(
  9296. $core.method({
  9297. selector: "selector:",
  9298. protocol: 'accessing',
  9299. fn: function (aString){
  9300. var self=this;
  9301. return $core.withContext(function($ctx1) {
  9302. $recv(self["@message"])._selector_(aString);
  9303. return self;
  9304. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  9305. },
  9306. args: ["aString"],
  9307. source: "selector: aString\x0a\x09message selector: aString",
  9308. referencedClasses: [],
  9309. messageSends: ["selector:"]
  9310. }),
  9311. $globals.MessageSend);
  9312. $core.addMethod(
  9313. $core.method({
  9314. selector: "value",
  9315. protocol: 'evaluating',
  9316. fn: function (){
  9317. var self=this;
  9318. return $core.withContext(function($ctx1) {
  9319. return $recv(self["@message"])._sendTo_(self._receiver());
  9320. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  9321. },
  9322. args: [],
  9323. source: "value\x0a\x09^ message sendTo: self receiver",
  9324. referencedClasses: [],
  9325. messageSends: ["sendTo:", "receiver"]
  9326. }),
  9327. $globals.MessageSend);
  9328. $core.addMethod(
  9329. $core.method({
  9330. selector: "value:",
  9331. protocol: 'evaluating',
  9332. fn: function (anObject){
  9333. var self=this;
  9334. return $core.withContext(function($ctx1) {
  9335. var $1;
  9336. $1=self["@message"];
  9337. $recv($1)._arguments_([anObject]);
  9338. return $recv($1)._sendTo_(self._receiver());
  9339. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  9340. },
  9341. args: ["anObject"],
  9342. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9343. referencedClasses: [],
  9344. messageSends: ["arguments:", "sendTo:", "receiver"]
  9345. }),
  9346. $globals.MessageSend);
  9347. $core.addMethod(
  9348. $core.method({
  9349. selector: "value:value:",
  9350. protocol: 'evaluating',
  9351. fn: function (firstArgument,secondArgument){
  9352. var self=this;
  9353. return $core.withContext(function($ctx1) {
  9354. var $1;
  9355. $1=self["@message"];
  9356. $recv($1)._arguments_([firstArgument,secondArgument]);
  9357. return $recv($1)._sendTo_(self._receiver());
  9358. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9359. },
  9360. args: ["firstArgument", "secondArgument"],
  9361. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9362. referencedClasses: [],
  9363. messageSends: ["arguments:", "sendTo:", "receiver"]
  9364. }),
  9365. $globals.MessageSend);
  9366. $core.addMethod(
  9367. $core.method({
  9368. selector: "value:value:value:",
  9369. protocol: 'evaluating',
  9370. fn: function (firstArgument,secondArgument,thirdArgument){
  9371. var self=this;
  9372. return $core.withContext(function($ctx1) {
  9373. var $1;
  9374. $1=self["@message"];
  9375. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9376. return $recv($1)._sendTo_(self._receiver());
  9377. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9378. },
  9379. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9380. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9381. referencedClasses: [],
  9382. messageSends: ["arguments:", "sendTo:", "receiver"]
  9383. }),
  9384. $globals.MessageSend);
  9385. $core.addMethod(
  9386. $core.method({
  9387. selector: "valueWithPossibleArguments:",
  9388. protocol: 'evaluating',
  9389. fn: function (aCollection){
  9390. var self=this;
  9391. return $core.withContext(function($ctx1) {
  9392. self._arguments_(aCollection);
  9393. return self._value();
  9394. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9395. },
  9396. args: ["aCollection"],
  9397. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9398. referencedClasses: [],
  9399. messageSends: ["arguments:", "value"]
  9400. }),
  9401. $globals.MessageSend);
  9402. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9403. $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`.";
  9404. $core.addMethod(
  9405. $core.method({
  9406. selector: "asString",
  9407. protocol: 'converting',
  9408. fn: function (){
  9409. var self=this;
  9410. return $core.withContext(function($ctx1) {
  9411. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9412. $2=self._isBlockContext();
  9413. if($core.assert($2)){
  9414. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9415. $ctx1.sendIdx[","]=2;
  9416. $1=$recv($3).__comma(")");
  9417. $ctx1.sendIdx[","]=1;
  9418. } else {
  9419. var methodClass;
  9420. methodClass=$recv(self._method())._methodClass();
  9421. methodClass;
  9422. $5=methodClass;
  9423. $7=self._receiver();
  9424. $ctx1.sendIdx["receiver"]=1;
  9425. $6=$recv($7)._class();
  9426. $ctx1.sendIdx["class"]=1;
  9427. $4=$recv($5).__eq($6);
  9428. if($core.assert($4)){
  9429. $11=self._receiver();
  9430. $ctx1.sendIdx["receiver"]=2;
  9431. $10=$recv($11)._class();
  9432. $ctx1.sendIdx["class"]=2;
  9433. $9=$recv($10)._name();
  9434. $ctx1.sendIdx["name"]=1;
  9435. $8=$recv($9).__comma(" >> ");
  9436. $ctx1.sendIdx[","]=4;
  9437. $12=self._selector();
  9438. $ctx1.sendIdx["selector"]=1;
  9439. $1=$recv($8).__comma($12);
  9440. $ctx1.sendIdx[","]=3;
  9441. } else {
  9442. $16=$recv($recv(self._receiver())._class())._name();
  9443. $ctx1.sendIdx["name"]=2;
  9444. $15=$recv($16).__comma("(");
  9445. $14=$recv($15).__comma($recv(methodClass)._name());
  9446. $ctx1.sendIdx[","]=7;
  9447. $13=$recv($14).__comma(") >> ");
  9448. $ctx1.sendIdx[","]=6;
  9449. $1=$recv($13).__comma(self._selector());
  9450. $ctx1.sendIdx[","]=5;
  9451. }
  9452. }
  9453. return $1;
  9454. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9455. },
  9456. args: [],
  9457. 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 ] ]",
  9458. referencedClasses: [],
  9459. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9460. }),
  9461. $globals.MethodContext);
  9462. $core.addMethod(
  9463. $core.method({
  9464. selector: "basicReceiver",
  9465. protocol: 'accessing',
  9466. fn: function (){
  9467. var self=this;
  9468. return $core.withContext(function($ctx1) {
  9469. return self.receiver;
  9470. return self;
  9471. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9472. },
  9473. args: [],
  9474. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  9475. referencedClasses: [],
  9476. messageSends: []
  9477. }),
  9478. $globals.MethodContext);
  9479. $core.addMethod(
  9480. $core.method({
  9481. selector: "evaluatedSelector",
  9482. protocol: 'accessing',
  9483. fn: function (){
  9484. var self=this;
  9485. return $core.withContext(function($ctx1) {
  9486. return self.evaluatedSelector;
  9487. return self;
  9488. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9489. },
  9490. args: [],
  9491. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  9492. referencedClasses: [],
  9493. messageSends: []
  9494. }),
  9495. $globals.MethodContext);
  9496. $core.addMethod(
  9497. $core.method({
  9498. selector: "findContextSuchThat:",
  9499. protocol: 'accessing',
  9500. fn: function (testBlock){
  9501. var self=this;
  9502. var context;
  9503. return $core.withContext(function($ctx1) {
  9504. var $1;
  9505. var $early={};
  9506. try {
  9507. context=self;
  9508. $recv((function(){
  9509. return $core.withContext(function($ctx2) {
  9510. return $recv(context)._isNil();
  9511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9512. }))._whileFalse_((function(){
  9513. return $core.withContext(function($ctx2) {
  9514. $1=$recv(testBlock)._value_(context);
  9515. if($core.assert($1)){
  9516. throw $early=[context];
  9517. }
  9518. context=$recv(context)._outerContext();
  9519. return context;
  9520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9521. }));
  9522. return nil;
  9523. }
  9524. catch(e) {if(e===$early)return e[0]; throw e}
  9525. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9526. },
  9527. args: ["testBlock"],
  9528. 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",
  9529. referencedClasses: [],
  9530. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9531. }),
  9532. $globals.MethodContext);
  9533. $core.addMethod(
  9534. $core.method({
  9535. selector: "home",
  9536. protocol: 'accessing',
  9537. fn: function (){
  9538. var self=this;
  9539. return $core.withContext(function($ctx1) {
  9540. return self.homeContext;
  9541. return self;
  9542. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9543. },
  9544. args: [],
  9545. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  9546. referencedClasses: [],
  9547. messageSends: []
  9548. }),
  9549. $globals.MethodContext);
  9550. $core.addMethod(
  9551. $core.method({
  9552. selector: "index",
  9553. protocol: 'accessing',
  9554. fn: function (){
  9555. var self=this;
  9556. return $core.withContext(function($ctx1) {
  9557. return self.index || 0;
  9558. return self;
  9559. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9560. },
  9561. args: [],
  9562. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  9563. referencedClasses: [],
  9564. messageSends: []
  9565. }),
  9566. $globals.MethodContext);
  9567. $core.addMethod(
  9568. $core.method({
  9569. selector: "isBlockContext",
  9570. protocol: 'testing',
  9571. fn: function (){
  9572. var self=this;
  9573. return $core.withContext(function($ctx1) {
  9574. return $recv(self._selector())._isNil();
  9575. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9576. },
  9577. args: [],
  9578. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9579. referencedClasses: [],
  9580. messageSends: ["isNil", "selector"]
  9581. }),
  9582. $globals.MethodContext);
  9583. $core.addMethod(
  9584. $core.method({
  9585. selector: "locals",
  9586. protocol: 'accessing',
  9587. fn: function (){
  9588. var self=this;
  9589. return $core.withContext(function($ctx1) {
  9590. return self.locals || {};
  9591. return self;
  9592. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9593. },
  9594. args: [],
  9595. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  9596. referencedClasses: [],
  9597. messageSends: []
  9598. }),
  9599. $globals.MethodContext);
  9600. $core.addMethod(
  9601. $core.method({
  9602. selector: "method",
  9603. protocol: 'accessing',
  9604. fn: function (){
  9605. var self=this;
  9606. var method,lookupClass,receiverClass,supercall;
  9607. return $core.withContext(function($ctx1) {
  9608. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  9609. $1=self._methodContext();
  9610. $ctx1.sendIdx["methodContext"]=1;
  9611. if(($receiver = $1) == null || $receiver.isNil){
  9612. return nil;
  9613. } else {
  9614. $1;
  9615. }
  9616. $3=self._methodContext();
  9617. $ctx1.sendIdx["methodContext"]=2;
  9618. $2=$recv($3)._receiver();
  9619. receiverClass=$recv($2)._class();
  9620. $4=receiverClass;
  9621. $6=self._methodContext();
  9622. $ctx1.sendIdx["methodContext"]=3;
  9623. $5=$recv($6)._selector();
  9624. $ctx1.sendIdx["selector"]=1;
  9625. method=$recv($4)._lookupSelector_($5);
  9626. $ctx1.sendIdx["lookupSelector:"]=1;
  9627. $7=self._outerContext();
  9628. if(($receiver = $7) == null || $receiver.isNil){
  9629. supercall=false;
  9630. } else {
  9631. var outer;
  9632. outer=$receiver;
  9633. supercall=$recv(outer)._supercall();
  9634. }
  9635. $8=supercall;
  9636. if($core.assert($8)){
  9637. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9638. } else {
  9639. return method;
  9640. }
  9641. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9642. },
  9643. args: [],
  9644. 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 ]",
  9645. referencedClasses: [],
  9646. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9647. }),
  9648. $globals.MethodContext);
  9649. $core.addMethod(
  9650. $core.method({
  9651. selector: "methodContext",
  9652. protocol: 'accessing',
  9653. fn: function (){
  9654. var self=this;
  9655. return $core.withContext(function($ctx1) {
  9656. var $1,$2,$receiver;
  9657. $1=self._isBlockContext();
  9658. if(!$core.assert($1)){
  9659. return self;
  9660. }
  9661. $2=self._outerContext();
  9662. if(($receiver = $2) == null || $receiver.isNil){
  9663. return $2;
  9664. } else {
  9665. var outer;
  9666. outer=$receiver;
  9667. return $recv(outer)._methodContext();
  9668. }
  9669. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9670. },
  9671. args: [],
  9672. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9673. referencedClasses: [],
  9674. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9675. }),
  9676. $globals.MethodContext);
  9677. $core.addMethod(
  9678. $core.method({
  9679. selector: "outerContext",
  9680. protocol: 'accessing',
  9681. fn: function (){
  9682. var self=this;
  9683. return $core.withContext(function($ctx1) {
  9684. return self.outerContext || self.homeContext;
  9685. return self;
  9686. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9687. },
  9688. args: [],
  9689. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  9690. referencedClasses: [],
  9691. messageSends: []
  9692. }),
  9693. $globals.MethodContext);
  9694. $core.addMethod(
  9695. $core.method({
  9696. selector: "printOn:",
  9697. protocol: 'printing',
  9698. fn: function (aStream){
  9699. var self=this;
  9700. return $core.withContext(function($ctx1) {
  9701. (
  9702. $ctx1.supercall = true,
  9703. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9704. $ctx1.supercall = false;
  9705. $recv(aStream)._nextPutAll_("(");
  9706. $ctx1.sendIdx["nextPutAll:"]=1;
  9707. $recv(aStream)._nextPutAll_(self._asString());
  9708. $ctx1.sendIdx["nextPutAll:"]=2;
  9709. $recv(aStream)._nextPutAll_(")");
  9710. return self;
  9711. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9712. },
  9713. args: ["aStream"],
  9714. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9715. referencedClasses: [],
  9716. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9717. }),
  9718. $globals.MethodContext);
  9719. $core.addMethod(
  9720. $core.method({
  9721. selector: "receiver",
  9722. protocol: 'accessing',
  9723. fn: function (){
  9724. var self=this;
  9725. return $core.withContext(function($ctx1) {
  9726. var $2,$1;
  9727. $1=$recv(self._isBlockContext())._and_((function(){
  9728. return $core.withContext(function($ctx2) {
  9729. $2=self._outerContext();
  9730. $ctx2.sendIdx["outerContext"]=1;
  9731. return $recv($2)._notNil();
  9732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9733. }));
  9734. if($core.assert($1)){
  9735. return $recv(self._outerContext())._receiver();
  9736. } else {
  9737. return self._basicReceiver();
  9738. }
  9739. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9740. },
  9741. args: [],
  9742. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9743. referencedClasses: [],
  9744. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9745. }),
  9746. $globals.MethodContext);
  9747. $core.addMethod(
  9748. $core.method({
  9749. selector: "selector",
  9750. protocol: 'accessing',
  9751. fn: function (){
  9752. var self=this;
  9753. return $core.withContext(function($ctx1) {
  9754. if(self.selector) {
  9755. return $core.js2st(self.selector);
  9756. } else {
  9757. return nil;
  9758. }
  9759. ;
  9760. return self;
  9761. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9762. },
  9763. args: [],
  9764. 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'>",
  9765. referencedClasses: [],
  9766. messageSends: []
  9767. }),
  9768. $globals.MethodContext);
  9769. $core.addMethod(
  9770. $core.method({
  9771. selector: "sendIndexAt:",
  9772. protocol: 'accessing',
  9773. fn: function (aSelector){
  9774. var self=this;
  9775. return $core.withContext(function($ctx1) {
  9776. return self.sendIdx[aSelector] || 0;
  9777. return self;
  9778. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9779. },
  9780. args: ["aSelector"],
  9781. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  9782. referencedClasses: [],
  9783. messageSends: []
  9784. }),
  9785. $globals.MethodContext);
  9786. $core.addMethod(
  9787. $core.method({
  9788. selector: "sendIndexes",
  9789. protocol: 'accessing',
  9790. fn: function (){
  9791. var self=this;
  9792. return $core.withContext(function($ctx1) {
  9793. return self.sendIdx;
  9794. return self;
  9795. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9796. },
  9797. args: [],
  9798. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  9799. referencedClasses: [],
  9800. messageSends: []
  9801. }),
  9802. $globals.MethodContext);
  9803. $core.addMethod(
  9804. $core.method({
  9805. selector: "supercall",
  9806. protocol: 'accessing',
  9807. fn: function (){
  9808. var self=this;
  9809. return $core.withContext(function($ctx1) {
  9810. return self.supercall == true;
  9811. return self;
  9812. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9813. },
  9814. args: [],
  9815. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  9816. referencedClasses: [],
  9817. messageSends: []
  9818. }),
  9819. $globals.MethodContext);
  9820. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9821. $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' ]";
  9822. $core.addMethod(
  9823. $core.method({
  9824. selector: "constructorNamed:",
  9825. protocol: 'instance creation',
  9826. fn: function (aString){
  9827. var self=this;
  9828. return $core.withContext(function($ctx1) {
  9829. var nativeFunc=(new Function('return this'))()[aString];
  9830. return new nativeFunc();
  9831. ;
  9832. return self;
  9833. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9834. },
  9835. args: ["aString"],
  9836. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  9837. referencedClasses: [],
  9838. messageSends: []
  9839. }),
  9840. $globals.NativeFunction.klass);
  9841. $core.addMethod(
  9842. $core.method({
  9843. selector: "constructorNamed:value:",
  9844. protocol: 'instance creation',
  9845. fn: function (aString,anObject){
  9846. var self=this;
  9847. return $core.withContext(function($ctx1) {
  9848. var nativeFunc=(new Function('return this'))()[aString];
  9849. return new nativeFunc(anObject);
  9850. ;
  9851. return self;
  9852. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9853. },
  9854. args: ["aString", "anObject"],
  9855. 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'>",
  9856. referencedClasses: [],
  9857. messageSends: []
  9858. }),
  9859. $globals.NativeFunction.klass);
  9860. $core.addMethod(
  9861. $core.method({
  9862. selector: "constructorNamed:value:value:",
  9863. protocol: 'instance creation',
  9864. fn: function (aString,anObject,anObject2){
  9865. var self=this;
  9866. return $core.withContext(function($ctx1) {
  9867. var nativeFunc=(new Function('return this'))()[aString];
  9868. return new nativeFunc(anObject,anObject2);
  9869. ;
  9870. return self;
  9871. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9872. },
  9873. args: ["aString", "anObject", "anObject2"],
  9874. 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'>",
  9875. referencedClasses: [],
  9876. messageSends: []
  9877. }),
  9878. $globals.NativeFunction.klass);
  9879. $core.addMethod(
  9880. $core.method({
  9881. selector: "constructorNamed:value:value:value:",
  9882. protocol: 'instance creation',
  9883. fn: function (aString,anObject,anObject2,anObject3){
  9884. var self=this;
  9885. return $core.withContext(function($ctx1) {
  9886. var nativeFunc=(new Function('return this'))()[aString];
  9887. return new nativeFunc(anObject,anObject2, anObject3);
  9888. ;
  9889. return self;
  9890. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9891. },
  9892. args: ["aString", "anObject", "anObject2", "anObject3"],
  9893. 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'>",
  9894. referencedClasses: [],
  9895. messageSends: []
  9896. }),
  9897. $globals.NativeFunction.klass);
  9898. $core.addMethod(
  9899. $core.method({
  9900. selector: "constructorOf:",
  9901. protocol: 'instance creation',
  9902. fn: function (nativeFunc){
  9903. var self=this;
  9904. return $core.withContext(function($ctx1) {
  9905. return new nativeFunc();
  9906. ;
  9907. return self;
  9908. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9909. },
  9910. args: ["nativeFunc"],
  9911. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  9912. referencedClasses: [],
  9913. messageSends: []
  9914. }),
  9915. $globals.NativeFunction.klass);
  9916. $core.addMethod(
  9917. $core.method({
  9918. selector: "constructorOf:value:",
  9919. protocol: 'instance creation',
  9920. fn: function (nativeFunc,anObject){
  9921. var self=this;
  9922. return $core.withContext(function($ctx1) {
  9923. return new nativeFunc(anObject);
  9924. ;
  9925. return self;
  9926. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9927. },
  9928. args: ["nativeFunc", "anObject"],
  9929. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  9930. referencedClasses: [],
  9931. messageSends: []
  9932. }),
  9933. $globals.NativeFunction.klass);
  9934. $core.addMethod(
  9935. $core.method({
  9936. selector: "constructorOf:value:value:",
  9937. protocol: 'instance creation',
  9938. fn: function (nativeFunc,anObject,anObject2){
  9939. var self=this;
  9940. return $core.withContext(function($ctx1) {
  9941. return new nativeFunc(anObject,anObject2);
  9942. ;
  9943. return self;
  9944. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9945. },
  9946. args: ["nativeFunc", "anObject", "anObject2"],
  9947. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  9948. referencedClasses: [],
  9949. messageSends: []
  9950. }),
  9951. $globals.NativeFunction.klass);
  9952. $core.addMethod(
  9953. $core.method({
  9954. selector: "constructorOf:value:value:value:",
  9955. protocol: 'instance creation',
  9956. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9957. var self=this;
  9958. return $core.withContext(function($ctx1) {
  9959. return new nativeFunc(anObject,anObject2, anObject3);
  9960. ;
  9961. return self;
  9962. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9963. },
  9964. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9965. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  9966. referencedClasses: [],
  9967. messageSends: []
  9968. }),
  9969. $globals.NativeFunction.klass);
  9970. $core.addMethod(
  9971. $core.method({
  9972. selector: "exists:",
  9973. protocol: 'testing',
  9974. fn: function (aString){
  9975. var self=this;
  9976. return $core.withContext(function($ctx1) {
  9977. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  9978. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  9979. },
  9980. args: ["aString"],
  9981. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  9982. referencedClasses: ["Smalltalk"],
  9983. messageSends: ["existsJsGlobal:"]
  9984. }),
  9985. $globals.NativeFunction.klass);
  9986. $core.addMethod(
  9987. $core.method({
  9988. selector: "functionNamed:",
  9989. protocol: 'function calling',
  9990. fn: function (aString){
  9991. var self=this;
  9992. return $core.withContext(function($ctx1) {
  9993. var nativeFunc=(new Function('return this'))()[aString];
  9994. return nativeFunc();
  9995. ;
  9996. return self;
  9997. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9998. },
  9999. args: ["aString"],
  10000. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  10001. referencedClasses: [],
  10002. messageSends: []
  10003. }),
  10004. $globals.NativeFunction.klass);
  10005. $core.addMethod(
  10006. $core.method({
  10007. selector: "functionNamed:value:",
  10008. protocol: 'function calling',
  10009. fn: function (aString,anObject){
  10010. var self=this;
  10011. return $core.withContext(function($ctx1) {
  10012. var nativeFunc=(new Function('return this'))()[aString];
  10013. return nativeFunc(anObject);
  10014. ;
  10015. return self;
  10016. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  10017. },
  10018. args: ["aString", "anObject"],
  10019. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  10020. referencedClasses: [],
  10021. messageSends: []
  10022. }),
  10023. $globals.NativeFunction.klass);
  10024. $core.addMethod(
  10025. $core.method({
  10026. selector: "functionNamed:value:value:",
  10027. protocol: 'function calling',
  10028. fn: function (aString,anObject,anObject2){
  10029. var self=this;
  10030. return $core.withContext(function($ctx1) {
  10031. var nativeFunc=(new Function('return this'))()[aString];
  10032. return nativeFunc(anObject,anObject2);
  10033. ;
  10034. return self;
  10035. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10036. },
  10037. args: ["aString", "anObject", "anObject2"],
  10038. 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'>",
  10039. referencedClasses: [],
  10040. messageSends: []
  10041. }),
  10042. $globals.NativeFunction.klass);
  10043. $core.addMethod(
  10044. $core.method({
  10045. selector: "functionNamed:value:value:value:",
  10046. protocol: 'function calling',
  10047. fn: function (aString,anObject,anObject2,anObject3){
  10048. var self=this;
  10049. return $core.withContext(function($ctx1) {
  10050. var nativeFunc=(new Function('return this'))()[aString];
  10051. return nativeFunc(anObject,anObject2, anObject3);
  10052. ;
  10053. return self;
  10054. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10055. },
  10056. args: ["aString", "anObject", "anObject2", "anObject3"],
  10057. 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'>",
  10058. referencedClasses: [],
  10059. messageSends: []
  10060. }),
  10061. $globals.NativeFunction.klass);
  10062. $core.addMethod(
  10063. $core.method({
  10064. selector: "functionNamed:valueWithArgs:",
  10065. protocol: 'function calling',
  10066. fn: function (aString,args){
  10067. var self=this;
  10068. return $core.withContext(function($ctx1) {
  10069. var nativeFunc=(new Function('return this'))()[aString];
  10070. return Function.prototype.apply.call(nativeFunc, null, args);
  10071. ;
  10072. return self;
  10073. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  10074. },
  10075. args: ["aString", "args"],
  10076. 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'>",
  10077. referencedClasses: [],
  10078. messageSends: []
  10079. }),
  10080. $globals.NativeFunction.klass);
  10081. $core.addMethod(
  10082. $core.method({
  10083. selector: "functionOf:",
  10084. protocol: 'function calling',
  10085. fn: function (nativeFunc){
  10086. var self=this;
  10087. return $core.withContext(function($ctx1) {
  10088. return nativeFunc();
  10089. ;
  10090. return self;
  10091. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  10092. },
  10093. args: ["nativeFunc"],
  10094. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  10095. referencedClasses: [],
  10096. messageSends: []
  10097. }),
  10098. $globals.NativeFunction.klass);
  10099. $core.addMethod(
  10100. $core.method({
  10101. selector: "functionOf:value:",
  10102. protocol: 'function calling',
  10103. fn: function (nativeFunc,anObject){
  10104. var self=this;
  10105. return $core.withContext(function($ctx1) {
  10106. return nativeFunc(anObject);
  10107. ;
  10108. return self;
  10109. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  10110. },
  10111. args: ["nativeFunc", "anObject"],
  10112. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  10113. referencedClasses: [],
  10114. messageSends: []
  10115. }),
  10116. $globals.NativeFunction.klass);
  10117. $core.addMethod(
  10118. $core.method({
  10119. selector: "functionOf:value:value:",
  10120. protocol: 'function calling',
  10121. fn: function (nativeFunc,anObject,anObject2){
  10122. var self=this;
  10123. return $core.withContext(function($ctx1) {
  10124. return nativeFunc(anObject,anObject2);
  10125. ;
  10126. return self;
  10127. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10128. },
  10129. args: ["nativeFunc", "anObject", "anObject2"],
  10130. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  10131. referencedClasses: [],
  10132. messageSends: []
  10133. }),
  10134. $globals.NativeFunction.klass);
  10135. $core.addMethod(
  10136. $core.method({
  10137. selector: "functionOf:value:value:value:",
  10138. protocol: 'function calling',
  10139. fn: function (nativeFunc,anObject,anObject2,anObject3){
  10140. var self=this;
  10141. return $core.withContext(function($ctx1) {
  10142. return nativeFunc(anObject,anObject2, anObject3);
  10143. ;
  10144. return self;
  10145. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10146. },
  10147. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  10148. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  10149. referencedClasses: [],
  10150. messageSends: []
  10151. }),
  10152. $globals.NativeFunction.klass);
  10153. $core.addMethod(
  10154. $core.method({
  10155. selector: "functionOf:valueWithArgs:",
  10156. protocol: 'function calling',
  10157. fn: function (nativeFunc,args){
  10158. var self=this;
  10159. return $core.withContext(function($ctx1) {
  10160. return Function.prototype.apply.call(nativeFunc, null, args);
  10161. ;
  10162. return self;
  10163. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  10164. },
  10165. args: ["nativeFunc", "args"],
  10166. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  10167. referencedClasses: [],
  10168. messageSends: []
  10169. }),
  10170. $globals.NativeFunction.klass);
  10171. $core.addMethod(
  10172. $core.method({
  10173. selector: "methodOf:this:",
  10174. protocol: 'method calling',
  10175. fn: function (nativeFunc,thisObject){
  10176. var self=this;
  10177. return $core.withContext(function($ctx1) {
  10178. return Function.prototype.call.call(nativeFunc, thisObject);
  10179. ;
  10180. return self;
  10181. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  10182. },
  10183. args: ["nativeFunc", "thisObject"],
  10184. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  10185. referencedClasses: [],
  10186. messageSends: []
  10187. }),
  10188. $globals.NativeFunction.klass);
  10189. $core.addMethod(
  10190. $core.method({
  10191. selector: "methodOf:this:value:",
  10192. protocol: 'method calling',
  10193. fn: function (nativeFunc,thisObject,anObject){
  10194. var self=this;
  10195. return $core.withContext(function($ctx1) {
  10196. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  10197. ;
  10198. return self;
  10199. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  10200. },
  10201. args: ["nativeFunc", "thisObject", "anObject"],
  10202. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  10203. referencedClasses: [],
  10204. messageSends: []
  10205. }),
  10206. $globals.NativeFunction.klass);
  10207. $core.addMethod(
  10208. $core.method({
  10209. selector: "methodOf:this:value:value:",
  10210. protocol: 'method calling',
  10211. fn: function (nativeFunc,thisObject,anObject,anObject2){
  10212. var self=this;
  10213. return $core.withContext(function($ctx1) {
  10214. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  10215. ;
  10216. return self;
  10217. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10218. },
  10219. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  10220. 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'>",
  10221. referencedClasses: [],
  10222. messageSends: []
  10223. }),
  10224. $globals.NativeFunction.klass);
  10225. $core.addMethod(
  10226. $core.method({
  10227. selector: "methodOf:this:value:value:value:",
  10228. protocol: 'method calling',
  10229. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  10230. var self=this;
  10231. return $core.withContext(function($ctx1) {
  10232. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  10233. ;
  10234. return self;
  10235. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10236. },
  10237. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  10238. 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'>",
  10239. referencedClasses: [],
  10240. messageSends: []
  10241. }),
  10242. $globals.NativeFunction.klass);
  10243. $core.addMethod(
  10244. $core.method({
  10245. selector: "methodOf:this:valueWithArgs:",
  10246. protocol: 'method calling',
  10247. fn: function (nativeFunc,thisObject,args){
  10248. var self=this;
  10249. return $core.withContext(function($ctx1) {
  10250. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  10251. ;
  10252. return self;
  10253. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10254. },
  10255. args: ["nativeFunc", "thisObject", "args"],
  10256. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  10257. referencedClasses: [],
  10258. messageSends: []
  10259. }),
  10260. $globals.NativeFunction.klass);
  10261. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10262. $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.";
  10263. $core.addMethod(
  10264. $core.method({
  10265. selector: "clearInterval",
  10266. protocol: 'timeout/interval',
  10267. fn: function (){
  10268. var self=this;
  10269. return $core.withContext(function($ctx1) {
  10270. var interval = self["@rawTimeout"];
  10271. clearInterval(interval);
  10272. ;
  10273. return self;
  10274. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10275. },
  10276. args: [],
  10277. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  10278. referencedClasses: [],
  10279. messageSends: []
  10280. }),
  10281. $globals.Timeout);
  10282. $core.addMethod(
  10283. $core.method({
  10284. selector: "clearTimeout",
  10285. protocol: 'timeout/interval',
  10286. fn: function (){
  10287. var self=this;
  10288. return $core.withContext(function($ctx1) {
  10289. var timeout = self["@rawTimeout"];
  10290. clearTimeout(timeout);
  10291. ;
  10292. return self;
  10293. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10294. },
  10295. args: [],
  10296. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  10297. referencedClasses: [],
  10298. messageSends: []
  10299. }),
  10300. $globals.Timeout);
  10301. $core.addMethod(
  10302. $core.method({
  10303. selector: "rawTimeout:",
  10304. protocol: 'accessing',
  10305. fn: function (anObject){
  10306. var self=this;
  10307. self["@rawTimeout"]=anObject;
  10308. return self;
  10309. },
  10310. args: ["anObject"],
  10311. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10312. referencedClasses: [],
  10313. messageSends: []
  10314. }),
  10315. $globals.Timeout);
  10316. $core.addMethod(
  10317. $core.method({
  10318. selector: "on:",
  10319. protocol: 'instance creation',
  10320. fn: function (anObject){
  10321. var self=this;
  10322. return $core.withContext(function($ctx1) {
  10323. var $1;
  10324. $1=self._new();
  10325. $recv($1)._rawTimeout_(anObject);
  10326. return $recv($1)._yourself();
  10327. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10328. },
  10329. args: ["anObject"],
  10330. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10331. referencedClasses: [],
  10332. messageSends: ["rawTimeout:", "new", "yourself"]
  10333. }),
  10334. $globals.Timeout.klass);
  10335. });
  10336. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  10337. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  10338. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  10339. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  10340. $core.addPackage('Kernel-Collections');
  10341. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10342. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10343. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10344. $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:`";
  10345. $core.addMethod(
  10346. $core.method({
  10347. selector: "=",
  10348. protocol: 'comparing',
  10349. fn: function (anAssociation){
  10350. var self=this;
  10351. return $core.withContext(function($ctx1) {
  10352. var $3,$2,$5,$4,$6,$1;
  10353. $3=self._class();
  10354. $ctx1.sendIdx["class"]=1;
  10355. $2=$recv($3).__eq($recv(anAssociation)._class());
  10356. $ctx1.sendIdx["="]=1;
  10357. $1=$recv($2)._and_((function(){
  10358. return $core.withContext(function($ctx2) {
  10359. $5=self._key();
  10360. $ctx2.sendIdx["key"]=1;
  10361. $4=$recv($5).__eq($recv(anAssociation)._key());
  10362. $ctx2.sendIdx["="]=2;
  10363. return $recv($4)._and_((function(){
  10364. return $core.withContext(function($ctx3) {
  10365. $6=self._value();
  10366. $ctx3.sendIdx["value"]=1;
  10367. return $recv($6).__eq($recv(anAssociation)._value());
  10368. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10369. }));
  10370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10371. }));
  10372. $ctx1.sendIdx["and:"]=1;
  10373. return $1;
  10374. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10375. },
  10376. args: ["anAssociation"],
  10377. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10378. referencedClasses: [],
  10379. messageSends: ["and:", "=", "class", "key", "value"]
  10380. }),
  10381. $globals.Association);
  10382. $core.addMethod(
  10383. $core.method({
  10384. selector: "key",
  10385. protocol: 'accessing',
  10386. fn: function (){
  10387. var self=this;
  10388. return self["@key"];
  10389. },
  10390. args: [],
  10391. source: "key\x0a\x09^ key",
  10392. referencedClasses: [],
  10393. messageSends: []
  10394. }),
  10395. $globals.Association);
  10396. $core.addMethod(
  10397. $core.method({
  10398. selector: "key:",
  10399. protocol: 'accessing',
  10400. fn: function (aKey){
  10401. var self=this;
  10402. self["@key"]=aKey;
  10403. return self;
  10404. },
  10405. args: ["aKey"],
  10406. source: "key: aKey\x0a\x09key := aKey",
  10407. referencedClasses: [],
  10408. messageSends: []
  10409. }),
  10410. $globals.Association);
  10411. $core.addMethod(
  10412. $core.method({
  10413. selector: "printOn:",
  10414. protocol: 'printing',
  10415. fn: function (aStream){
  10416. var self=this;
  10417. return $core.withContext(function($ctx1) {
  10418. $recv(self._key())._printOn_(aStream);
  10419. $ctx1.sendIdx["printOn:"]=1;
  10420. $recv(aStream)._nextPutAll_(" -> ");
  10421. $recv(self._value())._printOn_(aStream);
  10422. return self;
  10423. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10424. },
  10425. args: ["aStream"],
  10426. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10427. referencedClasses: [],
  10428. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10429. }),
  10430. $globals.Association);
  10431. $core.addMethod(
  10432. $core.method({
  10433. selector: "value",
  10434. protocol: 'accessing',
  10435. fn: function (){
  10436. var self=this;
  10437. return self["@value"];
  10438. },
  10439. args: [],
  10440. source: "value\x0a\x09^ value",
  10441. referencedClasses: [],
  10442. messageSends: []
  10443. }),
  10444. $globals.Association);
  10445. $core.addMethod(
  10446. $core.method({
  10447. selector: "value:",
  10448. protocol: 'accessing',
  10449. fn: function (aValue){
  10450. var self=this;
  10451. self["@value"]=aValue;
  10452. return self;
  10453. },
  10454. args: ["aValue"],
  10455. source: "value: aValue\x0a\x09value := aValue",
  10456. referencedClasses: [],
  10457. messageSends: []
  10458. }),
  10459. $globals.Association);
  10460. $core.addMethod(
  10461. $core.method({
  10462. selector: "key:value:",
  10463. protocol: 'instance creation',
  10464. fn: function (aKey,aValue){
  10465. var self=this;
  10466. return $core.withContext(function($ctx1) {
  10467. var $1;
  10468. $1=self._new();
  10469. $recv($1)._key_(aKey);
  10470. $recv($1)._value_(aValue);
  10471. return $recv($1)._yourself();
  10472. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10473. },
  10474. args: ["aKey", "aValue"],
  10475. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10476. referencedClasses: [],
  10477. messageSends: ["key:", "new", "value:", "yourself"]
  10478. }),
  10479. $globals.Association.klass);
  10480. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10481. $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`.";
  10482. $core.addMethod(
  10483. $core.method({
  10484. selector: "bucketOfElement:",
  10485. protocol: 'accessing',
  10486. fn: function (anObject){
  10487. var self=this;
  10488. return $core.withContext(function($ctx1) {
  10489. var hash = self['@hashBlock'](anObject);
  10490. if (!hash) return null;
  10491. var buckets = self['@buckets'],
  10492. bucket = buckets[hash];
  10493. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10494. return bucket;
  10495. ;
  10496. return self;
  10497. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10498. },
  10499. args: ["anObject"],
  10500. 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'>",
  10501. referencedClasses: [],
  10502. messageSends: []
  10503. }),
  10504. $globals.BucketStore);
  10505. $core.addMethod(
  10506. $core.method({
  10507. selector: "do:",
  10508. protocol: 'enumerating',
  10509. fn: function (aBlock){
  10510. var self=this;
  10511. return $core.withContext(function($ctx1) {
  10512. var buckets = self['@buckets'];
  10513. var keys = Object.keys(buckets);
  10514. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10515. ;
  10516. return self;
  10517. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10518. },
  10519. args: ["aBlock"],
  10520. 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'>",
  10521. referencedClasses: [],
  10522. messageSends: []
  10523. }),
  10524. $globals.BucketStore);
  10525. $core.addMethod(
  10526. $core.method({
  10527. selector: "hashBlock:",
  10528. protocol: 'accessing',
  10529. fn: function (aBlock){
  10530. var self=this;
  10531. self["@hashBlock"]=aBlock;
  10532. return self;
  10533. },
  10534. args: ["aBlock"],
  10535. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10536. referencedClasses: [],
  10537. messageSends: []
  10538. }),
  10539. $globals.BucketStore);
  10540. $core.addMethod(
  10541. $core.method({
  10542. selector: "initialize",
  10543. protocol: 'initialization',
  10544. fn: function (){
  10545. var self=this;
  10546. return $core.withContext(function($ctx1) {
  10547. (
  10548. $ctx1.supercall = true,
  10549. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  10550. $ctx1.supercall = false;
  10551. self._removeAll();
  10552. return self;
  10553. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10554. },
  10555. args: [],
  10556. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10557. referencedClasses: [],
  10558. messageSends: ["initialize", "removeAll"]
  10559. }),
  10560. $globals.BucketStore);
  10561. $core.addMethod(
  10562. $core.method({
  10563. selector: "newBucket",
  10564. protocol: 'private',
  10565. fn: function (){
  10566. var self=this;
  10567. return $core.withContext(function($ctx1) {
  10568. self._subclassResponsibility();
  10569. return self;
  10570. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10571. },
  10572. args: [],
  10573. source: "newBucket\x0a\x09self subclassResponsibility",
  10574. referencedClasses: [],
  10575. messageSends: ["subclassResponsibility"]
  10576. }),
  10577. $globals.BucketStore);
  10578. $core.addMethod(
  10579. $core.method({
  10580. selector: "removeAll",
  10581. protocol: 'adding/removing',
  10582. fn: function (){
  10583. var self=this;
  10584. return $core.withContext(function($ctx1) {
  10585. self['@buckets'] = Object.create(null);;
  10586. return self;
  10587. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10588. },
  10589. args: [],
  10590. source: "removeAll\x0a\x09<inlineJS: 'self[''@buckets''] = Object.create(null);'>",
  10591. referencedClasses: [],
  10592. messageSends: []
  10593. }),
  10594. $globals.BucketStore);
  10595. $core.addMethod(
  10596. $core.method({
  10597. selector: "hashBlock:",
  10598. protocol: 'instance creation',
  10599. fn: function (aBlock){
  10600. var self=this;
  10601. return $core.withContext(function($ctx1) {
  10602. var $1;
  10603. $1=self._new();
  10604. $recv($1)._hashBlock_(aBlock);
  10605. return $recv($1)._yourself();
  10606. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10607. },
  10608. args: ["aBlock"],
  10609. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10610. referencedClasses: [],
  10611. messageSends: ["hashBlock:", "new", "yourself"]
  10612. }),
  10613. $globals.BucketStore.klass);
  10614. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10615. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10616. $core.addMethod(
  10617. $core.method({
  10618. selector: "newBucket",
  10619. protocol: 'private',
  10620. fn: function (){
  10621. var self=this;
  10622. return [];
  10623. },
  10624. args: [],
  10625. source: "newBucket\x0a\x09^ #()",
  10626. referencedClasses: [],
  10627. messageSends: []
  10628. }),
  10629. $globals.ArrayBucketStore);
  10630. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10631. $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.";
  10632. $core.addMethod(
  10633. $core.method({
  10634. selector: ",",
  10635. protocol: 'copying',
  10636. fn: function (aCollection){
  10637. var self=this;
  10638. return $core.withContext(function($ctx1) {
  10639. var $1;
  10640. $1=self._copy();
  10641. $recv($1)._addAll_(aCollection);
  10642. return $recv($1)._yourself();
  10643. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10644. },
  10645. args: ["aCollection"],
  10646. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10647. referencedClasses: [],
  10648. messageSends: ["addAll:", "copy", "yourself"]
  10649. }),
  10650. $globals.Collection);
  10651. $core.addMethod(
  10652. $core.method({
  10653. selector: "add:",
  10654. protocol: 'adding/removing',
  10655. fn: function (anObject){
  10656. var self=this;
  10657. return $core.withContext(function($ctx1) {
  10658. self._subclassResponsibility();
  10659. return self;
  10660. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10661. },
  10662. args: ["anObject"],
  10663. source: "add: anObject\x0a\x09self subclassResponsibility",
  10664. referencedClasses: [],
  10665. messageSends: ["subclassResponsibility"]
  10666. }),
  10667. $globals.Collection);
  10668. $core.addMethod(
  10669. $core.method({
  10670. selector: "addAll:",
  10671. protocol: 'adding/removing',
  10672. fn: function (aCollection){
  10673. var self=this;
  10674. return $core.withContext(function($ctx1) {
  10675. $recv(aCollection)._do_((function(each){
  10676. return $core.withContext(function($ctx2) {
  10677. return self._add_(each);
  10678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10679. }));
  10680. return aCollection;
  10681. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10682. },
  10683. args: ["aCollection"],
  10684. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10685. referencedClasses: [],
  10686. messageSends: ["do:", "add:"]
  10687. }),
  10688. $globals.Collection);
  10689. $core.addMethod(
  10690. $core.method({
  10691. selector: "allSatisfy:",
  10692. protocol: 'enumerating',
  10693. fn: function (aBlock){
  10694. var self=this;
  10695. return $core.withContext(function($ctx1) {
  10696. var $1;
  10697. var $early={};
  10698. try {
  10699. self._do_((function(each){
  10700. return $core.withContext(function($ctx2) {
  10701. $1=$recv(aBlock)._value_(each);
  10702. if(!$core.assert($1)){
  10703. throw $early=[false];
  10704. }
  10705. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10706. }));
  10707. return true;
  10708. }
  10709. catch(e) {if(e===$early)return e[0]; throw e}
  10710. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10711. },
  10712. args: ["aBlock"],
  10713. 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",
  10714. referencedClasses: [],
  10715. messageSends: ["do:", "ifFalse:", "value:"]
  10716. }),
  10717. $globals.Collection);
  10718. $core.addMethod(
  10719. $core.method({
  10720. selector: "anyOne",
  10721. protocol: 'accessing',
  10722. fn: function (){
  10723. var self=this;
  10724. return $core.withContext(function($ctx1) {
  10725. var $early={};
  10726. try {
  10727. self._ifEmpty_((function(){
  10728. return $core.withContext(function($ctx2) {
  10729. return self._error_("Collection is empty");
  10730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10731. }));
  10732. self._do_((function(each){
  10733. throw $early=[each];
  10734. }));
  10735. return self;
  10736. }
  10737. catch(e) {if(e===$early)return e[0]; throw e}
  10738. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10739. },
  10740. args: [],
  10741. 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 ]",
  10742. referencedClasses: [],
  10743. messageSends: ["ifEmpty:", "error:", "do:"]
  10744. }),
  10745. $globals.Collection);
  10746. $core.addMethod(
  10747. $core.method({
  10748. selector: "anySatisfy:",
  10749. protocol: 'enumerating',
  10750. fn: function (aBlock){
  10751. var self=this;
  10752. return $core.withContext(function($ctx1) {
  10753. var $1;
  10754. var $early={};
  10755. try {
  10756. self._do_((function(each){
  10757. return $core.withContext(function($ctx2) {
  10758. $1=$recv(aBlock)._value_(each);
  10759. if($core.assert($1)){
  10760. throw $early=[true];
  10761. }
  10762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10763. }));
  10764. return false;
  10765. }
  10766. catch(e) {if(e===$early)return e[0]; throw e}
  10767. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10768. },
  10769. args: ["aBlock"],
  10770. 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",
  10771. referencedClasses: [],
  10772. messageSends: ["do:", "ifTrue:", "value:"]
  10773. }),
  10774. $globals.Collection);
  10775. $core.addMethod(
  10776. $core.method({
  10777. selector: "asArray",
  10778. protocol: 'converting',
  10779. fn: function (){
  10780. var self=this;
  10781. return $core.withContext(function($ctx1) {
  10782. return $recv($globals.Array)._withAll_(self);
  10783. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10784. },
  10785. args: [],
  10786. source: "asArray\x0a\x09^ Array withAll: self",
  10787. referencedClasses: ["Array"],
  10788. messageSends: ["withAll:"]
  10789. }),
  10790. $globals.Collection);
  10791. $core.addMethod(
  10792. $core.method({
  10793. selector: "asJSON",
  10794. protocol: 'converting',
  10795. fn: function (){
  10796. var self=this;
  10797. return $core.withContext(function($ctx1) {
  10798. return $recv(self._asArray())._collect_((function(each){
  10799. return $core.withContext(function($ctx2) {
  10800. return $recv(each)._asJSON();
  10801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10802. }));
  10803. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10804. },
  10805. args: [],
  10806. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10807. referencedClasses: [],
  10808. messageSends: ["collect:", "asArray", "asJSON"]
  10809. }),
  10810. $globals.Collection);
  10811. $core.addMethod(
  10812. $core.method({
  10813. selector: "asOrderedCollection",
  10814. protocol: 'converting',
  10815. fn: function (){
  10816. var self=this;
  10817. return $core.withContext(function($ctx1) {
  10818. return self._asArray();
  10819. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10820. },
  10821. args: [],
  10822. source: "asOrderedCollection\x0a\x09^ self asArray",
  10823. referencedClasses: [],
  10824. messageSends: ["asArray"]
  10825. }),
  10826. $globals.Collection);
  10827. $core.addMethod(
  10828. $core.method({
  10829. selector: "asSet",
  10830. protocol: 'converting',
  10831. fn: function (){
  10832. var self=this;
  10833. return $core.withContext(function($ctx1) {
  10834. return $recv($globals.Set)._withAll_(self);
  10835. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10836. },
  10837. args: [],
  10838. source: "asSet\x0a\x09^ Set withAll: self",
  10839. referencedClasses: ["Set"],
  10840. messageSends: ["withAll:"]
  10841. }),
  10842. $globals.Collection);
  10843. $core.addMethod(
  10844. $core.method({
  10845. selector: "collect:",
  10846. protocol: 'enumerating',
  10847. fn: function (aBlock){
  10848. var self=this;
  10849. var stream;
  10850. return $core.withContext(function($ctx1) {
  10851. stream=$recv($recv(self._class())._new())._writeStream();
  10852. self._do_((function(each){
  10853. return $core.withContext(function($ctx2) {
  10854. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10855. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10856. }));
  10857. return $recv(stream)._contents();
  10858. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10859. },
  10860. args: ["aBlock"],
  10861. 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",
  10862. referencedClasses: [],
  10863. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10864. }),
  10865. $globals.Collection);
  10866. $core.addMethod(
  10867. $core.method({
  10868. selector: "copyWith:",
  10869. protocol: 'copying',
  10870. fn: function (anObject){
  10871. var self=this;
  10872. return $core.withContext(function($ctx1) {
  10873. var $1;
  10874. $1=self._copy();
  10875. $recv($1)._add_(anObject);
  10876. return $recv($1)._yourself();
  10877. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10878. },
  10879. args: ["anObject"],
  10880. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10881. referencedClasses: [],
  10882. messageSends: ["add:", "copy", "yourself"]
  10883. }),
  10884. $globals.Collection);
  10885. $core.addMethod(
  10886. $core.method({
  10887. selector: "copyWithAll:",
  10888. protocol: 'copying',
  10889. fn: function (aCollection){
  10890. var self=this;
  10891. return $core.withContext(function($ctx1) {
  10892. var $1;
  10893. $1=self._copy();
  10894. $recv($1)._addAll_(aCollection);
  10895. return $recv($1)._yourself();
  10896. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10897. },
  10898. args: ["aCollection"],
  10899. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10900. referencedClasses: [],
  10901. messageSends: ["addAll:", "copy", "yourself"]
  10902. }),
  10903. $globals.Collection);
  10904. $core.addMethod(
  10905. $core.method({
  10906. selector: "copyWithoutAll:",
  10907. protocol: 'copying',
  10908. fn: function (aCollection){
  10909. var self=this;
  10910. return $core.withContext(function($ctx1) {
  10911. return self._reject_((function(each){
  10912. return $core.withContext(function($ctx2) {
  10913. return $recv(aCollection)._includes_(each);
  10914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10915. }));
  10916. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  10917. },
  10918. args: ["aCollection"],
  10919. 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 ]",
  10920. referencedClasses: [],
  10921. messageSends: ["reject:", "includes:"]
  10922. }),
  10923. $globals.Collection);
  10924. $core.addMethod(
  10925. $core.method({
  10926. selector: "deepCopy",
  10927. protocol: 'copying',
  10928. fn: function (){
  10929. var self=this;
  10930. return $core.withContext(function($ctx1) {
  10931. return self._collect_((function(each){
  10932. return $core.withContext(function($ctx2) {
  10933. return $recv(each)._deepCopy();
  10934. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10935. }));
  10936. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  10937. },
  10938. args: [],
  10939. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  10940. referencedClasses: [],
  10941. messageSends: ["collect:", "deepCopy"]
  10942. }),
  10943. $globals.Collection);
  10944. $core.addMethod(
  10945. $core.method({
  10946. selector: "detect:",
  10947. protocol: 'enumerating',
  10948. fn: function (aBlock){
  10949. var self=this;
  10950. return $core.withContext(function($ctx1) {
  10951. return self._detect_ifNone_(aBlock,(function(){
  10952. return $core.withContext(function($ctx2) {
  10953. return self._errorNotFound();
  10954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10955. }));
  10956. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  10957. },
  10958. args: ["aBlock"],
  10959. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  10960. referencedClasses: [],
  10961. messageSends: ["detect:ifNone:", "errorNotFound"]
  10962. }),
  10963. $globals.Collection);
  10964. $core.addMethod(
  10965. $core.method({
  10966. selector: "detect:ifNone:",
  10967. protocol: 'enumerating',
  10968. fn: function (aBlock,anotherBlock){
  10969. var self=this;
  10970. return $core.withContext(function($ctx1) {
  10971. self._subclassResponsibility();
  10972. return self;
  10973. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10974. },
  10975. args: ["aBlock", "anotherBlock"],
  10976. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10977. referencedClasses: [],
  10978. messageSends: ["subclassResponsibility"]
  10979. }),
  10980. $globals.Collection);
  10981. $core.addMethod(
  10982. $core.method({
  10983. selector: "do:",
  10984. protocol: 'enumerating',
  10985. fn: function (aBlock){
  10986. var self=this;
  10987. return $core.withContext(function($ctx1) {
  10988. self._subclassResponsibility();
  10989. return self;
  10990. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  10991. },
  10992. args: ["aBlock"],
  10993. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10994. referencedClasses: [],
  10995. messageSends: ["subclassResponsibility"]
  10996. }),
  10997. $globals.Collection);
  10998. $core.addMethod(
  10999. $core.method({
  11000. selector: "do:separatedBy:",
  11001. protocol: 'enumerating',
  11002. fn: function (aBlock,anotherBlock){
  11003. var self=this;
  11004. var actionBeforeElement;
  11005. return $core.withContext(function($ctx1) {
  11006. actionBeforeElement=(function(){
  11007. actionBeforeElement=anotherBlock;
  11008. return actionBeforeElement;
  11009. });
  11010. self._do_((function(each){
  11011. return $core.withContext(function($ctx2) {
  11012. $recv(actionBeforeElement)._value();
  11013. return $recv(aBlock)._value_(each);
  11014. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  11015. }));
  11016. return self;
  11017. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  11018. },
  11019. args: ["aBlock", "anotherBlock"],
  11020. 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 ]",
  11021. referencedClasses: [],
  11022. messageSends: ["do:", "value", "value:"]
  11023. }),
  11024. $globals.Collection);
  11025. $core.addMethod(
  11026. $core.method({
  11027. selector: "errorNotFound",
  11028. protocol: 'error handling',
  11029. fn: function (){
  11030. var self=this;
  11031. return $core.withContext(function($ctx1) {
  11032. self._error_("Object is not in the collection");
  11033. return self;
  11034. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  11035. },
  11036. args: [],
  11037. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  11038. referencedClasses: [],
  11039. messageSends: ["error:"]
  11040. }),
  11041. $globals.Collection);
  11042. $core.addMethod(
  11043. $core.method({
  11044. selector: "ifEmpty:",
  11045. protocol: 'testing',
  11046. fn: function (aBlock){
  11047. var self=this;
  11048. return $core.withContext(function($ctx1) {
  11049. var $1;
  11050. $1=self._isEmpty();
  11051. if($core.assert($1)){
  11052. return $recv(aBlock)._value();
  11053. } else {
  11054. return self;
  11055. }
  11056. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  11057. },
  11058. args: ["aBlock"],
  11059. 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 ]",
  11060. referencedClasses: [],
  11061. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  11062. }),
  11063. $globals.Collection);
  11064. $core.addMethod(
  11065. $core.method({
  11066. selector: "ifEmpty:ifNotEmpty:",
  11067. protocol: 'testing',
  11068. fn: function (aBlock,anotherBlock){
  11069. var self=this;
  11070. return $core.withContext(function($ctx1) {
  11071. var $1;
  11072. $1=self._isEmpty();
  11073. if($core.assert($1)){
  11074. return $recv(aBlock)._value();
  11075. } else {
  11076. return $recv(anotherBlock)._value_(self);
  11077. }
  11078. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11079. },
  11080. args: ["aBlock", "anotherBlock"],
  11081. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  11082. referencedClasses: [],
  11083. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  11084. }),
  11085. $globals.Collection);
  11086. $core.addMethod(
  11087. $core.method({
  11088. selector: "ifNotEmpty:",
  11089. protocol: 'testing',
  11090. fn: function (aBlock){
  11091. var self=this;
  11092. return $core.withContext(function($ctx1) {
  11093. var $1;
  11094. $1=self._notEmpty();
  11095. if($core.assert($1)){
  11096. return $recv(aBlock)._value_(self);
  11097. } else {
  11098. return self;
  11099. }
  11100. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  11101. },
  11102. args: ["aBlock"],
  11103. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  11104. referencedClasses: [],
  11105. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  11106. }),
  11107. $globals.Collection);
  11108. $core.addMethod(
  11109. $core.method({
  11110. selector: "ifNotEmpty:ifEmpty:",
  11111. protocol: 'testing',
  11112. fn: function (aBlock,anotherBlock){
  11113. var self=this;
  11114. return $core.withContext(function($ctx1) {
  11115. var $1;
  11116. $1=self._notEmpty();
  11117. if($core.assert($1)){
  11118. return $recv(aBlock)._value_(self);
  11119. } else {
  11120. return $recv(anotherBlock)._value();
  11121. }
  11122. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11123. },
  11124. args: ["aBlock", "anotherBlock"],
  11125. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  11126. referencedClasses: [],
  11127. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  11128. }),
  11129. $globals.Collection);
  11130. $core.addMethod(
  11131. $core.method({
  11132. selector: "includes:",
  11133. protocol: 'testing',
  11134. fn: function (anObject){
  11135. var self=this;
  11136. return $core.withContext(function($ctx1) {
  11137. return self._anySatisfy_((function(each){
  11138. return $core.withContext(function($ctx2) {
  11139. return $recv(each).__eq(anObject);
  11140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11141. }));
  11142. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  11143. },
  11144. args: ["anObject"],
  11145. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  11146. referencedClasses: [],
  11147. messageSends: ["anySatisfy:", "="]
  11148. }),
  11149. $globals.Collection);
  11150. $core.addMethod(
  11151. $core.method({
  11152. selector: "inject:into:",
  11153. protocol: 'enumerating',
  11154. fn: function (anObject,aBlock){
  11155. var self=this;
  11156. var result;
  11157. return $core.withContext(function($ctx1) {
  11158. result=anObject;
  11159. self._do_((function(each){
  11160. return $core.withContext(function($ctx2) {
  11161. result=$recv(aBlock)._value_value_(result,each);
  11162. return result;
  11163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11164. }));
  11165. return result;
  11166. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  11167. },
  11168. args: ["anObject", "aBlock"],
  11169. 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",
  11170. referencedClasses: [],
  11171. messageSends: ["do:", "value:value:"]
  11172. }),
  11173. $globals.Collection);
  11174. $core.addMethod(
  11175. $core.method({
  11176. selector: "intersection:",
  11177. protocol: 'enumerating',
  11178. fn: function (aCollection){
  11179. var self=this;
  11180. var set,outputSet;
  11181. return $core.withContext(function($ctx1) {
  11182. var $2,$1;
  11183. set=self._asSet();
  11184. outputSet=$recv($globals.Set)._new();
  11185. $recv(aCollection)._do_((function(each){
  11186. return $core.withContext(function($ctx2) {
  11187. $2=$recv(set)._includes_(each);
  11188. $ctx2.sendIdx["includes:"]=1;
  11189. $1=$recv($2)._and_((function(){
  11190. return $core.withContext(function($ctx3) {
  11191. return $recv($recv(outputSet)._includes_(each))._not();
  11192. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  11193. }));
  11194. if($core.assert($1)){
  11195. return $recv(outputSet)._add_(each);
  11196. }
  11197. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11198. }));
  11199. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  11200. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  11201. },
  11202. args: ["aCollection"],
  11203. 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",
  11204. referencedClasses: ["Set"],
  11205. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  11206. }),
  11207. $globals.Collection);
  11208. $core.addMethod(
  11209. $core.method({
  11210. selector: "isEmpty",
  11211. protocol: 'testing',
  11212. fn: function (){
  11213. var self=this;
  11214. return $core.withContext(function($ctx1) {
  11215. return $recv(self._size()).__eq((0));
  11216. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  11217. },
  11218. args: [],
  11219. source: "isEmpty\x0a\x09^ self size = 0",
  11220. referencedClasses: [],
  11221. messageSends: ["=", "size"]
  11222. }),
  11223. $globals.Collection);
  11224. $core.addMethod(
  11225. $core.method({
  11226. selector: "noneSatisfy:",
  11227. protocol: 'enumerating',
  11228. fn: function (aBlock){
  11229. var self=this;
  11230. return $core.withContext(function($ctx1) {
  11231. var $1;
  11232. var $early={};
  11233. try {
  11234. self._do_((function(item){
  11235. return $core.withContext(function($ctx2) {
  11236. $1=$recv(aBlock)._value_(item);
  11237. if($core.assert($1)){
  11238. throw $early=[false];
  11239. }
  11240. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11241. }));
  11242. return true;
  11243. }
  11244. catch(e) {if(e===$early)return e[0]; throw e}
  11245. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11246. },
  11247. args: ["aBlock"],
  11248. 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",
  11249. referencedClasses: [],
  11250. messageSends: ["do:", "ifTrue:", "value:"]
  11251. }),
  11252. $globals.Collection);
  11253. $core.addMethod(
  11254. $core.method({
  11255. selector: "notEmpty",
  11256. protocol: 'testing',
  11257. fn: function (){
  11258. var self=this;
  11259. return $core.withContext(function($ctx1) {
  11260. return $recv(self._isEmpty())._not();
  11261. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11262. },
  11263. args: [],
  11264. source: "notEmpty\x0a\x09^ self isEmpty not",
  11265. referencedClasses: [],
  11266. messageSends: ["not", "isEmpty"]
  11267. }),
  11268. $globals.Collection);
  11269. $core.addMethod(
  11270. $core.method({
  11271. selector: "occurrencesOf:",
  11272. protocol: 'accessing',
  11273. fn: function (anObject){
  11274. var self=this;
  11275. var tally;
  11276. return $core.withContext(function($ctx1) {
  11277. var $1;
  11278. tally=(0);
  11279. self._do_((function(each){
  11280. return $core.withContext(function($ctx2) {
  11281. $1=$recv(anObject).__eq(each);
  11282. if($core.assert($1)){
  11283. tally=$recv(tally).__plus((1));
  11284. return tally;
  11285. }
  11286. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11287. }));
  11288. return tally;
  11289. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11290. },
  11291. args: ["anObject"],
  11292. 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",
  11293. referencedClasses: [],
  11294. messageSends: ["do:", "ifTrue:", "=", "+"]
  11295. }),
  11296. $globals.Collection);
  11297. $core.addMethod(
  11298. $core.method({
  11299. selector: "putOn:",
  11300. protocol: 'streaming',
  11301. fn: function (aStream){
  11302. var self=this;
  11303. return $core.withContext(function($ctx1) {
  11304. self._do_((function(each){
  11305. return $core.withContext(function($ctx2) {
  11306. return $recv(each)._putOn_(aStream);
  11307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11308. }));
  11309. return self;
  11310. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11311. },
  11312. args: ["aStream"],
  11313. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11314. referencedClasses: [],
  11315. messageSends: ["do:", "putOn:"]
  11316. }),
  11317. $globals.Collection);
  11318. $core.addMethod(
  11319. $core.method({
  11320. selector: "reject:",
  11321. protocol: 'enumerating',
  11322. fn: function (aBlock){
  11323. var self=this;
  11324. return $core.withContext(function($ctx1) {
  11325. return self._select_((function(each){
  11326. return $core.withContext(function($ctx2) {
  11327. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11329. }));
  11330. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11331. },
  11332. args: ["aBlock"],
  11333. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11334. referencedClasses: [],
  11335. messageSends: ["select:", "=", "value:"]
  11336. }),
  11337. $globals.Collection);
  11338. $core.addMethod(
  11339. $core.method({
  11340. selector: "remove:",
  11341. protocol: 'adding/removing',
  11342. fn: function (anObject){
  11343. var self=this;
  11344. return $core.withContext(function($ctx1) {
  11345. return self._remove_ifAbsent_(anObject,(function(){
  11346. return $core.withContext(function($ctx2) {
  11347. return self._errorNotFound();
  11348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11349. }));
  11350. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11351. },
  11352. args: ["anObject"],
  11353. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11354. referencedClasses: [],
  11355. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11356. }),
  11357. $globals.Collection);
  11358. $core.addMethod(
  11359. $core.method({
  11360. selector: "remove:ifAbsent:",
  11361. protocol: 'adding/removing',
  11362. fn: function (anObject,aBlock){
  11363. var self=this;
  11364. return $core.withContext(function($ctx1) {
  11365. self._subclassResponsibility();
  11366. return self;
  11367. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11368. },
  11369. args: ["anObject", "aBlock"],
  11370. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11371. referencedClasses: [],
  11372. messageSends: ["subclassResponsibility"]
  11373. }),
  11374. $globals.Collection);
  11375. $core.addMethod(
  11376. $core.method({
  11377. selector: "removeAll",
  11378. protocol: 'adding/removing',
  11379. fn: function (){
  11380. var self=this;
  11381. return $core.withContext(function($ctx1) {
  11382. self._subclassResponsibility();
  11383. return self;
  11384. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11385. },
  11386. args: [],
  11387. source: "removeAll\x0a\x09self subclassResponsibility",
  11388. referencedClasses: [],
  11389. messageSends: ["subclassResponsibility"]
  11390. }),
  11391. $globals.Collection);
  11392. $core.addMethod(
  11393. $core.method({
  11394. selector: "select:",
  11395. protocol: 'enumerating',
  11396. fn: function (aBlock){
  11397. var self=this;
  11398. var stream;
  11399. return $core.withContext(function($ctx1) {
  11400. var $1;
  11401. stream=$recv($recv(self._class())._new())._writeStream();
  11402. self._do_((function(each){
  11403. return $core.withContext(function($ctx2) {
  11404. $1=$recv(aBlock)._value_(each);
  11405. if($core.assert($1)){
  11406. return $recv(stream)._nextPut_(each);
  11407. }
  11408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11409. }));
  11410. return $recv(stream)._contents();
  11411. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11412. },
  11413. args: ["aBlock"],
  11414. 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",
  11415. referencedClasses: [],
  11416. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11417. }),
  11418. $globals.Collection);
  11419. $core.addMethod(
  11420. $core.method({
  11421. selector: "select:thenCollect:",
  11422. protocol: 'enumerating',
  11423. fn: function (selectBlock,collectBlock){
  11424. var self=this;
  11425. var stream;
  11426. return $core.withContext(function($ctx1) {
  11427. var $1;
  11428. stream=$recv($recv(self._class())._new())._writeStream();
  11429. self._do_((function(each){
  11430. return $core.withContext(function($ctx2) {
  11431. $1=$recv(selectBlock)._value_(each);
  11432. $ctx2.sendIdx["value:"]=1;
  11433. if($core.assert($1)){
  11434. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11435. }
  11436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11437. }));
  11438. return $recv(stream)._contents();
  11439. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11440. },
  11441. args: ["selectBlock", "collectBlock"],
  11442. 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",
  11443. referencedClasses: [],
  11444. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11445. }),
  11446. $globals.Collection);
  11447. $core.addMethod(
  11448. $core.method({
  11449. selector: "shallowCopy",
  11450. protocol: 'copying',
  11451. fn: function (){
  11452. var self=this;
  11453. return $core.withContext(function($ctx1) {
  11454. return self._collect_((function(each){
  11455. return each;
  11456. }));
  11457. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  11458. },
  11459. args: [],
  11460. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  11461. referencedClasses: [],
  11462. messageSends: ["collect:"]
  11463. }),
  11464. $globals.Collection);
  11465. $core.addMethod(
  11466. $core.method({
  11467. selector: "single",
  11468. protocol: 'accessing',
  11469. fn: function (){
  11470. var self=this;
  11471. return $core.withContext(function($ctx1) {
  11472. var $1;
  11473. self._ifEmpty_((function(){
  11474. return $core.withContext(function($ctx2) {
  11475. return self._error_("Collection is empty");
  11476. $ctx2.sendIdx["error:"]=1;
  11477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11478. }));
  11479. $1=$recv(self._size()).__gt((1));
  11480. if($core.assert($1)){
  11481. self._error_("Collection holds more than one element");
  11482. }
  11483. return self._anyOne();
  11484. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  11485. },
  11486. args: [],
  11487. 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",
  11488. referencedClasses: [],
  11489. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  11490. }),
  11491. $globals.Collection);
  11492. $core.addMethod(
  11493. $core.method({
  11494. selector: "size",
  11495. protocol: 'accessing',
  11496. fn: function (){
  11497. var self=this;
  11498. return $core.withContext(function($ctx1) {
  11499. self._subclassResponsibility();
  11500. return self;
  11501. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11502. },
  11503. args: [],
  11504. source: "size\x0a\x09self subclassResponsibility",
  11505. referencedClasses: [],
  11506. messageSends: ["subclassResponsibility"]
  11507. }),
  11508. $globals.Collection);
  11509. $core.addMethod(
  11510. $core.method({
  11511. selector: "classTag",
  11512. protocol: 'accessing',
  11513. fn: function (){
  11514. var self=this;
  11515. return "collection";
  11516. },
  11517. args: [],
  11518. 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'",
  11519. referencedClasses: [],
  11520. messageSends: []
  11521. }),
  11522. $globals.Collection.klass);
  11523. $core.addMethod(
  11524. $core.method({
  11525. selector: "new:",
  11526. protocol: 'instance creation',
  11527. fn: function (anInteger){
  11528. var self=this;
  11529. return $core.withContext(function($ctx1) {
  11530. return self._new();
  11531. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11532. },
  11533. args: ["anInteger"],
  11534. source: "new: anInteger\x0a\x09^ self new",
  11535. referencedClasses: [],
  11536. messageSends: ["new"]
  11537. }),
  11538. $globals.Collection.klass);
  11539. $core.addMethod(
  11540. $core.method({
  11541. selector: "with:",
  11542. protocol: 'instance creation',
  11543. fn: function (anObject){
  11544. var self=this;
  11545. return $core.withContext(function($ctx1) {
  11546. var $1;
  11547. $1=self._new();
  11548. $recv($1)._add_(anObject);
  11549. return $recv($1)._yourself();
  11550. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11551. },
  11552. args: ["anObject"],
  11553. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11554. referencedClasses: [],
  11555. messageSends: ["add:", "new", "yourself"]
  11556. }),
  11557. $globals.Collection.klass);
  11558. $core.addMethod(
  11559. $core.method({
  11560. selector: "with:with:",
  11561. protocol: 'instance creation',
  11562. fn: function (anObject,anotherObject){
  11563. var self=this;
  11564. return $core.withContext(function($ctx1) {
  11565. var $1;
  11566. $1=self._new();
  11567. $recv($1)._add_(anObject);
  11568. $ctx1.sendIdx["add:"]=1;
  11569. $recv($1)._add_(anotherObject);
  11570. return $recv($1)._yourself();
  11571. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11572. },
  11573. args: ["anObject", "anotherObject"],
  11574. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11575. referencedClasses: [],
  11576. messageSends: ["add:", "new", "yourself"]
  11577. }),
  11578. $globals.Collection.klass);
  11579. $core.addMethod(
  11580. $core.method({
  11581. selector: "with:with:with:",
  11582. protocol: 'instance creation',
  11583. fn: function (firstObject,secondObject,thirdObject){
  11584. var self=this;
  11585. return $core.withContext(function($ctx1) {
  11586. var $1;
  11587. $1=self._new();
  11588. $recv($1)._add_(firstObject);
  11589. $ctx1.sendIdx["add:"]=1;
  11590. $recv($1)._add_(secondObject);
  11591. $ctx1.sendIdx["add:"]=2;
  11592. $recv($1)._add_(thirdObject);
  11593. return $recv($1)._yourself();
  11594. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11595. },
  11596. args: ["firstObject", "secondObject", "thirdObject"],
  11597. 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",
  11598. referencedClasses: [],
  11599. messageSends: ["add:", "new", "yourself"]
  11600. }),
  11601. $globals.Collection.klass);
  11602. $core.addMethod(
  11603. $core.method({
  11604. selector: "withAll:",
  11605. protocol: 'instance creation',
  11606. fn: function (aCollection){
  11607. var self=this;
  11608. return $core.withContext(function($ctx1) {
  11609. var $1;
  11610. $1=self._new();
  11611. $recv($1)._addAll_(aCollection);
  11612. return $recv($1)._yourself();
  11613. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11614. },
  11615. args: ["aCollection"],
  11616. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11617. referencedClasses: [],
  11618. messageSends: ["addAll:", "new", "yourself"]
  11619. }),
  11620. $globals.Collection.klass);
  11621. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11622. $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.";
  11623. $core.addMethod(
  11624. $core.method({
  11625. selector: "at:",
  11626. protocol: 'accessing',
  11627. fn: function (anIndex){
  11628. var self=this;
  11629. return $core.withContext(function($ctx1) {
  11630. return self._at_ifAbsent_(anIndex,(function(){
  11631. return $core.withContext(function($ctx2) {
  11632. return self._errorNotFound();
  11633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11634. }));
  11635. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11636. },
  11637. args: ["anIndex"],
  11638. 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 ]",
  11639. referencedClasses: [],
  11640. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11641. }),
  11642. $globals.IndexableCollection);
  11643. $core.addMethod(
  11644. $core.method({
  11645. selector: "at:ifAbsent:",
  11646. protocol: 'accessing',
  11647. fn: function (anIndex,aBlock){
  11648. var self=this;
  11649. return $core.withContext(function($ctx1) {
  11650. self._subclassResponsibility();
  11651. return self;
  11652. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11653. },
  11654. args: ["anIndex", "aBlock"],
  11655. 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",
  11656. referencedClasses: [],
  11657. messageSends: ["subclassResponsibility"]
  11658. }),
  11659. $globals.IndexableCollection);
  11660. $core.addMethod(
  11661. $core.method({
  11662. selector: "at:ifAbsentPut:",
  11663. protocol: 'accessing',
  11664. fn: function (aKey,aBlock){
  11665. var self=this;
  11666. return $core.withContext(function($ctx1) {
  11667. return self._at_ifAbsent_(aKey,(function(){
  11668. return $core.withContext(function($ctx2) {
  11669. return self._at_put_(aKey,$recv(aBlock)._value());
  11670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11671. }));
  11672. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11673. },
  11674. args: ["aKey", "aBlock"],
  11675. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11676. referencedClasses: [],
  11677. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11678. }),
  11679. $globals.IndexableCollection);
  11680. $core.addMethod(
  11681. $core.method({
  11682. selector: "at:ifPresent:",
  11683. protocol: 'accessing',
  11684. fn: function (anIndex,aBlock){
  11685. var self=this;
  11686. return $core.withContext(function($ctx1) {
  11687. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11688. return nil;
  11689. }));
  11690. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11691. },
  11692. args: ["anIndex", "aBlock"],
  11693. 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 ]",
  11694. referencedClasses: [],
  11695. messageSends: ["at:ifPresent:ifAbsent:"]
  11696. }),
  11697. $globals.IndexableCollection);
  11698. $core.addMethod(
  11699. $core.method({
  11700. selector: "at:ifPresent:ifAbsent:",
  11701. protocol: 'accessing',
  11702. fn: function (anIndex,aBlock,anotherBlock){
  11703. var self=this;
  11704. return $core.withContext(function($ctx1) {
  11705. self._subclassResponsibility();
  11706. return self;
  11707. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11708. },
  11709. args: ["anIndex", "aBlock", "anotherBlock"],
  11710. 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",
  11711. referencedClasses: [],
  11712. messageSends: ["subclassResponsibility"]
  11713. }),
  11714. $globals.IndexableCollection);
  11715. $core.addMethod(
  11716. $core.method({
  11717. selector: "at:put:",
  11718. protocol: 'accessing',
  11719. fn: function (anIndex,anObject){
  11720. var self=this;
  11721. return $core.withContext(function($ctx1) {
  11722. self._subclassResponsibility();
  11723. return self;
  11724. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11725. },
  11726. args: ["anIndex", "anObject"],
  11727. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11728. referencedClasses: [],
  11729. messageSends: ["subclassResponsibility"]
  11730. }),
  11731. $globals.IndexableCollection);
  11732. $core.addMethod(
  11733. $core.method({
  11734. selector: "indexOf:",
  11735. protocol: 'accessing',
  11736. fn: function (anObject){
  11737. var self=this;
  11738. return $core.withContext(function($ctx1) {
  11739. return self._indexOf_ifAbsent_(anObject,(function(){
  11740. return $core.withContext(function($ctx2) {
  11741. return self._errorNotFound();
  11742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11743. }));
  11744. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11745. },
  11746. args: ["anObject"],
  11747. 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 ]",
  11748. referencedClasses: [],
  11749. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11750. }),
  11751. $globals.IndexableCollection);
  11752. $core.addMethod(
  11753. $core.method({
  11754. selector: "indexOf:ifAbsent:",
  11755. protocol: 'accessing',
  11756. fn: function (anObject,aBlock){
  11757. var self=this;
  11758. return $core.withContext(function($ctx1) {
  11759. self._subclassResponsibility();
  11760. return self;
  11761. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11762. },
  11763. args: ["anObject", "aBlock"],
  11764. 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",
  11765. referencedClasses: [],
  11766. messageSends: ["subclassResponsibility"]
  11767. }),
  11768. $globals.IndexableCollection);
  11769. $core.addMethod(
  11770. $core.method({
  11771. selector: "with:do:",
  11772. protocol: 'enumerating',
  11773. fn: function (anotherCollection,aBlock){
  11774. var self=this;
  11775. return $core.withContext(function($ctx1) {
  11776. self._withIndexDo_((function(each,index){
  11777. return $core.withContext(function($ctx2) {
  11778. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11779. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11780. }));
  11781. return self;
  11782. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11783. },
  11784. args: ["anotherCollection", "aBlock"],
  11785. 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) ]",
  11786. referencedClasses: [],
  11787. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11788. }),
  11789. $globals.IndexableCollection);
  11790. $core.addMethod(
  11791. $core.method({
  11792. selector: "withIndexDo:",
  11793. protocol: 'enumerating',
  11794. fn: function (aBlock){
  11795. var self=this;
  11796. return $core.withContext(function($ctx1) {
  11797. self._subclassResponsibility();
  11798. return self;
  11799. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11800. },
  11801. args: ["aBlock"],
  11802. 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",
  11803. referencedClasses: [],
  11804. messageSends: ["subclassResponsibility"]
  11805. }),
  11806. $globals.IndexableCollection);
  11807. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11808. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11809. $core.addMethod(
  11810. $core.method({
  11811. selector: "=",
  11812. protocol: 'comparing',
  11813. fn: function (anAssocitativeCollection){
  11814. var self=this;
  11815. return $core.withContext(function($ctx1) {
  11816. var $2,$1,$4,$3,$5;
  11817. $2=self._class();
  11818. $ctx1.sendIdx["class"]=1;
  11819. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11820. $ctx1.sendIdx["="]=1;
  11821. if(!$core.assert($1)){
  11822. return false;
  11823. }
  11824. $4=self._size();
  11825. $ctx1.sendIdx["size"]=1;
  11826. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11827. $ctx1.sendIdx["="]=2;
  11828. if(!$core.assert($3)){
  11829. return false;
  11830. }
  11831. $5=self._associations();
  11832. $ctx1.sendIdx["associations"]=1;
  11833. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  11834. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11835. },
  11836. args: ["anAssocitativeCollection"],
  11837. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11838. referencedClasses: [],
  11839. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11840. }),
  11841. $globals.AssociativeCollection);
  11842. $core.addMethod(
  11843. $core.method({
  11844. selector: "add:",
  11845. protocol: 'adding/removing',
  11846. fn: function (anAssociation){
  11847. var self=this;
  11848. return $core.withContext(function($ctx1) {
  11849. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11850. return self;
  11851. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11852. },
  11853. args: ["anAssociation"],
  11854. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11855. referencedClasses: [],
  11856. messageSends: ["at:put:", "key", "value"]
  11857. }),
  11858. $globals.AssociativeCollection);
  11859. $core.addMethod(
  11860. $core.method({
  11861. selector: "addAll:",
  11862. protocol: 'adding/removing',
  11863. fn: function (anAssociativeCollection){
  11864. var self=this;
  11865. return $core.withContext(function($ctx1) {
  11866. (
  11867. $ctx1.supercall = true,
  11868. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11869. $ctx1.supercall = false;
  11870. return anAssociativeCollection;
  11871. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11872. },
  11873. args: ["anAssociativeCollection"],
  11874. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11875. referencedClasses: [],
  11876. messageSends: ["addAll:", "associations"]
  11877. }),
  11878. $globals.AssociativeCollection);
  11879. $core.addMethod(
  11880. $core.method({
  11881. selector: "asDictionary",
  11882. protocol: 'converting',
  11883. fn: function (){
  11884. var self=this;
  11885. return $core.withContext(function($ctx1) {
  11886. return $recv($globals.Dictionary)._from_(self._associations());
  11887. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11888. },
  11889. args: [],
  11890. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11891. referencedClasses: ["Dictionary"],
  11892. messageSends: ["from:", "associations"]
  11893. }),
  11894. $globals.AssociativeCollection);
  11895. $core.addMethod(
  11896. $core.method({
  11897. selector: "asHashedCollection",
  11898. protocol: 'converting',
  11899. fn: function (){
  11900. var self=this;
  11901. return $core.withContext(function($ctx1) {
  11902. return $recv($globals.HashedCollection)._from_(self._associations());
  11903. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11904. },
  11905. args: [],
  11906. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11907. referencedClasses: ["HashedCollection"],
  11908. messageSends: ["from:", "associations"]
  11909. }),
  11910. $globals.AssociativeCollection);
  11911. $core.addMethod(
  11912. $core.method({
  11913. selector: "asJSON",
  11914. protocol: 'converting',
  11915. fn: function (){
  11916. var self=this;
  11917. var hash;
  11918. return $core.withContext(function($ctx1) {
  11919. hash=$recv($globals.HashedCollection)._new();
  11920. self._keysAndValuesDo_((function(key,value){
  11921. return $core.withContext(function($ctx2) {
  11922. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11923. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11924. }));
  11925. return hash;
  11926. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11927. },
  11928. args: [],
  11929. source: "asJSON\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJSON ].\x0a\x09^ hash",
  11930. referencedClasses: ["HashedCollection"],
  11931. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11932. }),
  11933. $globals.AssociativeCollection);
  11934. $core.addMethod(
  11935. $core.method({
  11936. selector: "associations",
  11937. protocol: 'accessing',
  11938. fn: function (){
  11939. var self=this;
  11940. var associations;
  11941. return $core.withContext(function($ctx1) {
  11942. associations=[];
  11943. self._associationsDo_((function(each){
  11944. return $core.withContext(function($ctx2) {
  11945. return $recv(associations)._add_(each);
  11946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11947. }));
  11948. return associations;
  11949. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  11950. },
  11951. args: [],
  11952. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  11953. referencedClasses: [],
  11954. messageSends: ["associationsDo:", "add:"]
  11955. }),
  11956. $globals.AssociativeCollection);
  11957. $core.addMethod(
  11958. $core.method({
  11959. selector: "associationsDo:",
  11960. protocol: 'enumerating',
  11961. fn: function (aBlock){
  11962. var self=this;
  11963. return $core.withContext(function($ctx1) {
  11964. self._keysAndValuesDo_((function(key,value){
  11965. return $core.withContext(function($ctx2) {
  11966. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  11967. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11968. }));
  11969. return self;
  11970. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11971. },
  11972. args: ["aBlock"],
  11973. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  11974. referencedClasses: ["Association"],
  11975. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  11976. }),
  11977. $globals.AssociativeCollection);
  11978. $core.addMethod(
  11979. $core.method({
  11980. selector: "at:ifPresent:ifAbsent:",
  11981. protocol: 'accessing',
  11982. fn: function (aKey,aBlock,anotherBlock){
  11983. var self=this;
  11984. return $core.withContext(function($ctx1) {
  11985. var $1;
  11986. $1=self._includesKey_(aKey);
  11987. if($core.assert($1)){
  11988. return $recv(aBlock)._value_(self._at_(aKey));
  11989. } else {
  11990. return $recv(anotherBlock)._value();
  11991. }
  11992. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11993. },
  11994. args: ["aKey", "aBlock", "anotherBlock"],
  11995. 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 ]",
  11996. referencedClasses: [],
  11997. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  11998. }),
  11999. $globals.AssociativeCollection);
  12000. $core.addMethod(
  12001. $core.method({
  12002. selector: "collect:",
  12003. protocol: 'enumerating',
  12004. fn: function (aBlock){
  12005. var self=this;
  12006. var newDict;
  12007. return $core.withContext(function($ctx1) {
  12008. newDict=$recv(self._class())._new();
  12009. self._keysAndValuesDo_((function(key,value){
  12010. return $core.withContext(function($ctx2) {
  12011. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  12012. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12013. }));
  12014. return newDict;
  12015. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12016. },
  12017. args: ["aBlock"],
  12018. 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",
  12019. referencedClasses: [],
  12020. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  12021. }),
  12022. $globals.AssociativeCollection);
  12023. $core.addMethod(
  12024. $core.method({
  12025. selector: "deepCopy",
  12026. protocol: 'copying',
  12027. fn: function (){
  12028. var self=this;
  12029. var copy;
  12030. return $core.withContext(function($ctx1) {
  12031. copy=$recv(self._class())._new();
  12032. self._keysAndValuesDo_((function(key,value){
  12033. return $core.withContext(function($ctx2) {
  12034. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  12035. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12036. }));
  12037. return copy;
  12038. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  12039. },
  12040. args: [],
  12041. 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",
  12042. referencedClasses: [],
  12043. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  12044. }),
  12045. $globals.AssociativeCollection);
  12046. $core.addMethod(
  12047. $core.method({
  12048. selector: "detect:ifNone:",
  12049. protocol: 'enumerating',
  12050. fn: function (aBlock,anotherBlock){
  12051. var self=this;
  12052. return $core.withContext(function($ctx1) {
  12053. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  12054. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  12055. },
  12056. args: ["aBlock", "anotherBlock"],
  12057. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  12058. referencedClasses: [],
  12059. messageSends: ["detect:ifNone:", "values"]
  12060. }),
  12061. $globals.AssociativeCollection);
  12062. $core.addMethod(
  12063. $core.method({
  12064. selector: "do:",
  12065. protocol: 'enumerating',
  12066. fn: function (aBlock){
  12067. var self=this;
  12068. return $core.withContext(function($ctx1) {
  12069. self._valuesDo_(aBlock);
  12070. return self;
  12071. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12072. },
  12073. args: ["aBlock"],
  12074. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  12075. referencedClasses: [],
  12076. messageSends: ["valuesDo:"]
  12077. }),
  12078. $globals.AssociativeCollection);
  12079. $core.addMethod(
  12080. $core.method({
  12081. selector: "includes:",
  12082. protocol: 'enumerating',
  12083. fn: function (anObject){
  12084. var self=this;
  12085. return $core.withContext(function($ctx1) {
  12086. return $recv(self._values())._includes_(anObject);
  12087. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  12088. },
  12089. args: ["anObject"],
  12090. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  12091. referencedClasses: [],
  12092. messageSends: ["includes:", "values"]
  12093. }),
  12094. $globals.AssociativeCollection);
  12095. $core.addMethod(
  12096. $core.method({
  12097. selector: "includesKey:",
  12098. protocol: 'testing',
  12099. fn: function (aKey){
  12100. var self=this;
  12101. return $core.withContext(function($ctx1) {
  12102. self._subclassResponsibility();
  12103. return self;
  12104. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12105. },
  12106. args: ["aKey"],
  12107. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  12108. referencedClasses: [],
  12109. messageSends: ["subclassResponsibility"]
  12110. }),
  12111. $globals.AssociativeCollection);
  12112. $core.addMethod(
  12113. $core.method({
  12114. selector: "indexOf:ifAbsent:",
  12115. protocol: 'accessing',
  12116. fn: function (anObject,aBlock){
  12117. var self=this;
  12118. return $core.withContext(function($ctx1) {
  12119. return $recv(self._keys())._detect_ifNone_((function(each){
  12120. return $core.withContext(function($ctx2) {
  12121. return $recv(self._at_(each)).__eq(anObject);
  12122. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12123. }),aBlock);
  12124. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12125. },
  12126. args: ["anObject", "aBlock"],
  12127. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  12128. referencedClasses: [],
  12129. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  12130. }),
  12131. $globals.AssociativeCollection);
  12132. $core.addMethod(
  12133. $core.method({
  12134. selector: "keyAtValue:",
  12135. protocol: 'accessing',
  12136. fn: function (anObject){
  12137. var self=this;
  12138. return $core.withContext(function($ctx1) {
  12139. return self._keyAtValue_ifAbsent_(anObject,(function(){
  12140. return $core.withContext(function($ctx2) {
  12141. return self._errorNotFound();
  12142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12143. }));
  12144. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  12145. },
  12146. args: ["anObject"],
  12147. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  12148. referencedClasses: [],
  12149. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  12150. }),
  12151. $globals.AssociativeCollection);
  12152. $core.addMethod(
  12153. $core.method({
  12154. selector: "keyAtValue:ifAbsent:",
  12155. protocol: 'accessing',
  12156. fn: function (anObject,aBlock){
  12157. var self=this;
  12158. return $core.withContext(function($ctx1) {
  12159. return self._indexOf_ifAbsent_(anObject,aBlock);
  12160. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12161. },
  12162. args: ["anObject", "aBlock"],
  12163. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  12164. referencedClasses: [],
  12165. messageSends: ["indexOf:ifAbsent:"]
  12166. }),
  12167. $globals.AssociativeCollection);
  12168. $core.addMethod(
  12169. $core.method({
  12170. selector: "keys",
  12171. protocol: 'accessing',
  12172. fn: function (){
  12173. var self=this;
  12174. return $core.withContext(function($ctx1) {
  12175. self._subclassResponsibility();
  12176. return self;
  12177. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  12178. },
  12179. args: [],
  12180. source: "keys\x0a\x09self subclassResponsibility",
  12181. referencedClasses: [],
  12182. messageSends: ["subclassResponsibility"]
  12183. }),
  12184. $globals.AssociativeCollection);
  12185. $core.addMethod(
  12186. $core.method({
  12187. selector: "keysAndValuesDo:",
  12188. protocol: 'enumerating',
  12189. fn: function (aBlock){
  12190. var self=this;
  12191. return $core.withContext(function($ctx1) {
  12192. self._keysDo_((function(each){
  12193. return $core.withContext(function($ctx2) {
  12194. return $recv(aBlock)._value_value_(each,self._at_(each));
  12195. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12196. }));
  12197. return self;
  12198. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12199. },
  12200. args: ["aBlock"],
  12201. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  12202. referencedClasses: [],
  12203. messageSends: ["keysDo:", "value:value:", "at:"]
  12204. }),
  12205. $globals.AssociativeCollection);
  12206. $core.addMethod(
  12207. $core.method({
  12208. selector: "keysDo:",
  12209. protocol: 'enumerating',
  12210. fn: function (aBlock){
  12211. var self=this;
  12212. return $core.withContext(function($ctx1) {
  12213. self._subclassResponsibility();
  12214. return self;
  12215. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12216. },
  12217. args: ["aBlock"],
  12218. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  12219. referencedClasses: [],
  12220. messageSends: ["subclassResponsibility"]
  12221. }),
  12222. $globals.AssociativeCollection);
  12223. $core.addMethod(
  12224. $core.method({
  12225. selector: "printOn:",
  12226. protocol: 'printing',
  12227. fn: function (aStream){
  12228. var self=this;
  12229. return $core.withContext(function($ctx1) {
  12230. (
  12231. $ctx1.supercall = true,
  12232. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  12233. $ctx1.supercall = false;
  12234. $ctx1.sendIdx["printOn:"]=1;
  12235. $recv(aStream)._nextPutAll_(" (");
  12236. $ctx1.sendIdx["nextPutAll:"]=1;
  12237. $recv(self._associations())._do_separatedBy_((function(each){
  12238. return $core.withContext(function($ctx2) {
  12239. return $recv(each)._printOn_(aStream);
  12240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12241. }),(function(){
  12242. return $core.withContext(function($ctx2) {
  12243. return $recv(aStream)._nextPutAll_(" , ");
  12244. $ctx2.sendIdx["nextPutAll:"]=2;
  12245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12246. }));
  12247. $recv(aStream)._nextPutAll_(")");
  12248. return self;
  12249. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12250. },
  12251. args: ["aStream"],
  12252. 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: ')'",
  12253. referencedClasses: [],
  12254. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12255. }),
  12256. $globals.AssociativeCollection);
  12257. $core.addMethod(
  12258. $core.method({
  12259. selector: "remove:ifAbsent:",
  12260. protocol: 'adding/removing',
  12261. fn: function (aKey,aBlock){
  12262. var self=this;
  12263. return $core.withContext(function($ctx1) {
  12264. return self._removeKey_ifAbsent_(aKey,aBlock);
  12265. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12266. },
  12267. args: ["aKey", "aBlock"],
  12268. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12269. referencedClasses: [],
  12270. messageSends: ["removeKey:ifAbsent:"]
  12271. }),
  12272. $globals.AssociativeCollection);
  12273. $core.addMethod(
  12274. $core.method({
  12275. selector: "removeAll",
  12276. protocol: 'adding/removing',
  12277. fn: function (){
  12278. var self=this;
  12279. return $core.withContext(function($ctx1) {
  12280. return $recv(self._keys())._do_((function(each){
  12281. return $core.withContext(function($ctx2) {
  12282. return self._removeKey_(each);
  12283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12284. }));
  12285. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12286. },
  12287. args: [],
  12288. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12289. referencedClasses: [],
  12290. messageSends: ["do:", "keys", "removeKey:"]
  12291. }),
  12292. $globals.AssociativeCollection);
  12293. $core.addMethod(
  12294. $core.method({
  12295. selector: "removeKey:",
  12296. protocol: 'adding/removing',
  12297. fn: function (aKey){
  12298. var self=this;
  12299. return $core.withContext(function($ctx1) {
  12300. return self._remove_(aKey);
  12301. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12302. },
  12303. args: ["aKey"],
  12304. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12305. referencedClasses: [],
  12306. messageSends: ["remove:"]
  12307. }),
  12308. $globals.AssociativeCollection);
  12309. $core.addMethod(
  12310. $core.method({
  12311. selector: "removeKey:ifAbsent:",
  12312. protocol: 'adding/removing',
  12313. fn: function (aKey,aBlock){
  12314. var self=this;
  12315. return $core.withContext(function($ctx1) {
  12316. self._subclassResponsibility();
  12317. return self;
  12318. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12319. },
  12320. args: ["aKey", "aBlock"],
  12321. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12322. referencedClasses: [],
  12323. messageSends: ["subclassResponsibility"]
  12324. }),
  12325. $globals.AssociativeCollection);
  12326. $core.addMethod(
  12327. $core.method({
  12328. selector: "select:",
  12329. protocol: 'enumerating',
  12330. fn: function (aBlock){
  12331. var self=this;
  12332. var newDict;
  12333. return $core.withContext(function($ctx1) {
  12334. var $1;
  12335. newDict=$recv(self._class())._new();
  12336. self._keysAndValuesDo_((function(key,value){
  12337. return $core.withContext(function($ctx2) {
  12338. $1=$recv(aBlock)._value_(value);
  12339. if($core.assert($1)){
  12340. return $recv(newDict)._at_put_(key,value);
  12341. }
  12342. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12343. }));
  12344. return newDict;
  12345. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12346. },
  12347. args: ["aBlock"],
  12348. 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",
  12349. referencedClasses: [],
  12350. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12351. }),
  12352. $globals.AssociativeCollection);
  12353. $core.addMethod(
  12354. $core.method({
  12355. selector: "shallowCopy",
  12356. protocol: 'copying',
  12357. fn: function (){
  12358. var self=this;
  12359. var copy;
  12360. return $core.withContext(function($ctx1) {
  12361. copy=$recv(self._class())._new();
  12362. self._keysAndValuesDo_((function(key,value){
  12363. return $core.withContext(function($ctx2) {
  12364. return $recv(copy)._at_put_(key,value);
  12365. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12366. }));
  12367. return copy;
  12368. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12369. },
  12370. args: [],
  12371. 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",
  12372. referencedClasses: [],
  12373. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12374. }),
  12375. $globals.AssociativeCollection);
  12376. $core.addMethod(
  12377. $core.method({
  12378. selector: "size",
  12379. protocol: 'accessing',
  12380. fn: function (){
  12381. var self=this;
  12382. return $core.withContext(function($ctx1) {
  12383. return $recv(self._keys())._size();
  12384. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12385. },
  12386. args: [],
  12387. source: "size\x0a\x09^ self keys size",
  12388. referencedClasses: [],
  12389. messageSends: ["size", "keys"]
  12390. }),
  12391. $globals.AssociativeCollection);
  12392. $core.addMethod(
  12393. $core.method({
  12394. selector: "values",
  12395. protocol: 'accessing',
  12396. fn: function (){
  12397. var self=this;
  12398. return $core.withContext(function($ctx1) {
  12399. self._subclassResponsibility();
  12400. return self;
  12401. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12402. },
  12403. args: [],
  12404. source: "values\x0a\x09self subclassResponsibility",
  12405. referencedClasses: [],
  12406. messageSends: ["subclassResponsibility"]
  12407. }),
  12408. $globals.AssociativeCollection);
  12409. $core.addMethod(
  12410. $core.method({
  12411. selector: "valuesDo:",
  12412. protocol: 'enumerating',
  12413. fn: function (aBlock){
  12414. var self=this;
  12415. return $core.withContext(function($ctx1) {
  12416. self._subclassResponsibility();
  12417. return self;
  12418. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12419. },
  12420. args: ["aBlock"],
  12421. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12422. referencedClasses: [],
  12423. messageSends: ["subclassResponsibility"]
  12424. }),
  12425. $globals.AssociativeCollection);
  12426. $core.addMethod(
  12427. $core.method({
  12428. selector: "withIndexDo:",
  12429. protocol: 'enumerating',
  12430. fn: function (aBlock){
  12431. var self=this;
  12432. return $core.withContext(function($ctx1) {
  12433. self._keysAndValuesDo_((function(key,value){
  12434. return $core.withContext(function($ctx2) {
  12435. return $recv(aBlock)._value_value_(value,key);
  12436. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12437. }));
  12438. return self;
  12439. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12440. },
  12441. args: ["aBlock"],
  12442. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12443. referencedClasses: [],
  12444. messageSends: ["keysAndValuesDo:", "value:value:"]
  12445. }),
  12446. $globals.AssociativeCollection);
  12447. $core.addMethod(
  12448. $core.method({
  12449. selector: "from:",
  12450. protocol: 'instance creation',
  12451. fn: function (aCollection){
  12452. var self=this;
  12453. var newCollection;
  12454. return $core.withContext(function($ctx1) {
  12455. newCollection=self._new();
  12456. $recv(aCollection)._do_((function(each){
  12457. return $core.withContext(function($ctx2) {
  12458. return $recv(newCollection)._add_(each);
  12459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12460. }));
  12461. return newCollection;
  12462. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12463. },
  12464. args: ["aCollection"],
  12465. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12466. referencedClasses: [],
  12467. messageSends: ["new", "do:", "add:"]
  12468. }),
  12469. $globals.AssociativeCollection.klass);
  12470. $core.addMethod(
  12471. $core.method({
  12472. selector: "fromPairs:",
  12473. protocol: 'instance creation',
  12474. fn: function (aCollection){
  12475. var self=this;
  12476. return $core.withContext(function($ctx1) {
  12477. return self._from_(aCollection);
  12478. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12479. },
  12480. args: ["aCollection"],
  12481. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12482. referencedClasses: [],
  12483. messageSends: ["from:"]
  12484. }),
  12485. $globals.AssociativeCollection.klass);
  12486. $core.addMethod(
  12487. $core.method({
  12488. selector: "newFromPairs:",
  12489. protocol: 'instance creation',
  12490. fn: function (aCollection){
  12491. var self=this;
  12492. var newCollection;
  12493. return $core.withContext(function($ctx1) {
  12494. var $2,$1,$3,$4;
  12495. $2=$recv(aCollection)._size();
  12496. $ctx1.sendIdx["size"]=1;
  12497. $1=$recv($2)._even();
  12498. if(!$core.assert($1)){
  12499. self._error_("#newFromPairs only accepts arrays of an even length");
  12500. }
  12501. newCollection=self._new();
  12502. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12503. return $core.withContext(function($ctx2) {
  12504. $3=newCollection;
  12505. $4=$recv(aCollection)._at_(each);
  12506. $ctx2.sendIdx["at:"]=1;
  12507. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12508. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12509. }));
  12510. return newCollection;
  12511. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12512. },
  12513. args: ["aCollection"],
  12514. 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",
  12515. referencedClasses: [],
  12516. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12517. }),
  12518. $globals.AssociativeCollection.klass);
  12519. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12520. $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.";
  12521. $core.addMethod(
  12522. $core.method({
  12523. selector: "at:ifAbsent:",
  12524. protocol: 'accessing',
  12525. fn: function (aKey,aBlock){
  12526. var self=this;
  12527. return $core.withContext(function($ctx1) {
  12528. var index = self._positionOfKey_(aKey);
  12529. return index >=0 ? self['@values'][index] : aBlock._value();
  12530. ;
  12531. return self;
  12532. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12533. },
  12534. args: ["aKey", "aBlock"],
  12535. 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'>",
  12536. referencedClasses: [],
  12537. messageSends: []
  12538. }),
  12539. $globals.Dictionary);
  12540. $core.addMethod(
  12541. $core.method({
  12542. selector: "at:put:",
  12543. protocol: 'accessing',
  12544. fn: function (aKey,aValue){
  12545. var self=this;
  12546. return $core.withContext(function($ctx1) {
  12547. var index = self._positionOfKey_(aKey);
  12548. if(index === -1) {
  12549. var keys = self['@keys'];
  12550. index = keys.length;
  12551. keys.push(aKey);
  12552. }
  12553. return self['@values'][index] = aValue;
  12554. ;
  12555. return self;
  12556. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12557. },
  12558. args: ["aKey", "aValue"],
  12559. 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'>",
  12560. referencedClasses: [],
  12561. messageSends: []
  12562. }),
  12563. $globals.Dictionary);
  12564. $core.addMethod(
  12565. $core.method({
  12566. selector: "includesKey:",
  12567. protocol: 'testing',
  12568. fn: function (aKey){
  12569. var self=this;
  12570. return $core.withContext(function($ctx1) {
  12571. return self._positionOfKey_(aKey) >= 0;;
  12572. return self;
  12573. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12574. },
  12575. args: ["aKey"],
  12576. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self._positionOfKey_(aKey) >= 0;'>",
  12577. referencedClasses: [],
  12578. messageSends: []
  12579. }),
  12580. $globals.Dictionary);
  12581. $core.addMethod(
  12582. $core.method({
  12583. selector: "indexOf:ifAbsent:",
  12584. protocol: 'accessing',
  12585. fn: function (anObject,aBlock){
  12586. var self=this;
  12587. var index;
  12588. return $core.withContext(function($ctx1) {
  12589. var $1;
  12590. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12591. return (0);
  12592. }));
  12593. $1=$recv(index).__eq((0));
  12594. if($core.assert($1)){
  12595. return $recv(aBlock)._value();
  12596. } else {
  12597. return $recv(self["@keys"])._at_(index);
  12598. }
  12599. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12600. },
  12601. args: ["anObject", "aBlock"],
  12602. 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 ]",
  12603. referencedClasses: [],
  12604. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12605. }),
  12606. $globals.Dictionary);
  12607. $core.addMethod(
  12608. $core.method({
  12609. selector: "initialize",
  12610. protocol: 'initialization',
  12611. fn: function (){
  12612. var self=this;
  12613. return $core.withContext(function($ctx1) {
  12614. (
  12615. $ctx1.supercall = true,
  12616. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  12617. $ctx1.supercall = false;
  12618. self["@keys"]=[];
  12619. self["@values"]=[];
  12620. return self;
  12621. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12622. },
  12623. args: [],
  12624. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12625. referencedClasses: [],
  12626. messageSends: ["initialize"]
  12627. }),
  12628. $globals.Dictionary);
  12629. $core.addMethod(
  12630. $core.method({
  12631. selector: "keys",
  12632. protocol: 'accessing',
  12633. fn: function (){
  12634. var self=this;
  12635. return $core.withContext(function($ctx1) {
  12636. return $recv(self["@keys"])._copy();
  12637. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12638. },
  12639. args: [],
  12640. source: "keys\x0a\x09^ keys copy",
  12641. referencedClasses: [],
  12642. messageSends: ["copy"]
  12643. }),
  12644. $globals.Dictionary);
  12645. $core.addMethod(
  12646. $core.method({
  12647. selector: "keysAndValuesDo:",
  12648. protocol: 'enumerating',
  12649. fn: function (aBlock){
  12650. var self=this;
  12651. return $core.withContext(function($ctx1) {
  12652. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12653. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12654. },
  12655. args: ["aBlock"],
  12656. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12657. referencedClasses: [],
  12658. messageSends: ["with:do:"]
  12659. }),
  12660. $globals.Dictionary);
  12661. $core.addMethod(
  12662. $core.method({
  12663. selector: "keysDo:",
  12664. protocol: 'enumerating',
  12665. fn: function (aBlock){
  12666. var self=this;
  12667. return $core.withContext(function($ctx1) {
  12668. return $recv(self["@keys"])._do_(aBlock);
  12669. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12670. },
  12671. args: ["aBlock"],
  12672. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12673. referencedClasses: [],
  12674. messageSends: ["do:"]
  12675. }),
  12676. $globals.Dictionary);
  12677. $core.addMethod(
  12678. $core.method({
  12679. selector: "positionOfKey:",
  12680. protocol: 'private',
  12681. fn: function (anObject){
  12682. var self=this;
  12683. return $core.withContext(function($ctx1) {
  12684. var keys = self['@keys'];
  12685. for(var i=0;i<keys.length;i++){
  12686. if(keys[i].__eq(anObject)) { return i;}
  12687. }
  12688. return -1;
  12689. ;
  12690. return self;
  12691. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12692. },
  12693. args: ["anObject"],
  12694. 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'>",
  12695. referencedClasses: [],
  12696. messageSends: []
  12697. }),
  12698. $globals.Dictionary);
  12699. $core.addMethod(
  12700. $core.method({
  12701. selector: "removeAll",
  12702. protocol: 'adding/removing',
  12703. fn: function (){
  12704. var self=this;
  12705. return $core.withContext(function($ctx1) {
  12706. $recv(self["@keys"])._removeAll();
  12707. $ctx1.sendIdx["removeAll"]=1;
  12708. $recv(self["@values"])._removeAll();
  12709. return self;
  12710. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12711. },
  12712. args: [],
  12713. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12714. referencedClasses: [],
  12715. messageSends: ["removeAll"]
  12716. }),
  12717. $globals.Dictionary);
  12718. $core.addMethod(
  12719. $core.method({
  12720. selector: "removeKey:ifAbsent:",
  12721. protocol: 'adding/removing',
  12722. fn: function (aKey,aBlock){
  12723. var self=this;
  12724. return $core.withContext(function($ctx1) {
  12725. var index = self._positionOfKey_(aKey);
  12726. if(index === -1) {
  12727. return aBlock._value()
  12728. } else {
  12729. var keys = self['@keys'], values = self['@values'];
  12730. var value = values[index], l = keys.length;
  12731. keys[index] = keys[l-1];
  12732. keys.pop();
  12733. values[index] = values[l-1];
  12734. values.pop();
  12735. return value;
  12736. }
  12737. ;
  12738. return self;
  12739. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12740. },
  12741. args: ["aKey", "aBlock"],
  12742. 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'>",
  12743. referencedClasses: [],
  12744. messageSends: []
  12745. }),
  12746. $globals.Dictionary);
  12747. $core.addMethod(
  12748. $core.method({
  12749. selector: "values",
  12750. protocol: 'accessing',
  12751. fn: function (){
  12752. var self=this;
  12753. return self["@values"];
  12754. },
  12755. args: [],
  12756. source: "values\x0a\x09^ values",
  12757. referencedClasses: [],
  12758. messageSends: []
  12759. }),
  12760. $globals.Dictionary);
  12761. $core.addMethod(
  12762. $core.method({
  12763. selector: "valuesDo:",
  12764. protocol: 'enumerating',
  12765. fn: function (aBlock){
  12766. var self=this;
  12767. return $core.withContext(function($ctx1) {
  12768. return $recv(self["@values"])._do_(aBlock);
  12769. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12770. },
  12771. args: ["aBlock"],
  12772. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12773. referencedClasses: [],
  12774. messageSends: ["do:"]
  12775. }),
  12776. $globals.Dictionary);
  12777. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12778. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12779. $core.addMethod(
  12780. $core.method({
  12781. selector: "at:ifAbsent:",
  12782. protocol: 'accessing',
  12783. fn: function (aKey,aBlock){
  12784. var self=this;
  12785. return $core.withContext(function($ctx1) {
  12786. var $1;
  12787. $1=self._includesKey_(aKey);
  12788. if($core.assert($1)){
  12789. return self._basicAt_(aKey);
  12790. } else {
  12791. return $recv(aBlock)._value();
  12792. }
  12793. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12794. },
  12795. args: ["aKey", "aBlock"],
  12796. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12797. referencedClasses: [],
  12798. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12799. }),
  12800. $globals.HashedCollection);
  12801. $core.addMethod(
  12802. $core.method({
  12803. selector: "at:put:",
  12804. protocol: 'accessing',
  12805. fn: function (aKey,aValue){
  12806. var self=this;
  12807. return $core.withContext(function($ctx1) {
  12808. return self._basicAt_put_(aKey,aValue);
  12809. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12810. },
  12811. args: ["aKey", "aValue"],
  12812. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12813. referencedClasses: [],
  12814. messageSends: ["basicAt:put:"]
  12815. }),
  12816. $globals.HashedCollection);
  12817. $core.addMethod(
  12818. $core.method({
  12819. selector: "includesKey:",
  12820. protocol: 'testing',
  12821. fn: function (aKey){
  12822. var self=this;
  12823. return $core.withContext(function($ctx1) {
  12824. return self.hasOwnProperty(aKey);
  12825. return self;
  12826. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12827. },
  12828. args: ["aKey"],
  12829. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  12830. referencedClasses: [],
  12831. messageSends: []
  12832. }),
  12833. $globals.HashedCollection);
  12834. $core.addMethod(
  12835. $core.method({
  12836. selector: "keys",
  12837. protocol: 'accessing',
  12838. fn: function (){
  12839. var self=this;
  12840. return $core.withContext(function($ctx1) {
  12841. return Object.keys(self);
  12842. return self;
  12843. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12844. },
  12845. args: [],
  12846. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  12847. referencedClasses: [],
  12848. messageSends: []
  12849. }),
  12850. $globals.HashedCollection);
  12851. $core.addMethod(
  12852. $core.method({
  12853. selector: "keysDo:",
  12854. protocol: 'enumerating',
  12855. fn: function (aBlock){
  12856. var self=this;
  12857. return $core.withContext(function($ctx1) {
  12858. $recv(self._keys())._do_(aBlock);
  12859. return self;
  12860. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12861. },
  12862. args: ["aBlock"],
  12863. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12864. referencedClasses: [],
  12865. messageSends: ["do:", "keys"]
  12866. }),
  12867. $globals.HashedCollection);
  12868. $core.addMethod(
  12869. $core.method({
  12870. selector: "removeKey:ifAbsent:",
  12871. protocol: 'adding/removing',
  12872. fn: function (aKey,aBlock){
  12873. var self=this;
  12874. return $core.withContext(function($ctx1) {
  12875. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12876. return $core.withContext(function($ctx2) {
  12877. self._basicDelete_(aKey);
  12878. return removed;
  12879. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12880. }),(function(){
  12881. return $core.withContext(function($ctx2) {
  12882. return $recv(aBlock)._value();
  12883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12884. }));
  12885. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12886. },
  12887. args: ["aKey", "aBlock"],
  12888. 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 ]",
  12889. referencedClasses: [],
  12890. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12891. }),
  12892. $globals.HashedCollection);
  12893. $core.addMethod(
  12894. $core.method({
  12895. selector: "values",
  12896. protocol: 'accessing',
  12897. fn: function (){
  12898. var self=this;
  12899. return $core.withContext(function($ctx1) {
  12900. return self._keys().map(function(key){
  12901. return self._at_(key);
  12902. });
  12903. ;
  12904. return self;
  12905. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12906. },
  12907. args: [],
  12908. 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'>",
  12909. referencedClasses: [],
  12910. messageSends: []
  12911. }),
  12912. $globals.HashedCollection);
  12913. $core.addMethod(
  12914. $core.method({
  12915. selector: "valuesDo:",
  12916. protocol: 'enumerating',
  12917. fn: function (aBlock){
  12918. var self=this;
  12919. return $core.withContext(function($ctx1) {
  12920. $recv(self._values())._do_(aBlock);
  12921. return self;
  12922. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12923. },
  12924. args: ["aBlock"],
  12925. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12926. referencedClasses: [],
  12927. messageSends: ["do:", "values"]
  12928. }),
  12929. $globals.HashedCollection);
  12930. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12931. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12932. $core.addMethod(
  12933. $core.method({
  12934. selector: "=",
  12935. protocol: 'comparing',
  12936. fn: function (aCollection){
  12937. var self=this;
  12938. return $core.withContext(function($ctx1) {
  12939. var $3,$2,$4,$1,$5;
  12940. var $early={};
  12941. try {
  12942. $3=self._class();
  12943. $ctx1.sendIdx["class"]=1;
  12944. $2=$recv($3).__eq($recv(aCollection)._class());
  12945. $ctx1.sendIdx["="]=1;
  12946. $1=$recv($2)._and_((function(){
  12947. return $core.withContext(function($ctx2) {
  12948. $4=self._size();
  12949. $ctx2.sendIdx["size"]=1;
  12950. return $recv($4).__eq($recv(aCollection)._size());
  12951. $ctx2.sendIdx["="]=2;
  12952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12953. }));
  12954. if(!$core.assert($1)){
  12955. return false;
  12956. }
  12957. self._withIndexDo_((function(each,i){
  12958. return $core.withContext(function($ctx2) {
  12959. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  12960. if(!$core.assert($5)){
  12961. throw $early=[false];
  12962. }
  12963. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  12964. }));
  12965. return true;
  12966. }
  12967. catch(e) {if(e===$early)return e[0]; throw e}
  12968. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  12969. },
  12970. args: ["aCollection"],
  12971. 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",
  12972. referencedClasses: [],
  12973. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  12974. }),
  12975. $globals.SequenceableCollection);
  12976. $core.addMethod(
  12977. $core.method({
  12978. selector: "addLast:",
  12979. protocol: 'adding/removing',
  12980. fn: function (anObject){
  12981. var self=this;
  12982. return $core.withContext(function($ctx1) {
  12983. self._add_(anObject);
  12984. return self;
  12985. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  12986. },
  12987. args: ["anObject"],
  12988. source: "addLast: anObject\x0a\x09self add: anObject",
  12989. referencedClasses: [],
  12990. messageSends: ["add:"]
  12991. }),
  12992. $globals.SequenceableCollection);
  12993. $core.addMethod(
  12994. $core.method({
  12995. selector: "allButFirst",
  12996. protocol: 'accessing',
  12997. fn: function (){
  12998. var self=this;
  12999. return $core.withContext(function($ctx1) {
  13000. return self._copyFrom_to_((2),self._size());
  13001. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  13002. },
  13003. args: [],
  13004. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  13005. referencedClasses: [],
  13006. messageSends: ["copyFrom:to:", "size"]
  13007. }),
  13008. $globals.SequenceableCollection);
  13009. $core.addMethod(
  13010. $core.method({
  13011. selector: "allButLast",
  13012. protocol: 'accessing',
  13013. fn: function (){
  13014. var self=this;
  13015. return $core.withContext(function($ctx1) {
  13016. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  13017. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  13018. },
  13019. args: [],
  13020. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  13021. referencedClasses: [],
  13022. messageSends: ["copyFrom:to:", "-", "size"]
  13023. }),
  13024. $globals.SequenceableCollection);
  13025. $core.addMethod(
  13026. $core.method({
  13027. selector: "anyOne",
  13028. protocol: 'accessing',
  13029. fn: function (){
  13030. var self=this;
  13031. return $core.withContext(function($ctx1) {
  13032. return self._at_((1));
  13033. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  13034. },
  13035. args: [],
  13036. source: "anyOne\x0a\x09^ self at: 1",
  13037. referencedClasses: [],
  13038. messageSends: ["at:"]
  13039. }),
  13040. $globals.SequenceableCollection);
  13041. $core.addMethod(
  13042. $core.method({
  13043. selector: "atRandom",
  13044. protocol: 'accessing',
  13045. fn: function (){
  13046. var self=this;
  13047. return $core.withContext(function($ctx1) {
  13048. return self._at_($recv(self._size())._atRandom());
  13049. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  13050. },
  13051. args: [],
  13052. source: "atRandom\x0a\x09^ self at: self size atRandom",
  13053. referencedClasses: [],
  13054. messageSends: ["at:", "atRandom", "size"]
  13055. }),
  13056. $globals.SequenceableCollection);
  13057. $core.addMethod(
  13058. $core.method({
  13059. selector: "beginsWith:",
  13060. protocol: 'testing',
  13061. fn: function (prefix){
  13062. var self=this;
  13063. return $core.withContext(function($ctx1) {
  13064. var $2,$3,$1;
  13065. $2=self._size();
  13066. $ctx1.sendIdx["size"]=1;
  13067. $3=$recv(prefix)._size();
  13068. $ctx1.sendIdx["size"]=2;
  13069. $1=$recv($2).__lt($3);
  13070. if($core.assert($1)){
  13071. return false;
  13072. }
  13073. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  13074. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  13075. },
  13076. args: ["prefix"],
  13077. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  13078. referencedClasses: [],
  13079. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  13080. }),
  13081. $globals.SequenceableCollection);
  13082. $core.addMethod(
  13083. $core.method({
  13084. selector: "copyFrom:to:",
  13085. protocol: 'copying',
  13086. fn: function (anIndex,anotherIndex){
  13087. var self=this;
  13088. return $core.withContext(function($ctx1) {
  13089. self._subclassResponsibility();
  13090. return self;
  13091. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  13092. },
  13093. args: ["anIndex", "anotherIndex"],
  13094. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  13095. referencedClasses: [],
  13096. messageSends: ["subclassResponsibility"]
  13097. }),
  13098. $globals.SequenceableCollection);
  13099. $core.addMethod(
  13100. $core.method({
  13101. selector: "detect:ifNone:",
  13102. protocol: 'enumerating',
  13103. fn: function (aBlock,anotherBlock){
  13104. var self=this;
  13105. return $core.withContext(function($ctx1) {
  13106. self = self._numericallyIndexable();
  13107. for(var i = 0; i < self.length; i++)
  13108. if(aBlock._value_(self[i]))
  13109. return self[i];
  13110. return anotherBlock._value();
  13111. ;
  13112. return self;
  13113. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  13114. },
  13115. args: ["aBlock", "anotherBlock"],
  13116. 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'>",
  13117. referencedClasses: [],
  13118. messageSends: []
  13119. }),
  13120. $globals.SequenceableCollection);
  13121. $core.addMethod(
  13122. $core.method({
  13123. selector: "do:",
  13124. protocol: 'enumerating',
  13125. fn: function (aBlock){
  13126. var self=this;
  13127. return $core.withContext(function($ctx1) {
  13128. self = self._numericallyIndexable();
  13129. for(var i=0; i < self.length; i++) {
  13130. aBlock._value_(self[i]);
  13131. }
  13132. ;
  13133. return self;
  13134. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13135. },
  13136. args: ["aBlock"],
  13137. 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'>",
  13138. referencedClasses: [],
  13139. messageSends: []
  13140. }),
  13141. $globals.SequenceableCollection);
  13142. $core.addMethod(
  13143. $core.method({
  13144. selector: "endsWith:",
  13145. protocol: 'testing',
  13146. fn: function (suffix){
  13147. var self=this;
  13148. return $core.withContext(function($ctx1) {
  13149. var $2,$3,$1;
  13150. $2=self._size();
  13151. $ctx1.sendIdx["size"]=1;
  13152. $3=$recv(suffix)._size();
  13153. $ctx1.sendIdx["size"]=2;
  13154. $1=$recv($2).__lt($3);
  13155. if($core.assert($1)){
  13156. return false;
  13157. }
  13158. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  13159. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  13160. },
  13161. args: ["suffix"],
  13162. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  13163. referencedClasses: [],
  13164. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13165. }),
  13166. $globals.SequenceableCollection);
  13167. $core.addMethod(
  13168. $core.method({
  13169. selector: "first",
  13170. protocol: 'accessing',
  13171. fn: function (){
  13172. var self=this;
  13173. return $core.withContext(function($ctx1) {
  13174. return self._at_((1));
  13175. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13176. },
  13177. args: [],
  13178. source: "first\x0a\x09^ self at: 1",
  13179. referencedClasses: [],
  13180. messageSends: ["at:"]
  13181. }),
  13182. $globals.SequenceableCollection);
  13183. $core.addMethod(
  13184. $core.method({
  13185. selector: "first:",
  13186. protocol: 'accessing',
  13187. fn: function (aNumber){
  13188. var self=this;
  13189. return $core.withContext(function($ctx1) {
  13190. var $1;
  13191. $1=$recv(self._size()).__lt(aNumber);
  13192. if($core.assert($1)){
  13193. self._error_("Invalid number of elements");
  13194. }
  13195. return self._copyFrom_to_((1),aNumber);
  13196. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13197. },
  13198. args: ["aNumber"],
  13199. 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",
  13200. referencedClasses: [],
  13201. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13202. }),
  13203. $globals.SequenceableCollection);
  13204. $core.addMethod(
  13205. $core.method({
  13206. selector: "fourth",
  13207. protocol: 'accessing',
  13208. fn: function (){
  13209. var self=this;
  13210. return $core.withContext(function($ctx1) {
  13211. return self._at_((4));
  13212. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13213. },
  13214. args: [],
  13215. source: "fourth\x0a\x09^ self at: 4",
  13216. referencedClasses: [],
  13217. messageSends: ["at:"]
  13218. }),
  13219. $globals.SequenceableCollection);
  13220. $core.addMethod(
  13221. $core.method({
  13222. selector: "includes:",
  13223. protocol: 'testing',
  13224. fn: function (anObject){
  13225. var self=this;
  13226. return $core.withContext(function($ctx1) {
  13227. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  13228. return nil;
  13229. })))._notNil();
  13230. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13231. },
  13232. args: ["anObject"],
  13233. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13234. referencedClasses: [],
  13235. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13236. }),
  13237. $globals.SequenceableCollection);
  13238. $core.addMethod(
  13239. $core.method({
  13240. selector: "indexOf:ifAbsent:",
  13241. protocol: 'accessing',
  13242. fn: function (anObject,aBlock){
  13243. var self=this;
  13244. return $core.withContext(function($ctx1) {
  13245. self = self._numericallyIndexable();
  13246. for(var i=0; i < self.length; i++) {
  13247. if($recv(self[i]).__eq(anObject)) {return i+1}
  13248. };
  13249. return aBlock._value();
  13250. ;
  13251. return self;
  13252. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13253. },
  13254. args: ["anObject", "aBlock"],
  13255. 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'>",
  13256. referencedClasses: [],
  13257. messageSends: []
  13258. }),
  13259. $globals.SequenceableCollection);
  13260. $core.addMethod(
  13261. $core.method({
  13262. selector: "indexOf:startingAt:",
  13263. protocol: 'accessing',
  13264. fn: function (anObject,start){
  13265. var self=this;
  13266. return $core.withContext(function($ctx1) {
  13267. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13268. return (0);
  13269. }));
  13270. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13271. },
  13272. args: ["anObject", "start"],
  13273. 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 ]",
  13274. referencedClasses: [],
  13275. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13276. }),
  13277. $globals.SequenceableCollection);
  13278. $core.addMethod(
  13279. $core.method({
  13280. selector: "indexOf:startingAt:ifAbsent:",
  13281. protocol: 'accessing',
  13282. fn: function (anObject,start,aBlock){
  13283. var self=this;
  13284. return $core.withContext(function($ctx1) {
  13285. self = self._numericallyIndexable();
  13286. for(var i=start - 1; i < self.length; i++){
  13287. if($recv(self[i]).__eq(anObject)) {return i+1}
  13288. }
  13289. return aBlock._value();
  13290. ;
  13291. return self;
  13292. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13293. },
  13294. args: ["anObject", "start", "aBlock"],
  13295. 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'>",
  13296. referencedClasses: [],
  13297. messageSends: []
  13298. }),
  13299. $globals.SequenceableCollection);
  13300. $core.addMethod(
  13301. $core.method({
  13302. selector: "last",
  13303. protocol: 'accessing',
  13304. fn: function (){
  13305. var self=this;
  13306. return $core.withContext(function($ctx1) {
  13307. return self._at_(self._size());
  13308. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13309. },
  13310. args: [],
  13311. source: "last\x0a\x09^ self at: self size",
  13312. referencedClasses: [],
  13313. messageSends: ["at:", "size"]
  13314. }),
  13315. $globals.SequenceableCollection);
  13316. $core.addMethod(
  13317. $core.method({
  13318. selector: "last:",
  13319. protocol: 'accessing',
  13320. fn: function (aNumber){
  13321. var self=this;
  13322. return $core.withContext(function($ctx1) {
  13323. var $2,$1,$5,$4,$3;
  13324. $2=self._size();
  13325. $ctx1.sendIdx["size"]=1;
  13326. $1=$recv($2).__lt(aNumber);
  13327. if($core.assert($1)){
  13328. self._error_("Invalid number of elements");
  13329. }
  13330. $5=self._size();
  13331. $ctx1.sendIdx["size"]=2;
  13332. $4=$recv($5).__minus(aNumber);
  13333. $3=$recv($4).__plus((1));
  13334. return self._copyFrom_to_($3,self._size());
  13335. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13336. },
  13337. args: ["aNumber"],
  13338. 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",
  13339. referencedClasses: [],
  13340. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13341. }),
  13342. $globals.SequenceableCollection);
  13343. $core.addMethod(
  13344. $core.method({
  13345. selector: "newStream",
  13346. protocol: 'streaming',
  13347. fn: function (){
  13348. var self=this;
  13349. return $core.withContext(function($ctx1) {
  13350. return $recv(self._streamClass())._on_(self);
  13351. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13352. },
  13353. args: [],
  13354. source: "newStream\x0a\x09^ self streamClass on: self",
  13355. referencedClasses: [],
  13356. messageSends: ["on:", "streamClass"]
  13357. }),
  13358. $globals.SequenceableCollection);
  13359. $core.addMethod(
  13360. $core.method({
  13361. selector: "numericallyIndexable",
  13362. protocol: 'private',
  13363. fn: function (){
  13364. var self=this;
  13365. return $core.withContext(function($ctx1) {
  13366. self._subclassResponsibility();
  13367. return self;
  13368. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13369. },
  13370. args: [],
  13371. 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",
  13372. referencedClasses: [],
  13373. messageSends: ["subclassResponsibility"]
  13374. }),
  13375. $globals.SequenceableCollection);
  13376. $core.addMethod(
  13377. $core.method({
  13378. selector: "readStream",
  13379. protocol: 'streaming',
  13380. fn: function (){
  13381. var self=this;
  13382. return $core.withContext(function($ctx1) {
  13383. return self._stream();
  13384. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13385. },
  13386. args: [],
  13387. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13388. referencedClasses: [],
  13389. messageSends: ["stream"]
  13390. }),
  13391. $globals.SequenceableCollection);
  13392. $core.addMethod(
  13393. $core.method({
  13394. selector: "removeLast",
  13395. protocol: 'adding/removing',
  13396. fn: function (){
  13397. var self=this;
  13398. return $core.withContext(function($ctx1) {
  13399. return self._remove_(self._last());
  13400. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13401. },
  13402. args: [],
  13403. source: "removeLast\x0a\x09^ self remove: self last",
  13404. referencedClasses: [],
  13405. messageSends: ["remove:", "last"]
  13406. }),
  13407. $globals.SequenceableCollection);
  13408. $core.addMethod(
  13409. $core.method({
  13410. selector: "reversed",
  13411. protocol: 'converting',
  13412. fn: function (){
  13413. var self=this;
  13414. return $core.withContext(function($ctx1) {
  13415. self._subclassResponsibility();
  13416. return self;
  13417. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13418. },
  13419. args: [],
  13420. source: "reversed\x0a\x09self subclassResponsibility",
  13421. referencedClasses: [],
  13422. messageSends: ["subclassResponsibility"]
  13423. }),
  13424. $globals.SequenceableCollection);
  13425. $core.addMethod(
  13426. $core.method({
  13427. selector: "second",
  13428. protocol: 'accessing',
  13429. fn: function (){
  13430. var self=this;
  13431. return $core.withContext(function($ctx1) {
  13432. return self._at_((2));
  13433. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13434. },
  13435. args: [],
  13436. source: "second\x0a\x09^ self at: 2",
  13437. referencedClasses: [],
  13438. messageSends: ["at:"]
  13439. }),
  13440. $globals.SequenceableCollection);
  13441. $core.addMethod(
  13442. $core.method({
  13443. selector: "single",
  13444. protocol: 'accessing',
  13445. fn: function (){
  13446. var self=this;
  13447. return $core.withContext(function($ctx1) {
  13448. if (self.length == 0) throw new Error("Collection is empty");
  13449. if (self.length > 1) throw new Error("Collection holds more than one element.");
  13450. return self[0];;
  13451. return self;
  13452. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  13453. },
  13454. args: [],
  13455. 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'>",
  13456. referencedClasses: [],
  13457. messageSends: []
  13458. }),
  13459. $globals.SequenceableCollection);
  13460. $core.addMethod(
  13461. $core.method({
  13462. selector: "stream",
  13463. protocol: 'streaming',
  13464. fn: function (){
  13465. var self=this;
  13466. return $core.withContext(function($ctx1) {
  13467. return self._newStream();
  13468. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13469. },
  13470. args: [],
  13471. source: "stream\x0a\x09^ self newStream",
  13472. referencedClasses: [],
  13473. messageSends: ["newStream"]
  13474. }),
  13475. $globals.SequenceableCollection);
  13476. $core.addMethod(
  13477. $core.method({
  13478. selector: "streamClass",
  13479. protocol: 'streaming',
  13480. fn: function (){
  13481. var self=this;
  13482. return $core.withContext(function($ctx1) {
  13483. return $recv(self._class())._streamClass();
  13484. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13485. },
  13486. args: [],
  13487. source: "streamClass\x0a\x09^ self class streamClass",
  13488. referencedClasses: [],
  13489. messageSends: ["streamClass", "class"]
  13490. }),
  13491. $globals.SequenceableCollection);
  13492. $core.addMethod(
  13493. $core.method({
  13494. selector: "third",
  13495. protocol: 'accessing',
  13496. fn: function (){
  13497. var self=this;
  13498. return $core.withContext(function($ctx1) {
  13499. return self._at_((3));
  13500. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13501. },
  13502. args: [],
  13503. source: "third\x0a\x09^ self at: 3",
  13504. referencedClasses: [],
  13505. messageSends: ["at:"]
  13506. }),
  13507. $globals.SequenceableCollection);
  13508. $core.addMethod(
  13509. $core.method({
  13510. selector: "with:do:",
  13511. protocol: 'enumerating',
  13512. fn: function (anotherCollection,aBlock){
  13513. var self=this;
  13514. return $core.withContext(function($ctx1) {
  13515. self = self._numericallyIndexable();
  13516. anotherCollection = anotherCollection._numericallyIndexable();
  13517. for(var i=0; i<self.length; i++) {
  13518. aBlock._value_value_(self[i], anotherCollection[i]);
  13519. }
  13520. ;
  13521. return self;
  13522. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13523. },
  13524. args: ["anotherCollection", "aBlock"],
  13525. 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'>",
  13526. referencedClasses: [],
  13527. messageSends: []
  13528. }),
  13529. $globals.SequenceableCollection);
  13530. $core.addMethod(
  13531. $core.method({
  13532. selector: "withIndexDo:",
  13533. protocol: 'enumerating',
  13534. fn: function (aBlock){
  13535. var self=this;
  13536. return $core.withContext(function($ctx1) {
  13537. self = self._numericallyIndexable();
  13538. for(var i=0; i < self.length; i++) {
  13539. aBlock._value_value_(self[i], i+1);
  13540. }
  13541. ;
  13542. return self;
  13543. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13544. },
  13545. args: ["aBlock"],
  13546. 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'>",
  13547. referencedClasses: [],
  13548. messageSends: []
  13549. }),
  13550. $globals.SequenceableCollection);
  13551. $core.addMethod(
  13552. $core.method({
  13553. selector: "writeStream",
  13554. protocol: 'streaming',
  13555. fn: function (){
  13556. var self=this;
  13557. return $core.withContext(function($ctx1) {
  13558. return self._stream();
  13559. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13560. },
  13561. args: [],
  13562. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13563. referencedClasses: [],
  13564. messageSends: ["stream"]
  13565. }),
  13566. $globals.SequenceableCollection);
  13567. $core.addMethod(
  13568. $core.method({
  13569. selector: "streamClass",
  13570. protocol: 'accessing',
  13571. fn: function (){
  13572. var self=this;
  13573. return $globals.Stream;
  13574. },
  13575. args: [],
  13576. source: "streamClass\x0a\x09\x09^ Stream",
  13577. referencedClasses: ["Stream"],
  13578. messageSends: []
  13579. }),
  13580. $globals.SequenceableCollection.klass);
  13581. $core.addMethod(
  13582. $core.method({
  13583. selector: "streamContents:",
  13584. protocol: 'streaming',
  13585. fn: function (aBlock){
  13586. var self=this;
  13587. var stream;
  13588. return $core.withContext(function($ctx1) {
  13589. stream=$recv(self._streamClass())._on_(self._new());
  13590. $recv(aBlock)._value_(stream);
  13591. return $recv(stream)._contents();
  13592. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13593. },
  13594. args: ["aBlock"],
  13595. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13596. referencedClasses: [],
  13597. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13598. }),
  13599. $globals.SequenceableCollection.klass);
  13600. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13601. $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`.";
  13602. $core.addMethod(
  13603. $core.method({
  13604. selector: "add:",
  13605. protocol: 'adding/removing',
  13606. fn: function (anObject){
  13607. var self=this;
  13608. return $core.withContext(function($ctx1) {
  13609. self.push(anObject); return anObject;;
  13610. return self;
  13611. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13612. },
  13613. args: ["anObject"],
  13614. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  13615. referencedClasses: [],
  13616. messageSends: []
  13617. }),
  13618. $globals.Array);
  13619. $core.addMethod(
  13620. $core.method({
  13621. selector: "addAll:",
  13622. protocol: 'adding/removing',
  13623. fn: function (aCollection){
  13624. var self=this;
  13625. return $core.withContext(function($ctx1) {
  13626. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  13627. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  13628. return aCollection;;
  13629. return self;
  13630. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  13631. },
  13632. args: ["aCollection"],
  13633. 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'>",
  13634. referencedClasses: [],
  13635. messageSends: []
  13636. }),
  13637. $globals.Array);
  13638. $core.addMethod(
  13639. $core.method({
  13640. selector: "addFirst:",
  13641. protocol: 'adding/removing',
  13642. fn: function (anObject){
  13643. var self=this;
  13644. return $core.withContext(function($ctx1) {
  13645. self.unshift(anObject); return anObject;;
  13646. return self;
  13647. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13648. },
  13649. args: ["anObject"],
  13650. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  13651. referencedClasses: [],
  13652. messageSends: []
  13653. }),
  13654. $globals.Array);
  13655. $core.addMethod(
  13656. $core.method({
  13657. selector: "asJavascript",
  13658. protocol: 'converting',
  13659. fn: function (){
  13660. var self=this;
  13661. return $core.withContext(function($ctx1) {
  13662. var $1;
  13663. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13664. return $core.withContext(function($ctx2) {
  13665. return $recv(each)._asJavascript();
  13666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13667. })))._join_(", "))).__comma("]");
  13668. $ctx1.sendIdx[","]=1;
  13669. return $1;
  13670. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13671. },
  13672. args: [],
  13673. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13674. referencedClasses: [],
  13675. messageSends: [",", "join:", "collect:", "asJavascript"]
  13676. }),
  13677. $globals.Array);
  13678. $core.addMethod(
  13679. $core.method({
  13680. selector: "at:ifAbsent:",
  13681. protocol: 'accessing',
  13682. fn: function (anIndex,aBlock){
  13683. var self=this;
  13684. return $core.withContext(function($ctx1) {
  13685. return anIndex >= 1 && anIndex <= self.length
  13686. ? self[anIndex - 1]
  13687. : aBlock._value()
  13688. ;
  13689. return self;
  13690. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13691. },
  13692. args: ["anIndex", "aBlock"],
  13693. 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'>",
  13694. referencedClasses: [],
  13695. messageSends: []
  13696. }),
  13697. $globals.Array);
  13698. $core.addMethod(
  13699. $core.method({
  13700. selector: "at:ifPresent:ifAbsent:",
  13701. protocol: 'accessing',
  13702. fn: function (anIndex,aBlock,anotherBlock){
  13703. var self=this;
  13704. return $core.withContext(function($ctx1) {
  13705. return anIndex >= 1 && anIndex <= self.length
  13706. ? aBlock._value_(self[anIndex - 1])
  13707. : anotherBlock._value()
  13708. ;
  13709. return self;
  13710. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13711. },
  13712. args: ["anIndex", "aBlock", "anotherBlock"],
  13713. 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'>",
  13714. referencedClasses: [],
  13715. messageSends: []
  13716. }),
  13717. $globals.Array);
  13718. $core.addMethod(
  13719. $core.method({
  13720. selector: "at:put:",
  13721. protocol: 'accessing',
  13722. fn: function (anIndex,anObject){
  13723. var self=this;
  13724. return $core.withContext(function($ctx1) {
  13725. return self[anIndex - 1] = anObject;
  13726. return self;
  13727. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13728. },
  13729. args: ["anIndex", "anObject"],
  13730. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  13731. referencedClasses: [],
  13732. messageSends: []
  13733. }),
  13734. $globals.Array);
  13735. $core.addMethod(
  13736. $core.method({
  13737. selector: "collect:",
  13738. protocol: 'enumerating',
  13739. fn: function (aBlock){
  13740. var self=this;
  13741. return $core.withContext(function($ctx1) {
  13742. return self.map(function(each) {return aBlock._value_(each)});
  13743. return self;
  13744. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13745. },
  13746. args: ["aBlock"],
  13747. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  13748. referencedClasses: [],
  13749. messageSends: []
  13750. }),
  13751. $globals.Array);
  13752. $core.addMethod(
  13753. $core.method({
  13754. selector: "copyFrom:to:",
  13755. protocol: 'copying',
  13756. fn: function (anIndex,anotherIndex){
  13757. var self=this;
  13758. return $core.withContext(function($ctx1) {
  13759. if (anIndex >= 1 && anotherIndex <= self.length) {
  13760. return self.slice(anIndex - 1, anotherIndex);
  13761. } else {
  13762. self._at_(anIndex);
  13763. self._at_(self.length + 1);
  13764. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  13765. };
  13766. return self;
  13767. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  13768. },
  13769. args: ["anIndex", "anotherIndex"],
  13770. 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'>",
  13771. referencedClasses: [],
  13772. messageSends: []
  13773. }),
  13774. $globals.Array);
  13775. $core.addMethod(
  13776. $core.method({
  13777. selector: "join:",
  13778. protocol: 'enumerating',
  13779. fn: function (aString){
  13780. var self=this;
  13781. return $core.withContext(function($ctx1) {
  13782. return self.join(aString);
  13783. return self;
  13784. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13785. },
  13786. args: ["aString"],
  13787. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  13788. referencedClasses: [],
  13789. messageSends: []
  13790. }),
  13791. $globals.Array);
  13792. $core.addMethod(
  13793. $core.method({
  13794. selector: "numericallyIndexable",
  13795. protocol: 'private',
  13796. fn: function (){
  13797. var self=this;
  13798. return self;
  13799. },
  13800. args: [],
  13801. source: "numericallyIndexable\x0a\x09^ self",
  13802. referencedClasses: [],
  13803. messageSends: []
  13804. }),
  13805. $globals.Array);
  13806. $core.addMethod(
  13807. $core.method({
  13808. selector: "printOn:",
  13809. protocol: 'printing',
  13810. fn: function (aStream){
  13811. var self=this;
  13812. return $core.withContext(function($ctx1) {
  13813. (
  13814. $ctx1.supercall = true,
  13815. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  13816. $ctx1.supercall = false;
  13817. $ctx1.sendIdx["printOn:"]=1;
  13818. $recv(aStream)._nextPutAll_(" (");
  13819. $ctx1.sendIdx["nextPutAll:"]=1;
  13820. self._do_separatedBy_((function(each){
  13821. return $core.withContext(function($ctx2) {
  13822. return $recv(each)._printOn_(aStream);
  13823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13824. }),(function(){
  13825. return $core.withContext(function($ctx2) {
  13826. return $recv(aStream)._nextPutAll_(" ");
  13827. $ctx2.sendIdx["nextPutAll:"]=2;
  13828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13829. }));
  13830. $recv(aStream)._nextPutAll_(")");
  13831. return self;
  13832. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13833. },
  13834. args: ["aStream"],
  13835. 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: ')'",
  13836. referencedClasses: [],
  13837. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13838. }),
  13839. $globals.Array);
  13840. $core.addMethod(
  13841. $core.method({
  13842. selector: "remove:ifAbsent:",
  13843. protocol: 'adding/removing',
  13844. fn: function (anObject,aBlock){
  13845. var self=this;
  13846. var index;
  13847. return $core.withContext(function($ctx1) {
  13848. var $1;
  13849. index=self._indexOf_ifAbsent_(anObject,(function(){
  13850. return (0);
  13851. }));
  13852. $1=$recv(index).__eq((0));
  13853. if($core.assert($1)){
  13854. return $recv(aBlock)._value();
  13855. } else {
  13856. self._removeIndex_(index);
  13857. return anObject;
  13858. }
  13859. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13860. },
  13861. args: ["anObject", "aBlock"],
  13862. 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 ]",
  13863. referencedClasses: [],
  13864. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13865. }),
  13866. $globals.Array);
  13867. $core.addMethod(
  13868. $core.method({
  13869. selector: "removeAll",
  13870. protocol: 'adding/removing',
  13871. fn: function (){
  13872. var self=this;
  13873. return $core.withContext(function($ctx1) {
  13874. self.length = 0;
  13875. return self;
  13876. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13877. },
  13878. args: [],
  13879. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  13880. referencedClasses: [],
  13881. messageSends: []
  13882. }),
  13883. $globals.Array);
  13884. $core.addMethod(
  13885. $core.method({
  13886. selector: "removeFrom:to:",
  13887. protocol: 'adding/removing',
  13888. fn: function (aNumber,anotherNumber){
  13889. var self=this;
  13890. return $core.withContext(function($ctx1) {
  13891. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13892. return self;
  13893. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13894. },
  13895. args: ["aNumber", "anotherNumber"],
  13896. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  13897. referencedClasses: [],
  13898. messageSends: []
  13899. }),
  13900. $globals.Array);
  13901. $core.addMethod(
  13902. $core.method({
  13903. selector: "removeIndex:",
  13904. protocol: 'adding/removing',
  13905. fn: function (anInteger){
  13906. var self=this;
  13907. return $core.withContext(function($ctx1) {
  13908. self.splice(anInteger - 1, 1);
  13909. return self;
  13910. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13911. },
  13912. args: ["anInteger"],
  13913. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  13914. referencedClasses: [],
  13915. messageSends: []
  13916. }),
  13917. $globals.Array);
  13918. $core.addMethod(
  13919. $core.method({
  13920. selector: "removeLast",
  13921. protocol: 'adding/removing',
  13922. fn: function (){
  13923. var self=this;
  13924. return $core.withContext(function($ctx1) {
  13925. return self.pop();;
  13926. return self;
  13927. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13928. },
  13929. args: [],
  13930. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  13931. referencedClasses: [],
  13932. messageSends: []
  13933. }),
  13934. $globals.Array);
  13935. $core.addMethod(
  13936. $core.method({
  13937. selector: "reversed",
  13938. protocol: 'converting',
  13939. fn: function (){
  13940. var self=this;
  13941. return $core.withContext(function($ctx1) {
  13942. return self.slice().reverse();
  13943. return self;
  13944. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13945. },
  13946. args: [],
  13947. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  13948. referencedClasses: [],
  13949. messageSends: []
  13950. }),
  13951. $globals.Array);
  13952. $core.addMethod(
  13953. $core.method({
  13954. selector: "select:",
  13955. protocol: 'enumerating',
  13956. fn: function (aBlock){
  13957. var self=this;
  13958. return $core.withContext(function($ctx1) {
  13959. return self.filter(function(each) {return aBlock._value_(each)});
  13960. return self;
  13961. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13962. },
  13963. args: ["aBlock"],
  13964. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  13965. referencedClasses: [],
  13966. messageSends: []
  13967. }),
  13968. $globals.Array);
  13969. $core.addMethod(
  13970. $core.method({
  13971. selector: "shallowCopy",
  13972. protocol: 'copying',
  13973. fn: function (){
  13974. var self=this;
  13975. return $core.withContext(function($ctx1) {
  13976. return self.slice();
  13977. return self;
  13978. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  13979. },
  13980. args: [],
  13981. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  13982. referencedClasses: [],
  13983. messageSends: []
  13984. }),
  13985. $globals.Array);
  13986. $core.addMethod(
  13987. $core.method({
  13988. selector: "size",
  13989. protocol: 'accessing',
  13990. fn: function (){
  13991. var self=this;
  13992. return $core.withContext(function($ctx1) {
  13993. return self.length;
  13994. return self;
  13995. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  13996. },
  13997. args: [],
  13998. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  13999. referencedClasses: [],
  14000. messageSends: []
  14001. }),
  14002. $globals.Array);
  14003. $core.addMethod(
  14004. $core.method({
  14005. selector: "sort",
  14006. protocol: 'enumerating',
  14007. fn: function (){
  14008. var self=this;
  14009. return $core.withContext(function($ctx1) {
  14010. return self._sort_((function(a,b){
  14011. return $core.withContext(function($ctx2) {
  14012. return $recv(a).__lt(b);
  14013. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  14014. }));
  14015. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  14016. },
  14017. args: [],
  14018. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  14019. referencedClasses: [],
  14020. messageSends: ["sort:", "<"]
  14021. }),
  14022. $globals.Array);
  14023. $core.addMethod(
  14024. $core.method({
  14025. selector: "sort:",
  14026. protocol: 'enumerating',
  14027. fn: function (aBlock){
  14028. var self=this;
  14029. return $core.withContext(function($ctx1) {
  14030. return self.sort(function(a, b) {
  14031. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  14032. })
  14033. ;
  14034. return self;
  14035. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  14036. },
  14037. args: ["aBlock"],
  14038. 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'>",
  14039. referencedClasses: [],
  14040. messageSends: []
  14041. }),
  14042. $globals.Array);
  14043. $core.addMethod(
  14044. $core.method({
  14045. selector: "sorted",
  14046. protocol: 'enumerating',
  14047. fn: function (){
  14048. var self=this;
  14049. return $core.withContext(function($ctx1) {
  14050. return $recv(self._copy())._sort();
  14051. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  14052. },
  14053. args: [],
  14054. source: "sorted\x0a\x09^ self copy sort",
  14055. referencedClasses: [],
  14056. messageSends: ["sort", "copy"]
  14057. }),
  14058. $globals.Array);
  14059. $core.addMethod(
  14060. $core.method({
  14061. selector: "sorted:",
  14062. protocol: 'enumerating',
  14063. fn: function (aBlock){
  14064. var self=this;
  14065. return $core.withContext(function($ctx1) {
  14066. return $recv(self._copy())._sort_(aBlock);
  14067. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  14068. },
  14069. args: ["aBlock"],
  14070. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  14071. referencedClasses: [],
  14072. messageSends: ["sort:", "copy"]
  14073. }),
  14074. $globals.Array);
  14075. $core.addMethod(
  14076. $core.method({
  14077. selector: "new:",
  14078. protocol: 'instance creation',
  14079. fn: function (anInteger){
  14080. var self=this;
  14081. return $core.withContext(function($ctx1) {
  14082. return new Array(anInteger);
  14083. return self;
  14084. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  14085. },
  14086. args: ["anInteger"],
  14087. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  14088. referencedClasses: [],
  14089. messageSends: []
  14090. }),
  14091. $globals.Array.klass);
  14092. $core.addMethod(
  14093. $core.method({
  14094. selector: "with:",
  14095. protocol: 'instance creation',
  14096. fn: function (anObject){
  14097. var self=this;
  14098. return $core.withContext(function($ctx1) {
  14099. var $1;
  14100. $1=self._new_((1));
  14101. $recv($1)._at_put_((1),anObject);
  14102. return $recv($1)._yourself();
  14103. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  14104. },
  14105. args: ["anObject"],
  14106. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  14107. referencedClasses: [],
  14108. messageSends: ["at:put:", "new:", "yourself"]
  14109. }),
  14110. $globals.Array.klass);
  14111. $core.addMethod(
  14112. $core.method({
  14113. selector: "with:with:",
  14114. protocol: 'instance creation',
  14115. fn: function (anObject,anObject2){
  14116. var self=this;
  14117. return $core.withContext(function($ctx1) {
  14118. var $1;
  14119. $1=self._new_((2));
  14120. $recv($1)._at_put_((1),anObject);
  14121. $ctx1.sendIdx["at:put:"]=1;
  14122. $recv($1)._at_put_((2),anObject2);
  14123. return $recv($1)._yourself();
  14124. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  14125. },
  14126. args: ["anObject", "anObject2"],
  14127. 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",
  14128. referencedClasses: [],
  14129. messageSends: ["at:put:", "new:", "yourself"]
  14130. }),
  14131. $globals.Array.klass);
  14132. $core.addMethod(
  14133. $core.method({
  14134. selector: "with:with:with:",
  14135. protocol: 'instance creation',
  14136. fn: function (anObject,anObject2,anObject3){
  14137. var self=this;
  14138. return $core.withContext(function($ctx1) {
  14139. var $1;
  14140. $1=self._new_((3));
  14141. $recv($1)._at_put_((1),anObject);
  14142. $ctx1.sendIdx["at:put:"]=1;
  14143. $recv($1)._at_put_((2),anObject2);
  14144. $ctx1.sendIdx["at:put:"]=2;
  14145. $recv($1)._at_put_((3),anObject3);
  14146. return $recv($1)._yourself();
  14147. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  14148. },
  14149. args: ["anObject", "anObject2", "anObject3"],
  14150. 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",
  14151. referencedClasses: [],
  14152. messageSends: ["at:put:", "new:", "yourself"]
  14153. }),
  14154. $globals.Array.klass);
  14155. $core.addMethod(
  14156. $core.method({
  14157. selector: "withAll:",
  14158. protocol: 'instance creation',
  14159. fn: function (aCollection){
  14160. var self=this;
  14161. var instance,index;
  14162. return $core.withContext(function($ctx1) {
  14163. index=(1);
  14164. instance=self._new_($recv(aCollection)._size());
  14165. $recv(aCollection)._do_((function(each){
  14166. return $core.withContext(function($ctx2) {
  14167. $recv(instance)._at_put_(index,each);
  14168. index=$recv(index).__plus((1));
  14169. return index;
  14170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14171. }));
  14172. return instance;
  14173. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14174. },
  14175. args: ["aCollection"],
  14176. 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",
  14177. referencedClasses: [],
  14178. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14179. }),
  14180. $globals.Array.klass);
  14181. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14182. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14183. $core.addMethod(
  14184. $core.method({
  14185. selector: ",",
  14186. protocol: 'copying',
  14187. fn: function (aString){
  14188. var self=this;
  14189. return $core.withContext(function($ctx1) {
  14190. var $1;
  14191. $1=self._asString();
  14192. $ctx1.sendIdx["asString"]=1;
  14193. return $recv($1).__comma($recv(aString)._asString());
  14194. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14195. },
  14196. args: ["aString"],
  14197. source: ", aString\x0a\x09^ self asString, aString asString",
  14198. referencedClasses: [],
  14199. messageSends: [",", "asString"]
  14200. }),
  14201. $globals.CharacterArray);
  14202. $core.addMethod(
  14203. $core.method({
  14204. selector: "add:",
  14205. protocol: 'adding/removing',
  14206. fn: function (anObject){
  14207. var self=this;
  14208. return $core.withContext(function($ctx1) {
  14209. self._errorReadOnly();
  14210. return self;
  14211. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14212. },
  14213. args: ["anObject"],
  14214. source: "add: anObject\x0a\x09self errorReadOnly",
  14215. referencedClasses: [],
  14216. messageSends: ["errorReadOnly"]
  14217. }),
  14218. $globals.CharacterArray);
  14219. $core.addMethod(
  14220. $core.method({
  14221. selector: "asLowercase",
  14222. protocol: 'converting',
  14223. fn: function (){
  14224. var self=this;
  14225. return $core.withContext(function($ctx1) {
  14226. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14227. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14228. },
  14229. args: [],
  14230. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14231. referencedClasses: [],
  14232. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14233. }),
  14234. $globals.CharacterArray);
  14235. $core.addMethod(
  14236. $core.method({
  14237. selector: "asNumber",
  14238. protocol: 'converting',
  14239. fn: function (){
  14240. var self=this;
  14241. return $core.withContext(function($ctx1) {
  14242. return $recv(self._asString())._asNumber();
  14243. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14244. },
  14245. args: [],
  14246. source: "asNumber\x0a\x09^ self asString asNumber",
  14247. referencedClasses: [],
  14248. messageSends: ["asNumber", "asString"]
  14249. }),
  14250. $globals.CharacterArray);
  14251. $core.addMethod(
  14252. $core.method({
  14253. selector: "asString",
  14254. protocol: 'converting',
  14255. fn: function (){
  14256. var self=this;
  14257. return $core.withContext(function($ctx1) {
  14258. return self._subclassResponsibility();
  14259. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14260. },
  14261. args: [],
  14262. source: "asString\x0a\x09^ self subclassResponsibility",
  14263. referencedClasses: [],
  14264. messageSends: ["subclassResponsibility"]
  14265. }),
  14266. $globals.CharacterArray);
  14267. $core.addMethod(
  14268. $core.method({
  14269. selector: "asSymbol",
  14270. protocol: 'converting',
  14271. fn: function (){
  14272. var self=this;
  14273. return $core.withContext(function($ctx1) {
  14274. return self._asString();
  14275. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14276. },
  14277. args: [],
  14278. source: "asSymbol\x0a\x09^ self asString",
  14279. referencedClasses: [],
  14280. messageSends: ["asString"]
  14281. }),
  14282. $globals.CharacterArray);
  14283. $core.addMethod(
  14284. $core.method({
  14285. selector: "asUppercase",
  14286. protocol: 'converting',
  14287. fn: function (){
  14288. var self=this;
  14289. return $core.withContext(function($ctx1) {
  14290. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14291. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14292. },
  14293. args: [],
  14294. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14295. referencedClasses: [],
  14296. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14297. }),
  14298. $globals.CharacterArray);
  14299. $core.addMethod(
  14300. $core.method({
  14301. selector: "at:put:",
  14302. protocol: 'accessing',
  14303. fn: function (anIndex,anObject){
  14304. var self=this;
  14305. return $core.withContext(function($ctx1) {
  14306. self._errorReadOnly();
  14307. return self;
  14308. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14309. },
  14310. args: ["anIndex", "anObject"],
  14311. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14312. referencedClasses: [],
  14313. messageSends: ["errorReadOnly"]
  14314. }),
  14315. $globals.CharacterArray);
  14316. $core.addMethod(
  14317. $core.method({
  14318. selector: "errorReadOnly",
  14319. protocol: 'error handling',
  14320. fn: function (){
  14321. var self=this;
  14322. return $core.withContext(function($ctx1) {
  14323. self._error_("Object is read-only");
  14324. return self;
  14325. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14326. },
  14327. args: [],
  14328. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14329. referencedClasses: [],
  14330. messageSends: ["error:"]
  14331. }),
  14332. $globals.CharacterArray);
  14333. $core.addMethod(
  14334. $core.method({
  14335. selector: "printOn:",
  14336. protocol: 'printing',
  14337. fn: function (aStream){
  14338. var self=this;
  14339. return $core.withContext(function($ctx1) {
  14340. $recv(self._asString())._printOn_(aStream);
  14341. return self;
  14342. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14343. },
  14344. args: ["aStream"],
  14345. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14346. referencedClasses: [],
  14347. messageSends: ["printOn:", "asString"]
  14348. }),
  14349. $globals.CharacterArray);
  14350. $core.addMethod(
  14351. $core.method({
  14352. selector: "putOn:",
  14353. protocol: 'streaming',
  14354. fn: function (aStream){
  14355. var self=this;
  14356. return $core.withContext(function($ctx1) {
  14357. $recv(aStream)._nextPutString_(self);
  14358. return self;
  14359. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14360. },
  14361. args: ["aStream"],
  14362. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14363. referencedClasses: [],
  14364. messageSends: ["nextPutString:"]
  14365. }),
  14366. $globals.CharacterArray);
  14367. $core.addMethod(
  14368. $core.method({
  14369. selector: "remove:",
  14370. protocol: 'adding/removing',
  14371. fn: function (anObject){
  14372. var self=this;
  14373. return $core.withContext(function($ctx1) {
  14374. self._errorReadOnly();
  14375. return self;
  14376. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14377. },
  14378. args: ["anObject"],
  14379. source: "remove: anObject\x0a\x09self errorReadOnly",
  14380. referencedClasses: [],
  14381. messageSends: ["errorReadOnly"]
  14382. }),
  14383. $globals.CharacterArray);
  14384. $core.addMethod(
  14385. $core.method({
  14386. selector: "fromString:",
  14387. protocol: 'instance creation',
  14388. fn: function (aString){
  14389. var self=this;
  14390. return $core.withContext(function($ctx1) {
  14391. self._subclassResponsibility();
  14392. return self;
  14393. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14394. },
  14395. args: ["aString"],
  14396. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14397. referencedClasses: [],
  14398. messageSends: ["subclassResponsibility"]
  14399. }),
  14400. $globals.CharacterArray.klass);
  14401. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14402. $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 >> #,`";
  14403. $core.addMethod(
  14404. $core.method({
  14405. selector: ",",
  14406. protocol: 'copying',
  14407. fn: function (aString){
  14408. var self=this;
  14409. return $core.withContext(function($ctx1) {
  14410. return String(self) + aString;
  14411. return self;
  14412. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14413. },
  14414. args: ["aString"],
  14415. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  14416. referencedClasses: [],
  14417. messageSends: []
  14418. }),
  14419. $globals.String);
  14420. $core.addMethod(
  14421. $core.method({
  14422. selector: "<",
  14423. protocol: 'comparing',
  14424. fn: function (aString){
  14425. var self=this;
  14426. return $core.withContext(function($ctx1) {
  14427. return String(self) < aString._asString();
  14428. return self;
  14429. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14430. },
  14431. args: ["aString"],
  14432. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  14433. referencedClasses: [],
  14434. messageSends: []
  14435. }),
  14436. $globals.String);
  14437. $core.addMethod(
  14438. $core.method({
  14439. selector: "<=",
  14440. protocol: 'comparing',
  14441. fn: function (aString){
  14442. var self=this;
  14443. return $core.withContext(function($ctx1) {
  14444. return String(self) <= aString._asString();
  14445. return self;
  14446. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14447. },
  14448. args: ["aString"],
  14449. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  14450. referencedClasses: [],
  14451. messageSends: []
  14452. }),
  14453. $globals.String);
  14454. $core.addMethod(
  14455. $core.method({
  14456. selector: "=",
  14457. protocol: 'comparing',
  14458. fn: function (aString){
  14459. var self=this;
  14460. return $core.withContext(function($ctx1) {
  14461. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14462. return self;
  14463. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14464. },
  14465. args: ["aString"],
  14466. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  14467. referencedClasses: [],
  14468. messageSends: []
  14469. }),
  14470. $globals.String);
  14471. $core.addMethod(
  14472. $core.method({
  14473. selector: "==",
  14474. protocol: 'comparing',
  14475. fn: function (aString){
  14476. var self=this;
  14477. return $core.withContext(function($ctx1) {
  14478. if (typeof aString === "string") return String(self) === aString;
  14479. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  14480. else return false;;
  14481. return self;
  14482. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14483. },
  14484. args: ["aString"],
  14485. 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'>",
  14486. referencedClasses: [],
  14487. messageSends: []
  14488. }),
  14489. $globals.String);
  14490. $core.addMethod(
  14491. $core.method({
  14492. selector: ">",
  14493. protocol: 'comparing',
  14494. fn: function (aString){
  14495. var self=this;
  14496. return $core.withContext(function($ctx1) {
  14497. return String(self) > aString._asString();
  14498. return self;
  14499. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14500. },
  14501. args: ["aString"],
  14502. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  14503. referencedClasses: [],
  14504. messageSends: []
  14505. }),
  14506. $globals.String);
  14507. $core.addMethod(
  14508. $core.method({
  14509. selector: ">=",
  14510. protocol: 'comparing',
  14511. fn: function (aString){
  14512. var self=this;
  14513. return $core.withContext(function($ctx1) {
  14514. return String(self) >= aString._asString();
  14515. return self;
  14516. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14517. },
  14518. args: ["aString"],
  14519. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  14520. referencedClasses: [],
  14521. messageSends: []
  14522. }),
  14523. $globals.String);
  14524. $core.addMethod(
  14525. $core.method({
  14526. selector: "asJSON",
  14527. protocol: 'converting',
  14528. fn: function (){
  14529. var self=this;
  14530. return self;
  14531. },
  14532. args: [],
  14533. source: "asJSON\x0a\x09^ self",
  14534. referencedClasses: [],
  14535. messageSends: []
  14536. }),
  14537. $globals.String);
  14538. $core.addMethod(
  14539. $core.method({
  14540. selector: "asJavaScriptMethodName",
  14541. protocol: 'converting',
  14542. fn: function (){
  14543. var self=this;
  14544. return $core.withContext(function($ctx1) {
  14545. return $core.st2js(self);
  14546. return self;
  14547. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14548. },
  14549. args: [],
  14550. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  14551. referencedClasses: [],
  14552. messageSends: []
  14553. }),
  14554. $globals.String);
  14555. $core.addMethod(
  14556. $core.method({
  14557. selector: "asJavascript",
  14558. protocol: 'converting',
  14559. fn: function (){
  14560. var self=this;
  14561. return $core.withContext(function($ctx1) {
  14562. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14563. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14564. else
  14565. return "\"" + self + "\"";
  14566. ;
  14567. return self;
  14568. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14569. },
  14570. args: [],
  14571. source: "asJavascript\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'>",
  14572. referencedClasses: [],
  14573. messageSends: []
  14574. }),
  14575. $globals.String);
  14576. $core.addMethod(
  14577. $core.method({
  14578. selector: "asLowercase",
  14579. protocol: 'converting',
  14580. fn: function (){
  14581. var self=this;
  14582. return $core.withContext(function($ctx1) {
  14583. return self.toLowerCase();
  14584. return self;
  14585. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14586. },
  14587. args: [],
  14588. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  14589. referencedClasses: [],
  14590. messageSends: []
  14591. }),
  14592. $globals.String);
  14593. $core.addMethod(
  14594. $core.method({
  14595. selector: "asMutator",
  14596. protocol: 'converting',
  14597. fn: function (){
  14598. var self=this;
  14599. return $core.withContext(function($ctx1) {
  14600. var $1;
  14601. $1=$recv(self._last()).__eq(":");
  14602. if(!$core.assert($1)){
  14603. return self.__comma(":");
  14604. }
  14605. return self;
  14606. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14607. },
  14608. args: [],
  14609. 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",
  14610. referencedClasses: [],
  14611. messageSends: ["ifFalse:", "=", "last", ","]
  14612. }),
  14613. $globals.String);
  14614. $core.addMethod(
  14615. $core.method({
  14616. selector: "asNumber",
  14617. protocol: 'converting',
  14618. fn: function (){
  14619. var self=this;
  14620. return $core.withContext(function($ctx1) {
  14621. return Number(self);
  14622. return self;
  14623. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14624. },
  14625. args: [],
  14626. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  14627. referencedClasses: [],
  14628. messageSends: []
  14629. }),
  14630. $globals.String);
  14631. $core.addMethod(
  14632. $core.method({
  14633. selector: "asRegexp",
  14634. protocol: 'converting',
  14635. fn: function (){
  14636. var self=this;
  14637. return $core.withContext(function($ctx1) {
  14638. return $recv($globals.RegularExpression)._fromString_(self);
  14639. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14640. },
  14641. args: [],
  14642. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14643. referencedClasses: ["RegularExpression"],
  14644. messageSends: ["fromString:"]
  14645. }),
  14646. $globals.String);
  14647. $core.addMethod(
  14648. $core.method({
  14649. selector: "asString",
  14650. protocol: 'converting',
  14651. fn: function (){
  14652. var self=this;
  14653. return self;
  14654. },
  14655. args: [],
  14656. source: "asString\x0a\x09^ self",
  14657. referencedClasses: [],
  14658. messageSends: []
  14659. }),
  14660. $globals.String);
  14661. $core.addMethod(
  14662. $core.method({
  14663. selector: "asSymbol",
  14664. protocol: 'converting',
  14665. fn: function (){
  14666. var self=this;
  14667. return self;
  14668. },
  14669. args: [],
  14670. source: "asSymbol\x0a\x09^ self",
  14671. referencedClasses: [],
  14672. messageSends: []
  14673. }),
  14674. $globals.String);
  14675. $core.addMethod(
  14676. $core.method({
  14677. selector: "asUppercase",
  14678. protocol: 'converting',
  14679. fn: function (){
  14680. var self=this;
  14681. return $core.withContext(function($ctx1) {
  14682. return self.toUpperCase();
  14683. return self;
  14684. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14685. },
  14686. args: [],
  14687. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  14688. referencedClasses: [],
  14689. messageSends: []
  14690. }),
  14691. $globals.String);
  14692. $core.addMethod(
  14693. $core.method({
  14694. selector: "asciiValue",
  14695. protocol: 'accessing',
  14696. fn: function (){
  14697. var self=this;
  14698. return $core.withContext(function($ctx1) {
  14699. return self.charCodeAt(0);;
  14700. return self;
  14701. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14702. },
  14703. args: [],
  14704. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  14705. referencedClasses: [],
  14706. messageSends: []
  14707. }),
  14708. $globals.String);
  14709. $core.addMethod(
  14710. $core.method({
  14711. selector: "at:ifAbsent:",
  14712. protocol: 'accessing',
  14713. fn: function (anIndex,aBlock){
  14714. var self=this;
  14715. return $core.withContext(function($ctx1) {
  14716. return String(self)[anIndex - 1] || aBlock._value();
  14717. return self;
  14718. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14719. },
  14720. args: ["anIndex", "aBlock"],
  14721. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  14722. referencedClasses: [],
  14723. messageSends: []
  14724. }),
  14725. $globals.String);
  14726. $core.addMethod(
  14727. $core.method({
  14728. selector: "at:ifPresent:ifAbsent:",
  14729. protocol: 'accessing',
  14730. fn: function (anIndex,aBlock,anotherBlock){
  14731. var self=this;
  14732. return $core.withContext(function($ctx1) {
  14733. var result = String(self)[anIndex - 1];
  14734. return result ? aBlock._value_(result) : anotherBlock._value();
  14735. ;
  14736. return self;
  14737. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14738. },
  14739. args: ["anIndex", "aBlock", "anotherBlock"],
  14740. 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'>",
  14741. referencedClasses: [],
  14742. messageSends: []
  14743. }),
  14744. $globals.String);
  14745. $core.addMethod(
  14746. $core.method({
  14747. selector: "capitalized",
  14748. protocol: 'converting',
  14749. fn: function (){
  14750. var self=this;
  14751. return $core.withContext(function($ctx1) {
  14752. return self._ifNotEmpty_((function(){
  14753. return $core.withContext(function($ctx2) {
  14754. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14756. }));
  14757. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14758. },
  14759. args: [],
  14760. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  14761. referencedClasses: [],
  14762. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  14763. }),
  14764. $globals.String);
  14765. $core.addMethod(
  14766. $core.method({
  14767. selector: "charCodeAt:",
  14768. protocol: 'accessing',
  14769. fn: function (anInteger){
  14770. var self=this;
  14771. return $core.withContext(function($ctx1) {
  14772. return self.charCodeAt(anInteger - 1);
  14773. return self;
  14774. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14775. },
  14776. args: ["anInteger"],
  14777. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  14778. referencedClasses: [],
  14779. messageSends: []
  14780. }),
  14781. $globals.String);
  14782. $core.addMethod(
  14783. $core.method({
  14784. selector: "copyFrom:to:",
  14785. protocol: 'copying',
  14786. fn: function (anIndex,anotherIndex){
  14787. var self=this;
  14788. return $core.withContext(function($ctx1) {
  14789. return self.substring(anIndex - 1, anotherIndex);
  14790. return self;
  14791. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14792. },
  14793. args: ["anIndex", "anotherIndex"],
  14794. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  14795. referencedClasses: [],
  14796. messageSends: []
  14797. }),
  14798. $globals.String);
  14799. $core.addMethod(
  14800. $core.method({
  14801. selector: "crlfSanitized",
  14802. protocol: 'converting',
  14803. fn: function (){
  14804. var self=this;
  14805. return $core.withContext(function($ctx1) {
  14806. return $recv(self._lines())._join_($recv($globals.String)._lf());
  14807. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14808. },
  14809. args: [],
  14810. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14811. referencedClasses: ["String"],
  14812. messageSends: ["join:", "lines", "lf"]
  14813. }),
  14814. $globals.String);
  14815. $core.addMethod(
  14816. $core.method({
  14817. selector: "deepCopy",
  14818. protocol: 'copying',
  14819. fn: function (){
  14820. var self=this;
  14821. return $core.withContext(function($ctx1) {
  14822. return self._shallowCopy();
  14823. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14824. },
  14825. args: [],
  14826. source: "deepCopy\x0a\x09^ self shallowCopy",
  14827. referencedClasses: [],
  14828. messageSends: ["shallowCopy"]
  14829. }),
  14830. $globals.String);
  14831. $core.addMethod(
  14832. $core.method({
  14833. selector: "escaped",
  14834. protocol: 'converting',
  14835. fn: function (){
  14836. var self=this;
  14837. return $core.withContext(function($ctx1) {
  14838. return escape(self);
  14839. return self;
  14840. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14841. },
  14842. args: [],
  14843. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  14844. referencedClasses: [],
  14845. messageSends: []
  14846. }),
  14847. $globals.String);
  14848. $core.addMethod(
  14849. $core.method({
  14850. selector: "includesSubString:",
  14851. protocol: 'testing',
  14852. fn: function (subString){
  14853. var self=this;
  14854. return $core.withContext(function($ctx1) {
  14855. return self.indexOf(subString) != -1;
  14856. return self;
  14857. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14858. },
  14859. args: ["subString"],
  14860. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  14861. referencedClasses: [],
  14862. messageSends: []
  14863. }),
  14864. $globals.String);
  14865. $core.addMethod(
  14866. $core.method({
  14867. selector: "isCapitalized",
  14868. protocol: 'testing',
  14869. fn: function (){
  14870. var self=this;
  14871. return $core.withContext(function($ctx1) {
  14872. var $2,$1;
  14873. $2=self._first();
  14874. $ctx1.sendIdx["first"]=1;
  14875. $1=$recv($2)._asUppercase();
  14876. return $recv($1).__eq_eq(self._first());
  14877. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14878. },
  14879. args: [],
  14880. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14881. referencedClasses: [],
  14882. messageSends: ["==", "asUppercase", "first"]
  14883. }),
  14884. $globals.String);
  14885. $core.addMethod(
  14886. $core.method({
  14887. selector: "isImmutable",
  14888. protocol: 'testing',
  14889. fn: function (){
  14890. var self=this;
  14891. return true;
  14892. },
  14893. args: [],
  14894. source: "isImmutable\x0a\x09^ true",
  14895. referencedClasses: [],
  14896. messageSends: []
  14897. }),
  14898. $globals.String);
  14899. $core.addMethod(
  14900. $core.method({
  14901. selector: "isString",
  14902. protocol: 'testing',
  14903. fn: function (){
  14904. var self=this;
  14905. return true;
  14906. },
  14907. args: [],
  14908. source: "isString\x0a\x09^ true",
  14909. referencedClasses: [],
  14910. messageSends: []
  14911. }),
  14912. $globals.String);
  14913. $core.addMethod(
  14914. $core.method({
  14915. selector: "isVowel",
  14916. protocol: 'testing',
  14917. fn: function (){
  14918. var self=this;
  14919. return $core.withContext(function($ctx1) {
  14920. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  14921. return $core.withContext(function($ctx2) {
  14922. return "aeiou"._includes_(self._asLowercase());
  14923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14924. }));
  14925. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14926. },
  14927. args: [],
  14928. 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 ]",
  14929. referencedClasses: [],
  14930. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14931. }),
  14932. $globals.String);
  14933. $core.addMethod(
  14934. $core.method({
  14935. selector: "join:",
  14936. protocol: 'split join',
  14937. fn: function (aCollection){
  14938. var self=this;
  14939. return $core.withContext(function($ctx1) {
  14940. return $recv($globals.String)._streamContents_((function(stream){
  14941. return $core.withContext(function($ctx2) {
  14942. return $recv(aCollection)._do_separatedBy_((function(each){
  14943. return $core.withContext(function($ctx3) {
  14944. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14945. $ctx3.sendIdx["nextPutAll:"]=1;
  14946. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14947. }),(function(){
  14948. return $core.withContext(function($ctx3) {
  14949. return $recv(stream)._nextPutAll_(self);
  14950. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14951. }));
  14952. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14953. }));
  14954. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14955. },
  14956. args: ["aCollection"],
  14957. 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 ]]",
  14958. referencedClasses: ["String"],
  14959. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14960. }),
  14961. $globals.String);
  14962. $core.addMethod(
  14963. $core.method({
  14964. selector: "lineIndicesDo:",
  14965. protocol: 'split join',
  14966. fn: function (aBlock){
  14967. var self=this;
  14968. var cr,lf,start,sz,nextLF,nextCR;
  14969. return $core.withContext(function($ctx1) {
  14970. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  14971. var $early={};
  14972. try {
  14973. start=(1);
  14974. sz=self._size();
  14975. cr=$recv($globals.String)._cr();
  14976. nextCR=self._indexOf_startingAt_(cr,(1));
  14977. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  14978. lf=$recv($globals.String)._lf();
  14979. nextLF=self._indexOf_startingAt_(lf,(1));
  14980. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  14981. $recv((function(){
  14982. return $core.withContext(function($ctx2) {
  14983. return $recv(start).__lt_eq(sz);
  14984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14985. }))._whileTrue_((function(){
  14986. return $core.withContext(function($ctx2) {
  14987. $2=$recv(nextLF).__eq((0));
  14988. $ctx2.sendIdx["="]=1;
  14989. $1=$recv($2)._and_((function(){
  14990. return $core.withContext(function($ctx3) {
  14991. return $recv(nextCR).__eq((0));
  14992. $ctx3.sendIdx["="]=2;
  14993. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14994. }));
  14995. $ctx2.sendIdx["and:"]=1;
  14996. if($core.assert($1)){
  14997. $recv(aBlock)._value_value_value_(start,sz,sz);
  14998. $ctx2.sendIdx["value:value:value:"]=1;
  14999. throw $early=[self];
  15000. }
  15001. $4=$recv(nextCR).__eq((0));
  15002. $ctx2.sendIdx["="]=3;
  15003. $3=$recv($4)._or_((function(){
  15004. return $core.withContext(function($ctx3) {
  15005. $5=(0).__lt(nextLF);
  15006. $ctx3.sendIdx["<"]=1;
  15007. return $recv($5)._and_((function(){
  15008. return $core.withContext(function($ctx4) {
  15009. return $recv(nextLF).__lt(nextCR);
  15010. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  15011. }));
  15012. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  15013. }));
  15014. if($core.assert($3)){
  15015. $6=start;
  15016. $7=$recv(nextLF).__minus((1));
  15017. $ctx2.sendIdx["-"]=1;
  15018. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  15019. $ctx2.sendIdx["value:value:value:"]=2;
  15020. start=(1).__plus(nextLF);
  15021. $ctx2.sendIdx["+"]=1;
  15022. start;
  15023. nextLF=self._indexOf_startingAt_(lf,start);
  15024. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  15025. return nextLF;
  15026. } else {
  15027. $9=(1).__plus(nextCR);
  15028. $ctx2.sendIdx["+"]=2;
  15029. $8=$recv($9).__eq(nextLF);
  15030. if($core.assert($8)){
  15031. $10=start;
  15032. $11=$recv(nextCR).__minus((1));
  15033. $ctx2.sendIdx["-"]=2;
  15034. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  15035. $ctx2.sendIdx["value:value:value:"]=3;
  15036. start=(1).__plus(nextLF);
  15037. $ctx2.sendIdx["+"]=3;
  15038. start;
  15039. nextCR=self._indexOf_startingAt_(cr,start);
  15040. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  15041. nextCR;
  15042. nextLF=self._indexOf_startingAt_(lf,start);
  15043. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  15044. return nextLF;
  15045. } else {
  15046. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  15047. start=(1).__plus(nextCR);
  15048. start;
  15049. nextCR=self._indexOf_startingAt_(cr,start);
  15050. return nextCR;
  15051. }
  15052. }
  15053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15054. }));
  15055. return self;
  15056. }
  15057. catch(e) {if(e===$early)return e[0]; throw e}
  15058. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  15059. },
  15060. args: ["aBlock"],
  15061. 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 ] ]]",
  15062. referencedClasses: ["String"],
  15063. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  15064. }),
  15065. $globals.String);
  15066. $core.addMethod(
  15067. $core.method({
  15068. selector: "lineNumber:",
  15069. protocol: 'split join',
  15070. fn: function (anIndex){
  15071. var self=this;
  15072. var lineCount;
  15073. return $core.withContext(function($ctx1) {
  15074. var $2,$1;
  15075. var $early={};
  15076. try {
  15077. lineCount=(0);
  15078. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15079. return $core.withContext(function($ctx2) {
  15080. lineCount=$recv(lineCount).__plus((1));
  15081. $2=lineCount;
  15082. $1=$recv($2).__eq(anIndex);
  15083. if($core.assert($1)){
  15084. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  15085. }
  15086. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15087. }));
  15088. return nil;
  15089. }
  15090. catch(e) {if(e===$early)return e[0]; throw e}
  15091. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  15092. },
  15093. args: ["anIndex"],
  15094. 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",
  15095. referencedClasses: [],
  15096. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  15097. }),
  15098. $globals.String);
  15099. $core.addMethod(
  15100. $core.method({
  15101. selector: "lines",
  15102. protocol: 'split join',
  15103. fn: function (){
  15104. var self=this;
  15105. return $core.withContext(function($ctx1) {
  15106. var result = self.split(/\r\n|\r|\n/);
  15107. if (!result[result.length-1]) result.pop();
  15108. return result;;
  15109. return self;
  15110. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  15111. },
  15112. args: [],
  15113. 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'>",
  15114. referencedClasses: [],
  15115. messageSends: []
  15116. }),
  15117. $globals.String);
  15118. $core.addMethod(
  15119. $core.method({
  15120. selector: "linesDo:",
  15121. protocol: 'split join',
  15122. fn: function (aBlock){
  15123. var self=this;
  15124. return $core.withContext(function($ctx1) {
  15125. $recv(self._lines())._do_(aBlock);
  15126. return self;
  15127. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15128. },
  15129. args: ["aBlock"],
  15130. 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",
  15131. referencedClasses: [],
  15132. messageSends: ["do:", "lines"]
  15133. }),
  15134. $globals.String);
  15135. $core.addMethod(
  15136. $core.method({
  15137. selector: "match:",
  15138. protocol: 'regular expressions',
  15139. fn: function (aRegexp){
  15140. var self=this;
  15141. return $core.withContext(function($ctx1) {
  15142. return self.search(aRegexp) != -1;
  15143. return self;
  15144. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15145. },
  15146. args: ["aRegexp"],
  15147. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  15148. referencedClasses: [],
  15149. messageSends: []
  15150. }),
  15151. $globals.String);
  15152. $core.addMethod(
  15153. $core.method({
  15154. selector: "matchesOf:",
  15155. protocol: 'regular expressions',
  15156. fn: function (aRegularExpression){
  15157. var self=this;
  15158. return $core.withContext(function($ctx1) {
  15159. return self.match(aRegularExpression);
  15160. return self;
  15161. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15162. },
  15163. args: ["aRegularExpression"],
  15164. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  15165. referencedClasses: [],
  15166. messageSends: []
  15167. }),
  15168. $globals.String);
  15169. $core.addMethod(
  15170. $core.method({
  15171. selector: "numericallyIndexable",
  15172. protocol: 'private',
  15173. fn: function (){
  15174. var self=this;
  15175. return $core.withContext(function($ctx1) {
  15176. return String(self);
  15177. return self;
  15178. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15179. },
  15180. args: [],
  15181. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  15182. referencedClasses: [],
  15183. messageSends: []
  15184. }),
  15185. $globals.String);
  15186. $core.addMethod(
  15187. $core.method({
  15188. selector: "printNl",
  15189. protocol: 'printing',
  15190. fn: function (){
  15191. var self=this;
  15192. return $core.withContext(function($ctx1) {
  15193. console.log(self);
  15194. return self;
  15195. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15196. },
  15197. args: [],
  15198. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  15199. referencedClasses: [],
  15200. messageSends: []
  15201. }),
  15202. $globals.String);
  15203. $core.addMethod(
  15204. $core.method({
  15205. selector: "printOn:",
  15206. protocol: 'printing',
  15207. fn: function (aStream){
  15208. var self=this;
  15209. return $core.withContext(function($ctx1) {
  15210. $recv(aStream)._nextPutAll_("'");
  15211. $ctx1.sendIdx["nextPutAll:"]=1;
  15212. $recv(aStream)._nextPutAll_(self);
  15213. $ctx1.sendIdx["nextPutAll:"]=2;
  15214. $recv(aStream)._nextPutAll_("'");
  15215. return self;
  15216. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15217. },
  15218. args: ["aStream"],
  15219. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15220. referencedClasses: [],
  15221. messageSends: ["nextPutAll:"]
  15222. }),
  15223. $globals.String);
  15224. $core.addMethod(
  15225. $core.method({
  15226. selector: "replace:with:",
  15227. protocol: 'regular expressions',
  15228. fn: function (aString,anotherString){
  15229. var self=this;
  15230. return $core.withContext(function($ctx1) {
  15231. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  15232. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15233. },
  15234. args: ["aString", "anotherString"],
  15235. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15236. referencedClasses: ["RegularExpression"],
  15237. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15238. }),
  15239. $globals.String);
  15240. $core.addMethod(
  15241. $core.method({
  15242. selector: "replaceRegexp:with:",
  15243. protocol: 'regular expressions',
  15244. fn: function (aRegexp,aString){
  15245. var self=this;
  15246. return $core.withContext(function($ctx1) {
  15247. return self.replace(aRegexp, aString);
  15248. return self;
  15249. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15250. },
  15251. args: ["aRegexp", "aString"],
  15252. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  15253. referencedClasses: [],
  15254. messageSends: []
  15255. }),
  15256. $globals.String);
  15257. $core.addMethod(
  15258. $core.method({
  15259. selector: "reversed",
  15260. protocol: 'converting',
  15261. fn: function (){
  15262. var self=this;
  15263. return $core.withContext(function($ctx1) {
  15264. return self.split("").reverse().join("");
  15265. return self;
  15266. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15267. },
  15268. args: [],
  15269. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  15270. referencedClasses: [],
  15271. messageSends: []
  15272. }),
  15273. $globals.String);
  15274. $core.addMethod(
  15275. $core.method({
  15276. selector: "shallowCopy",
  15277. protocol: 'copying',
  15278. fn: function (){
  15279. var self=this;
  15280. return self;
  15281. },
  15282. args: [],
  15283. source: "shallowCopy\x0a\x09^ self",
  15284. referencedClasses: [],
  15285. messageSends: []
  15286. }),
  15287. $globals.String);
  15288. $core.addMethod(
  15289. $core.method({
  15290. selector: "size",
  15291. protocol: 'accessing',
  15292. fn: function (){
  15293. var self=this;
  15294. return $core.withContext(function($ctx1) {
  15295. return self.length;
  15296. return self;
  15297. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15298. },
  15299. args: [],
  15300. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  15301. referencedClasses: [],
  15302. messageSends: []
  15303. }),
  15304. $globals.String);
  15305. $core.addMethod(
  15306. $core.method({
  15307. selector: "subStrings:",
  15308. protocol: 'split join',
  15309. fn: function (aString){
  15310. var self=this;
  15311. return $core.withContext(function($ctx1) {
  15312. return self._tokenize_(aString);
  15313. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15314. },
  15315. args: ["aString"],
  15316. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15317. referencedClasses: [],
  15318. messageSends: ["tokenize:"]
  15319. }),
  15320. $globals.String);
  15321. $core.addMethod(
  15322. $core.method({
  15323. selector: "tokenize:",
  15324. protocol: 'split join',
  15325. fn: function (aString){
  15326. var self=this;
  15327. return $core.withContext(function($ctx1) {
  15328. return self.split(aString);
  15329. return self;
  15330. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15331. },
  15332. args: ["aString"],
  15333. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  15334. referencedClasses: [],
  15335. messageSends: []
  15336. }),
  15337. $globals.String);
  15338. $core.addMethod(
  15339. $core.method({
  15340. selector: "trimBoth",
  15341. protocol: 'regular expressions',
  15342. fn: function (){
  15343. var self=this;
  15344. return $core.withContext(function($ctx1) {
  15345. return self._trimBoth_("\x5cs");
  15346. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15347. },
  15348. args: [],
  15349. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15350. referencedClasses: [],
  15351. messageSends: ["trimBoth:"]
  15352. }),
  15353. $globals.String);
  15354. $core.addMethod(
  15355. $core.method({
  15356. selector: "trimBoth:",
  15357. protocol: 'regular expressions',
  15358. fn: function (separators){
  15359. var self=this;
  15360. return $core.withContext(function($ctx1) {
  15361. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  15362. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15363. },
  15364. args: ["separators"],
  15365. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15366. referencedClasses: [],
  15367. messageSends: ["trimRight:", "trimLeft:"]
  15368. }),
  15369. $globals.String);
  15370. $core.addMethod(
  15371. $core.method({
  15372. selector: "trimLeft",
  15373. protocol: 'regular expressions',
  15374. fn: function (){
  15375. var self=this;
  15376. return $core.withContext(function($ctx1) {
  15377. return self._trimLeft_("\x5cs");
  15378. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15379. },
  15380. args: [],
  15381. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15382. referencedClasses: [],
  15383. messageSends: ["trimLeft:"]
  15384. }),
  15385. $globals.String);
  15386. $core.addMethod(
  15387. $core.method({
  15388. selector: "trimLeft:",
  15389. protocol: 'regular expressions',
  15390. fn: function (separators){
  15391. var self=this;
  15392. return $core.withContext(function($ctx1) {
  15393. var $2,$1;
  15394. $2=$recv("^[".__comma(separators)).__comma("]+");
  15395. $ctx1.sendIdx[","]=1;
  15396. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15397. return self._replaceRegexp_with_($1,"");
  15398. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15399. },
  15400. args: ["separators"],
  15401. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15402. referencedClasses: ["RegularExpression"],
  15403. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15404. }),
  15405. $globals.String);
  15406. $core.addMethod(
  15407. $core.method({
  15408. selector: "trimRight",
  15409. protocol: 'regular expressions',
  15410. fn: function (){
  15411. var self=this;
  15412. return $core.withContext(function($ctx1) {
  15413. return self._trimRight_("\x5cs");
  15414. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15415. },
  15416. args: [],
  15417. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15418. referencedClasses: [],
  15419. messageSends: ["trimRight:"]
  15420. }),
  15421. $globals.String);
  15422. $core.addMethod(
  15423. $core.method({
  15424. selector: "trimRight:",
  15425. protocol: 'regular expressions',
  15426. fn: function (separators){
  15427. var self=this;
  15428. return $core.withContext(function($ctx1) {
  15429. var $2,$1;
  15430. $2=$recv("[".__comma(separators)).__comma("]+$");
  15431. $ctx1.sendIdx[","]=1;
  15432. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15433. return self._replaceRegexp_with_($1,"");
  15434. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15435. },
  15436. args: ["separators"],
  15437. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15438. referencedClasses: ["RegularExpression"],
  15439. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15440. }),
  15441. $globals.String);
  15442. $core.addMethod(
  15443. $core.method({
  15444. selector: "unescaped",
  15445. protocol: 'converting',
  15446. fn: function (){
  15447. var self=this;
  15448. return $core.withContext(function($ctx1) {
  15449. return unescape(self);
  15450. return self;
  15451. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15452. },
  15453. args: [],
  15454. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  15455. referencedClasses: [],
  15456. messageSends: []
  15457. }),
  15458. $globals.String);
  15459. $core.addMethod(
  15460. $core.method({
  15461. selector: "uriComponentDecoded",
  15462. protocol: 'converting',
  15463. fn: function (){
  15464. var self=this;
  15465. return $core.withContext(function($ctx1) {
  15466. return decodeURIComponent(self);
  15467. return self;
  15468. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15469. },
  15470. args: [],
  15471. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  15472. referencedClasses: [],
  15473. messageSends: []
  15474. }),
  15475. $globals.String);
  15476. $core.addMethod(
  15477. $core.method({
  15478. selector: "uriComponentEncoded",
  15479. protocol: 'converting',
  15480. fn: function (){
  15481. var self=this;
  15482. return $core.withContext(function($ctx1) {
  15483. return encodeURIComponent(self);
  15484. return self;
  15485. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15486. },
  15487. args: [],
  15488. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  15489. referencedClasses: [],
  15490. messageSends: []
  15491. }),
  15492. $globals.String);
  15493. $core.addMethod(
  15494. $core.method({
  15495. selector: "uriDecoded",
  15496. protocol: 'converting',
  15497. fn: function (){
  15498. var self=this;
  15499. return $core.withContext(function($ctx1) {
  15500. return decodeURI(self);
  15501. return self;
  15502. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15503. },
  15504. args: [],
  15505. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  15506. referencedClasses: [],
  15507. messageSends: []
  15508. }),
  15509. $globals.String);
  15510. $core.addMethod(
  15511. $core.method({
  15512. selector: "uriEncoded",
  15513. protocol: 'converting',
  15514. fn: function (){
  15515. var self=this;
  15516. return $core.withContext(function($ctx1) {
  15517. return encodeURI(self);
  15518. return self;
  15519. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15520. },
  15521. args: [],
  15522. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  15523. referencedClasses: [],
  15524. messageSends: []
  15525. }),
  15526. $globals.String);
  15527. $core.addMethod(
  15528. $core.method({
  15529. selector: "value:",
  15530. protocol: 'evaluating',
  15531. fn: function (anObject){
  15532. var self=this;
  15533. return $core.withContext(function($ctx1) {
  15534. return $recv(anObject)._perform_(self);
  15535. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15536. },
  15537. args: ["anObject"],
  15538. source: "value: anObject \x0a\x09^ anObject perform: self",
  15539. referencedClasses: [],
  15540. messageSends: ["perform:"]
  15541. }),
  15542. $globals.String);
  15543. $core.addMethod(
  15544. $core.method({
  15545. selector: "cr",
  15546. protocol: 'accessing',
  15547. fn: function (){
  15548. var self=this;
  15549. return $core.withContext(function($ctx1) {
  15550. return "\r";
  15551. return self;
  15552. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15553. },
  15554. args: [],
  15555. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  15556. referencedClasses: [],
  15557. messageSends: []
  15558. }),
  15559. $globals.String.klass);
  15560. $core.addMethod(
  15561. $core.method({
  15562. selector: "crlf",
  15563. protocol: 'accessing',
  15564. fn: function (){
  15565. var self=this;
  15566. return $core.withContext(function($ctx1) {
  15567. return "\r\n";
  15568. return self;
  15569. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15570. },
  15571. args: [],
  15572. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  15573. referencedClasses: [],
  15574. messageSends: []
  15575. }),
  15576. $globals.String.klass);
  15577. $core.addMethod(
  15578. $core.method({
  15579. selector: "esc",
  15580. protocol: 'accessing',
  15581. fn: function (){
  15582. var self=this;
  15583. return $core.withContext(function($ctx1) {
  15584. return self._fromCharCode_((27));
  15585. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15586. },
  15587. args: [],
  15588. source: "esc\x0a\x09^ self fromCharCode: 27",
  15589. referencedClasses: [],
  15590. messageSends: ["fromCharCode:"]
  15591. }),
  15592. $globals.String.klass);
  15593. $core.addMethod(
  15594. $core.method({
  15595. selector: "fromCharCode:",
  15596. protocol: 'instance creation',
  15597. fn: function (anInteger){
  15598. var self=this;
  15599. return $core.withContext(function($ctx1) {
  15600. return String.fromCharCode(anInteger);
  15601. return self;
  15602. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15603. },
  15604. args: ["anInteger"],
  15605. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  15606. referencedClasses: [],
  15607. messageSends: []
  15608. }),
  15609. $globals.String.klass);
  15610. $core.addMethod(
  15611. $core.method({
  15612. selector: "fromString:",
  15613. protocol: 'instance creation',
  15614. fn: function (aString){
  15615. var self=this;
  15616. return $core.withContext(function($ctx1) {
  15617. return String(aString);
  15618. return self;
  15619. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15620. },
  15621. args: ["aString"],
  15622. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  15623. referencedClasses: [],
  15624. messageSends: []
  15625. }),
  15626. $globals.String.klass);
  15627. $core.addMethod(
  15628. $core.method({
  15629. selector: "lf",
  15630. protocol: 'accessing',
  15631. fn: function (){
  15632. var self=this;
  15633. return $core.withContext(function($ctx1) {
  15634. return "\n";
  15635. return self;
  15636. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15637. },
  15638. args: [],
  15639. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  15640. referencedClasses: [],
  15641. messageSends: []
  15642. }),
  15643. $globals.String.klass);
  15644. $core.addMethod(
  15645. $core.method({
  15646. selector: "random",
  15647. protocol: 'random',
  15648. fn: function (){
  15649. var self=this;
  15650. return $core.withContext(function($ctx1) {
  15651. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15652. return self;
  15653. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15654. },
  15655. args: [],
  15656. 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);'>",
  15657. referencedClasses: [],
  15658. messageSends: []
  15659. }),
  15660. $globals.String.klass);
  15661. $core.addMethod(
  15662. $core.method({
  15663. selector: "randomNotIn:",
  15664. protocol: 'random',
  15665. fn: function (aString){
  15666. var self=this;
  15667. var result;
  15668. return $core.withContext(function($ctx1) {
  15669. $recv((function(){
  15670. return $core.withContext(function($ctx2) {
  15671. result=self._random();
  15672. result;
  15673. return $recv(aString)._includesSubString_(result);
  15674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15675. }))._whileTrue();
  15676. return result;
  15677. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15678. },
  15679. args: ["aString"],
  15680. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15681. referencedClasses: [],
  15682. messageSends: ["whileTrue", "random", "includesSubString:"]
  15683. }),
  15684. $globals.String.klass);
  15685. $core.addMethod(
  15686. $core.method({
  15687. selector: "space",
  15688. protocol: 'accessing',
  15689. fn: function (){
  15690. var self=this;
  15691. return $core.withContext(function($ctx1) {
  15692. return " ";
  15693. return self;
  15694. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15695. },
  15696. args: [],
  15697. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  15698. referencedClasses: [],
  15699. messageSends: []
  15700. }),
  15701. $globals.String.klass);
  15702. $core.addMethod(
  15703. $core.method({
  15704. selector: "streamClass",
  15705. protocol: 'accessing',
  15706. fn: function (){
  15707. var self=this;
  15708. return $globals.StringStream;
  15709. },
  15710. args: [],
  15711. source: "streamClass\x0a\x09\x09^ StringStream",
  15712. referencedClasses: ["StringStream"],
  15713. messageSends: []
  15714. }),
  15715. $globals.String.klass);
  15716. $core.addMethod(
  15717. $core.method({
  15718. selector: "tab",
  15719. protocol: 'accessing',
  15720. fn: function (){
  15721. var self=this;
  15722. return $core.withContext(function($ctx1) {
  15723. return "\t";
  15724. return self;
  15725. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15726. },
  15727. args: [],
  15728. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  15729. referencedClasses: [],
  15730. messageSends: []
  15731. }),
  15732. $globals.String.klass);
  15733. $core.addMethod(
  15734. $core.method({
  15735. selector: "value:",
  15736. protocol: 'instance creation',
  15737. fn: function (aUTFCharCode){
  15738. var self=this;
  15739. return $core.withContext(function($ctx1) {
  15740. return String.fromCharCode(aUTFCharCode);;
  15741. return self;
  15742. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15743. },
  15744. args: ["aUTFCharCode"],
  15745. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  15746. referencedClasses: [],
  15747. messageSends: []
  15748. }),
  15749. $globals.String.klass);
  15750. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15751. $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`.";
  15752. $core.addMethod(
  15753. $core.method({
  15754. selector: "=",
  15755. protocol: 'comparing',
  15756. fn: function (aCollection){
  15757. var self=this;
  15758. return $core.withContext(function($ctx1) {
  15759. var $2,$1,$4,$3,$5;
  15760. var $early={};
  15761. try {
  15762. $2=self._class();
  15763. $ctx1.sendIdx["class"]=1;
  15764. $1=$recv($2).__eq($recv(aCollection)._class());
  15765. $ctx1.sendIdx["="]=1;
  15766. if(!$core.assert($1)){
  15767. return false;
  15768. }
  15769. $4=self._size();
  15770. $ctx1.sendIdx["size"]=1;
  15771. $3=$recv($4).__eq($recv(aCollection)._size());
  15772. if(!$core.assert($3)){
  15773. return false;
  15774. }
  15775. self._do_((function(each){
  15776. return $core.withContext(function($ctx2) {
  15777. $5=$recv(aCollection)._includes_(each);
  15778. if(!$core.assert($5)){
  15779. throw $early=[false];
  15780. }
  15781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15782. }));
  15783. return true;
  15784. }
  15785. catch(e) {if(e===$early)return e[0]; throw e}
  15786. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15787. },
  15788. args: ["aCollection"],
  15789. 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",
  15790. referencedClasses: [],
  15791. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15792. }),
  15793. $globals.Set);
  15794. $core.addMethod(
  15795. $core.method({
  15796. selector: "add:",
  15797. protocol: 'adding/removing',
  15798. fn: function (anObject){
  15799. var self=this;
  15800. var bucket;
  15801. return $core.withContext(function($ctx1) {
  15802. var $1,$receiver;
  15803. bucket=self._bucketsOfElement_(anObject);
  15804. $1=$recv(bucket)._second();
  15805. if(($receiver = $1) == null || $receiver.isNil){
  15806. var object,slowBucket;
  15807. object=$recv(bucket)._first();
  15808. $ctx1.sendIdx["first"]=1;
  15809. object;
  15810. slowBucket=$recv(bucket)._third();
  15811. slowBucket;
  15812. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15813. return $core.withContext(function($ctx2) {
  15814. $recv(slowBucket)._add_(object);
  15815. self["@size"]=$recv(self["@size"]).__plus((1));
  15816. return self["@size"];
  15817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15818. }));
  15819. return object;
  15820. } else {
  15821. var primitiveBucket;
  15822. primitiveBucket=$receiver;
  15823. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  15824. }
  15825. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15826. },
  15827. args: ["anObject"],
  15828. 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 ]",
  15829. referencedClasses: [],
  15830. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15831. }),
  15832. $globals.Set);
  15833. $core.addMethod(
  15834. $core.method({
  15835. selector: "add:in:",
  15836. protocol: 'private',
  15837. fn: function (anObject,anotherObject){
  15838. var self=this;
  15839. return $core.withContext(function($ctx1) {
  15840. if (anObject in anotherObject.store) { return false; }
  15841. self['@size']++;
  15842. anotherObject.store[anObject] = true;
  15843. return anObject;
  15844. ;
  15845. return self;
  15846. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15847. },
  15848. args: ["anObject", "anotherObject"],
  15849. 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'>",
  15850. referencedClasses: [],
  15851. messageSends: []
  15852. }),
  15853. $globals.Set);
  15854. $core.addMethod(
  15855. $core.method({
  15856. selector: "bucketsOfElement:",
  15857. protocol: 'private',
  15858. fn: function (anObject){
  15859. var self=this;
  15860. return $core.withContext(function($ctx1) {
  15861. // include nil to well-known objects under "boolean" fastBucket
  15862. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  15863. var prim = anObject.valueOf();
  15864. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  15865. var bucket = null;
  15866. self['@slowBucketStores'].some(function (store) {
  15867. return bucket = store._bucketOfElement_(anObject);
  15868. });
  15869. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15870. }
  15871. return [ prim, self['@fastBuckets'][typeof prim] ];
  15872. ;
  15873. return self;
  15874. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15875. },
  15876. args: ["anObject"],
  15877. 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'>",
  15878. referencedClasses: [],
  15879. messageSends: []
  15880. }),
  15881. $globals.Set);
  15882. $core.addMethod(
  15883. $core.method({
  15884. selector: "classNameOf:",
  15885. protocol: 'private',
  15886. fn: function (anObject){
  15887. var self=this;
  15888. return $core.withContext(function($ctx1) {
  15889. return anObject.klass != null && anObject.klass.className;
  15890. return self;
  15891. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15892. },
  15893. args: ["anObject"],
  15894. 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'>",
  15895. referencedClasses: [],
  15896. messageSends: []
  15897. }),
  15898. $globals.Set);
  15899. $core.addMethod(
  15900. $core.method({
  15901. selector: "collect:",
  15902. protocol: 'enumerating',
  15903. fn: function (aBlock){
  15904. var self=this;
  15905. var collection;
  15906. return $core.withContext(function($ctx1) {
  15907. collection=$recv(self._class())._new();
  15908. self._do_((function(each){
  15909. return $core.withContext(function($ctx2) {
  15910. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15912. }));
  15913. return collection;
  15914. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15915. },
  15916. args: ["aBlock"],
  15917. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15918. referencedClasses: [],
  15919. messageSends: ["new", "class", "do:", "add:", "value:"]
  15920. }),
  15921. $globals.Set);
  15922. $core.addMethod(
  15923. $core.method({
  15924. selector: "detect:ifNone:",
  15925. protocol: 'enumerating',
  15926. fn: function (aBlock,anotherBlock){
  15927. var self=this;
  15928. return $core.withContext(function($ctx1) {
  15929. var $1;
  15930. var $early={};
  15931. try {
  15932. self._do_((function(each){
  15933. return $core.withContext(function($ctx2) {
  15934. $1=$recv(aBlock)._value_(each);
  15935. if($core.assert($1)){
  15936. throw $early=[each];
  15937. }
  15938. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15939. }));
  15940. return $recv(anotherBlock)._value();
  15941. }
  15942. catch(e) {if(e===$early)return e[0]; throw e}
  15943. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15944. },
  15945. args: ["aBlock", "anotherBlock"],
  15946. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15947. referencedClasses: [],
  15948. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15949. }),
  15950. $globals.Set);
  15951. $core.addMethod(
  15952. $core.method({
  15953. selector: "do:",
  15954. protocol: 'enumerating',
  15955. fn: function (aBlock){
  15956. var self=this;
  15957. return $core.withContext(function($ctx1) {
  15958. var el, keys, i;
  15959. el = self['@fastBuckets'];
  15960. keys = Object.keys(el);
  15961. for (i = 0; i < keys.length; ++i) {
  15962. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15963. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15964. else { store._do_(aBlock); }
  15965. }
  15966. el = self['@slowBucketStores'];
  15967. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  15968. self['@defaultBucket']._do_(aBlock);
  15969. ;
  15970. return self;
  15971. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  15972. },
  15973. args: ["aBlock"],
  15974. 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'>",
  15975. referencedClasses: [],
  15976. messageSends: []
  15977. }),
  15978. $globals.Set);
  15979. $core.addMethod(
  15980. $core.method({
  15981. selector: "includes:",
  15982. protocol: 'testing',
  15983. fn: function (anObject){
  15984. var self=this;
  15985. var bucket;
  15986. return $core.withContext(function($ctx1) {
  15987. var $1,$2,$3,$receiver;
  15988. bucket=self._bucketsOfElement_(anObject);
  15989. $1=$recv(bucket)._second();
  15990. if(($receiver = $1) == null || $receiver.isNil){
  15991. $2=$recv(bucket)._third();
  15992. $3=$recv(bucket)._first();
  15993. $ctx1.sendIdx["first"]=1;
  15994. return $recv($2)._includes_($3);
  15995. } else {
  15996. var primitiveBucket;
  15997. primitiveBucket=$receiver;
  15998. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  15999. }
  16000. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  16001. },
  16002. args: ["anObject"],
  16003. 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 ]",
  16004. referencedClasses: [],
  16005. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  16006. }),
  16007. $globals.Set);
  16008. $core.addMethod(
  16009. $core.method({
  16010. selector: "includes:in:",
  16011. protocol: 'private',
  16012. fn: function (anObject,anotherObject){
  16013. var self=this;
  16014. return $core.withContext(function($ctx1) {
  16015. return anObject in anotherObject.store;
  16016. return self;
  16017. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16018. },
  16019. args: ["anObject", "anotherObject"],
  16020. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  16021. referencedClasses: [],
  16022. messageSends: []
  16023. }),
  16024. $globals.Set);
  16025. $core.addMethod(
  16026. $core.method({
  16027. selector: "initialize",
  16028. protocol: 'initialization',
  16029. fn: function (){
  16030. var self=this;
  16031. return $core.withContext(function($ctx1) {
  16032. (
  16033. $ctx1.supercall = true,
  16034. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  16035. $ctx1.supercall = false;
  16036. self["@defaultBucket"]=[];
  16037. self._initializeSlowBucketStores();
  16038. self._removeAll();
  16039. return self;
  16040. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  16041. },
  16042. args: [],
  16043. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  16044. referencedClasses: [],
  16045. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  16046. }),
  16047. $globals.Set);
  16048. $core.addMethod(
  16049. $core.method({
  16050. selector: "initializeSlowBucketStores",
  16051. protocol: 'initialization',
  16052. fn: function (){
  16053. var self=this;
  16054. return $core.withContext(function($ctx1) {
  16055. var $1;
  16056. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16057. return $core.withContext(function($ctx2) {
  16058. return self._classNameOf_(x);
  16059. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  16060. }));
  16061. $ctx1.sendIdx["hashBlock:"]=1;
  16062. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16063. return $core.withContext(function($ctx2) {
  16064. return self._jsConstructorNameOf_(x);
  16065. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  16066. }))];
  16067. return self;
  16068. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  16069. },
  16070. args: [],
  16071. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  16072. referencedClasses: ["ArrayBucketStore"],
  16073. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  16074. }),
  16075. $globals.Set);
  16076. $core.addMethod(
  16077. $core.method({
  16078. selector: "jsConstructorNameOf:",
  16079. protocol: 'private',
  16080. fn: function (anObject){
  16081. var self=this;
  16082. return $core.withContext(function($ctx1) {
  16083. return anObject.constructor && anObject.constructor.name;
  16084. return self;
  16085. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16086. },
  16087. args: ["anObject"],
  16088. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  16089. referencedClasses: [],
  16090. messageSends: []
  16091. }),
  16092. $globals.Set);
  16093. $core.addMethod(
  16094. $core.method({
  16095. selector: "printOn:",
  16096. protocol: 'printing',
  16097. fn: function (aStream){
  16098. var self=this;
  16099. return $core.withContext(function($ctx1) {
  16100. (
  16101. $ctx1.supercall = true,
  16102. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  16103. $ctx1.supercall = false;
  16104. $ctx1.sendIdx["printOn:"]=1;
  16105. $recv(aStream)._nextPutAll_(" (");
  16106. $ctx1.sendIdx["nextPutAll:"]=1;
  16107. self._do_separatedBy_((function(each){
  16108. return $core.withContext(function($ctx2) {
  16109. return $recv(each)._printOn_(aStream);
  16110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16111. }),(function(){
  16112. return $core.withContext(function($ctx2) {
  16113. return $recv(aStream)._nextPutAll_(" ");
  16114. $ctx2.sendIdx["nextPutAll:"]=2;
  16115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16116. }));
  16117. $recv(aStream)._nextPutAll_(")");
  16118. return self;
  16119. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16120. },
  16121. args: ["aStream"],
  16122. 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: ')'",
  16123. referencedClasses: [],
  16124. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16125. }),
  16126. $globals.Set);
  16127. $core.addMethod(
  16128. $core.method({
  16129. selector: "remove:ifAbsent:",
  16130. protocol: 'adding/removing',
  16131. fn: function (anObject,aBlock){
  16132. var self=this;
  16133. var bucket;
  16134. return $core.withContext(function($ctx1) {
  16135. var $1,$2,$3,$receiver;
  16136. var $early={};
  16137. try {
  16138. bucket=self._bucketsOfElement_(anObject);
  16139. $1=$recv(bucket)._second();
  16140. if(($receiver = $1) == null || $receiver.isNil){
  16141. $2=$recv(bucket)._third();
  16142. $3=$recv(bucket)._first();
  16143. $ctx1.sendIdx["first"]=1;
  16144. $recv($2)._remove_ifAbsent_($3,(function(){
  16145. return $core.withContext(function($ctx2) {
  16146. throw $early=[$recv(aBlock)._value()];
  16147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16148. }));
  16149. self["@size"]=$recv(self["@size"]).__minus((1));
  16150. return self["@size"];
  16151. } else {
  16152. var primitiveBucket;
  16153. primitiveBucket=$receiver;
  16154. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16155. }
  16156. }
  16157. catch(e) {if(e===$early)return e[0]; throw e}
  16158. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16159. },
  16160. args: ["anObject", "aBlock"],
  16161. 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 ]",
  16162. referencedClasses: [],
  16163. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16164. }),
  16165. $globals.Set);
  16166. $core.addMethod(
  16167. $core.method({
  16168. selector: "remove:in:",
  16169. protocol: 'private',
  16170. fn: function (anObject,anotherObject){
  16171. var self=this;
  16172. return $core.withContext(function($ctx1) {
  16173. if (delete anotherObject.store[anObject]) self['@size']--;
  16174. return self;
  16175. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16176. },
  16177. args: ["anObject", "anotherObject"],
  16178. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (delete anotherObject.store[anObject]) self[''@size'']--'>",
  16179. referencedClasses: [],
  16180. messageSends: []
  16181. }),
  16182. $globals.Set);
  16183. $core.addMethod(
  16184. $core.method({
  16185. selector: "removeAll",
  16186. protocol: 'adding/removing',
  16187. fn: function (){
  16188. var self=this;
  16189. return $core.withContext(function($ctx1) {
  16190. self['@fastBuckets'] = {
  16191. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  16192. "number": { store: Object.create(null), fn: Number },
  16193. "string": { store: Object.create(null) }
  16194. };
  16195. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16196. self['@defaultBucket']._removeAll();
  16197. self['@size'] = 0;
  16198. ;
  16199. return self;
  16200. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16201. },
  16202. args: [],
  16203. 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'>",
  16204. referencedClasses: [],
  16205. messageSends: []
  16206. }),
  16207. $globals.Set);
  16208. $core.addMethod(
  16209. $core.method({
  16210. selector: "select:",
  16211. protocol: 'enumerating',
  16212. fn: function (aBlock){
  16213. var self=this;
  16214. var collection;
  16215. return $core.withContext(function($ctx1) {
  16216. var $1;
  16217. collection=$recv(self._class())._new();
  16218. self._do_((function(each){
  16219. return $core.withContext(function($ctx2) {
  16220. $1=$recv(aBlock)._value_(each);
  16221. if($core.assert($1)){
  16222. return $recv(collection)._add_(each);
  16223. }
  16224. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16225. }));
  16226. return collection;
  16227. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16228. },
  16229. args: ["aBlock"],
  16230. 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",
  16231. referencedClasses: [],
  16232. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16233. }),
  16234. $globals.Set);
  16235. $core.addMethod(
  16236. $core.method({
  16237. selector: "size",
  16238. protocol: 'accessing',
  16239. fn: function (){
  16240. var self=this;
  16241. return self["@size"];
  16242. },
  16243. args: [],
  16244. source: "size\x0a\x09^ size",
  16245. referencedClasses: [],
  16246. messageSends: []
  16247. }),
  16248. $globals.Set);
  16249. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16250. $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.";
  16251. $core.addMethod(
  16252. $core.method({
  16253. selector: "<<",
  16254. protocol: 'writing',
  16255. fn: function (anObject){
  16256. var self=this;
  16257. return $core.withContext(function($ctx1) {
  16258. self._write_(anObject);
  16259. return self;
  16260. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16261. },
  16262. args: ["anObject"],
  16263. source: "<< anObject\x0a\x09self write: anObject",
  16264. referencedClasses: [],
  16265. messageSends: ["write:"]
  16266. }),
  16267. $globals.ProtoStream);
  16268. $core.addMethod(
  16269. $core.method({
  16270. selector: "atEnd",
  16271. protocol: 'testing',
  16272. fn: function (){
  16273. var self=this;
  16274. return $core.withContext(function($ctx1) {
  16275. self._subclassResponsibility();
  16276. return self;
  16277. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16278. },
  16279. args: [],
  16280. source: "atEnd\x0a\x09self subclassResponsibility",
  16281. referencedClasses: [],
  16282. messageSends: ["subclassResponsibility"]
  16283. }),
  16284. $globals.ProtoStream);
  16285. $core.addMethod(
  16286. $core.method({
  16287. selector: "atStart",
  16288. protocol: 'testing',
  16289. fn: function (){
  16290. var self=this;
  16291. return $core.withContext(function($ctx1) {
  16292. self._subclassResponsibility();
  16293. return self;
  16294. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16295. },
  16296. args: [],
  16297. source: "atStart\x0a\x09self subclassResponsibility",
  16298. referencedClasses: [],
  16299. messageSends: ["subclassResponsibility"]
  16300. }),
  16301. $globals.ProtoStream);
  16302. $core.addMethod(
  16303. $core.method({
  16304. selector: "contents",
  16305. protocol: 'accessing',
  16306. fn: function (){
  16307. var self=this;
  16308. return $core.withContext(function($ctx1) {
  16309. self._subclassResponsibility();
  16310. return self;
  16311. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16312. },
  16313. args: [],
  16314. source: "contents\x0a\x09self subclassResponsibility",
  16315. referencedClasses: [],
  16316. messageSends: ["subclassResponsibility"]
  16317. }),
  16318. $globals.ProtoStream);
  16319. $core.addMethod(
  16320. $core.method({
  16321. selector: "do:",
  16322. protocol: 'enumerating',
  16323. fn: function (aBlock){
  16324. var self=this;
  16325. return $core.withContext(function($ctx1) {
  16326. $recv((function(){
  16327. return $core.withContext(function($ctx2) {
  16328. return self._atEnd();
  16329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16330. }))._whileFalse_((function(){
  16331. return $core.withContext(function($ctx2) {
  16332. return $recv(aBlock)._value_(self._next());
  16333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16334. }));
  16335. return self;
  16336. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16337. },
  16338. args: ["aBlock"],
  16339. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16340. referencedClasses: [],
  16341. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16342. }),
  16343. $globals.ProtoStream);
  16344. $core.addMethod(
  16345. $core.method({
  16346. selector: "isEmpty",
  16347. protocol: 'testing',
  16348. fn: function (){
  16349. var self=this;
  16350. return $core.withContext(function($ctx1) {
  16351. return $recv(self._atStart())._and_((function(){
  16352. return $core.withContext(function($ctx2) {
  16353. return self._atEnd();
  16354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16355. }));
  16356. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16357. },
  16358. args: [],
  16359. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16360. referencedClasses: [],
  16361. messageSends: ["and:", "atStart", "atEnd"]
  16362. }),
  16363. $globals.ProtoStream);
  16364. $core.addMethod(
  16365. $core.method({
  16366. selector: "next",
  16367. protocol: 'reading',
  16368. fn: function (){
  16369. var self=this;
  16370. return $core.withContext(function($ctx1) {
  16371. var $1;
  16372. $1=self._atEnd();
  16373. if($core.assert($1)){
  16374. return nil;
  16375. } else {
  16376. return self._subclassResponsibility();
  16377. }
  16378. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16379. },
  16380. args: [],
  16381. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16382. referencedClasses: [],
  16383. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16384. }),
  16385. $globals.ProtoStream);
  16386. $core.addMethod(
  16387. $core.method({
  16388. selector: "nextPut:",
  16389. protocol: 'writing',
  16390. fn: function (anObject){
  16391. var self=this;
  16392. return $core.withContext(function($ctx1) {
  16393. self._subclassResponsibility();
  16394. return self;
  16395. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16396. },
  16397. args: ["anObject"],
  16398. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16399. referencedClasses: [],
  16400. messageSends: ["subclassResponsibility"]
  16401. }),
  16402. $globals.ProtoStream);
  16403. $core.addMethod(
  16404. $core.method({
  16405. selector: "nextPutAll:",
  16406. protocol: 'writing',
  16407. fn: function (aCollection){
  16408. var self=this;
  16409. return $core.withContext(function($ctx1) {
  16410. $recv(aCollection)._do_((function(each){
  16411. return $core.withContext(function($ctx2) {
  16412. return self._nextPut_(each);
  16413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16414. }));
  16415. return self;
  16416. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16417. },
  16418. args: ["aCollection"],
  16419. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16420. referencedClasses: [],
  16421. messageSends: ["do:", "nextPut:"]
  16422. }),
  16423. $globals.ProtoStream);
  16424. $core.addMethod(
  16425. $core.method({
  16426. selector: "nextPutJSObject:",
  16427. protocol: 'writing',
  16428. fn: function (aJSObject){
  16429. var self=this;
  16430. return $core.withContext(function($ctx1) {
  16431. self._nextPut_(aJSObject);
  16432. return self;
  16433. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16434. },
  16435. args: ["aJSObject"],
  16436. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16437. referencedClasses: [],
  16438. messageSends: ["nextPut:"]
  16439. }),
  16440. $globals.ProtoStream);
  16441. $core.addMethod(
  16442. $core.method({
  16443. selector: "nextPutString:",
  16444. protocol: 'writing',
  16445. fn: function (aString){
  16446. var self=this;
  16447. return $core.withContext(function($ctx1) {
  16448. self._nextPut_(aString);
  16449. return self;
  16450. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16451. },
  16452. args: ["aString"],
  16453. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16454. referencedClasses: [],
  16455. messageSends: ["nextPut:"]
  16456. }),
  16457. $globals.ProtoStream);
  16458. $core.addMethod(
  16459. $core.method({
  16460. selector: "peek",
  16461. protocol: 'reading',
  16462. fn: function (){
  16463. var self=this;
  16464. return $core.withContext(function($ctx1) {
  16465. var $1;
  16466. $1=self._atEnd();
  16467. if($core.assert($1)){
  16468. return nil;
  16469. } else {
  16470. return self._subclassResponsibility();
  16471. }
  16472. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16473. },
  16474. args: [],
  16475. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16476. referencedClasses: [],
  16477. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16478. }),
  16479. $globals.ProtoStream);
  16480. $core.addMethod(
  16481. $core.method({
  16482. selector: "reset",
  16483. protocol: 'actions',
  16484. fn: function (){
  16485. var self=this;
  16486. return $core.withContext(function($ctx1) {
  16487. self._subclassResponsibility();
  16488. return self;
  16489. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16490. },
  16491. args: [],
  16492. source: "reset\x0a\x09self subclassResponsibility",
  16493. referencedClasses: [],
  16494. messageSends: ["subclassResponsibility"]
  16495. }),
  16496. $globals.ProtoStream);
  16497. $core.addMethod(
  16498. $core.method({
  16499. selector: "resetContents",
  16500. protocol: 'actions',
  16501. fn: function (){
  16502. var self=this;
  16503. return $core.withContext(function($ctx1) {
  16504. self._subclassResponsibility();
  16505. return self;
  16506. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16507. },
  16508. args: [],
  16509. source: "resetContents\x0a\x09self subclassResponsibility",
  16510. referencedClasses: [],
  16511. messageSends: ["subclassResponsibility"]
  16512. }),
  16513. $globals.ProtoStream);
  16514. $core.addMethod(
  16515. $core.method({
  16516. selector: "setToEnd",
  16517. protocol: 'positioning',
  16518. fn: function (){
  16519. var self=this;
  16520. return $core.withContext(function($ctx1) {
  16521. self._subclassResponsibility();
  16522. return self;
  16523. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16524. },
  16525. args: [],
  16526. source: "setToEnd\x0a\x09self subclassResponsibility",
  16527. referencedClasses: [],
  16528. messageSends: ["subclassResponsibility"]
  16529. }),
  16530. $globals.ProtoStream);
  16531. $core.addMethod(
  16532. $core.method({
  16533. selector: "setToStart",
  16534. protocol: 'positioning',
  16535. fn: function (){
  16536. var self=this;
  16537. return $core.withContext(function($ctx1) {
  16538. self._reset();
  16539. return self;
  16540. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16541. },
  16542. args: [],
  16543. source: "setToStart\x0a\x09self reset",
  16544. referencedClasses: [],
  16545. messageSends: ["reset"]
  16546. }),
  16547. $globals.ProtoStream);
  16548. $core.addMethod(
  16549. $core.method({
  16550. selector: "write:",
  16551. protocol: 'writing',
  16552. fn: function (anObject){
  16553. var self=this;
  16554. return $core.withContext(function($ctx1) {
  16555. $recv(anObject)._putOn_(self);
  16556. return self;
  16557. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16558. },
  16559. args: ["anObject"],
  16560. source: "write: anObject\x0a\x09anObject putOn: self",
  16561. referencedClasses: [],
  16562. messageSends: ["putOn:"]
  16563. }),
  16564. $globals.ProtoStream);
  16565. $core.addMethod(
  16566. $core.method({
  16567. selector: "on:",
  16568. protocol: 'instance creation',
  16569. fn: function (aCollection){
  16570. var self=this;
  16571. return $core.withContext(function($ctx1) {
  16572. var $1;
  16573. $1=self._new();
  16574. $recv($1)._setCollection_(aCollection);
  16575. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16576. return $recv($1)._yourself();
  16577. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16578. },
  16579. args: ["aCollection"],
  16580. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16581. referencedClasses: [],
  16582. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16583. }),
  16584. $globals.ProtoStream.klass);
  16585. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16586. $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.";
  16587. $core.addMethod(
  16588. $core.method({
  16589. selector: "atEnd",
  16590. protocol: 'testing',
  16591. fn: function (){
  16592. var self=this;
  16593. return $core.withContext(function($ctx1) {
  16594. return $recv(self._position()).__eq(self._size());
  16595. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16596. },
  16597. args: [],
  16598. source: "atEnd\x0a\x09^ self position = self size",
  16599. referencedClasses: [],
  16600. messageSends: ["=", "position", "size"]
  16601. }),
  16602. $globals.Stream);
  16603. $core.addMethod(
  16604. $core.method({
  16605. selector: "atStart",
  16606. protocol: 'testing',
  16607. fn: function (){
  16608. var self=this;
  16609. return $core.withContext(function($ctx1) {
  16610. return $recv(self._position()).__eq((0));
  16611. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16612. },
  16613. args: [],
  16614. source: "atStart\x0a\x09^ self position = 0",
  16615. referencedClasses: [],
  16616. messageSends: ["=", "position"]
  16617. }),
  16618. $globals.Stream);
  16619. $core.addMethod(
  16620. $core.method({
  16621. selector: "close",
  16622. protocol: 'actions',
  16623. fn: function (){
  16624. var self=this;
  16625. return self;
  16626. },
  16627. args: [],
  16628. source: "close",
  16629. referencedClasses: [],
  16630. messageSends: []
  16631. }),
  16632. $globals.Stream);
  16633. $core.addMethod(
  16634. $core.method({
  16635. selector: "collection",
  16636. protocol: 'accessing',
  16637. fn: function (){
  16638. var self=this;
  16639. return self["@collection"];
  16640. },
  16641. args: [],
  16642. source: "collection\x0a\x09^ collection",
  16643. referencedClasses: [],
  16644. messageSends: []
  16645. }),
  16646. $globals.Stream);
  16647. $core.addMethod(
  16648. $core.method({
  16649. selector: "contents",
  16650. protocol: 'accessing',
  16651. fn: function (){
  16652. var self=this;
  16653. return $core.withContext(function($ctx1) {
  16654. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16655. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16656. },
  16657. args: [],
  16658. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16659. referencedClasses: [],
  16660. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16661. }),
  16662. $globals.Stream);
  16663. $core.addMethod(
  16664. $core.method({
  16665. selector: "flush",
  16666. protocol: 'actions',
  16667. fn: function (){
  16668. var self=this;
  16669. return self;
  16670. },
  16671. args: [],
  16672. source: "flush",
  16673. referencedClasses: [],
  16674. messageSends: []
  16675. }),
  16676. $globals.Stream);
  16677. $core.addMethod(
  16678. $core.method({
  16679. selector: "isEmpty",
  16680. protocol: 'testing',
  16681. fn: function (){
  16682. var self=this;
  16683. return $core.withContext(function($ctx1) {
  16684. return $recv(self._size()).__eq((0));
  16685. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16686. },
  16687. args: [],
  16688. source: "isEmpty\x0a\x09^ self size = 0",
  16689. referencedClasses: [],
  16690. messageSends: ["=", "size"]
  16691. }),
  16692. $globals.Stream);
  16693. $core.addMethod(
  16694. $core.method({
  16695. selector: "next",
  16696. protocol: 'reading',
  16697. fn: function (){
  16698. var self=this;
  16699. return $core.withContext(function($ctx1) {
  16700. var $1,$3,$2;
  16701. $1=self._atEnd();
  16702. if($core.assert($1)){
  16703. return nil;
  16704. } else {
  16705. $3=self._position();
  16706. $ctx1.sendIdx["position"]=1;
  16707. $2=$recv($3).__plus((1));
  16708. self._position_($2);
  16709. return $recv(self["@collection"])._at_(self._position());
  16710. }
  16711. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16712. },
  16713. args: [],
  16714. 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 ]",
  16715. referencedClasses: [],
  16716. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16717. }),
  16718. $globals.Stream);
  16719. $core.addMethod(
  16720. $core.method({
  16721. selector: "next:",
  16722. protocol: 'reading',
  16723. fn: function (anInteger){
  16724. var self=this;
  16725. var tempCollection;
  16726. return $core.withContext(function($ctx1) {
  16727. var $1;
  16728. tempCollection=$recv($recv(self._collection())._class())._new();
  16729. $recv(anInteger)._timesRepeat_((function(){
  16730. return $core.withContext(function($ctx2) {
  16731. $1=self._atEnd();
  16732. if(!$core.assert($1)){
  16733. return $recv(tempCollection)._add_(self._next());
  16734. }
  16735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16736. }));
  16737. return tempCollection;
  16738. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16739. },
  16740. args: ["anInteger"],
  16741. 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",
  16742. referencedClasses: [],
  16743. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16744. }),
  16745. $globals.Stream);
  16746. $core.addMethod(
  16747. $core.method({
  16748. selector: "nextPut:",
  16749. protocol: 'writing',
  16750. fn: function (anObject){
  16751. var self=this;
  16752. return $core.withContext(function($ctx1) {
  16753. var $2,$1,$3,$4;
  16754. $2=self._position();
  16755. $ctx1.sendIdx["position"]=1;
  16756. $1=$recv($2).__plus((1));
  16757. self._position_($1);
  16758. $3=self._collection();
  16759. $4=self._position();
  16760. $ctx1.sendIdx["position"]=2;
  16761. $recv($3)._at_put_($4,anObject);
  16762. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16763. return self;
  16764. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16765. },
  16766. args: ["anObject"],
  16767. 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)",
  16768. referencedClasses: [],
  16769. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16770. }),
  16771. $globals.Stream);
  16772. $core.addMethod(
  16773. $core.method({
  16774. selector: "peek",
  16775. protocol: 'reading',
  16776. fn: function (){
  16777. var self=this;
  16778. return $core.withContext(function($ctx1) {
  16779. var $1;
  16780. $1=self._atEnd();
  16781. if(!$core.assert($1)){
  16782. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16783. }
  16784. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16785. },
  16786. args: [],
  16787. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16788. referencedClasses: [],
  16789. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16790. }),
  16791. $globals.Stream);
  16792. $core.addMethod(
  16793. $core.method({
  16794. selector: "position",
  16795. protocol: 'accessing',
  16796. fn: function (){
  16797. var self=this;
  16798. return $core.withContext(function($ctx1) {
  16799. var $1,$receiver;
  16800. $1=self["@position"];
  16801. if(($receiver = $1) == null || $receiver.isNil){
  16802. self["@position"]=(0);
  16803. return self["@position"];
  16804. } else {
  16805. return $1;
  16806. }
  16807. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16808. },
  16809. args: [],
  16810. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16811. referencedClasses: [],
  16812. messageSends: ["ifNil:"]
  16813. }),
  16814. $globals.Stream);
  16815. $core.addMethod(
  16816. $core.method({
  16817. selector: "position:",
  16818. protocol: 'accessing',
  16819. fn: function (anInteger){
  16820. var self=this;
  16821. self["@position"]=anInteger;
  16822. return self;
  16823. },
  16824. args: ["anInteger"],
  16825. source: "position: anInteger\x0a\x09position := anInteger",
  16826. referencedClasses: [],
  16827. messageSends: []
  16828. }),
  16829. $globals.Stream);
  16830. $core.addMethod(
  16831. $core.method({
  16832. selector: "reset",
  16833. protocol: 'actions',
  16834. fn: function (){
  16835. var self=this;
  16836. return $core.withContext(function($ctx1) {
  16837. self._position_((0));
  16838. return self;
  16839. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16840. },
  16841. args: [],
  16842. source: "reset\x0a\x09self position: 0",
  16843. referencedClasses: [],
  16844. messageSends: ["position:"]
  16845. }),
  16846. $globals.Stream);
  16847. $core.addMethod(
  16848. $core.method({
  16849. selector: "resetContents",
  16850. protocol: 'actions',
  16851. fn: function (){
  16852. var self=this;
  16853. return $core.withContext(function($ctx1) {
  16854. self._reset();
  16855. self._setStreamSize_((0));
  16856. return self;
  16857. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16858. },
  16859. args: [],
  16860. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16861. referencedClasses: [],
  16862. messageSends: ["reset", "setStreamSize:"]
  16863. }),
  16864. $globals.Stream);
  16865. $core.addMethod(
  16866. $core.method({
  16867. selector: "setCollection:",
  16868. protocol: 'accessing',
  16869. fn: function (aCollection){
  16870. var self=this;
  16871. self["@collection"]=aCollection;
  16872. return self;
  16873. },
  16874. args: ["aCollection"],
  16875. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16876. referencedClasses: [],
  16877. messageSends: []
  16878. }),
  16879. $globals.Stream);
  16880. $core.addMethod(
  16881. $core.method({
  16882. selector: "setStreamSize:",
  16883. protocol: 'accessing',
  16884. fn: function (anInteger){
  16885. var self=this;
  16886. self["@streamSize"]=anInteger;
  16887. return self;
  16888. },
  16889. args: ["anInteger"],
  16890. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16891. referencedClasses: [],
  16892. messageSends: []
  16893. }),
  16894. $globals.Stream);
  16895. $core.addMethod(
  16896. $core.method({
  16897. selector: "setToEnd",
  16898. protocol: 'positioning',
  16899. fn: function (){
  16900. var self=this;
  16901. return $core.withContext(function($ctx1) {
  16902. self._position_(self._size());
  16903. return self;
  16904. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16905. },
  16906. args: [],
  16907. source: "setToEnd\x0a\x09self position: self size",
  16908. referencedClasses: [],
  16909. messageSends: ["position:", "size"]
  16910. }),
  16911. $globals.Stream);
  16912. $core.addMethod(
  16913. $core.method({
  16914. selector: "size",
  16915. protocol: 'accessing',
  16916. fn: function (){
  16917. var self=this;
  16918. return $core.withContext(function($ctx1) {
  16919. return self._streamSize();
  16920. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16921. },
  16922. args: [],
  16923. source: "size\x0a\x09^ self streamSize",
  16924. referencedClasses: [],
  16925. messageSends: ["streamSize"]
  16926. }),
  16927. $globals.Stream);
  16928. $core.addMethod(
  16929. $core.method({
  16930. selector: "skip:",
  16931. protocol: 'positioning',
  16932. fn: function (anInteger){
  16933. var self=this;
  16934. return $core.withContext(function($ctx1) {
  16935. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16936. return self;
  16937. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16938. },
  16939. args: ["anInteger"],
  16940. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16941. referencedClasses: [],
  16942. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16943. }),
  16944. $globals.Stream);
  16945. $core.addMethod(
  16946. $core.method({
  16947. selector: "streamSize",
  16948. protocol: 'accessing',
  16949. fn: function (){
  16950. var self=this;
  16951. return self["@streamSize"];
  16952. },
  16953. args: [],
  16954. source: "streamSize\x0a\x09^ streamSize",
  16955. referencedClasses: [],
  16956. messageSends: []
  16957. }),
  16958. $globals.Stream);
  16959. $core.addMethod(
  16960. $core.method({
  16961. selector: "on:",
  16962. protocol: 'instance creation',
  16963. fn: function (aCollection){
  16964. var self=this;
  16965. return $core.withContext(function($ctx1) {
  16966. var $1;
  16967. $1=self._new();
  16968. $recv($1)._setCollection_(aCollection);
  16969. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16970. return $recv($1)._yourself();
  16971. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  16972. },
  16973. args: ["aCollection"],
  16974. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16975. referencedClasses: [],
  16976. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16977. }),
  16978. $globals.Stream.klass);
  16979. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  16980. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  16981. $core.addMethod(
  16982. $core.method({
  16983. selector: "cr",
  16984. protocol: 'writing',
  16985. fn: function (){
  16986. var self=this;
  16987. return $core.withContext(function($ctx1) {
  16988. return self._nextPutAll_($recv($globals.String)._cr());
  16989. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  16990. },
  16991. args: [],
  16992. source: "cr\x0a\x09^ self nextPutAll: String cr",
  16993. referencedClasses: ["String"],
  16994. messageSends: ["nextPutAll:", "cr"]
  16995. }),
  16996. $globals.StringStream);
  16997. $core.addMethod(
  16998. $core.method({
  16999. selector: "crlf",
  17000. protocol: 'writing',
  17001. fn: function (){
  17002. var self=this;
  17003. return $core.withContext(function($ctx1) {
  17004. return self._nextPutAll_($recv($globals.String)._crlf());
  17005. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  17006. },
  17007. args: [],
  17008. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  17009. referencedClasses: ["String"],
  17010. messageSends: ["nextPutAll:", "crlf"]
  17011. }),
  17012. $globals.StringStream);
  17013. $core.addMethod(
  17014. $core.method({
  17015. selector: "lf",
  17016. protocol: 'writing',
  17017. fn: function (){
  17018. var self=this;
  17019. return $core.withContext(function($ctx1) {
  17020. return self._nextPutAll_($recv($globals.String)._lf());
  17021. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  17022. },
  17023. args: [],
  17024. source: "lf\x0a\x09^ self nextPutAll: String lf",
  17025. referencedClasses: ["String"],
  17026. messageSends: ["nextPutAll:", "lf"]
  17027. }),
  17028. $globals.StringStream);
  17029. $core.addMethod(
  17030. $core.method({
  17031. selector: "next:",
  17032. protocol: 'reading',
  17033. fn: function (anInteger){
  17034. var self=this;
  17035. var tempCollection;
  17036. return $core.withContext(function($ctx1) {
  17037. var $1;
  17038. tempCollection=$recv($recv(self._collection())._class())._new();
  17039. $recv(anInteger)._timesRepeat_((function(){
  17040. return $core.withContext(function($ctx2) {
  17041. $1=self._atEnd();
  17042. if(!$core.assert($1)){
  17043. tempCollection=$recv(tempCollection).__comma(self._next());
  17044. return tempCollection;
  17045. }
  17046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17047. }));
  17048. return tempCollection;
  17049. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17050. },
  17051. args: ["anInteger"],
  17052. 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",
  17053. referencedClasses: [],
  17054. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17055. }),
  17056. $globals.StringStream);
  17057. $core.addMethod(
  17058. $core.method({
  17059. selector: "nextPut:",
  17060. protocol: 'writing',
  17061. fn: function (aString){
  17062. var self=this;
  17063. return $core.withContext(function($ctx1) {
  17064. self._nextPutAll_(aString);
  17065. return self;
  17066. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17067. },
  17068. args: ["aString"],
  17069. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17070. referencedClasses: [],
  17071. messageSends: ["nextPutAll:"]
  17072. }),
  17073. $globals.StringStream);
  17074. $core.addMethod(
  17075. $core.method({
  17076. selector: "nextPutAll:",
  17077. protocol: 'writing',
  17078. fn: function (aString){
  17079. var self=this;
  17080. var pre,post;
  17081. return $core.withContext(function($ctx1) {
  17082. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17083. $1=self._atEnd();
  17084. if($core.assert($1)){
  17085. $3=self._collection();
  17086. $ctx1.sendIdx["collection"]=1;
  17087. $2=$recv($3).__comma(aString);
  17088. $ctx1.sendIdx[","]=1;
  17089. self._setCollection_($2);
  17090. $ctx1.sendIdx["setCollection:"]=1;
  17091. } else {
  17092. $4=self._collection();
  17093. $ctx1.sendIdx["collection"]=2;
  17094. $5=self._position();
  17095. $ctx1.sendIdx["position"]=1;
  17096. pre=$recv($4)._copyFrom_to_((1),$5);
  17097. $ctx1.sendIdx["copyFrom:to:"]=1;
  17098. pre;
  17099. $6=self._collection();
  17100. $ctx1.sendIdx["collection"]=3;
  17101. $9=self._position();
  17102. $ctx1.sendIdx["position"]=2;
  17103. $8=$recv($9).__plus((1));
  17104. $ctx1.sendIdx["+"]=2;
  17105. $10=$recv(aString)._size();
  17106. $ctx1.sendIdx["size"]=1;
  17107. $7=$recv($8).__plus($10);
  17108. $ctx1.sendIdx["+"]=1;
  17109. $11=$recv(self._collection())._size();
  17110. $ctx1.sendIdx["size"]=2;
  17111. post=$recv($6)._copyFrom_to_($7,$11);
  17112. post;
  17113. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17114. $ctx1.sendIdx[","]=2;
  17115. self._setCollection_($12);
  17116. }
  17117. $14=self._position();
  17118. $ctx1.sendIdx["position"]=3;
  17119. $13=$recv($14).__plus($recv(aString)._size());
  17120. self._position_($13);
  17121. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17122. return self;
  17123. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17124. },
  17125. args: ["aString"],
  17126. 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)",
  17127. referencedClasses: [],
  17128. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17129. }),
  17130. $globals.StringStream);
  17131. $core.addMethod(
  17132. $core.method({
  17133. selector: "nextPutString:",
  17134. protocol: 'writing',
  17135. fn: function (aString){
  17136. var self=this;
  17137. return $core.withContext(function($ctx1) {
  17138. self._nextPutAll_(aString);
  17139. return self;
  17140. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17141. },
  17142. args: ["aString"],
  17143. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17144. referencedClasses: [],
  17145. messageSends: ["nextPutAll:"]
  17146. }),
  17147. $globals.StringStream);
  17148. $core.addMethod(
  17149. $core.method({
  17150. selector: "space",
  17151. protocol: 'writing',
  17152. fn: function (){
  17153. var self=this;
  17154. return $core.withContext(function($ctx1) {
  17155. self._nextPut_(" ");
  17156. return self;
  17157. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17158. },
  17159. args: [],
  17160. source: "space\x0a\x09self nextPut: ' '",
  17161. referencedClasses: [],
  17162. messageSends: ["nextPut:"]
  17163. }),
  17164. $globals.StringStream);
  17165. $core.addMethod(
  17166. $core.method({
  17167. selector: "tab",
  17168. protocol: 'writing',
  17169. fn: function (){
  17170. var self=this;
  17171. return $core.withContext(function($ctx1) {
  17172. return self._nextPutAll_($recv($globals.String)._tab());
  17173. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17174. },
  17175. args: [],
  17176. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17177. referencedClasses: ["String"],
  17178. messageSends: ["nextPutAll:", "tab"]
  17179. }),
  17180. $globals.StringStream);
  17181. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17182. $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.";
  17183. $core.addMethod(
  17184. $core.method({
  17185. selector: "initialize",
  17186. protocol: 'initialization',
  17187. fn: function (){
  17188. var self=this;
  17189. return $core.withContext(function($ctx1) {
  17190. (
  17191. $ctx1.supercall = true,
  17192. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  17193. $ctx1.supercall = false;
  17194. self["@read"]=$recv($globals.OrderedCollection)._new();
  17195. $ctx1.sendIdx["new"]=1;
  17196. self["@write"]=$recv($globals.OrderedCollection)._new();
  17197. self["@readIndex"]=(1);
  17198. return self;
  17199. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17200. },
  17201. args: [],
  17202. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17203. referencedClasses: ["OrderedCollection"],
  17204. messageSends: ["initialize", "new"]
  17205. }),
  17206. $globals.Queue);
  17207. $core.addMethod(
  17208. $core.method({
  17209. selector: "next",
  17210. protocol: 'accessing',
  17211. fn: function (){
  17212. var self=this;
  17213. return $core.withContext(function($ctx1) {
  17214. return self._nextIfAbsent_((function(){
  17215. return $core.withContext(function($ctx2) {
  17216. return self._error_("Cannot read from empty Queue.");
  17217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17218. }));
  17219. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17220. },
  17221. args: [],
  17222. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17223. referencedClasses: [],
  17224. messageSends: ["nextIfAbsent:", "error:"]
  17225. }),
  17226. $globals.Queue);
  17227. $core.addMethod(
  17228. $core.method({
  17229. selector: "nextIfAbsent:",
  17230. protocol: 'accessing',
  17231. fn: function (aBlock){
  17232. var self=this;
  17233. var result;
  17234. return $core.withContext(function($ctx1) {
  17235. var $1;
  17236. var $early={};
  17237. try {
  17238. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17239. return $core.withContext(function($ctx2) {
  17240. $recv(self["@write"])._ifEmpty_((function(){
  17241. return $core.withContext(function($ctx3) {
  17242. $1=$recv(self["@readIndex"]).__gt((1));
  17243. if($core.assert($1)){
  17244. self["@read"]=[];
  17245. self["@read"];
  17246. self["@readIndex"]=(1);
  17247. self["@readIndex"];
  17248. }
  17249. throw $early=[$recv(aBlock)._value()];
  17250. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17251. }));
  17252. self["@read"]=self["@write"];
  17253. self["@read"];
  17254. self["@readIndex"]=(1);
  17255. self["@readIndex"];
  17256. self["@write"]=$recv($globals.OrderedCollection)._new();
  17257. self["@write"];
  17258. return $recv(self["@read"])._first();
  17259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17260. }));
  17261. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17262. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17263. return result;
  17264. }
  17265. catch(e) {if(e===$early)return e[0]; throw e}
  17266. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17267. },
  17268. args: ["aBlock"],
  17269. 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",
  17270. referencedClasses: ["OrderedCollection"],
  17271. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  17272. }),
  17273. $globals.Queue);
  17274. $core.addMethod(
  17275. $core.method({
  17276. selector: "nextPut:",
  17277. protocol: 'accessing',
  17278. fn: function (anObject){
  17279. var self=this;
  17280. return $core.withContext(function($ctx1) {
  17281. $recv(self["@write"])._add_(anObject);
  17282. return self;
  17283. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17284. },
  17285. args: ["anObject"],
  17286. source: "nextPut: anObject\x0a\x09write add: anObject",
  17287. referencedClasses: [],
  17288. messageSends: ["add:"]
  17289. }),
  17290. $globals.Queue);
  17291. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17292. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17293. $core.addMethod(
  17294. $core.method({
  17295. selector: "compile:",
  17296. protocol: 'evaluating',
  17297. fn: function (aString){
  17298. var self=this;
  17299. return $core.withContext(function($ctx1) {
  17300. return self.compile(aString);
  17301. return self;
  17302. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17303. },
  17304. args: ["aString"],
  17305. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  17306. referencedClasses: [],
  17307. messageSends: []
  17308. }),
  17309. $globals.RegularExpression);
  17310. $core.addMethod(
  17311. $core.method({
  17312. selector: "exec:",
  17313. protocol: 'evaluating',
  17314. fn: function (aString){
  17315. var self=this;
  17316. return $core.withContext(function($ctx1) {
  17317. return self.exec(aString) || nil;
  17318. return self;
  17319. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17320. },
  17321. args: ["aString"],
  17322. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  17323. referencedClasses: [],
  17324. messageSends: []
  17325. }),
  17326. $globals.RegularExpression);
  17327. $core.addMethod(
  17328. $core.method({
  17329. selector: "test:",
  17330. protocol: 'evaluating',
  17331. fn: function (aString){
  17332. var self=this;
  17333. return $core.withContext(function($ctx1) {
  17334. return self.test(aString);
  17335. return self;
  17336. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17337. },
  17338. args: ["aString"],
  17339. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  17340. referencedClasses: [],
  17341. messageSends: []
  17342. }),
  17343. $globals.RegularExpression);
  17344. $core.addMethod(
  17345. $core.method({
  17346. selector: "fromString:",
  17347. protocol: 'instance creation',
  17348. fn: function (aString){
  17349. var self=this;
  17350. return $core.withContext(function($ctx1) {
  17351. return self._fromString_flag_(aString,"");
  17352. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17353. },
  17354. args: ["aString"],
  17355. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17356. referencedClasses: [],
  17357. messageSends: ["fromString:flag:"]
  17358. }),
  17359. $globals.RegularExpression.klass);
  17360. $core.addMethod(
  17361. $core.method({
  17362. selector: "fromString:flag:",
  17363. protocol: 'instance creation',
  17364. fn: function (aString,anotherString){
  17365. var self=this;
  17366. return $core.withContext(function($ctx1) {
  17367. return new RegExp(aString, anotherString);
  17368. return self;
  17369. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17370. },
  17371. args: ["aString", "anotherString"],
  17372. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  17373. referencedClasses: [],
  17374. messageSends: []
  17375. }),
  17376. $globals.RegularExpression.klass);
  17377. });
  17378. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17379. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  17380. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17381. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  17382. $core.addPackage('Kernel-Dag');
  17383. $core.packages["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  17384. $core.packages["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17385. $core.addClass('AbstractDagVisitor', $globals.Object, [], 'Kernel-Dag');
  17386. $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:`.";
  17387. $core.addMethod(
  17388. $core.method({
  17389. selector: "value:",
  17390. protocol: 'evaluating',
  17391. fn: function (anObject){
  17392. var self=this;
  17393. return $core.withContext(function($ctx1) {
  17394. return self._visit_(anObject);
  17395. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  17396. },
  17397. args: ["anObject"],
  17398. source: "value: anObject\x0a\x09^ self visit: anObject",
  17399. referencedClasses: [],
  17400. messageSends: ["visit:"]
  17401. }),
  17402. $globals.AbstractDagVisitor);
  17403. $core.addMethod(
  17404. $core.method({
  17405. selector: "visit:",
  17406. protocol: 'visiting',
  17407. fn: function (aNode){
  17408. var self=this;
  17409. return $core.withContext(function($ctx1) {
  17410. return $recv(aNode)._acceptDagVisitor_(self);
  17411. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  17412. },
  17413. args: ["aNode"],
  17414. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  17415. referencedClasses: [],
  17416. messageSends: ["acceptDagVisitor:"]
  17417. }),
  17418. $globals.AbstractDagVisitor);
  17419. $core.addMethod(
  17420. $core.method({
  17421. selector: "visitAll:",
  17422. protocol: 'visiting',
  17423. fn: function (aCollection){
  17424. var self=this;
  17425. return $core.withContext(function($ctx1) {
  17426. return $recv(aCollection)._collect_((function(each){
  17427. return $core.withContext(function($ctx2) {
  17428. return self._visit_(each);
  17429. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17430. }));
  17431. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  17432. },
  17433. args: ["aCollection"],
  17434. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  17435. referencedClasses: [],
  17436. messageSends: ["collect:", "visit:"]
  17437. }),
  17438. $globals.AbstractDagVisitor);
  17439. $core.addMethod(
  17440. $core.method({
  17441. selector: "visitAllChildren:",
  17442. protocol: 'visiting',
  17443. fn: function (aDagNode){
  17444. var self=this;
  17445. return $core.withContext(function($ctx1) {
  17446. return self._visitAll_($recv(aDagNode)._dagChildren());
  17447. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  17448. },
  17449. args: ["aDagNode"],
  17450. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  17451. referencedClasses: [],
  17452. messageSends: ["visitAll:", "dagChildren"]
  17453. }),
  17454. $globals.AbstractDagVisitor);
  17455. $core.addMethod(
  17456. $core.method({
  17457. selector: "visitDagNode:",
  17458. protocol: 'visiting',
  17459. fn: function (aNode){
  17460. var self=this;
  17461. return $core.withContext(function($ctx1) {
  17462. self._subclassResponsibility();
  17463. return self;
  17464. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  17465. },
  17466. args: ["aNode"],
  17467. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  17468. referencedClasses: [],
  17469. messageSends: ["subclassResponsibility"]
  17470. }),
  17471. $globals.AbstractDagVisitor);
  17472. $core.addMethod(
  17473. $core.method({
  17474. selector: "visitDagNodeVariantRedux:",
  17475. protocol: 'visiting',
  17476. fn: function (aNode){
  17477. var self=this;
  17478. var newChildren,oldChildren;
  17479. return $core.withContext(function($ctx1) {
  17480. var $2,$3,$1,$4,$5;
  17481. var $early={};
  17482. try {
  17483. oldChildren=$recv(aNode)._dagChildren();
  17484. newChildren=self._visitAllChildren_(aNode);
  17485. $2=$recv(oldChildren)._size();
  17486. $ctx1.sendIdx["size"]=1;
  17487. $3=$recv(newChildren)._size();
  17488. $ctx1.sendIdx["size"]=2;
  17489. $1=$recv($2).__eq($3);
  17490. if($core.assert($1)){
  17491. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  17492. return $core.withContext(function($ctx2) {
  17493. $4=$recv(oldChildren)._at_(i);
  17494. $ctx2.sendIdx["at:"]=1;
  17495. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  17496. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  17497. }),(function(){
  17498. throw $early=[aNode];
  17499. }));
  17500. }
  17501. $5=$recv(aNode)._copy();
  17502. $recv($5)._dagChildren_(newChildren);
  17503. return $recv($5)._yourself();
  17504. }
  17505. catch(e) {if(e===$early)return e[0]; throw e}
  17506. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  17507. },
  17508. args: ["aNode"],
  17509. 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",
  17510. referencedClasses: [],
  17511. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  17512. }),
  17513. $globals.AbstractDagVisitor);
  17514. $core.addMethod(
  17515. $core.method({
  17516. selector: "visitDagNodeVariantSimple:",
  17517. protocol: 'visiting',
  17518. fn: function (aNode){
  17519. var self=this;
  17520. return $core.withContext(function($ctx1) {
  17521. self._visitAllChildren_(aNode);
  17522. return aNode;
  17523. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  17524. },
  17525. args: ["aNode"],
  17526. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  17527. referencedClasses: [],
  17528. messageSends: ["visitAllChildren:"]
  17529. }),
  17530. $globals.AbstractDagVisitor);
  17531. $core.addClass('PathDagVisitor', $globals.AbstractDagVisitor, ['path'], 'Kernel-Dag');
  17532. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  17533. $core.addMethod(
  17534. $core.method({
  17535. selector: "initialize",
  17536. protocol: 'initialization',
  17537. fn: function (){
  17538. var self=this;
  17539. return $core.withContext(function($ctx1) {
  17540. (
  17541. $ctx1.supercall = true,
  17542. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  17543. $ctx1.supercall = false;
  17544. self["@path"]=[];
  17545. return self;
  17546. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  17547. },
  17548. args: [],
  17549. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  17550. referencedClasses: [],
  17551. messageSends: ["initialize"]
  17552. }),
  17553. $globals.PathDagVisitor);
  17554. $core.addMethod(
  17555. $core.method({
  17556. selector: "path",
  17557. protocol: 'accessing',
  17558. fn: function (){
  17559. var self=this;
  17560. return self["@path"];
  17561. },
  17562. args: [],
  17563. source: "path\x0a\x09^ path",
  17564. referencedClasses: [],
  17565. messageSends: []
  17566. }),
  17567. $globals.PathDagVisitor);
  17568. $core.addMethod(
  17569. $core.method({
  17570. selector: "visit:",
  17571. protocol: 'visiting',
  17572. fn: function (aNode){
  17573. var self=this;
  17574. var oldPath,result;
  17575. return $core.withContext(function($ctx1) {
  17576. result=aNode;
  17577. oldPath=self["@path"];
  17578. $recv((function(){
  17579. return $core.withContext(function($ctx2) {
  17580. self["@path"]=$recv(self["@path"]).__comma([aNode]);
  17581. self["@path"];
  17582. result=(
  17583. $ctx2.supercall = true,
  17584. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  17585. $ctx2.supercall = false;
  17586. return result;
  17587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17588. }))._ensure_((function(){
  17589. self["@path"]=oldPath;
  17590. return self["@path"];
  17591. }));
  17592. return result;
  17593. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  17594. },
  17595. args: ["aNode"],
  17596. 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",
  17597. referencedClasses: [],
  17598. messageSends: ["ensure:", ",", "visit:"]
  17599. }),
  17600. $globals.PathDagVisitor);
  17601. $core.addMethod(
  17602. $core.method({
  17603. selector: "visitDagNodeVariantRedux:",
  17604. protocol: 'visiting',
  17605. fn: function (aNode){
  17606. var self=this;
  17607. var newNode;
  17608. return $core.withContext(function($ctx1) {
  17609. var $1;
  17610. newNode=(
  17611. $ctx1.supercall = true,
  17612. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($recv(self), [aNode]));
  17613. $ctx1.supercall = false;
  17614. $1=$recv(aNode).__eq_eq(newNode);
  17615. if(!$core.assert($1)){
  17616. $recv(self["@path"])._at_put_($recv(self["@path"])._size(),newNode);
  17617. }
  17618. return newNode;
  17619. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  17620. },
  17621. args: ["aNode"],
  17622. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  17623. referencedClasses: [],
  17624. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  17625. }),
  17626. $globals.PathDagVisitor);
  17627. $core.addClass('DagNode', $globals.Object, [], 'Kernel-Dag');
  17628. $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).";
  17629. $core.addMethod(
  17630. $core.method({
  17631. selector: "acceptDagVisitor:",
  17632. protocol: 'visiting',
  17633. fn: function (aVisitor){
  17634. var self=this;
  17635. return $core.withContext(function($ctx1) {
  17636. return $recv(aVisitor)._visitDagNode_(self);
  17637. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  17638. },
  17639. args: ["aVisitor"],
  17640. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  17641. referencedClasses: [],
  17642. messageSends: ["visitDagNode:"]
  17643. }),
  17644. $globals.DagNode);
  17645. $core.addMethod(
  17646. $core.method({
  17647. selector: "allDagChildren",
  17648. protocol: 'accessing',
  17649. fn: function (){
  17650. var self=this;
  17651. var allNodes;
  17652. return $core.withContext(function($ctx1) {
  17653. var $1;
  17654. $1=self._dagChildren();
  17655. $ctx1.sendIdx["dagChildren"]=1;
  17656. allNodes=$recv($1)._asSet();
  17657. $recv(self._dagChildren())._do_((function(each){
  17658. return $core.withContext(function($ctx2) {
  17659. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  17660. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17661. }));
  17662. return allNodes;
  17663. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  17664. },
  17665. args: [],
  17666. 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",
  17667. referencedClasses: [],
  17668. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  17669. }),
  17670. $globals.DagNode);
  17671. $core.addMethod(
  17672. $core.method({
  17673. selector: "dagChildren",
  17674. protocol: 'accessing',
  17675. fn: function (){
  17676. var self=this;
  17677. return $core.withContext(function($ctx1) {
  17678. self._subclassResponsibility();
  17679. return self;
  17680. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  17681. },
  17682. args: [],
  17683. source: "dagChildren\x0a\x09self subclassResponsibility",
  17684. referencedClasses: [],
  17685. messageSends: ["subclassResponsibility"]
  17686. }),
  17687. $globals.DagNode);
  17688. $core.addMethod(
  17689. $core.method({
  17690. selector: "dagChildren:",
  17691. protocol: 'accessing',
  17692. fn: function (aCollection){
  17693. var self=this;
  17694. return $core.withContext(function($ctx1) {
  17695. self._subclassResponsibility();
  17696. return self;
  17697. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  17698. },
  17699. args: ["aCollection"],
  17700. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  17701. referencedClasses: [],
  17702. messageSends: ["subclassResponsibility"]
  17703. }),
  17704. $globals.DagNode);
  17705. $core.addMethod(
  17706. $core.method({
  17707. selector: "isDagNode",
  17708. protocol: 'testing',
  17709. fn: function (){
  17710. var self=this;
  17711. return true;
  17712. },
  17713. args: [],
  17714. source: "isDagNode\x0a\x09^ true",
  17715. referencedClasses: [],
  17716. messageSends: []
  17717. }),
  17718. $globals.DagNode);
  17719. $core.addClass('DagParentNode', $globals.DagNode, ['nodes'], 'Kernel-Dag');
  17720. $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.";
  17721. $core.addMethod(
  17722. $core.method({
  17723. selector: "addDagChild:",
  17724. protocol: 'accessing',
  17725. fn: function (aDagNode){
  17726. var self=this;
  17727. return $core.withContext(function($ctx1) {
  17728. $recv(self._dagChildren())._add_(aDagNode);
  17729. return self;
  17730. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  17731. },
  17732. args: ["aDagNode"],
  17733. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  17734. referencedClasses: [],
  17735. messageSends: ["add:", "dagChildren"]
  17736. }),
  17737. $globals.DagParentNode);
  17738. $core.addMethod(
  17739. $core.method({
  17740. selector: "dagChildren",
  17741. protocol: 'accessing',
  17742. fn: function (){
  17743. var self=this;
  17744. return $core.withContext(function($ctx1) {
  17745. var $1,$receiver;
  17746. $1=self["@nodes"];
  17747. if(($receiver = $1) == null || $receiver.isNil){
  17748. self["@nodes"]=$recv($globals.Array)._new();
  17749. return self["@nodes"];
  17750. } else {
  17751. return $1;
  17752. }
  17753. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  17754. },
  17755. args: [],
  17756. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  17757. referencedClasses: ["Array"],
  17758. messageSends: ["ifNil:", "new"]
  17759. }),
  17760. $globals.DagParentNode);
  17761. $core.addMethod(
  17762. $core.method({
  17763. selector: "dagChildren:",
  17764. protocol: 'accessing',
  17765. fn: function (aCollection){
  17766. var self=this;
  17767. self["@nodes"]=aCollection;
  17768. return self;
  17769. },
  17770. args: ["aCollection"],
  17771. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  17772. referencedClasses: [],
  17773. messageSends: []
  17774. }),
  17775. $globals.DagParentNode);
  17776. $core.addClass('DagSink', $globals.DagNode, ['nodes'], 'Kernel-Dag');
  17777. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  17778. $core.addMethod(
  17779. $core.method({
  17780. selector: "dagChildren",
  17781. protocol: 'accessing',
  17782. fn: function (){
  17783. var self=this;
  17784. return [];
  17785. },
  17786. args: [],
  17787. source: "dagChildren\x0a\x09^ #()",
  17788. referencedClasses: [],
  17789. messageSends: []
  17790. }),
  17791. $globals.DagSink);
  17792. $core.addMethod(
  17793. $core.method({
  17794. selector: "dagChildren:",
  17795. protocol: 'accessing',
  17796. fn: function (aCollection){
  17797. var self=this;
  17798. return $core.withContext(function($ctx1) {
  17799. $recv(aCollection)._ifNotEmpty_((function(){
  17800. return $core.withContext(function($ctx2) {
  17801. return self._error_("A DagSink cannot have children.");
  17802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17803. }));
  17804. return self;
  17805. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  17806. },
  17807. args: ["aCollection"],
  17808. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  17809. referencedClasses: [],
  17810. messageSends: ["ifNotEmpty:", "error:"]
  17811. }),
  17812. $globals.DagSink);
  17813. $core.addMethod(
  17814. $core.method({
  17815. selector: "isDagNode",
  17816. protocol: '*Kernel-Dag',
  17817. fn: function (){
  17818. var self=this;
  17819. return false;
  17820. },
  17821. args: [],
  17822. source: "isDagNode\x0a\x09^ false",
  17823. referencedClasses: [],
  17824. messageSends: []
  17825. }),
  17826. $globals.Object);
  17827. });
  17828. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17829. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  17830. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17831. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  17832. $core.addPackage('Kernel-Exceptions');
  17833. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  17834. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17835. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  17836. $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.";
  17837. $core.addMethod(
  17838. $core.method({
  17839. selector: "beHandled",
  17840. protocol: 'accessing',
  17841. fn: function (){
  17842. var self=this;
  17843. return $core.withContext(function($ctx1) {
  17844. self.amberHandled = true;
  17845. return self;
  17846. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  17847. },
  17848. args: [],
  17849. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  17850. referencedClasses: [],
  17851. messageSends: []
  17852. }),
  17853. $globals.Error);
  17854. $core.addMethod(
  17855. $core.method({
  17856. selector: "beUnhandled",
  17857. protocol: 'accessing',
  17858. fn: function (){
  17859. var self=this;
  17860. return $core.withContext(function($ctx1) {
  17861. self.amberHandled = false;
  17862. return self;
  17863. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  17864. },
  17865. args: [],
  17866. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  17867. referencedClasses: [],
  17868. messageSends: []
  17869. }),
  17870. $globals.Error);
  17871. $core.addMethod(
  17872. $core.method({
  17873. selector: "context",
  17874. protocol: 'accessing',
  17875. fn: function (){
  17876. var self=this;
  17877. return $core.withContext(function($ctx1) {
  17878. return self.context;
  17879. return self;
  17880. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  17881. },
  17882. args: [],
  17883. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  17884. referencedClasses: [],
  17885. messageSends: []
  17886. }),
  17887. $globals.Error);
  17888. $core.addMethod(
  17889. $core.method({
  17890. selector: "initialize",
  17891. protocol: 'initialization',
  17892. fn: function (){
  17893. var self=this;
  17894. return $core.withContext(function($ctx1) {
  17895. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  17896. return self;
  17897. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  17898. },
  17899. args: [],
  17900. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  17901. referencedClasses: [],
  17902. messageSends: ["messageText:", ",", "name", "class"]
  17903. }),
  17904. $globals.Error);
  17905. $core.addMethod(
  17906. $core.method({
  17907. selector: "isSmalltalkError",
  17908. protocol: 'testing',
  17909. fn: function (){
  17910. var self=this;
  17911. return $core.withContext(function($ctx1) {
  17912. return self.smalltalkError === true;
  17913. return self;
  17914. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  17915. },
  17916. args: [],
  17917. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  17918. referencedClasses: [],
  17919. messageSends: []
  17920. }),
  17921. $globals.Error);
  17922. $core.addMethod(
  17923. $core.method({
  17924. selector: "jsStack",
  17925. protocol: 'accessing',
  17926. fn: function (){
  17927. var self=this;
  17928. return $core.withContext(function($ctx1) {
  17929. return self.stack;
  17930. return self;
  17931. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  17932. },
  17933. args: [],
  17934. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  17935. referencedClasses: [],
  17936. messageSends: []
  17937. }),
  17938. $globals.Error);
  17939. $core.addMethod(
  17940. $core.method({
  17941. selector: "messageText",
  17942. protocol: 'accessing',
  17943. fn: function (){
  17944. var self=this;
  17945. return self["@messageText"];
  17946. },
  17947. args: [],
  17948. source: "messageText\x0a\x09^ messageText",
  17949. referencedClasses: [],
  17950. messageSends: []
  17951. }),
  17952. $globals.Error);
  17953. $core.addMethod(
  17954. $core.method({
  17955. selector: "messageText:",
  17956. protocol: 'accessing',
  17957. fn: function (aString){
  17958. var self=this;
  17959. self["@messageText"]=aString;
  17960. return self;
  17961. },
  17962. args: ["aString"],
  17963. source: "messageText: aString\x0a\x09messageText := aString",
  17964. referencedClasses: [],
  17965. messageSends: []
  17966. }),
  17967. $globals.Error);
  17968. $core.addMethod(
  17969. $core.method({
  17970. selector: "resignal",
  17971. protocol: 'signaling',
  17972. fn: function (){
  17973. var self=this;
  17974. return $core.withContext(function($ctx1) {
  17975. self.amberHandled = false;
  17976. throw(self);
  17977. ;
  17978. return self;
  17979. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  17980. },
  17981. args: [],
  17982. 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'>",
  17983. referencedClasses: [],
  17984. messageSends: []
  17985. }),
  17986. $globals.Error);
  17987. $core.addMethod(
  17988. $core.method({
  17989. selector: "signal",
  17990. protocol: 'signaling',
  17991. fn: function (){
  17992. var self=this;
  17993. return $core.withContext(function($ctx1) {
  17994. self.amberHandled = false;
  17995. self.context = $core.getThisContext();
  17996. self.smalltalkError = true;
  17997. throw self;
  17998. ;
  17999. return self;
  18000. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  18001. },
  18002. args: [],
  18003. 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'>",
  18004. referencedClasses: [],
  18005. messageSends: []
  18006. }),
  18007. $globals.Error);
  18008. $core.addMethod(
  18009. $core.method({
  18010. selector: "signal:",
  18011. protocol: 'signaling',
  18012. fn: function (aString){
  18013. var self=this;
  18014. return $core.withContext(function($ctx1) {
  18015. self._messageText_(aString);
  18016. self._signal();
  18017. return self;
  18018. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  18019. },
  18020. args: ["aString"],
  18021. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  18022. referencedClasses: [],
  18023. messageSends: ["messageText:", "signal"]
  18024. }),
  18025. $globals.Error);
  18026. $core.addMethod(
  18027. $core.method({
  18028. selector: "signalerContext",
  18029. protocol: 'accessing',
  18030. fn: function (){
  18031. var self=this;
  18032. return $core.withContext(function($ctx1) {
  18033. return self._signalerContextFrom_(self._context());
  18034. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  18035. },
  18036. args: [],
  18037. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  18038. referencedClasses: [],
  18039. messageSends: ["signalerContextFrom:", "context"]
  18040. }),
  18041. $globals.Error);
  18042. $core.addMethod(
  18043. $core.method({
  18044. selector: "signalerContextFrom:",
  18045. protocol: 'accessing',
  18046. fn: function (aContext){
  18047. var self=this;
  18048. return $core.withContext(function($ctx1) {
  18049. var $3,$2,$1;
  18050. return $recv(aContext)._findContextSuchThat_((function(context){
  18051. return $core.withContext(function($ctx2) {
  18052. $3=$recv(context)._receiver();
  18053. $ctx2.sendIdx["receiver"]=1;
  18054. $2=$recv($3).__eq_eq(self);
  18055. $ctx2.sendIdx["=="]=1;
  18056. $1=$recv($2)._or_((function(){
  18057. return $core.withContext(function($ctx3) {
  18058. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  18059. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  18060. }));
  18061. return $recv($1)._not();
  18062. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  18063. }));
  18064. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  18065. },
  18066. args: ["aContext"],
  18067. 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 ]",
  18068. referencedClasses: [],
  18069. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  18070. }),
  18071. $globals.Error);
  18072. $core.addMethod(
  18073. $core.method({
  18074. selector: "wasHandled",
  18075. protocol: 'testing',
  18076. fn: function (){
  18077. var self=this;
  18078. return $core.withContext(function($ctx1) {
  18079. return self.amberHandled || false;
  18080. return self;
  18081. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  18082. },
  18083. args: [],
  18084. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  18085. referencedClasses: [],
  18086. messageSends: []
  18087. }),
  18088. $globals.Error);
  18089. $core.addMethod(
  18090. $core.method({
  18091. selector: "classTag",
  18092. protocol: 'accessing',
  18093. fn: function (){
  18094. var self=this;
  18095. return "exception";
  18096. },
  18097. args: [],
  18098. 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'",
  18099. referencedClasses: [],
  18100. messageSends: []
  18101. }),
  18102. $globals.Error.klass);
  18103. $core.addMethod(
  18104. $core.method({
  18105. selector: "signal",
  18106. protocol: 'instance creation',
  18107. fn: function (){
  18108. var self=this;
  18109. return $core.withContext(function($ctx1) {
  18110. return $recv(self._new())._signal();
  18111. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  18112. },
  18113. args: [],
  18114. source: "signal\x0a\x09^ self new signal",
  18115. referencedClasses: [],
  18116. messageSends: ["signal", "new"]
  18117. }),
  18118. $globals.Error.klass);
  18119. $core.addMethod(
  18120. $core.method({
  18121. selector: "signal:",
  18122. protocol: 'instance creation',
  18123. fn: function (aString){
  18124. var self=this;
  18125. return $core.withContext(function($ctx1) {
  18126. return $recv(self._new())._signal_(aString);
  18127. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  18128. },
  18129. args: ["aString"],
  18130. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  18131. referencedClasses: [],
  18132. messageSends: ["signal:", "new"]
  18133. }),
  18134. $globals.Error.klass);
  18135. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  18136. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  18137. $core.addMethod(
  18138. $core.method({
  18139. selector: "messageText",
  18140. protocol: 'accessing',
  18141. fn: function (){
  18142. var self=this;
  18143. return "Halt encountered";
  18144. },
  18145. args: [],
  18146. source: "messageText\x0a\x09^ 'Halt encountered'",
  18147. referencedClasses: [],
  18148. messageSends: []
  18149. }),
  18150. $globals.Halt);
  18151. $core.addMethod(
  18152. $core.method({
  18153. selector: "signalerContextFrom:",
  18154. protocol: 'accessing',
  18155. fn: function (aContext){
  18156. var self=this;
  18157. return $core.withContext(function($ctx1) {
  18158. var $3,$2,$1;
  18159. return $recv(aContext)._findContextSuchThat_((function(context){
  18160. return $core.withContext(function($ctx2) {
  18161. $3=$recv(context)._receiver();
  18162. $ctx2.sendIdx["receiver"]=1;
  18163. $2=$recv($3).__eq_eq(self);
  18164. $ctx2.sendIdx["=="]=1;
  18165. $1=$recv($2)._or_((function(){
  18166. return $core.withContext(function($ctx3) {
  18167. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  18168. return $core.withContext(function($ctx4) {
  18169. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  18170. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  18171. }));
  18172. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  18173. }));
  18174. $ctx2.sendIdx["or:"]=1;
  18175. return $recv($1)._not();
  18176. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  18177. }));
  18178. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  18179. },
  18180. args: ["aContext"],
  18181. 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 ]",
  18182. referencedClasses: [],
  18183. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  18184. }),
  18185. $globals.Halt);
  18186. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  18187. $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:`";
  18188. $core.addMethod(
  18189. $core.method({
  18190. selector: "context:",
  18191. protocol: 'accessing',
  18192. fn: function (aMethodContext){
  18193. var self=this;
  18194. return $core.withContext(function($ctx1) {
  18195. self.context = aMethodContext;
  18196. return self;
  18197. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  18198. },
  18199. args: ["aMethodContext"],
  18200. 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'>",
  18201. referencedClasses: [],
  18202. messageSends: []
  18203. }),
  18204. $globals.JavaScriptException);
  18205. $core.addMethod(
  18206. $core.method({
  18207. selector: "exception",
  18208. protocol: 'accessing',
  18209. fn: function (){
  18210. var self=this;
  18211. return self["@exception"];
  18212. },
  18213. args: [],
  18214. source: "exception\x0a\x09^ exception",
  18215. referencedClasses: [],
  18216. messageSends: []
  18217. }),
  18218. $globals.JavaScriptException);
  18219. $core.addMethod(
  18220. $core.method({
  18221. selector: "exception:",
  18222. protocol: 'accessing',
  18223. fn: function (anException){
  18224. var self=this;
  18225. self["@exception"]=anException;
  18226. return self;
  18227. },
  18228. args: ["anException"],
  18229. source: "exception: anException\x0a\x09exception := anException",
  18230. referencedClasses: [],
  18231. messageSends: []
  18232. }),
  18233. $globals.JavaScriptException);
  18234. $core.addMethod(
  18235. $core.method({
  18236. selector: "messageText",
  18237. protocol: 'accessing',
  18238. fn: function (){
  18239. var self=this;
  18240. return $core.withContext(function($ctx1) {
  18241. return "JavaScript exception: " + self["@exception"].toString();
  18242. return self;
  18243. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  18244. },
  18245. args: [],
  18246. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + self[\x22@exception\x22].toString()'>",
  18247. referencedClasses: [],
  18248. messageSends: []
  18249. }),
  18250. $globals.JavaScriptException);
  18251. $core.addMethod(
  18252. $core.method({
  18253. selector: "on:",
  18254. protocol: 'instance creation',
  18255. fn: function (anException){
  18256. var self=this;
  18257. return $core.withContext(function($ctx1) {
  18258. var $1;
  18259. $1=self._new();
  18260. $recv($1)._exception_(anException);
  18261. return $recv($1)._yourself();
  18262. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  18263. },
  18264. args: ["anException"],
  18265. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  18266. referencedClasses: [],
  18267. messageSends: ["exception:", "new", "yourself"]
  18268. }),
  18269. $globals.JavaScriptException.klass);
  18270. $core.addMethod(
  18271. $core.method({
  18272. selector: "on:context:",
  18273. protocol: 'instance creation',
  18274. fn: function (anException,aMethodContext){
  18275. var self=this;
  18276. return $core.withContext(function($ctx1) {
  18277. var $1;
  18278. $1=self._new();
  18279. $recv($1)._exception_(anException);
  18280. $recv($1)._context_(aMethodContext);
  18281. return $recv($1)._yourself();
  18282. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  18283. },
  18284. args: ["anException", "aMethodContext"],
  18285. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  18286. referencedClasses: [],
  18287. messageSends: ["exception:", "new", "context:", "yourself"]
  18288. }),
  18289. $globals.JavaScriptException.klass);
  18290. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  18291. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  18292. $core.addMethod(
  18293. $core.method({
  18294. selector: "message",
  18295. protocol: 'accessing',
  18296. fn: function (){
  18297. var self=this;
  18298. return self["@message"];
  18299. },
  18300. args: [],
  18301. source: "message\x0a\x09^ message",
  18302. referencedClasses: [],
  18303. messageSends: []
  18304. }),
  18305. $globals.MessageNotUnderstood);
  18306. $core.addMethod(
  18307. $core.method({
  18308. selector: "message:",
  18309. protocol: 'accessing',
  18310. fn: function (aMessage){
  18311. var self=this;
  18312. self["@message"]=aMessage;
  18313. return self;
  18314. },
  18315. args: ["aMessage"],
  18316. source: "message: aMessage\x0a\x09message := aMessage",
  18317. referencedClasses: [],
  18318. messageSends: []
  18319. }),
  18320. $globals.MessageNotUnderstood);
  18321. $core.addMethod(
  18322. $core.method({
  18323. selector: "messageText",
  18324. protocol: 'accessing',
  18325. fn: function (){
  18326. var self=this;
  18327. return $core.withContext(function($ctx1) {
  18328. var $1;
  18329. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  18330. $ctx1.sendIdx[","]=1;
  18331. return $1;
  18332. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  18333. },
  18334. args: [],
  18335. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  18336. referencedClasses: [],
  18337. messageSends: [",", "asString", "receiver", "selector", "message"]
  18338. }),
  18339. $globals.MessageNotUnderstood);
  18340. $core.addMethod(
  18341. $core.method({
  18342. selector: "receiver",
  18343. protocol: 'accessing',
  18344. fn: function (){
  18345. var self=this;
  18346. return self["@receiver"];
  18347. },
  18348. args: [],
  18349. source: "receiver\x0a\x09^ receiver",
  18350. referencedClasses: [],
  18351. messageSends: []
  18352. }),
  18353. $globals.MessageNotUnderstood);
  18354. $core.addMethod(
  18355. $core.method({
  18356. selector: "receiver:",
  18357. protocol: 'accessing',
  18358. fn: function (anObject){
  18359. var self=this;
  18360. self["@receiver"]=anObject;
  18361. return self;
  18362. },
  18363. args: ["anObject"],
  18364. source: "receiver: anObject\x0a\x09receiver := anObject",
  18365. referencedClasses: [],
  18366. messageSends: []
  18367. }),
  18368. $globals.MessageNotUnderstood);
  18369. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  18370. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  18371. $core.addMethod(
  18372. $core.method({
  18373. selector: "object",
  18374. protocol: 'accessing',
  18375. fn: function (){
  18376. var self=this;
  18377. return self["@object"];
  18378. },
  18379. args: [],
  18380. source: "object\x0a\x09^ object",
  18381. referencedClasses: [],
  18382. messageSends: []
  18383. }),
  18384. $globals.NonBooleanReceiver);
  18385. $core.addMethod(
  18386. $core.method({
  18387. selector: "object:",
  18388. protocol: 'accessing',
  18389. fn: function (anObject){
  18390. var self=this;
  18391. self["@object"]=anObject;
  18392. return self;
  18393. },
  18394. args: ["anObject"],
  18395. source: "object: anObject\x0a\x09object := anObject",
  18396. referencedClasses: [],
  18397. messageSends: []
  18398. }),
  18399. $globals.NonBooleanReceiver);
  18400. });
  18401. define('amber_core/Kernel-Infrastructure',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  18402. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  18403. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  18404. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  18405. $core.addPackage('Kernel-Infrastructure');
  18406. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  18407. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  18408. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  18409. $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`.";
  18410. $core.addMethod(
  18411. $core.method({
  18412. selector: "=",
  18413. protocol: 'comparing',
  18414. fn: function (anObject){
  18415. var self=this;
  18416. return $core.withContext(function($ctx1) {
  18417. var $2,$1;
  18418. $2=$recv(anObject)._class();
  18419. $ctx1.sendIdx["class"]=1;
  18420. $1=$recv($2).__eq_eq(self._class());
  18421. if(!$core.assert($1)){
  18422. return false;
  18423. }
  18424. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  18425. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  18426. },
  18427. args: ["anObject"],
  18428. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  18429. referencedClasses: ["JSObjectProxy"],
  18430. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  18431. }),
  18432. $globals.JSObjectProxy);
  18433. $core.addMethod(
  18434. $core.method({
  18435. selector: "asJSON",
  18436. protocol: 'enumerating',
  18437. fn: function (){
  18438. var self=this;
  18439. return self["@jsObject"];
  18440. },
  18441. args: [],
  18442. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  18443. referencedClasses: [],
  18444. messageSends: []
  18445. }),
  18446. $globals.JSObjectProxy);
  18447. $core.addMethod(
  18448. $core.method({
  18449. selector: "at:",
  18450. protocol: 'accessing',
  18451. fn: function (aString){
  18452. var self=this;
  18453. return $core.withContext(function($ctx1) {
  18454. return self['@jsObject'][aString];
  18455. return self;
  18456. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  18457. },
  18458. args: ["aString"],
  18459. source: "at: aString\x0a\x09<inlineJS: 'return self[''@jsObject''][aString]'>",
  18460. referencedClasses: [],
  18461. messageSends: []
  18462. }),
  18463. $globals.JSObjectProxy);
  18464. $core.addMethod(
  18465. $core.method({
  18466. selector: "at:ifAbsent:",
  18467. protocol: 'accessing',
  18468. fn: function (aString,aBlock){
  18469. var self=this;
  18470. return $core.withContext(function($ctx1) {
  18471. var obj = self['@jsObject'];
  18472. return aString in obj ? obj[aString] : aBlock._value();
  18473. ;
  18474. return self;
  18475. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18476. },
  18477. args: ["aString", "aBlock"],
  18478. 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'>",
  18479. referencedClasses: [],
  18480. messageSends: []
  18481. }),
  18482. $globals.JSObjectProxy);
  18483. $core.addMethod(
  18484. $core.method({
  18485. selector: "at:ifPresent:",
  18486. protocol: 'accessing',
  18487. fn: function (aString,aBlock){
  18488. var self=this;
  18489. return $core.withContext(function($ctx1) {
  18490. var obj = self['@jsObject'];
  18491. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  18492. ;
  18493. return self;
  18494. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18495. },
  18496. args: ["aString", "aBlock"],
  18497. 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'>",
  18498. referencedClasses: [],
  18499. messageSends: []
  18500. }),
  18501. $globals.JSObjectProxy);
  18502. $core.addMethod(
  18503. $core.method({
  18504. selector: "at:ifPresent:ifAbsent:",
  18505. protocol: 'accessing',
  18506. fn: function (aString,aBlock,anotherBlock){
  18507. var self=this;
  18508. return $core.withContext(function($ctx1) {
  18509. var obj = self['@jsObject'];
  18510. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  18511. ;
  18512. return self;
  18513. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  18514. },
  18515. args: ["aString", "aBlock", "anotherBlock"],
  18516. 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'>",
  18517. referencedClasses: [],
  18518. messageSends: []
  18519. }),
  18520. $globals.JSObjectProxy);
  18521. $core.addMethod(
  18522. $core.method({
  18523. selector: "at:put:",
  18524. protocol: 'accessing',
  18525. fn: function (aString,anObject){
  18526. var self=this;
  18527. return $core.withContext(function($ctx1) {
  18528. return self['@jsObject'][aString] = anObject;
  18529. return self;
  18530. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  18531. },
  18532. args: ["aString", "anObject"],
  18533. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return self[''@jsObject''][aString] = anObject'>",
  18534. referencedClasses: [],
  18535. messageSends: []
  18536. }),
  18537. $globals.JSObjectProxy);
  18538. $core.addMethod(
  18539. $core.method({
  18540. selector: "doesNotUnderstand:",
  18541. protocol: 'proxy',
  18542. fn: function (aMessage){
  18543. var self=this;
  18544. return $core.withContext(function($ctx1) {
  18545. var $1,$receiver;
  18546. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  18547. if(($receiver = $1) == null || $receiver.isNil){
  18548. return (
  18549. $ctx1.supercall = true,
  18550. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  18551. $ctx1.supercall = false;
  18552. } else {
  18553. var jsSelector;
  18554. jsSelector=$receiver;
  18555. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  18556. }
  18557. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  18558. },
  18559. args: ["aMessage"],
  18560. 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 ]",
  18561. referencedClasses: ["JSObjectProxy"],
  18562. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  18563. }),
  18564. $globals.JSObjectProxy);
  18565. $core.addMethod(
  18566. $core.method({
  18567. selector: "in:",
  18568. protocol: 'accessing',
  18569. fn: function (aValuable){
  18570. var self=this;
  18571. return $core.withContext(function($ctx1) {
  18572. return $recv(aValuable)._value_(self["@jsObject"]);
  18573. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  18574. },
  18575. args: ["aValuable"],
  18576. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  18577. referencedClasses: [],
  18578. messageSends: ["value:"]
  18579. }),
  18580. $globals.JSObjectProxy);
  18581. $core.addMethod(
  18582. $core.method({
  18583. selector: "jsObject",
  18584. protocol: 'accessing',
  18585. fn: function (){
  18586. var self=this;
  18587. return self["@jsObject"];
  18588. },
  18589. args: [],
  18590. source: "jsObject\x0a\x09^ jsObject",
  18591. referencedClasses: [],
  18592. messageSends: []
  18593. }),
  18594. $globals.JSObjectProxy);
  18595. $core.addMethod(
  18596. $core.method({
  18597. selector: "keysAndValuesDo:",
  18598. protocol: 'enumerating',
  18599. fn: function (aBlock){
  18600. var self=this;
  18601. return $core.withContext(function($ctx1) {
  18602. var o = self['@jsObject'];
  18603. for(var i in o) {
  18604. aBlock._value_value_(i, o[i]);
  18605. }
  18606. ;
  18607. return self;
  18608. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  18609. },
  18610. args: ["aBlock"],
  18611. 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'>",
  18612. referencedClasses: [],
  18613. messageSends: []
  18614. }),
  18615. $globals.JSObjectProxy);
  18616. $core.addMethod(
  18617. $core.method({
  18618. selector: "printOn:",
  18619. protocol: 'printing',
  18620. fn: function (aStream){
  18621. var self=this;
  18622. return $core.withContext(function($ctx1) {
  18623. $recv(aStream)._nextPutAll_(self._printString());
  18624. return self;
  18625. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18626. },
  18627. args: ["aStream"],
  18628. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  18629. referencedClasses: [],
  18630. messageSends: ["nextPutAll:", "printString"]
  18631. }),
  18632. $globals.JSObjectProxy);
  18633. $core.addMethod(
  18634. $core.method({
  18635. selector: "printString",
  18636. protocol: 'printing',
  18637. fn: function (){
  18638. var self=this;
  18639. return $core.withContext(function($ctx1) {
  18640. var js = self['@jsObject'];
  18641. return js.toString
  18642. ? js.toString()
  18643. : Object.prototype.toString.call(js)
  18644. ;
  18645. return self;
  18646. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  18647. },
  18648. args: [],
  18649. 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'>",
  18650. referencedClasses: [],
  18651. messageSends: []
  18652. }),
  18653. $globals.JSObjectProxy);
  18654. $core.addMethod(
  18655. $core.method({
  18656. selector: "putOn:",
  18657. protocol: 'streaming',
  18658. fn: function (aStream){
  18659. var self=this;
  18660. return $core.withContext(function($ctx1) {
  18661. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  18662. return self;
  18663. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18664. },
  18665. args: ["aStream"],
  18666. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  18667. referencedClasses: [],
  18668. messageSends: ["nextPutJSObject:"]
  18669. }),
  18670. $globals.JSObjectProxy);
  18671. $core.addMethod(
  18672. $core.method({
  18673. selector: "addObjectVariablesTo:ofProxy:",
  18674. protocol: 'proxy',
  18675. fn: function (aDictionary,aProxy){
  18676. var self=this;
  18677. return $core.withContext(function($ctx1) {
  18678. var jsObject = aProxy['@jsObject'];
  18679. for(var i in jsObject) {
  18680. aDictionary._at_put_(i, jsObject[i]);
  18681. }
  18682. ;
  18683. return self;
  18684. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18685. },
  18686. args: ["aDictionary", "aProxy"],
  18687. 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'>",
  18688. referencedClasses: [],
  18689. messageSends: []
  18690. }),
  18691. $globals.JSObjectProxy.klass);
  18692. $core.addMethod(
  18693. $core.method({
  18694. selector: "compareJSObjectOfProxy:withProxy:",
  18695. protocol: 'proxy',
  18696. fn: function (aProxy,anotherProxy){
  18697. var self=this;
  18698. return $core.withContext(function($ctx1) {
  18699. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  18700. return aProxy["@jsObject"] === anotherJSObject;
  18701. return self;
  18702. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  18703. },
  18704. args: ["aProxy", "anotherProxy"],
  18705. 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'>",
  18706. referencedClasses: [],
  18707. messageSends: []
  18708. }),
  18709. $globals.JSObjectProxy.klass);
  18710. $core.addMethod(
  18711. $core.method({
  18712. selector: "forwardMessage:withArguments:ofProxy:",
  18713. protocol: 'proxy',
  18714. fn: function (aString,anArray,aProxy){
  18715. var self=this;
  18716. return $core.withContext(function($ctx1) {
  18717. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  18718. ;
  18719. return self;
  18720. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18721. },
  18722. args: ["aString", "anArray", "aProxy"],
  18723. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  18724. referencedClasses: [],
  18725. messageSends: []
  18726. }),
  18727. $globals.JSObjectProxy.klass);
  18728. $core.addMethod(
  18729. $core.method({
  18730. selector: "jsObject:ofProxy:",
  18731. protocol: 'proxy',
  18732. fn: function (aJSObject,aProxy){
  18733. var self=this;
  18734. return $core.withContext(function($ctx1) {
  18735. aProxy['@jsObject'] = aJSObject;
  18736. return self;
  18737. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18738. },
  18739. args: ["aJSObject", "aProxy"],
  18740. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  18741. referencedClasses: [],
  18742. messageSends: []
  18743. }),
  18744. $globals.JSObjectProxy.klass);
  18745. $core.addMethod(
  18746. $core.method({
  18747. selector: "lookupProperty:ofProxy:",
  18748. protocol: 'proxy',
  18749. fn: function (aString,aProxy){
  18750. var self=this;
  18751. return $core.withContext(function($ctx1) {
  18752. return aString in aProxy._jsObject() ? aString : nil;
  18753. return self;
  18754. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18755. },
  18756. args: ["aString", "aProxy"],
  18757. 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'>",
  18758. referencedClasses: [],
  18759. messageSends: []
  18760. }),
  18761. $globals.JSObjectProxy.klass);
  18762. $core.addMethod(
  18763. $core.method({
  18764. selector: "on:",
  18765. protocol: 'instance creation',
  18766. fn: function (aJSObject){
  18767. var self=this;
  18768. var instance;
  18769. return $core.withContext(function($ctx1) {
  18770. instance=self._new();
  18771. self._jsObject_ofProxy_(aJSObject,instance);
  18772. return instance;
  18773. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  18774. },
  18775. args: ["aJSObject"],
  18776. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  18777. referencedClasses: [],
  18778. messageSends: ["new", "jsObject:ofProxy:"]
  18779. }),
  18780. $globals.JSObjectProxy.klass);
  18781. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  18782. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  18783. $core.addMethod(
  18784. $core.method({
  18785. selector: "addElement:",
  18786. protocol: 'accessing',
  18787. fn: function (anObject){
  18788. var self=this;
  18789. return $core.withContext(function($ctx1) {
  18790. self.elements.addElement(anObject);
  18791. return self;
  18792. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  18793. },
  18794. args: ["anObject"],
  18795. source: "addElement: anObject\x0a\x09<inlineJS: 'self.elements.addElement(anObject)'>",
  18796. referencedClasses: [],
  18797. messageSends: []
  18798. }),
  18799. $globals.Organizer);
  18800. $core.addMethod(
  18801. $core.method({
  18802. selector: "elements",
  18803. protocol: 'accessing',
  18804. fn: function (){
  18805. var self=this;
  18806. return $core.withContext(function($ctx1) {
  18807. return $recv(self._basicAt_("elements"))._copy();
  18808. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  18809. },
  18810. args: [],
  18811. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  18812. referencedClasses: [],
  18813. messageSends: ["copy", "basicAt:"]
  18814. }),
  18815. $globals.Organizer);
  18816. $core.addMethod(
  18817. $core.method({
  18818. selector: "removeElement:",
  18819. protocol: 'accessing',
  18820. fn: function (anObject){
  18821. var self=this;
  18822. return $core.withContext(function($ctx1) {
  18823. self.elements.removeElement(anObject);
  18824. return self;
  18825. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  18826. },
  18827. args: ["anObject"],
  18828. source: "removeElement: anObject\x0a\x09<inlineJS: 'self.elements.removeElement(anObject)'>",
  18829. referencedClasses: [],
  18830. messageSends: []
  18831. }),
  18832. $globals.Organizer);
  18833. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18834. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  18835. $core.addMethod(
  18836. $core.method({
  18837. selector: "addElement:",
  18838. protocol: 'accessing',
  18839. fn: function (aString){
  18840. var self=this;
  18841. return $core.withContext(function($ctx1) {
  18842. var $1,$3,$2;
  18843. (
  18844. $ctx1.supercall = true,
  18845. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($recv(self), [aString]));
  18846. $ctx1.supercall = false;
  18847. $1=$recv($globals.SystemAnnouncer)._current();
  18848. $3=$recv($globals.ProtocolAdded)._new();
  18849. $recv($3)._protocol_(aString);
  18850. $recv($3)._theClass_(self._theClass());
  18851. $2=$recv($3)._yourself();
  18852. $recv($1)._announce_($2);
  18853. return self;
  18854. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  18855. },
  18856. args: ["aString"],
  18857. 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)",
  18858. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  18859. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18860. }),
  18861. $globals.ClassOrganizer);
  18862. $core.addMethod(
  18863. $core.method({
  18864. selector: "removeElement:",
  18865. protocol: 'accessing',
  18866. fn: function (aString){
  18867. var self=this;
  18868. return $core.withContext(function($ctx1) {
  18869. var $1,$3,$2;
  18870. (
  18871. $ctx1.supercall = true,
  18872. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($recv(self), [aString]));
  18873. $ctx1.supercall = false;
  18874. $1=$recv($globals.SystemAnnouncer)._current();
  18875. $3=$recv($globals.ProtocolRemoved)._new();
  18876. $recv($3)._protocol_(aString);
  18877. $recv($3)._theClass_(self._theClass());
  18878. $2=$recv($3)._yourself();
  18879. $recv($1)._announce_($2);
  18880. return self;
  18881. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  18882. },
  18883. args: ["aString"],
  18884. 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)",
  18885. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  18886. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18887. }),
  18888. $globals.ClassOrganizer);
  18889. $core.addMethod(
  18890. $core.method({
  18891. selector: "theClass",
  18892. protocol: 'accessing',
  18893. fn: function (){
  18894. var self=this;
  18895. return $core.withContext(function($ctx1) {
  18896. return self.theClass;
  18897. return self;
  18898. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  18899. },
  18900. args: [],
  18901. source: "theClass\x0a\x09<inlineJS: 'return self.theClass'>",
  18902. referencedClasses: [],
  18903. messageSends: []
  18904. }),
  18905. $globals.ClassOrganizer);
  18906. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18907. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  18908. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  18909. $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'";
  18910. $core.addMethod(
  18911. $core.method({
  18912. selector: "basicImports",
  18913. protocol: 'private',
  18914. fn: function (){
  18915. var self=this;
  18916. return $core.withContext(function($ctx1) {
  18917. return self.imports || [];
  18918. return self;
  18919. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  18920. },
  18921. args: [],
  18922. 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 || []'>",
  18923. referencedClasses: [],
  18924. messageSends: []
  18925. }),
  18926. $globals.Package);
  18927. $core.addMethod(
  18928. $core.method({
  18929. selector: "basicName:",
  18930. protocol: 'private',
  18931. fn: function (aString){
  18932. var self=this;
  18933. return $core.withContext(function($ctx1) {
  18934. self.pkgName = aString;
  18935. return self;
  18936. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  18937. },
  18938. args: ["aString"],
  18939. source: "basicName: aString\x0a\x09<inlineJS: 'self.pkgName = aString'>",
  18940. referencedClasses: [],
  18941. messageSends: []
  18942. }),
  18943. $globals.Package);
  18944. $core.addMethod(
  18945. $core.method({
  18946. selector: "basicTransport",
  18947. protocol: 'private',
  18948. fn: function (){
  18949. var self=this;
  18950. return $core.withContext(function($ctx1) {
  18951. return self.transport;
  18952. return self;
  18953. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  18954. },
  18955. args: [],
  18956. 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'>",
  18957. referencedClasses: [],
  18958. messageSends: []
  18959. }),
  18960. $globals.Package);
  18961. $core.addMethod(
  18962. $core.method({
  18963. selector: "beClean",
  18964. protocol: 'accessing',
  18965. fn: function (){
  18966. var self=this;
  18967. return $core.withContext(function($ctx1) {
  18968. var $1,$3,$2;
  18969. self["@dirty"]=false;
  18970. $1=$recv($globals.SystemAnnouncer)._current();
  18971. $3=$recv($globals.PackageClean)._new();
  18972. $recv($3)._package_(self);
  18973. $2=$recv($3)._yourself();
  18974. $recv($1)._announce_($2);
  18975. return self;
  18976. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18977. },
  18978. args: [],
  18979. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18980. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18981. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18982. }),
  18983. $globals.Package);
  18984. $core.addMethod(
  18985. $core.method({
  18986. selector: "beDirty",
  18987. protocol: 'accessing',
  18988. fn: function (){
  18989. var self=this;
  18990. return $core.withContext(function($ctx1) {
  18991. var $1,$3,$2;
  18992. self["@dirty"]=true;
  18993. $1=$recv($globals.SystemAnnouncer)._current();
  18994. $3=$recv($globals.PackageDirty)._new();
  18995. $recv($3)._package_(self);
  18996. $2=$recv($3)._yourself();
  18997. $recv($1)._announce_($2);
  18998. return self;
  18999. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  19000. },
  19001. args: [],
  19002. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  19003. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  19004. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  19005. }),
  19006. $globals.Package);
  19007. $core.addMethod(
  19008. $core.method({
  19009. selector: "classTemplate",
  19010. protocol: 'accessing',
  19011. fn: function (){
  19012. var self=this;
  19013. return $core.withContext(function($ctx1) {
  19014. var $2,$3,$1,$4,$5;
  19015. return $recv($globals.String)._streamContents_((function(stream){
  19016. return $core.withContext(function($ctx2) {
  19017. $recv(stream)._nextPutAll_("Object");
  19018. $ctx2.sendIdx["nextPutAll:"]=1;
  19019. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  19020. $ctx2.sendIdx["nextPutAll:"]=2;
  19021. $2=$recv($globals.String)._lf();
  19022. $ctx2.sendIdx["lf"]=1;
  19023. $3=$recv($globals.String)._tab();
  19024. $ctx2.sendIdx["tab"]=1;
  19025. $1=$recv($2).__comma($3);
  19026. $ctx2.sendIdx[","]=1;
  19027. $recv(stream)._nextPutAll_($1);
  19028. $ctx2.sendIdx["nextPutAll:"]=3;
  19029. $4=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  19030. $ctx2.sendIdx["nextPutAll:"]=4;
  19031. $4;
  19032. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  19033. $ctx2.sendIdx[","]=2;
  19034. $recv(stream)._nextPutAll_($5);
  19035. $ctx2.sendIdx["nextPutAll:"]=5;
  19036. $recv(stream)._nextPutAll_("package: '");
  19037. $ctx2.sendIdx["nextPutAll:"]=6;
  19038. $recv(stream)._nextPutAll_(self._name());
  19039. $ctx2.sendIdx["nextPutAll:"]=7;
  19040. return $recv(stream)._nextPutAll_("'");
  19041. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  19042. }));
  19043. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  19044. },
  19045. args: [],
  19046. source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object';\x0a\x09\x09\x09nextPutAll: ' subclass: #NameOfSubclass';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''''.\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: '''' ]",
  19047. referencedClasses: ["String"],
  19048. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  19049. }),
  19050. $globals.Package);
  19051. $core.addMethod(
  19052. $core.method({
  19053. selector: "classes",
  19054. protocol: 'classes',
  19055. fn: function (){
  19056. var self=this;
  19057. return $core.withContext(function($ctx1) {
  19058. return $recv(self._organization())._elements();
  19059. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  19060. },
  19061. args: [],
  19062. source: "classes\x0a\x09^ self organization elements",
  19063. referencedClasses: [],
  19064. messageSends: ["elements", "organization"]
  19065. }),
  19066. $globals.Package);
  19067. $core.addMethod(
  19068. $core.method({
  19069. selector: "definition",
  19070. protocol: 'accessing',
  19071. fn: function (){
  19072. var self=this;
  19073. return $core.withContext(function($ctx1) {
  19074. var $1,$3,$4,$2,$6,$5,$8,$9,$7,$10;
  19075. return $recv($globals.String)._streamContents_((function(stream){
  19076. return $core.withContext(function($ctx2) {
  19077. $1=$recv(self._class())._name();
  19078. $ctx2.sendIdx["name"]=1;
  19079. $recv(stream)._nextPutAll_($1);
  19080. $ctx2.sendIdx["nextPutAll:"]=1;
  19081. $3=$recv($globals.String)._lf();
  19082. $ctx2.sendIdx["lf"]=1;
  19083. $4=$recv($globals.String)._tab();
  19084. $ctx2.sendIdx["tab"]=1;
  19085. $2=$recv($3).__comma($4);
  19086. $ctx2.sendIdx[","]=1;
  19087. $recv(stream)._nextPutAll_($2);
  19088. $ctx2.sendIdx["nextPutAll:"]=2;
  19089. $recv(stream)._nextPutAll_("named: ");
  19090. $ctx2.sendIdx["nextPutAll:"]=3;
  19091. $6="'".__comma(self._name());
  19092. $ctx2.sendIdx[","]=3;
  19093. $5=$recv($6).__comma("'");
  19094. $ctx2.sendIdx[","]=2;
  19095. $recv(stream)._nextPutAll_($5);
  19096. $ctx2.sendIdx["nextPutAll:"]=4;
  19097. $8=$recv($globals.String)._lf();
  19098. $ctx2.sendIdx["lf"]=2;
  19099. $9=$recv($globals.String)._tab();
  19100. $ctx2.sendIdx["tab"]=2;
  19101. $7=$recv($8).__comma($9);
  19102. $ctx2.sendIdx[","]=4;
  19103. $recv(stream)._nextPutAll_($7);
  19104. $ctx2.sendIdx["nextPutAll:"]=5;
  19105. $recv(stream)._nextPutAll_("imports: ");
  19106. $ctx2.sendIdx["nextPutAll:"]=6;
  19107. $recv(stream)._nextPutAll_(self._importsDefinition());
  19108. $ctx2.sendIdx["nextPutAll:"]=7;
  19109. $10=$recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab());
  19110. $ctx2.sendIdx[","]=5;
  19111. $recv(stream)._nextPutAll_($10);
  19112. $ctx2.sendIdx["nextPutAll:"]=8;
  19113. $recv(stream)._nextPutAll_("transport: (");
  19114. $ctx2.sendIdx["nextPutAll:"]=9;
  19115. return $recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  19116. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  19117. }));
  19118. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  19119. },
  19120. args: [],
  19121. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'named: ';\x0a\x09\x09\x09nextPutAll: '''', self name, '''';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'imports: ';\x0a\x09\x09\x09nextPutAll: self importsDefinition;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'transport: (';\x0a\x09\x09\x09nextPutAll: self transport definition, ')' ]",
  19122. referencedClasses: ["String"],
  19123. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  19124. }),
  19125. $globals.Package);
  19126. $core.addMethod(
  19127. $core.method({
  19128. selector: "imports",
  19129. protocol: 'accessing',
  19130. fn: function (){
  19131. var self=this;
  19132. return $core.withContext(function($ctx1) {
  19133. var $1,$receiver;
  19134. $1=self["@imports"];
  19135. if(($receiver = $1) == null || $receiver.isNil){
  19136. var parsed;
  19137. parsed=self._importsFromJson_(self._basicImports());
  19138. parsed;
  19139. self._imports_(parsed);
  19140. return self["@imports"];
  19141. } else {
  19142. return $1;
  19143. }
  19144. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  19145. },
  19146. args: [],
  19147. 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 ]",
  19148. referencedClasses: [],
  19149. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  19150. }),
  19151. $globals.Package);
  19152. $core.addMethod(
  19153. $core.method({
  19154. selector: "imports:",
  19155. protocol: 'accessing',
  19156. fn: function (anArray){
  19157. var self=this;
  19158. return $core.withContext(function($ctx1) {
  19159. self._validateImports_(anArray);
  19160. self["@imports"]=$recv(anArray)._asSet();
  19161. return self;
  19162. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  19163. },
  19164. args: ["anArray"],
  19165. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  19166. referencedClasses: [],
  19167. messageSends: ["validateImports:", "asSet"]
  19168. }),
  19169. $globals.Package);
  19170. $core.addMethod(
  19171. $core.method({
  19172. selector: "importsAsJson",
  19173. protocol: 'converting',
  19174. fn: function (){
  19175. var self=this;
  19176. return $core.withContext(function($ctx1) {
  19177. var $1;
  19178. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  19179. return $core.withContext(function($ctx2) {
  19180. $1=$recv(each)._isString();
  19181. if($core.assert($1)){
  19182. return each;
  19183. } else {
  19184. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  19185. $ctx2.sendIdx[","]=1;
  19186. }
  19187. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19188. }));
  19189. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  19190. },
  19191. args: [],
  19192. 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 ]]",
  19193. referencedClasses: [],
  19194. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  19195. }),
  19196. $globals.Package);
  19197. $core.addMethod(
  19198. $core.method({
  19199. selector: "importsDefinition",
  19200. protocol: 'accessing',
  19201. fn: function (){
  19202. var self=this;
  19203. return $core.withContext(function($ctx1) {
  19204. return $recv($globals.String)._streamContents_((function(stream){
  19205. return $core.withContext(function($ctx2) {
  19206. $recv(stream)._nextPutAll_("{");
  19207. $ctx2.sendIdx["nextPutAll:"]=1;
  19208. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  19209. return $core.withContext(function($ctx3) {
  19210. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  19211. $ctx3.sendIdx["nextPutAll:"]=2;
  19212. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  19213. }),(function(){
  19214. return $core.withContext(function($ctx3) {
  19215. return $recv(stream)._nextPutAll_(". ");
  19216. $ctx3.sendIdx["nextPutAll:"]=3;
  19217. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  19218. }));
  19219. return $recv(stream)._nextPutAll_("}");
  19220. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  19221. }));
  19222. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  19223. },
  19224. args: [],
  19225. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream nextPutAll: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each importsString ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: '. ' ].\x0a\x09\x09stream nextPutAll: '}' ]",
  19226. referencedClasses: ["String"],
  19227. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  19228. }),
  19229. $globals.Package);
  19230. $core.addMethod(
  19231. $core.method({
  19232. selector: "importsFromJson:",
  19233. protocol: 'converting',
  19234. fn: function (anArray){
  19235. var self=this;
  19236. return $core.withContext(function($ctx1) {
  19237. var $1;
  19238. return $recv(anArray)._collect_((function(each){
  19239. var split;
  19240. return $core.withContext(function($ctx2) {
  19241. split=$recv(each)._tokenize_("=");
  19242. split;
  19243. $1=$recv($recv(split)._size()).__eq((1));
  19244. if($core.assert($1)){
  19245. return $recv(split)._first();
  19246. $ctx2.sendIdx["first"]=1;
  19247. } else {
  19248. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  19249. }
  19250. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  19251. }));
  19252. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  19253. },
  19254. args: ["anArray"],
  19255. 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 ]]",
  19256. referencedClasses: [],
  19257. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  19258. }),
  19259. $globals.Package);
  19260. $core.addMethod(
  19261. $core.method({
  19262. selector: "isDirty",
  19263. protocol: 'testing',
  19264. fn: function (){
  19265. var self=this;
  19266. return $core.withContext(function($ctx1) {
  19267. var $1,$receiver;
  19268. $1=self["@dirty"];
  19269. if(($receiver = $1) == null || $receiver.isNil){
  19270. return false;
  19271. } else {
  19272. return $1;
  19273. }
  19274. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  19275. },
  19276. args: [],
  19277. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  19278. referencedClasses: [],
  19279. messageSends: ["ifNil:"]
  19280. }),
  19281. $globals.Package);
  19282. $core.addMethod(
  19283. $core.method({
  19284. selector: "isPackage",
  19285. protocol: 'testing',
  19286. fn: function (){
  19287. var self=this;
  19288. return true;
  19289. },
  19290. args: [],
  19291. source: "isPackage\x0a\x09^ true",
  19292. referencedClasses: [],
  19293. messageSends: []
  19294. }),
  19295. $globals.Package);
  19296. $core.addMethod(
  19297. $core.method({
  19298. selector: "loadDependencies",
  19299. protocol: 'dependencies',
  19300. fn: function (){
  19301. var self=this;
  19302. var classes,packages;
  19303. return $core.withContext(function($ctx1) {
  19304. var $1;
  19305. classes=self._loadDependencyClasses();
  19306. $1=$recv($recv(classes)._collect_((function(each){
  19307. return $core.withContext(function($ctx2) {
  19308. return $recv(each)._package();
  19309. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19310. })))._asSet();
  19311. $recv($1)._remove_ifAbsent_(self,(function(){
  19312. }));
  19313. return $recv($1)._yourself();
  19314. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  19315. },
  19316. args: [],
  19317. 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",
  19318. referencedClasses: [],
  19319. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  19320. }),
  19321. $globals.Package);
  19322. $core.addMethod(
  19323. $core.method({
  19324. selector: "loadDependencyClasses",
  19325. protocol: 'dependencies',
  19326. fn: function (){
  19327. var self=this;
  19328. var starCategoryName;
  19329. return $core.withContext(function($ctx1) {
  19330. var $3,$2,$1,$5,$4;
  19331. starCategoryName="*".__comma(self._name());
  19332. $ctx1.sendIdx[","]=1;
  19333. $3=self._classes();
  19334. $ctx1.sendIdx["classes"]=1;
  19335. $2=$recv($3)._collect_((function(each){
  19336. return $core.withContext(function($ctx2) {
  19337. return $recv(each)._superclass();
  19338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19339. }));
  19340. $1=$recv($2)._asSet();
  19341. $recv($1)._remove_ifAbsent_(nil,(function(){
  19342. }));
  19343. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  19344. return $core.withContext(function($ctx2) {
  19345. $5=$recv(each)._protocols();
  19346. $ctx2.sendIdx["protocols"]=1;
  19347. $4=$recv($5).__comma($recv($recv(each)._class())._protocols());
  19348. return $recv($4)._includes_(starCategoryName);
  19349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  19350. })));
  19351. return $recv($1)._yourself();
  19352. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  19353. },
  19354. args: [],
  19355. 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\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
  19356. referencedClasses: ["Smalltalk"],
  19357. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  19358. }),
  19359. $globals.Package);
  19360. $core.addMethod(
  19361. $core.method({
  19362. selector: "name",
  19363. protocol: 'accessing',
  19364. fn: function (){
  19365. var self=this;
  19366. return $core.withContext(function($ctx1) {
  19367. return self.pkgName;
  19368. return self;
  19369. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  19370. },
  19371. args: [],
  19372. source: "name\x0a\x09<inlineJS: 'return self.pkgName'>",
  19373. referencedClasses: [],
  19374. messageSends: []
  19375. }),
  19376. $globals.Package);
  19377. $core.addMethod(
  19378. $core.method({
  19379. selector: "name:",
  19380. protocol: 'accessing',
  19381. fn: function (aString){
  19382. var self=this;
  19383. return $core.withContext(function($ctx1) {
  19384. self._basicName_(aString);
  19385. self._beDirty();
  19386. return self;
  19387. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  19388. },
  19389. args: ["aString"],
  19390. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  19391. referencedClasses: [],
  19392. messageSends: ["basicName:", "beDirty"]
  19393. }),
  19394. $globals.Package);
  19395. $core.addMethod(
  19396. $core.method({
  19397. selector: "organization",
  19398. protocol: 'accessing',
  19399. fn: function (){
  19400. var self=this;
  19401. return $core.withContext(function($ctx1) {
  19402. return self._basicAt_("organization");
  19403. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  19404. },
  19405. args: [],
  19406. source: "organization\x0a\x09^ self basicAt: 'organization'",
  19407. referencedClasses: [],
  19408. messageSends: ["basicAt:"]
  19409. }),
  19410. $globals.Package);
  19411. $core.addMethod(
  19412. $core.method({
  19413. selector: "printOn:",
  19414. protocol: 'printing',
  19415. fn: function (aStream){
  19416. var self=this;
  19417. return $core.withContext(function($ctx1) {
  19418. (
  19419. $ctx1.supercall = true,
  19420. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  19421. $ctx1.supercall = false;
  19422. $recv(aStream)._nextPutAll_(" (");
  19423. $ctx1.sendIdx["nextPutAll:"]=1;
  19424. $recv(aStream)._nextPutAll_(self._name());
  19425. $ctx1.sendIdx["nextPutAll:"]=2;
  19426. $recv(aStream)._nextPutAll_(")");
  19427. return self;
  19428. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  19429. },
  19430. args: ["aStream"],
  19431. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  19432. referencedClasses: [],
  19433. messageSends: ["printOn:", "nextPutAll:", "name"]
  19434. }),
  19435. $globals.Package);
  19436. $core.addMethod(
  19437. $core.method({
  19438. selector: "setupClasses",
  19439. protocol: 'classes',
  19440. fn: function (){
  19441. var self=this;
  19442. return $core.withContext(function($ctx1) {
  19443. var $1;
  19444. $1=self._classes();
  19445. $recv($1)._do_((function(each){
  19446. return $core.withContext(function($ctx2) {
  19447. return $recv($recv($globals.ClassBuilder)._new())._setupClass_(each);
  19448. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19449. }));
  19450. $ctx1.sendIdx["do:"]=1;
  19451. $recv($1)._do_((function(each){
  19452. return $core.withContext(function($ctx2) {
  19453. return $recv(each)._initialize();
  19454. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19455. }));
  19456. return self;
  19457. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  19458. },
  19459. args: [],
  19460. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  19461. referencedClasses: ["ClassBuilder"],
  19462. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  19463. }),
  19464. $globals.Package);
  19465. $core.addMethod(
  19466. $core.method({
  19467. selector: "sortedClasses",
  19468. protocol: 'classes',
  19469. fn: function (){
  19470. var self=this;
  19471. return $core.withContext(function($ctx1) {
  19472. return $recv(self._class())._sortedClasses_(self._classes());
  19473. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  19474. },
  19475. args: [],
  19476. 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",
  19477. referencedClasses: [],
  19478. messageSends: ["sortedClasses:", "class", "classes"]
  19479. }),
  19480. $globals.Package);
  19481. $core.addMethod(
  19482. $core.method({
  19483. selector: "sortedImportsAsArray",
  19484. protocol: 'private',
  19485. fn: function (){
  19486. var self=this;
  19487. return $core.withContext(function($ctx1) {
  19488. var $3,$2,$4,$1,$6,$5,$7;
  19489. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  19490. return $core.withContext(function($ctx2) {
  19491. $3=$recv(a)._isString();
  19492. $ctx2.sendIdx["isString"]=1;
  19493. $2=$recv($3)._not();
  19494. $4=$recv(b)._isString();
  19495. $ctx2.sendIdx["isString"]=2;
  19496. $1=$recv($2).__and($4);
  19497. return $recv($1)._or_((function(){
  19498. return $core.withContext(function($ctx3) {
  19499. $6=$recv(a)._isString();
  19500. $ctx3.sendIdx["isString"]=3;
  19501. $5=$recv($6).__eq($recv(b)._isString());
  19502. return $recv($5)._and_((function(){
  19503. return $core.withContext(function($ctx4) {
  19504. $7=$recv(a)._value();
  19505. $ctx4.sendIdx["value"]=1;
  19506. return $recv($7).__lt_eq($recv(b)._value());
  19507. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  19508. }));
  19509. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19510. }));
  19511. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  19512. }));
  19513. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  19514. },
  19515. args: [],
  19516. 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 ]]]",
  19517. referencedClasses: [],
  19518. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  19519. }),
  19520. $globals.Package);
  19521. $core.addMethod(
  19522. $core.method({
  19523. selector: "transport",
  19524. protocol: 'accessing',
  19525. fn: function (){
  19526. var self=this;
  19527. return $core.withContext(function($ctx1) {
  19528. var $1,$2,$receiver;
  19529. $1=self["@transport"];
  19530. if(($receiver = $1) == null || $receiver.isNil){
  19531. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  19532. $recv($2)._package_(self);
  19533. self["@transport"]=$recv($2)._yourself();
  19534. return self["@transport"];
  19535. } else {
  19536. return $1;
  19537. }
  19538. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  19539. },
  19540. args: [],
  19541. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  19542. referencedClasses: ["PackageTransport"],
  19543. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  19544. }),
  19545. $globals.Package);
  19546. $core.addMethod(
  19547. $core.method({
  19548. selector: "transport:",
  19549. protocol: 'accessing',
  19550. fn: function (aPackageTransport){
  19551. var self=this;
  19552. return $core.withContext(function($ctx1) {
  19553. self["@transport"]=aPackageTransport;
  19554. $recv(aPackageTransport)._package_(self);
  19555. return self;
  19556. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  19557. },
  19558. args: ["aPackageTransport"],
  19559. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  19560. referencedClasses: [],
  19561. messageSends: ["package:"]
  19562. }),
  19563. $globals.Package);
  19564. $core.addMethod(
  19565. $core.method({
  19566. selector: "validateImports:",
  19567. protocol: 'validation',
  19568. fn: function (aCollection){
  19569. var self=this;
  19570. return $core.withContext(function($ctx1) {
  19571. var $1,$2,$5,$4,$3,$6;
  19572. $recv(aCollection)._do_((function(import_){
  19573. return $core.withContext(function($ctx2) {
  19574. $1=$recv(import_)._isString();
  19575. $ctx2.sendIdx["isString"]=1;
  19576. if(!$core.assert($1)){
  19577. $2=$recv(import_)._respondsTo_("key");
  19578. if(!$core.assert($2)){
  19579. self._error_("Imports must be Strings or Associations");
  19580. $ctx2.sendIdx["error:"]=1;
  19581. }
  19582. $5=$recv(import_)._key();
  19583. $ctx2.sendIdx["key"]=1;
  19584. $4=$recv($5)._isString();
  19585. $ctx2.sendIdx["isString"]=2;
  19586. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  19587. if(!$core.assert($3)){
  19588. self._error_("Key and value must be Strings");
  19589. $ctx2.sendIdx["error:"]=2;
  19590. }
  19591. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  19592. if(!$core.assert($6)){
  19593. return self._error_("Keys must be identifiers");
  19594. }
  19595. }
  19596. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  19597. }));
  19598. return self;
  19599. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  19600. },
  19601. args: ["aCollection"],
  19602. 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' ]]]",
  19603. referencedClasses: [],
  19604. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  19605. }),
  19606. $globals.Package);
  19607. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  19608. $core.addMethod(
  19609. $core.method({
  19610. selector: "named:",
  19611. protocol: 'accessing',
  19612. fn: function (aPackageName){
  19613. var self=this;
  19614. return $core.withContext(function($ctx1) {
  19615. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  19616. return $core.withContext(function($ctx2) {
  19617. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  19618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19619. }));
  19620. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  19621. },
  19622. args: ["aPackageName"],
  19623. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  19624. referencedClasses: ["Smalltalk"],
  19625. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  19626. }),
  19627. $globals.Package.klass);
  19628. $core.addMethod(
  19629. $core.method({
  19630. selector: "named:ifAbsent:",
  19631. protocol: 'accessing',
  19632. fn: function (aPackageName,aBlock){
  19633. var self=this;
  19634. return $core.withContext(function($ctx1) {
  19635. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  19636. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  19637. },
  19638. args: ["aPackageName", "aBlock"],
  19639. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  19640. referencedClasses: ["Smalltalk"],
  19641. messageSends: ["packageAt:ifAbsent:"]
  19642. }),
  19643. $globals.Package.klass);
  19644. $core.addMethod(
  19645. $core.method({
  19646. selector: "named:imports:transport:",
  19647. protocol: 'accessing',
  19648. fn: function (aPackageName,anArray,aTransport){
  19649. var self=this;
  19650. var package_;
  19651. return $core.withContext(function($ctx1) {
  19652. package_=self._named_(aPackageName);
  19653. $recv(package_)._imports_(anArray);
  19654. $recv(package_)._transport_(aTransport);
  19655. return package_;
  19656. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19657. },
  19658. args: ["aPackageName", "anArray", "aTransport"],
  19659. 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",
  19660. referencedClasses: [],
  19661. messageSends: ["named:", "imports:", "transport:"]
  19662. }),
  19663. $globals.Package.klass);
  19664. $core.addMethod(
  19665. $core.method({
  19666. selector: "named:transport:",
  19667. protocol: 'accessing',
  19668. fn: function (aPackageName,aTransport){
  19669. var self=this;
  19670. var package_;
  19671. return $core.withContext(function($ctx1) {
  19672. package_=self._named_(aPackageName);
  19673. $recv(package_)._transport_(aTransport);
  19674. return package_;
  19675. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19676. },
  19677. args: ["aPackageName", "aTransport"],
  19678. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  19679. referencedClasses: [],
  19680. messageSends: ["named:", "transport:"]
  19681. }),
  19682. $globals.Package.klass);
  19683. $core.addMethod(
  19684. $core.method({
  19685. selector: "sortedClasses:",
  19686. protocol: 'sorting',
  19687. fn: function (classes){
  19688. var self=this;
  19689. var children,others,nodes,expandedClasses;
  19690. return $core.withContext(function($ctx1) {
  19691. var $1,$3,$2;
  19692. children=[];
  19693. others=[];
  19694. $recv(classes)._do_((function(each){
  19695. return $core.withContext(function($ctx2) {
  19696. $1=$recv(classes)._includes_($recv(each)._superclass());
  19697. if($core.assert($1)){
  19698. return $recv(others)._add_(each);
  19699. } else {
  19700. return $recv(children)._add_(each);
  19701. $ctx2.sendIdx["add:"]=1;
  19702. }
  19703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19704. }));
  19705. $ctx1.sendIdx["do:"]=1;
  19706. nodes=$recv(children)._collect_((function(each){
  19707. return $core.withContext(function($ctx2) {
  19708. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  19709. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  19710. }));
  19711. nodes=$recv(nodes)._sorted_((function(a,b){
  19712. return $core.withContext(function($ctx2) {
  19713. $3=$recv(a)._theClass();
  19714. $ctx2.sendIdx["theClass"]=1;
  19715. $2=$recv($3)._name();
  19716. $ctx2.sendIdx["name"]=1;
  19717. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  19718. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  19719. }));
  19720. expandedClasses=$recv($globals.Array)._new();
  19721. $recv(nodes)._do_((function(aNode){
  19722. return $core.withContext(function($ctx2) {
  19723. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  19724. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  19725. }));
  19726. return expandedClasses;
  19727. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  19728. },
  19729. args: ["classes"],
  19730. 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",
  19731. referencedClasses: ["ClassSorterNode", "Array"],
  19732. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  19733. }),
  19734. $globals.Package.klass);
  19735. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  19736. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  19737. $core.addMethod(
  19738. $core.method({
  19739. selector: "announcer",
  19740. protocol: 'accessing',
  19741. fn: function (){
  19742. var self=this;
  19743. return $core.withContext(function($ctx1) {
  19744. return $recv($globals.SystemAnnouncer)._current();
  19745. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  19746. },
  19747. args: [],
  19748. source: "announcer\x0a\x09^ SystemAnnouncer current",
  19749. referencedClasses: ["SystemAnnouncer"],
  19750. messageSends: ["current"]
  19751. }),
  19752. $globals.PackageStateObserver);
  19753. $core.addMethod(
  19754. $core.method({
  19755. selector: "observeSystem",
  19756. protocol: 'actions',
  19757. fn: function (){
  19758. var self=this;
  19759. return $core.withContext(function($ctx1) {
  19760. var $1;
  19761. $1=self._announcer();
  19762. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  19763. $ctx1.sendIdx["on:send:to:"]=1;
  19764. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  19765. $ctx1.sendIdx["on:send:to:"]=2;
  19766. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  19767. $ctx1.sendIdx["on:send:to:"]=3;
  19768. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  19769. return self;
  19770. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  19771. },
  19772. args: [],
  19773. 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",
  19774. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  19775. messageSends: ["on:send:to:", "announcer"]
  19776. }),
  19777. $globals.PackageStateObserver);
  19778. $core.addMethod(
  19779. $core.method({
  19780. selector: "onClassModification:",
  19781. protocol: 'reactions',
  19782. fn: function (anAnnouncement){
  19783. var self=this;
  19784. return $core.withContext(function($ctx1) {
  19785. var $1,$receiver;
  19786. $1=$recv(anAnnouncement)._theClass();
  19787. if(($receiver = $1) == null || $receiver.isNil){
  19788. $1;
  19789. } else {
  19790. var theClass;
  19791. theClass=$receiver;
  19792. $recv($recv(theClass)._package())._beDirty();
  19793. }
  19794. return self;
  19795. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19796. },
  19797. args: ["anAnnouncement"],
  19798. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  19799. referencedClasses: [],
  19800. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  19801. }),
  19802. $globals.PackageStateObserver);
  19803. $core.addMethod(
  19804. $core.method({
  19805. selector: "onMethodModification:",
  19806. protocol: 'reactions',
  19807. fn: function (anAnnouncement){
  19808. var self=this;
  19809. return $core.withContext(function($ctx1) {
  19810. var $1,$receiver;
  19811. $1=$recv($recv(anAnnouncement)._method())._package();
  19812. if(($receiver = $1) == null || $receiver.isNil){
  19813. $1;
  19814. } else {
  19815. var package_;
  19816. package_=$receiver;
  19817. $recv(package_)._beDirty();
  19818. }
  19819. return self;
  19820. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19821. },
  19822. args: ["anAnnouncement"],
  19823. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  19824. referencedClasses: [],
  19825. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  19826. }),
  19827. $globals.PackageStateObserver);
  19828. $core.addMethod(
  19829. $core.method({
  19830. selector: "onPackageAdded:",
  19831. protocol: 'reactions',
  19832. fn: function (anAnnouncement){
  19833. var self=this;
  19834. return $core.withContext(function($ctx1) {
  19835. $recv($recv(anAnnouncement)._package())._beDirty();
  19836. return self;
  19837. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19838. },
  19839. args: ["anAnnouncement"],
  19840. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  19841. referencedClasses: [],
  19842. messageSends: ["beDirty", "package"]
  19843. }),
  19844. $globals.PackageStateObserver);
  19845. $core.addMethod(
  19846. $core.method({
  19847. selector: "onProtocolModification:",
  19848. protocol: 'reactions',
  19849. fn: function (anAnnouncement){
  19850. var self=this;
  19851. return $core.withContext(function($ctx1) {
  19852. var $1,$receiver;
  19853. $1=$recv(anAnnouncement)._package();
  19854. if(($receiver = $1) == null || $receiver.isNil){
  19855. $1;
  19856. } else {
  19857. var package_;
  19858. package_=$receiver;
  19859. $recv(package_)._beDirty();
  19860. }
  19861. return self;
  19862. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19863. },
  19864. args: ["anAnnouncement"],
  19865. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  19866. referencedClasses: [],
  19867. messageSends: ["ifNotNil:", "package", "beDirty"]
  19868. }),
  19869. $globals.PackageStateObserver);
  19870. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  19871. $core.addMethod(
  19872. $core.method({
  19873. selector: "current",
  19874. protocol: 'accessing',
  19875. fn: function (){
  19876. var self=this;
  19877. return $core.withContext(function($ctx1) {
  19878. var $1,$receiver;
  19879. $1=self["@current"];
  19880. if(($receiver = $1) == null || $receiver.isNil){
  19881. self["@current"]=self._new();
  19882. return self["@current"];
  19883. } else {
  19884. return $1;
  19885. }
  19886. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  19887. },
  19888. args: [],
  19889. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  19890. referencedClasses: [],
  19891. messageSends: ["ifNil:", "new"]
  19892. }),
  19893. $globals.PackageStateObserver.klass);
  19894. $core.addMethod(
  19895. $core.method({
  19896. selector: "initialize",
  19897. protocol: 'initialization',
  19898. fn: function (){
  19899. var self=this;
  19900. return $core.withContext(function($ctx1) {
  19901. $recv(self._current())._observeSystem();
  19902. return self;
  19903. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  19904. },
  19905. args: [],
  19906. source: "initialize\x0a\x09self current observeSystem",
  19907. referencedClasses: [],
  19908. messageSends: ["observeSystem", "current"]
  19909. }),
  19910. $globals.PackageStateObserver.klass);
  19911. $core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
  19912. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  19913. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19914. $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`";
  19915. $core.addMethod(
  19916. $core.method({
  19917. selector: "defaultValue",
  19918. protocol: 'accessing',
  19919. fn: function (){
  19920. var self=this;
  19921. return self["@defaultValue"];
  19922. },
  19923. args: [],
  19924. source: "defaultValue\x0a\x09^ defaultValue",
  19925. referencedClasses: [],
  19926. messageSends: []
  19927. }),
  19928. $globals.Setting);
  19929. $core.addMethod(
  19930. $core.method({
  19931. selector: "defaultValue:",
  19932. protocol: 'accessing',
  19933. fn: function (aStringifiableObject){
  19934. var self=this;
  19935. self["@defaultValue"]=aStringifiableObject;
  19936. return self;
  19937. },
  19938. args: ["aStringifiableObject"],
  19939. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19940. referencedClasses: [],
  19941. messageSends: []
  19942. }),
  19943. $globals.Setting);
  19944. $core.addMethod(
  19945. $core.method({
  19946. selector: "key",
  19947. protocol: 'accessing',
  19948. fn: function (){
  19949. var self=this;
  19950. return self["@key"];
  19951. },
  19952. args: [],
  19953. source: "key\x0a\x09^ key",
  19954. referencedClasses: [],
  19955. messageSends: []
  19956. }),
  19957. $globals.Setting);
  19958. $core.addMethod(
  19959. $core.method({
  19960. selector: "key:",
  19961. protocol: 'accessing',
  19962. fn: function (aString){
  19963. var self=this;
  19964. self["@key"]=aString;
  19965. return self;
  19966. },
  19967. args: ["aString"],
  19968. source: "key: aString\x0a\x09key := aString",
  19969. referencedClasses: [],
  19970. messageSends: []
  19971. }),
  19972. $globals.Setting);
  19973. $core.addMethod(
  19974. $core.method({
  19975. selector: "value",
  19976. protocol: 'accessing',
  19977. fn: function (){
  19978. var self=this;
  19979. return $core.withContext(function($ctx1) {
  19980. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  19981. return $core.withContext(function($ctx2) {
  19982. return self._defaultValue();
  19983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19984. }));
  19985. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19986. },
  19987. args: [],
  19988. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19989. referencedClasses: ["Smalltalk"],
  19990. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19991. }),
  19992. $globals.Setting);
  19993. $core.addMethod(
  19994. $core.method({
  19995. selector: "value:",
  19996. protocol: 'accessing',
  19997. fn: function (aStringifiableObject){
  19998. var self=this;
  19999. return $core.withContext(function($ctx1) {
  20000. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  20001. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  20002. },
  20003. args: ["aStringifiableObject"],
  20004. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  20005. referencedClasses: ["Smalltalk"],
  20006. messageSends: ["at:put:", "settings", "key"]
  20007. }),
  20008. $globals.Setting);
  20009. $core.addMethod(
  20010. $core.method({
  20011. selector: "at:ifAbsent:",
  20012. protocol: 'instance creation',
  20013. fn: function (aString,aDefaultValue){
  20014. var self=this;
  20015. return $core.withContext(function($ctx1) {
  20016. var $1;
  20017. $1=(
  20018. $ctx1.supercall = true,
  20019. ($globals.Setting.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  20020. $ctx1.supercall = false;
  20021. $recv($1)._key_(aString);
  20022. $recv($1)._defaultValue_(aDefaultValue);
  20023. return $recv($1)._yourself();
  20024. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  20025. },
  20026. args: ["aString", "aDefaultValue"],
  20027. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  20028. referencedClasses: [],
  20029. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  20030. }),
  20031. $globals.Setting.klass);
  20032. $core.addMethod(
  20033. $core.method({
  20034. selector: "new",
  20035. protocol: 'instance creation',
  20036. fn: function (){
  20037. var self=this;
  20038. return $core.withContext(function($ctx1) {
  20039. self._shouldNotImplement();
  20040. return self;
  20041. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  20042. },
  20043. args: [],
  20044. source: "new\x0a\x09self shouldNotImplement",
  20045. referencedClasses: [],
  20046. messageSends: ["shouldNotImplement"]
  20047. }),
  20048. $globals.Setting.klass);
  20049. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  20050. $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.";
  20051. $core.addMethod(
  20052. $core.method({
  20053. selector: "addGlobalJsVariable:",
  20054. protocol: 'globals',
  20055. fn: function (aString){
  20056. var self=this;
  20057. return $core.withContext(function($ctx1) {
  20058. $recv(self._globalJsVariables())._add_(aString);
  20059. return self;
  20060. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  20061. },
  20062. args: ["aString"],
  20063. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  20064. referencedClasses: [],
  20065. messageSends: ["add:", "globalJsVariables"]
  20066. }),
  20067. $globals.SmalltalkImage);
  20068. $core.addMethod(
  20069. $core.method({
  20070. selector: "amdRequire",
  20071. protocol: 'accessing amd',
  20072. fn: function (){
  20073. var self=this;
  20074. return $core.withContext(function($ctx1) {
  20075. return $recv(self._core())._at_("amdRequire");
  20076. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  20077. },
  20078. args: [],
  20079. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  20080. referencedClasses: [],
  20081. messageSends: ["at:", "core"]
  20082. }),
  20083. $globals.SmalltalkImage);
  20084. $core.addMethod(
  20085. $core.method({
  20086. selector: "asSmalltalkException:",
  20087. protocol: 'error handling',
  20088. fn: function (anObject){
  20089. var self=this;
  20090. return $core.withContext(function($ctx1) {
  20091. var $1;
  20092. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  20093. return $core.withContext(function($ctx2) {
  20094. return $recv(anObject)._isKindOf_($globals.Error);
  20095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20096. }));
  20097. if($core.assert($1)){
  20098. return anObject;
  20099. } else {
  20100. return $recv($globals.JavaScriptException)._on_(anObject);
  20101. }
  20102. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  20103. },
  20104. args: ["anObject"],
  20105. 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 ]",
  20106. referencedClasses: ["Error", "JavaScriptException"],
  20107. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  20108. }),
  20109. $globals.SmalltalkImage);
  20110. $core.addMethod(
  20111. $core.method({
  20112. selector: "basicCreatePackage:",
  20113. protocol: 'private',
  20114. fn: function (packageName){
  20115. var self=this;
  20116. return $core.withContext(function($ctx1) {
  20117. return $core.addPackage(packageName);
  20118. return self;
  20119. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  20120. },
  20121. args: ["packageName"],
  20122. 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)'>",
  20123. referencedClasses: [],
  20124. messageSends: []
  20125. }),
  20126. $globals.SmalltalkImage);
  20127. $core.addMethod(
  20128. $core.method({
  20129. selector: "basicParse:",
  20130. protocol: 'private',
  20131. fn: function (aString){
  20132. var self=this;
  20133. return $core.withContext(function($ctx1) {
  20134. return $recv($globals.SmalltalkParser)._parse_(aString);
  20135. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  20136. },
  20137. args: ["aString"],
  20138. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  20139. referencedClasses: ["SmalltalkParser"],
  20140. messageSends: ["parse:"]
  20141. }),
  20142. $globals.SmalltalkImage);
  20143. $core.addMethod(
  20144. $core.method({
  20145. selector: "basicRegisterPackage:",
  20146. protocol: 'private',
  20147. fn: function (aPackage){
  20148. var self=this;
  20149. return $core.withContext(function($ctx1) {
  20150. $core.packages[aPackage.pkgName]=aPackage;
  20151. return self;
  20152. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  20153. },
  20154. args: ["aPackage"],
  20155. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<inlineJS: '$core.packages[aPackage.pkgName]=aPackage'>",
  20156. referencedClasses: [],
  20157. messageSends: []
  20158. }),
  20159. $globals.SmalltalkImage);
  20160. $core.addMethod(
  20161. $core.method({
  20162. selector: "cancelOptOut:",
  20163. protocol: 'accessing',
  20164. fn: function (anObject){
  20165. var self=this;
  20166. return $core.withContext(function($ctx1) {
  20167. delete anObject.klass;
  20168. return self;
  20169. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  20170. },
  20171. args: ["anObject"],
  20172. 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'>",
  20173. referencedClasses: [],
  20174. messageSends: []
  20175. }),
  20176. $globals.SmalltalkImage);
  20177. $core.addMethod(
  20178. $core.method({
  20179. selector: "classes",
  20180. protocol: 'classes',
  20181. fn: function (){
  20182. var self=this;
  20183. return $core.withContext(function($ctx1) {
  20184. return $core.classes();
  20185. return self;
  20186. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  20187. },
  20188. args: [],
  20189. source: "classes\x0a\x09<inlineJS: 'return $core.classes()'>",
  20190. referencedClasses: [],
  20191. messageSends: []
  20192. }),
  20193. $globals.SmalltalkImage);
  20194. $core.addMethod(
  20195. $core.method({
  20196. selector: "core",
  20197. protocol: 'accessing',
  20198. fn: function (){
  20199. var self=this;
  20200. return $core.withContext(function($ctx1) {
  20201. return $core;
  20202. return self;
  20203. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  20204. },
  20205. args: [],
  20206. source: "core\x0a\x09<inlineJS: 'return $core'>",
  20207. referencedClasses: [],
  20208. messageSends: []
  20209. }),
  20210. $globals.SmalltalkImage);
  20211. $core.addMethod(
  20212. $core.method({
  20213. selector: "createPackage:",
  20214. protocol: 'packages',
  20215. fn: function (packageName){
  20216. var self=this;
  20217. var package_,announcement;
  20218. return $core.withContext(function($ctx1) {
  20219. var $1;
  20220. package_=self._basicCreatePackage_(packageName);
  20221. $1=$recv($globals.PackageAdded)._new();
  20222. $recv($1)._package_(package_);
  20223. announcement=$recv($1)._yourself();
  20224. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  20225. return package_;
  20226. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  20227. },
  20228. args: ["packageName"],
  20229. 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",
  20230. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  20231. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  20232. }),
  20233. $globals.SmalltalkImage);
  20234. $core.addMethod(
  20235. $core.method({
  20236. selector: "defaultAmdNamespace",
  20237. protocol: 'accessing amd',
  20238. fn: function (){
  20239. var self=this;
  20240. return $core.withContext(function($ctx1) {
  20241. return "transport.defaultAmdNamespace"._settingValue();
  20242. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  20243. },
  20244. args: [],
  20245. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  20246. referencedClasses: [],
  20247. messageSends: ["settingValue"]
  20248. }),
  20249. $globals.SmalltalkImage);
  20250. $core.addMethod(
  20251. $core.method({
  20252. selector: "defaultAmdNamespace:",
  20253. protocol: 'accessing amd',
  20254. fn: function (aString){
  20255. var self=this;
  20256. return $core.withContext(function($ctx1) {
  20257. "transport.defaultAmdNamespace"._settingValue_(aString);
  20258. return self;
  20259. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  20260. },
  20261. args: ["aString"],
  20262. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  20263. referencedClasses: [],
  20264. messageSends: ["settingValue:"]
  20265. }),
  20266. $globals.SmalltalkImage);
  20267. $core.addMethod(
  20268. $core.method({
  20269. selector: "deleteClass:",
  20270. protocol: 'private',
  20271. fn: function (aClass){
  20272. var self=this;
  20273. return $core.withContext(function($ctx1) {
  20274. $core.removeClass(aClass);
  20275. return self;
  20276. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20277. },
  20278. args: ["aClass"],
  20279. 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)'>",
  20280. referencedClasses: [],
  20281. messageSends: []
  20282. }),
  20283. $globals.SmalltalkImage);
  20284. $core.addMethod(
  20285. $core.method({
  20286. selector: "deleteGlobalJsVariable:",
  20287. protocol: 'globals',
  20288. fn: function (aString){
  20289. var self=this;
  20290. return $core.withContext(function($ctx1) {
  20291. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  20292. }));
  20293. return self;
  20294. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  20295. },
  20296. args: ["aString"],
  20297. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  20298. referencedClasses: [],
  20299. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  20300. }),
  20301. $globals.SmalltalkImage);
  20302. $core.addMethod(
  20303. $core.method({
  20304. selector: "deletePackage:",
  20305. protocol: 'private',
  20306. fn: function (packageName){
  20307. var self=this;
  20308. return $core.withContext(function($ctx1) {
  20309. delete $core.packages[packageName];
  20310. return self;
  20311. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  20312. },
  20313. args: ["packageName"],
  20314. 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]'>",
  20315. referencedClasses: [],
  20316. messageSends: []
  20317. }),
  20318. $globals.SmalltalkImage);
  20319. $core.addMethod(
  20320. $core.method({
  20321. selector: "existsJsGlobal:",
  20322. protocol: 'testing',
  20323. fn: function (aString){
  20324. var self=this;
  20325. return $core.withContext(function($ctx1) {
  20326. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  20327. return true;
  20328. }),(function(){
  20329. return false;
  20330. }));
  20331. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  20332. },
  20333. args: ["aString"],
  20334. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  20335. referencedClasses: ["Platform"],
  20336. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  20337. }),
  20338. $globals.SmalltalkImage);
  20339. $core.addMethod(
  20340. $core.method({
  20341. selector: "globalJsVariables",
  20342. protocol: 'globals',
  20343. fn: function (){
  20344. var self=this;
  20345. return $core.withContext(function($ctx1) {
  20346. return $core.globalJsVariables;
  20347. return self;
  20348. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  20349. },
  20350. args: [],
  20351. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<inlineJS: 'return $core.globalJsVariables'>",
  20352. referencedClasses: [],
  20353. messageSends: []
  20354. }),
  20355. $globals.SmalltalkImage);
  20356. $core.addMethod(
  20357. $core.method({
  20358. selector: "globals",
  20359. protocol: 'accessing',
  20360. fn: function (){
  20361. var self=this;
  20362. return $core.withContext(function($ctx1) {
  20363. return $globals;
  20364. return self;
  20365. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  20366. },
  20367. args: [],
  20368. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  20369. referencedClasses: [],
  20370. messageSends: []
  20371. }),
  20372. $globals.SmalltalkImage);
  20373. $core.addMethod(
  20374. $core.method({
  20375. selector: "includesKey:",
  20376. protocol: 'accessing',
  20377. fn: function (aKey){
  20378. var self=this;
  20379. return $core.withContext(function($ctx1) {
  20380. return $core.hasOwnProperty(aKey);
  20381. return self;
  20382. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  20383. },
  20384. args: ["aKey"],
  20385. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  20386. referencedClasses: [],
  20387. messageSends: []
  20388. }),
  20389. $globals.SmalltalkImage);
  20390. $core.addMethod(
  20391. $core.method({
  20392. selector: "isSmalltalkObject:",
  20393. protocol: 'testing',
  20394. fn: function (anObject){
  20395. var self=this;
  20396. return $core.withContext(function($ctx1) {
  20397. return anObject.klass != null;
  20398. return self;
  20399. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20400. },
  20401. args: ["anObject"],
  20402. 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'>",
  20403. referencedClasses: [],
  20404. messageSends: []
  20405. }),
  20406. $globals.SmalltalkImage);
  20407. $core.addMethod(
  20408. $core.method({
  20409. selector: "optOut:",
  20410. protocol: 'accessing',
  20411. fn: function (anObject){
  20412. var self=this;
  20413. return $core.withContext(function($ctx1) {
  20414. anObject.klass = null;
  20415. return self;
  20416. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  20417. },
  20418. args: ["anObject"],
  20419. 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'>",
  20420. referencedClasses: [],
  20421. messageSends: []
  20422. }),
  20423. $globals.SmalltalkImage);
  20424. $core.addMethod(
  20425. $core.method({
  20426. selector: "packageAt:",
  20427. protocol: 'packages',
  20428. fn: function (packageName){
  20429. var self=this;
  20430. return $core.withContext(function($ctx1) {
  20431. return $core.packages[packageName];
  20432. return self;
  20433. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  20434. },
  20435. args: ["packageName"],
  20436. source: "packageAt: packageName\x0a\x09<inlineJS: 'return $core.packages[packageName]'>",
  20437. referencedClasses: [],
  20438. messageSends: []
  20439. }),
  20440. $globals.SmalltalkImage);
  20441. $core.addMethod(
  20442. $core.method({
  20443. selector: "packageAt:ifAbsent:",
  20444. protocol: 'packages',
  20445. fn: function (packageName,aBlock){
  20446. var self=this;
  20447. return $core.withContext(function($ctx1) {
  20448. var $1;
  20449. $1=self._packageAt_(packageName);
  20450. return $recv($1)._ifNil_(aBlock);
  20451. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  20452. },
  20453. args: ["packageName", "aBlock"],
  20454. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  20455. referencedClasses: [],
  20456. messageSends: ["ifNil:", "packageAt:"]
  20457. }),
  20458. $globals.SmalltalkImage);
  20459. $core.addMethod(
  20460. $core.method({
  20461. selector: "packages",
  20462. protocol: 'packages',
  20463. fn: function (){
  20464. var self=this;
  20465. return $core.withContext(function($ctx1) {
  20466. return Object.keys($core.packages).map(function(k) {
  20467. return $core.packages[k];
  20468. })
  20469. ;
  20470. return self;
  20471. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  20472. },
  20473. args: [],
  20474. 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'>",
  20475. referencedClasses: [],
  20476. messageSends: []
  20477. }),
  20478. $globals.SmalltalkImage);
  20479. $core.addMethod(
  20480. $core.method({
  20481. selector: "parse:",
  20482. protocol: 'accessing',
  20483. fn: function (aString){
  20484. var self=this;
  20485. var result;
  20486. return $core.withContext(function($ctx1) {
  20487. var $1;
  20488. $recv((function(){
  20489. return $core.withContext(function($ctx2) {
  20490. result=self._basicParse_(aString);
  20491. return result;
  20492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20493. }))._tryCatch_((function(ex){
  20494. return $core.withContext(function($ctx2) {
  20495. return $recv(self._parseError_parsing_(ex,aString))._signal();
  20496. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  20497. }));
  20498. $1=result;
  20499. $recv($1)._source_(aString);
  20500. return $recv($1)._yourself();
  20501. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  20502. },
  20503. args: ["aString"],
  20504. 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",
  20505. referencedClasses: [],
  20506. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  20507. }),
  20508. $globals.SmalltalkImage);
  20509. $core.addMethod(
  20510. $core.method({
  20511. selector: "parseError:parsing:",
  20512. protocol: 'error handling',
  20513. fn: function (anException,aString){
  20514. var self=this;
  20515. return $core.withContext(function($ctx1) {
  20516. var $1,$7,$6,$5,$8,$4,$3,$2;
  20517. $1=$recv($globals.ParseError)._new();
  20518. $7=$recv(anException)._basicAt_("line");
  20519. $ctx1.sendIdx["basicAt:"]=1;
  20520. $6="Parse error on line ".__comma($7);
  20521. $5=$recv($6).__comma(" column ");
  20522. $ctx1.sendIdx[","]=4;
  20523. $8=$recv(anException)._basicAt_("column");
  20524. $ctx1.sendIdx["basicAt:"]=2;
  20525. $4=$recv($5).__comma($8);
  20526. $ctx1.sendIdx[","]=3;
  20527. $3=$recv($4).__comma(" : Unexpected character ");
  20528. $ctx1.sendIdx[","]=2;
  20529. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  20530. $ctx1.sendIdx[","]=1;
  20531. return $recv($1)._messageText_($2);
  20532. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  20533. },
  20534. args: ["anException", "aString"],
  20535. 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')",
  20536. referencedClasses: ["ParseError"],
  20537. messageSends: ["messageText:", "new", ",", "basicAt:"]
  20538. }),
  20539. $globals.SmalltalkImage);
  20540. $core.addMethod(
  20541. $core.method({
  20542. selector: "pseudoVariableNames",
  20543. protocol: 'accessing',
  20544. fn: function (){
  20545. var self=this;
  20546. return ["self", "super", "nil", "true", "false", "thisContext"];
  20547. },
  20548. args: [],
  20549. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  20550. referencedClasses: [],
  20551. messageSends: []
  20552. }),
  20553. $globals.SmalltalkImage);
  20554. $core.addMethod(
  20555. $core.method({
  20556. selector: "readJSObject:",
  20557. protocol: 'accessing',
  20558. fn: function (anObject){
  20559. var self=this;
  20560. return $core.withContext(function($ctx1) {
  20561. return $core.readJSObject(anObject);
  20562. return self;
  20563. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20564. },
  20565. args: ["anObject"],
  20566. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  20567. referencedClasses: [],
  20568. messageSends: []
  20569. }),
  20570. $globals.SmalltalkImage);
  20571. $core.addMethod(
  20572. $core.method({
  20573. selector: "removeClass:",
  20574. protocol: 'classes',
  20575. fn: function (aClass){
  20576. var self=this;
  20577. return $core.withContext(function($ctx1) {
  20578. var $1,$2,$4,$3;
  20579. $1=$recv(aClass)._isMetaclass();
  20580. if($core.assert($1)){
  20581. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  20582. }
  20583. self._deleteClass_(aClass);
  20584. $2=$recv($globals.SystemAnnouncer)._current();
  20585. $4=$recv($globals.ClassRemoved)._new();
  20586. $recv($4)._theClass_(aClass);
  20587. $3=$recv($4)._yourself();
  20588. $recv($2)._announce_($3);
  20589. return self;
  20590. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20591. },
  20592. args: ["aClass"],
  20593. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  20594. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  20595. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  20596. }),
  20597. $globals.SmalltalkImage);
  20598. $core.addMethod(
  20599. $core.method({
  20600. selector: "removePackage:",
  20601. protocol: 'packages',
  20602. fn: function (packageName){
  20603. var self=this;
  20604. var pkg;
  20605. return $core.withContext(function($ctx1) {
  20606. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20607. return $core.withContext(function($ctx2) {
  20608. return self._error_("Missing package: ".__comma(packageName));
  20609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20610. }));
  20611. $recv($recv(pkg)._classes())._do_((function(each){
  20612. return $core.withContext(function($ctx2) {
  20613. return self._removeClass_(each);
  20614. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  20615. }));
  20616. self._deletePackage_(packageName);
  20617. return self;
  20618. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  20619. },
  20620. args: ["packageName"],
  20621. 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",
  20622. referencedClasses: [],
  20623. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  20624. }),
  20625. $globals.SmalltalkImage);
  20626. $core.addMethod(
  20627. $core.method({
  20628. selector: "renamePackage:to:",
  20629. protocol: 'packages',
  20630. fn: function (packageName,newName){
  20631. var self=this;
  20632. var pkg;
  20633. return $core.withContext(function($ctx1) {
  20634. var $1,$2,$receiver;
  20635. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20636. return $core.withContext(function($ctx2) {
  20637. $1="Missing package: ".__comma(packageName);
  20638. $ctx2.sendIdx[","]=1;
  20639. return self._error_($1);
  20640. $ctx2.sendIdx["error:"]=1;
  20641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20642. }));
  20643. $2=self._packageAt_(newName);
  20644. if(($receiver = $2) == null || $receiver.isNil){
  20645. $2;
  20646. } else {
  20647. self._error_("Already exists a package called: ".__comma(newName));
  20648. }
  20649. $recv(pkg)._name_(newName);
  20650. self._basicRegisterPackage_(pkg);
  20651. self._deletePackage_(packageName);
  20652. return self;
  20653. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  20654. },
  20655. args: ["packageName", "newName"],
  20656. 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.",
  20657. referencedClasses: [],
  20658. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  20659. }),
  20660. $globals.SmalltalkImage);
  20661. $core.addMethod(
  20662. $core.method({
  20663. selector: "reservedWords",
  20664. protocol: 'accessing',
  20665. fn: function (){
  20666. var self=this;
  20667. return $core.withContext(function($ctx1) {
  20668. return $core.reservedWords;
  20669. return self;
  20670. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  20671. },
  20672. args: [],
  20673. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<inlineJS: 'return $core.reservedWords'>",
  20674. referencedClasses: [],
  20675. messageSends: []
  20676. }),
  20677. $globals.SmalltalkImage);
  20678. $core.addMethod(
  20679. $core.method({
  20680. selector: "settings",
  20681. protocol: 'accessing',
  20682. fn: function (){
  20683. var self=this;
  20684. return $globals.SmalltalkSettings;
  20685. },
  20686. args: [],
  20687. source: "settings\x0a\x09^ SmalltalkSettings",
  20688. referencedClasses: ["SmalltalkSettings"],
  20689. messageSends: []
  20690. }),
  20691. $globals.SmalltalkImage);
  20692. $core.addMethod(
  20693. $core.method({
  20694. selector: "version",
  20695. protocol: 'accessing',
  20696. fn: function (){
  20697. var self=this;
  20698. return "0.18.2";
  20699. },
  20700. args: [],
  20701. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.18.2'",
  20702. referencedClasses: [],
  20703. messageSends: []
  20704. }),
  20705. $globals.SmalltalkImage);
  20706. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  20707. $core.addMethod(
  20708. $core.method({
  20709. selector: "current",
  20710. protocol: 'instance creation',
  20711. fn: function (){
  20712. var self=this;
  20713. return $core.withContext(function($ctx1) {
  20714. var $1,$receiver;
  20715. $1=self["@current"];
  20716. if(($receiver = $1) == null || $receiver.isNil){
  20717. self["@current"]=(
  20718. $ctx1.supercall = true,
  20719. ($globals.SmalltalkImage.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  20720. $ctx1.supercall = false;
  20721. return self["@current"];
  20722. } else {
  20723. self._deprecatedAPI();
  20724. return self["@current"];
  20725. }
  20726. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  20727. },
  20728. args: [],
  20729. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  20730. referencedClasses: [],
  20731. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  20732. }),
  20733. $globals.SmalltalkImage.klass);
  20734. $core.addMethod(
  20735. $core.method({
  20736. selector: "initialize",
  20737. protocol: 'initialization',
  20738. fn: function (){
  20739. var self=this;
  20740. var st;
  20741. return $core.withContext(function($ctx1) {
  20742. st=self._current();
  20743. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  20744. return self;
  20745. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  20746. },
  20747. args: [],
  20748. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  20749. referencedClasses: [],
  20750. messageSends: ["current", "at:put:", "globals"]
  20751. }),
  20752. $globals.SmalltalkImage.klass);
  20753. $core.addMethod(
  20754. $core.method({
  20755. selector: "new",
  20756. protocol: 'instance creation',
  20757. fn: function (){
  20758. var self=this;
  20759. return $core.withContext(function($ctx1) {
  20760. self._shouldNotImplement();
  20761. return self;
  20762. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  20763. },
  20764. args: [],
  20765. source: "new\x0a\x09self shouldNotImplement",
  20766. referencedClasses: [],
  20767. messageSends: ["shouldNotImplement"]
  20768. }),
  20769. $globals.SmalltalkImage.klass);
  20770. $core.addMethod(
  20771. $core.method({
  20772. selector: "importsString",
  20773. protocol: '*Kernel-Infrastructure',
  20774. fn: function (){
  20775. var self=this;
  20776. return $core.withContext(function($ctx1) {
  20777. var $3,$2,$1;
  20778. $3=$recv(self._key())._importsString();
  20779. $ctx1.sendIdx["importsString"]=1;
  20780. $2=$recv($3).__comma(" -> ");
  20781. $1=$recv($2).__comma($recv(self._value())._importsString());
  20782. $ctx1.sendIdx[","]=1;
  20783. return $1;
  20784. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  20785. },
  20786. args: [],
  20787. source: "importsString\x0a\x09\x22This is for use by package exporter.\x0a\x09It can fail for non-string keys and values.\x22\x0a\x0a\x09^ self key importsString, ' -> ', self value importsString",
  20788. referencedClasses: [],
  20789. messageSends: [",", "importsString", "key", "value"]
  20790. }),
  20791. $globals.Association);
  20792. $core.addMethod(
  20793. $core.method({
  20794. selector: "asJavaScriptPropertyName",
  20795. protocol: '*Kernel-Infrastructure',
  20796. fn: function (){
  20797. var self=this;
  20798. return $core.withContext(function($ctx1) {
  20799. return $core.st2prop(self);
  20800. return self;
  20801. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  20802. },
  20803. args: [],
  20804. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  20805. referencedClasses: [],
  20806. messageSends: []
  20807. }),
  20808. $globals.String);
  20809. $core.addMethod(
  20810. $core.method({
  20811. selector: "asSetting",
  20812. protocol: '*Kernel-Infrastructure',
  20813. fn: function (){
  20814. var self=this;
  20815. return $core.withContext(function($ctx1) {
  20816. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  20817. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  20818. },
  20819. args: [],
  20820. 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",
  20821. referencedClasses: ["Setting"],
  20822. messageSends: ["at:ifAbsent:"]
  20823. }),
  20824. $globals.String);
  20825. $core.addMethod(
  20826. $core.method({
  20827. selector: "asSettingIfAbsent:",
  20828. protocol: '*Kernel-Infrastructure',
  20829. fn: function (aDefaultValue){
  20830. var self=this;
  20831. return $core.withContext(function($ctx1) {
  20832. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  20833. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20834. },
  20835. args: ["aDefaultValue"],
  20836. 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",
  20837. referencedClasses: ["Setting"],
  20838. messageSends: ["at:ifAbsent:"]
  20839. }),
  20840. $globals.String);
  20841. $core.addMethod(
  20842. $core.method({
  20843. selector: "importsString",
  20844. protocol: '*Kernel-Infrastructure',
  20845. fn: function (){
  20846. var self=this;
  20847. return $core.withContext(function($ctx1) {
  20848. var $1;
  20849. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  20850. $ctx1.sendIdx[","]=1;
  20851. return $1;
  20852. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  20853. },
  20854. args: [],
  20855. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  20856. referencedClasses: [],
  20857. messageSends: [",", "replace:with:"]
  20858. }),
  20859. $globals.String);
  20860. $core.addMethod(
  20861. $core.method({
  20862. selector: "settingValue",
  20863. protocol: '*Kernel-Infrastructure',
  20864. fn: function (){
  20865. var self=this;
  20866. return $core.withContext(function($ctx1) {
  20867. return $recv(self._asSetting())._value();
  20868. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20869. },
  20870. args: [],
  20871. source: "settingValue\x0a\x09^ self asSetting value",
  20872. referencedClasses: [],
  20873. messageSends: ["value", "asSetting"]
  20874. }),
  20875. $globals.String);
  20876. $core.addMethod(
  20877. $core.method({
  20878. selector: "settingValue:",
  20879. protocol: '*Kernel-Infrastructure',
  20880. fn: function (aValue){
  20881. var self=this;
  20882. return $core.withContext(function($ctx1) {
  20883. return $recv(self._asSetting())._value_(aValue);
  20884. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20885. },
  20886. args: ["aValue"],
  20887. 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",
  20888. referencedClasses: [],
  20889. messageSends: ["value:", "asSetting"]
  20890. }),
  20891. $globals.String);
  20892. $core.addMethod(
  20893. $core.method({
  20894. selector: "settingValueIfAbsent:",
  20895. protocol: '*Kernel-Infrastructure',
  20896. fn: function (aDefaultValue){
  20897. var self=this;
  20898. return $core.withContext(function($ctx1) {
  20899. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20900. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20901. },
  20902. args: ["aDefaultValue"],
  20903. 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",
  20904. referencedClasses: [],
  20905. messageSends: ["value", "asSettingIfAbsent:"]
  20906. }),
  20907. $globals.String);
  20908. });
  20909. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20910. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  20911. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20912. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  20913. $core.addPackage('Kernel-Promises');
  20914. $core.packages["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  20915. $core.packages["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20916. $core.addClass('Thenable', $globals.Object, [], 'Kernel-Promises');
  20917. $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.";
  20918. $core.addMethod(
  20919. $core.method({
  20920. selector: "catch:",
  20921. protocol: 'promises',
  20922. fn: function (aBlock){
  20923. var self=this;
  20924. return $core.withContext(function($ctx1) {
  20925. return self.then(null, function (err) {return $core.seamless(function () {
  20926. return aBlock._value_(err);
  20927. })});
  20928. return self;
  20929. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.Thenable)});
  20930. },
  20931. args: ["aBlock"],
  20932. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  20933. referencedClasses: [],
  20934. messageSends: []
  20935. }),
  20936. $globals.Thenable);
  20937. $core.addMethod(
  20938. $core.method({
  20939. selector: "on:do:",
  20940. protocol: 'promises',
  20941. fn: function (aClass,aBlock){
  20942. var self=this;
  20943. return $core.withContext(function($ctx1) {
  20944. return self.then(null, function (err) {return $core.seamless(function () {
  20945. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  20946. else throw err;
  20947. })});
  20948. return self;
  20949. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  20950. },
  20951. args: ["aClass", "aBlock"],
  20952. 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})})'>",
  20953. referencedClasses: [],
  20954. messageSends: []
  20955. }),
  20956. $globals.Thenable);
  20957. $core.addMethod(
  20958. $core.method({
  20959. selector: "on:do:catch:",
  20960. protocol: 'promises',
  20961. fn: function (aClass,aBlock,anotherBlock){
  20962. var self=this;
  20963. return $core.withContext(function($ctx1) {
  20964. return self.then(null, function (err) {return $core.seamless(function () {
  20965. try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }
  20966. return anotherBlock._value_(err);
  20967. })});
  20968. return self;
  20969. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  20970. },
  20971. args: ["aClass", "aBlock", "anotherBlock"],
  20972. 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})})'>",
  20973. referencedClasses: [],
  20974. messageSends: []
  20975. }),
  20976. $globals.Thenable);
  20977. $core.addMethod(
  20978. $core.method({
  20979. selector: "then:",
  20980. protocol: 'promises',
  20981. fn: function (aBlockOrArray){
  20982. var self=this;
  20983. return $core.withContext(function($ctx1) {
  20984. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  20985. return array.reduce(function (soFar, aBlock) {
  20986. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  20987. function (result) {return $core.seamless(function () {
  20988. if (Array.isArray(result)) {
  20989. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  20990. } else {
  20991. return aBlock._value_(result);
  20992. }
  20993. })} :
  20994. function (result) {return $core.seamless(function () {
  20995. return aBlock._value_(result);
  20996. })}
  20997. );
  20998. }, self);
  20999. return self;
  21000. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.Thenable)});
  21001. },
  21002. args: ["aBlockOrArray"],
  21003. 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)'>",
  21004. referencedClasses: [],
  21005. messageSends: []
  21006. }),
  21007. $globals.Thenable);
  21008. $core.addMethod(
  21009. $core.method({
  21010. selector: "then:catch:",
  21011. protocol: 'promises',
  21012. fn: function (aBlockOrArray,anotherBlock){
  21013. var self=this;
  21014. return $core.withContext(function($ctx1) {
  21015. return $recv(self._then_(aBlockOrArray))._catch_(anotherBlock);
  21016. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.Thenable)});
  21017. },
  21018. args: ["aBlockOrArray", "anotherBlock"],
  21019. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21020. referencedClasses: [],
  21021. messageSends: ["catch:", "then:"]
  21022. }),
  21023. $globals.Thenable);
  21024. $core.addMethod(
  21025. $core.method({
  21026. selector: "then:on:do:",
  21027. protocol: 'promises',
  21028. fn: function (aBlockOrArray,aClass,aBlock){
  21029. var self=this;
  21030. return $core.withContext(function($ctx1) {
  21031. return $recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21032. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  21033. },
  21034. args: ["aBlockOrArray", "aClass", "aBlock"],
  21035. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21036. referencedClasses: [],
  21037. messageSends: ["on:do:", "then:"]
  21038. }),
  21039. $globals.Thenable);
  21040. $core.addMethod(
  21041. $core.method({
  21042. selector: "then:on:do:catch:",
  21043. protocol: 'promises',
  21044. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21045. var self=this;
  21046. return $core.withContext(function($ctx1) {
  21047. return $recv($recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21048. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  21049. },
  21050. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21051. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21052. referencedClasses: [],
  21053. messageSends: ["catch:", "on:do:", "then:"]
  21054. }),
  21055. $globals.Thenable);
  21056. $core.addClass('Promise', $globals.Thenable, [], 'Kernel-Promises');
  21057. $core.addMethod(
  21058. $core.method({
  21059. selector: "all:",
  21060. protocol: 'composites',
  21061. fn: function (aCollection){
  21062. var self=this;
  21063. return $core.withContext(function($ctx1) {
  21064. return Promise.all($recv(aCollection)._asArray());
  21065. return self;
  21066. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.klass)});
  21067. },
  21068. args: ["aCollection"],
  21069. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21070. referencedClasses: [],
  21071. messageSends: []
  21072. }),
  21073. $globals.Promise.klass);
  21074. $core.addMethod(
  21075. $core.method({
  21076. selector: "any:",
  21077. protocol: 'composites',
  21078. fn: function (aCollection){
  21079. var self=this;
  21080. return $core.withContext(function($ctx1) {
  21081. return Promise.race($recv(aCollection)._asArray());
  21082. return self;
  21083. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.klass)});
  21084. },
  21085. args: ["aCollection"],
  21086. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21087. referencedClasses: [],
  21088. messageSends: []
  21089. }),
  21090. $globals.Promise.klass);
  21091. $core.addMethod(
  21092. $core.method({
  21093. selector: "forBlock:",
  21094. protocol: 'instance creation',
  21095. fn: function (aBlock){
  21096. var self=this;
  21097. return $core.withContext(function($ctx1) {
  21098. return $recv(self._new())._then_(aBlock);
  21099. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.klass)});
  21100. },
  21101. args: ["aBlock"],
  21102. 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",
  21103. referencedClasses: [],
  21104. messageSends: ["then:", "new"]
  21105. }),
  21106. $globals.Promise.klass);
  21107. $core.addMethod(
  21108. $core.method({
  21109. selector: "new",
  21110. protocol: 'instance creation',
  21111. fn: function (){
  21112. var self=this;
  21113. return $core.withContext(function($ctx1) {
  21114. return Promise.resolve();
  21115. return self;
  21116. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.klass)});
  21117. },
  21118. args: [],
  21119. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21120. referencedClasses: [],
  21121. messageSends: []
  21122. }),
  21123. $globals.Promise.klass);
  21124. $core.addMethod(
  21125. $core.method({
  21126. selector: "new:",
  21127. protocol: 'instance creation',
  21128. fn: function (aBlock){
  21129. var self=this;
  21130. return $core.withContext(function($ctx1) {
  21131. return new Promise(function (resolve, reject) {
  21132. var model = {value: resolve, signal: reject}; // TODO make faster
  21133. aBlock._value_(model);
  21134. });
  21135. return self;
  21136. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.klass)});
  21137. },
  21138. args: ["aBlock"],
  21139. 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})'>",
  21140. referencedClasses: [],
  21141. messageSends: []
  21142. }),
  21143. $globals.Promise.klass);
  21144. $core.addMethod(
  21145. $core.method({
  21146. selector: "signal:",
  21147. protocol: 'instance creation',
  21148. fn: function (anObject){
  21149. var self=this;
  21150. return $core.withContext(function($ctx1) {
  21151. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21152. return self;
  21153. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.klass)});
  21154. },
  21155. args: ["anObject"],
  21156. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21157. referencedClasses: [],
  21158. messageSends: []
  21159. }),
  21160. $globals.Promise.klass);
  21161. $core.addMethod(
  21162. $core.method({
  21163. selector: "value:",
  21164. protocol: 'instance creation',
  21165. fn: function (anObject){
  21166. var self=this;
  21167. return $core.withContext(function($ctx1) {
  21168. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21169. return self;
  21170. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.klass)});
  21171. },
  21172. args: ["anObject"],
  21173. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21174. referencedClasses: [],
  21175. messageSends: []
  21176. }),
  21177. $globals.Promise.klass);
  21178. $core.addMethod(
  21179. $core.method({
  21180. selector: "catch:",
  21181. protocol: '*Kernel-Promises',
  21182. fn: function (aBlock){
  21183. var self=this;
  21184. return $core.withContext(function($ctx1) {
  21185. var js = self["@jsObject"];
  21186. if (typeof js.then === "function")
  21187. return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);
  21188. else
  21189. return self._doesNotUnderstand_(
  21190. $globals.Message._new()
  21191. ._selector_("catch:")
  21192. ._arguments_([aBlock])
  21193. );
  21194. return self;
  21195. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21196. },
  21197. args: ["aBlock"],
  21198. 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 )'>",
  21199. referencedClasses: [],
  21200. messageSends: []
  21201. }),
  21202. $globals.JSObjectProxy);
  21203. $core.addMethod(
  21204. $core.method({
  21205. selector: "on:do:",
  21206. protocol: '*Kernel-Promises',
  21207. fn: function (aClass,aBlock){
  21208. var self=this;
  21209. return $core.withContext(function($ctx1) {
  21210. var js = self["@jsObject"];
  21211. if (typeof js.then === "function")
  21212. return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);
  21213. else
  21214. return self._doesNotUnderstand_(
  21215. $globals.Message._new()
  21216. ._selector_("on:do:")
  21217. ._arguments_([aClass, aBlock])
  21218. );
  21219. return self;
  21220. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21221. },
  21222. args: ["aClass", "aBlock"],
  21223. 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 )'>",
  21224. referencedClasses: [],
  21225. messageSends: []
  21226. }),
  21227. $globals.JSObjectProxy);
  21228. $core.addMethod(
  21229. $core.method({
  21230. selector: "on:do:catch:",
  21231. protocol: '*Kernel-Promises',
  21232. fn: function (aClass,aBlock,anotherBlock){
  21233. var self=this;
  21234. return $core.withContext(function($ctx1) {
  21235. var js = self["@jsObject"];
  21236. if (typeof js.then === "function")
  21237. return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);
  21238. else
  21239. return self._doesNotUnderstand_(
  21240. $globals.Message._new()
  21241. ._selector_("on:do:catch:")
  21242. ._arguments_([aClass, aBlock, anotherBlock])
  21243. );
  21244. return self;
  21245. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21246. },
  21247. args: ["aClass", "aBlock", "anotherBlock"],
  21248. 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 )'>",
  21249. referencedClasses: [],
  21250. messageSends: []
  21251. }),
  21252. $globals.JSObjectProxy);
  21253. $core.addMethod(
  21254. $core.method({
  21255. selector: "then:",
  21256. protocol: '*Kernel-Promises',
  21257. fn: function (aBlockOrArray){
  21258. var self=this;
  21259. return $core.withContext(function($ctx1) {
  21260. var js = self["@jsObject"];
  21261. if (typeof js.then === "function")
  21262. return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);
  21263. else
  21264. return self._doesNotUnderstand_(
  21265. $globals.Message._new()
  21266. ._selector_("then:")
  21267. ._arguments_([aBlockOrArray])
  21268. );
  21269. return self;
  21270. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21271. },
  21272. args: ["aBlockOrArray"],
  21273. 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 )'>",
  21274. referencedClasses: [],
  21275. messageSends: []
  21276. }),
  21277. $globals.JSObjectProxy);
  21278. $core.addMethod(
  21279. $core.method({
  21280. selector: "then:catch:",
  21281. protocol: '*Kernel-Promises',
  21282. fn: function (aBlockOrArray,anotherBlock){
  21283. var self=this;
  21284. return $core.withContext(function($ctx1) {
  21285. var js = self["@jsObject"];
  21286. if (typeof js.then === "function")
  21287. return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);
  21288. else
  21289. return self._doesNotUnderstand_(
  21290. $globals.Message._new()
  21291. ._selector_("then:catch:")
  21292. ._arguments_([aBlockOrArray, anotherBlock])
  21293. );
  21294. return self;
  21295. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21296. },
  21297. args: ["aBlockOrArray", "anotherBlock"],
  21298. 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 )'>",
  21299. referencedClasses: [],
  21300. messageSends: []
  21301. }),
  21302. $globals.JSObjectProxy);
  21303. $core.addMethod(
  21304. $core.method({
  21305. selector: "then:on:do:",
  21306. protocol: '*Kernel-Promises',
  21307. fn: function (aBlockOrArray,aClass,aBlock){
  21308. var self=this;
  21309. return $core.withContext(function($ctx1) {
  21310. var js = self["@jsObject"];
  21311. if (typeof js.then === "function")
  21312. return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);
  21313. else
  21314. return self._doesNotUnderstand_(
  21315. $globals.Message._new()
  21316. ._selector_("then:on:do:")
  21317. ._arguments_([aBlockOrArray, aClass, aBlock])
  21318. );
  21319. return self;
  21320. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21321. },
  21322. args: ["aBlockOrArray", "aClass", "aBlock"],
  21323. 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 )'>",
  21324. referencedClasses: [],
  21325. messageSends: []
  21326. }),
  21327. $globals.JSObjectProxy);
  21328. $core.addMethod(
  21329. $core.method({
  21330. selector: "then:on:do:catch:",
  21331. protocol: '*Kernel-Promises',
  21332. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21333. var self=this;
  21334. return $core.withContext(function($ctx1) {
  21335. var js = self["@jsObject"];
  21336. if (typeof js.then === "function")
  21337. return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);
  21338. else
  21339. return self._doesNotUnderstand_(
  21340. $globals.Message._new()
  21341. ._selector_("then:on:do:catch:")
  21342. ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])
  21343. );
  21344. return self;
  21345. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21346. },
  21347. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21348. 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 )'>",
  21349. referencedClasses: [],
  21350. messageSends: []
  21351. }),
  21352. $globals.JSObjectProxy);
  21353. });
  21354. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21355. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  21356. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21357. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  21358. $core.addPackage('Kernel-Announcements');
  21359. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  21360. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21361. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  21362. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  21363. $core.addMethod(
  21364. $core.method({
  21365. selector: "announcementClass",
  21366. protocol: 'accessing',
  21367. fn: function (){
  21368. var self=this;
  21369. return self["@announcementClass"];
  21370. },
  21371. args: [],
  21372. source: "announcementClass\x0a\x09^ announcementClass",
  21373. referencedClasses: [],
  21374. messageSends: []
  21375. }),
  21376. $globals.AnnouncementSubscription);
  21377. $core.addMethod(
  21378. $core.method({
  21379. selector: "announcementClass:",
  21380. protocol: 'accessing',
  21381. fn: function (aClass){
  21382. var self=this;
  21383. self["@announcementClass"]=aClass;
  21384. return self;
  21385. },
  21386. args: ["aClass"],
  21387. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  21388. referencedClasses: [],
  21389. messageSends: []
  21390. }),
  21391. $globals.AnnouncementSubscription);
  21392. $core.addMethod(
  21393. $core.method({
  21394. selector: "deliver:",
  21395. protocol: 'announcing',
  21396. fn: function (anAnnouncement){
  21397. var self=this;
  21398. return $core.withContext(function($ctx1) {
  21399. var $1;
  21400. $1=self._handlesAnnouncement_(anAnnouncement);
  21401. if($core.assert($1)){
  21402. $recv(self._valuable())._value_(anAnnouncement);
  21403. }
  21404. return self;
  21405. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  21406. },
  21407. args: ["anAnnouncement"],
  21408. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  21409. referencedClasses: [],
  21410. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  21411. }),
  21412. $globals.AnnouncementSubscription);
  21413. $core.addMethod(
  21414. $core.method({
  21415. selector: "handlesAnnouncement:",
  21416. protocol: 'announcing',
  21417. fn: function (anAnnouncement){
  21418. var self=this;
  21419. return $core.withContext(function($ctx1) {
  21420. var $2,$3,$1,$receiver;
  21421. $2=$recv($globals.Smalltalk)._globals();
  21422. $ctx1.sendIdx["globals"]=1;
  21423. $3=$recv(self._announcementClass())._name();
  21424. $ctx1.sendIdx["name"]=1;
  21425. $1=$recv($2)._at_($3);
  21426. $ctx1.sendIdx["at:"]=1;
  21427. if(($receiver = $1) == null || $receiver.isNil){
  21428. return false;
  21429. } else {
  21430. var class_;
  21431. class_=$receiver;
  21432. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  21433. }
  21434. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  21435. },
  21436. args: ["anAnnouncement"],
  21437. 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 ]",
  21438. referencedClasses: ["Smalltalk"],
  21439. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  21440. }),
  21441. $globals.AnnouncementSubscription);
  21442. $core.addMethod(
  21443. $core.method({
  21444. selector: "receiver",
  21445. protocol: 'accessing',
  21446. fn: function (){
  21447. var self=this;
  21448. return $core.withContext(function($ctx1) {
  21449. return $recv(self._valuable())._receiver();
  21450. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  21451. },
  21452. args: [],
  21453. source: "receiver\x0a\x09^ self valuable receiver",
  21454. referencedClasses: [],
  21455. messageSends: ["receiver", "valuable"]
  21456. }),
  21457. $globals.AnnouncementSubscription);
  21458. $core.addMethod(
  21459. $core.method({
  21460. selector: "valuable",
  21461. protocol: 'accessing',
  21462. fn: function (){
  21463. var self=this;
  21464. return self["@valuable"];
  21465. },
  21466. args: [],
  21467. source: "valuable\x0a\x09^ valuable",
  21468. referencedClasses: [],
  21469. messageSends: []
  21470. }),
  21471. $globals.AnnouncementSubscription);
  21472. $core.addMethod(
  21473. $core.method({
  21474. selector: "valuable:",
  21475. protocol: 'accessing',
  21476. fn: function (aValuable){
  21477. var self=this;
  21478. self["@valuable"]=aValuable;
  21479. return self;
  21480. },
  21481. args: ["aValuable"],
  21482. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  21483. referencedClasses: [],
  21484. messageSends: []
  21485. }),
  21486. $globals.AnnouncementSubscription);
  21487. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  21488. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  21489. $core.addMethod(
  21490. $core.method({
  21491. selector: "receiver",
  21492. protocol: 'accessing',
  21493. fn: function (){
  21494. var self=this;
  21495. return self["@receiver"];
  21496. },
  21497. args: [],
  21498. source: "receiver\x0a\x09^ receiver",
  21499. referencedClasses: [],
  21500. messageSends: []
  21501. }),
  21502. $globals.AnnouncementValuable);
  21503. $core.addMethod(
  21504. $core.method({
  21505. selector: "receiver:",
  21506. protocol: 'accessing',
  21507. fn: function (anObject){
  21508. var self=this;
  21509. self["@receiver"]=anObject;
  21510. return self;
  21511. },
  21512. args: ["anObject"],
  21513. source: "receiver: anObject\x0a\x09receiver := anObject",
  21514. referencedClasses: [],
  21515. messageSends: []
  21516. }),
  21517. $globals.AnnouncementValuable);
  21518. $core.addMethod(
  21519. $core.method({
  21520. selector: "valuable",
  21521. protocol: 'accessing',
  21522. fn: function (){
  21523. var self=this;
  21524. return self["@valuable"];
  21525. },
  21526. args: [],
  21527. source: "valuable\x0a\x09^ valuable",
  21528. referencedClasses: [],
  21529. messageSends: []
  21530. }),
  21531. $globals.AnnouncementValuable);
  21532. $core.addMethod(
  21533. $core.method({
  21534. selector: "valuable:",
  21535. protocol: 'accessing',
  21536. fn: function (anObject){
  21537. var self=this;
  21538. self["@valuable"]=anObject;
  21539. return self;
  21540. },
  21541. args: ["anObject"],
  21542. source: "valuable: anObject\x0a\x09valuable := anObject",
  21543. referencedClasses: [],
  21544. messageSends: []
  21545. }),
  21546. $globals.AnnouncementValuable);
  21547. $core.addMethod(
  21548. $core.method({
  21549. selector: "value",
  21550. protocol: 'evaluating',
  21551. fn: function (){
  21552. var self=this;
  21553. return $core.withContext(function($ctx1) {
  21554. return $recv(self._valuable())._value();
  21555. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  21556. },
  21557. args: [],
  21558. source: "value\x0a\x09^ self valuable value",
  21559. referencedClasses: [],
  21560. messageSends: ["value", "valuable"]
  21561. }),
  21562. $globals.AnnouncementValuable);
  21563. $core.addMethod(
  21564. $core.method({
  21565. selector: "value:",
  21566. protocol: 'evaluating',
  21567. fn: function (anObject){
  21568. var self=this;
  21569. return $core.withContext(function($ctx1) {
  21570. return $recv(self._valuable())._value_(anObject);
  21571. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  21572. },
  21573. args: ["anObject"],
  21574. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  21575. referencedClasses: [],
  21576. messageSends: ["value:", "valuable"]
  21577. }),
  21578. $globals.AnnouncementValuable);
  21579. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  21580. $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' ].";
  21581. $core.addMethod(
  21582. $core.method({
  21583. selector: "announce:",
  21584. protocol: 'announcing',
  21585. fn: function (anAnnouncement){
  21586. var self=this;
  21587. return $core.withContext(function($ctx1) {
  21588. $recv(self["@subscriptions"])._do_((function(each){
  21589. return $core.withContext(function($ctx2) {
  21590. return $recv(each)._deliver_(anAnnouncement);
  21591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21592. }));
  21593. return self;
  21594. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  21595. },
  21596. args: ["anAnnouncement"],
  21597. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  21598. referencedClasses: [],
  21599. messageSends: ["do:", "deliver:"]
  21600. }),
  21601. $globals.Announcer);
  21602. $core.addMethod(
  21603. $core.method({
  21604. selector: "initialize",
  21605. protocol: 'initialization',
  21606. fn: function (){
  21607. var self=this;
  21608. return $core.withContext(function($ctx1) {
  21609. (
  21610. $ctx1.supercall = true,
  21611. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  21612. $ctx1.supercall = false;
  21613. self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  21614. return self;
  21615. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  21616. },
  21617. args: [],
  21618. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  21619. referencedClasses: ["OrderedCollection"],
  21620. messageSends: ["initialize", "new"]
  21621. }),
  21622. $globals.Announcer);
  21623. $core.addMethod(
  21624. $core.method({
  21625. selector: "on:do:",
  21626. protocol: 'subscribing',
  21627. fn: function (aClass,aBlock){
  21628. var self=this;
  21629. return $core.withContext(function($ctx1) {
  21630. self._on_do_for_(aClass,aBlock,nil);
  21631. return self;
  21632. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  21633. },
  21634. args: ["aClass", "aBlock"],
  21635. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  21636. referencedClasses: [],
  21637. messageSends: ["on:do:for:"]
  21638. }),
  21639. $globals.Announcer);
  21640. $core.addMethod(
  21641. $core.method({
  21642. selector: "on:do:for:",
  21643. protocol: 'subscribing',
  21644. fn: function (aClass,aBlock,aReceiver){
  21645. var self=this;
  21646. return $core.withContext(function($ctx1) {
  21647. var $1,$3,$5,$6,$4,$2;
  21648. $1=self["@subscriptions"];
  21649. $3=$recv($globals.AnnouncementSubscription)._new();
  21650. $ctx1.sendIdx["new"]=1;
  21651. $5=$recv($globals.AnnouncementValuable)._new();
  21652. $recv($5)._valuable_(aBlock);
  21653. $recv($5)._receiver_(aReceiver);
  21654. $6=$recv($5)._yourself();
  21655. $ctx1.sendIdx["yourself"]=1;
  21656. $4=$6;
  21657. $recv($3)._valuable_($4);
  21658. $ctx1.sendIdx["valuable:"]=1;
  21659. $recv($3)._announcementClass_(aClass);
  21660. $2=$recv($3)._yourself();
  21661. $recv($1)._add_($2);
  21662. return self;
  21663. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  21664. },
  21665. args: ["aClass", "aBlock", "aReceiver"],
  21666. 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)",
  21667. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  21668. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  21669. }),
  21670. $globals.Announcer);
  21671. $core.addMethod(
  21672. $core.method({
  21673. selector: "on:doOnce:",
  21674. protocol: 'subscribing',
  21675. fn: function (aClass,aBlock){
  21676. var self=this;
  21677. var subscription;
  21678. return $core.withContext(function($ctx1) {
  21679. var $1;
  21680. $1=$recv($globals.AnnouncementSubscription)._new();
  21681. $recv($1)._announcementClass_(aClass);
  21682. subscription=$recv($1)._yourself();
  21683. $recv(subscription)._valuable_((function(ann){
  21684. return $core.withContext(function($ctx2) {
  21685. $recv(self["@subscriptions"])._remove_(subscription);
  21686. return $recv(aBlock)._value_(ann);
  21687. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  21688. }));
  21689. $recv(self["@subscriptions"])._add_(subscription);
  21690. return self;
  21691. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  21692. },
  21693. args: ["aClass", "aBlock"],
  21694. 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",
  21695. referencedClasses: ["AnnouncementSubscription"],
  21696. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  21697. }),
  21698. $globals.Announcer);
  21699. $core.addMethod(
  21700. $core.method({
  21701. selector: "on:send:to:",
  21702. protocol: 'subscribing',
  21703. fn: function (aClass,aSelector,anObject){
  21704. var self=this;
  21705. return $core.withContext(function($ctx1) {
  21706. var $1,$3,$5,$6,$4,$2;
  21707. $1=self["@subscriptions"];
  21708. $3=$recv($globals.AnnouncementSubscription)._new();
  21709. $ctx1.sendIdx["new"]=1;
  21710. $5=$recv($globals.MessageSend)._new();
  21711. $recv($5)._receiver_(anObject);
  21712. $recv($5)._selector_(aSelector);
  21713. $6=$recv($5)._yourself();
  21714. $ctx1.sendIdx["yourself"]=1;
  21715. $4=$6;
  21716. $recv($3)._valuable_($4);
  21717. $recv($3)._announcementClass_(aClass);
  21718. $2=$recv($3)._yourself();
  21719. $recv($1)._add_($2);
  21720. return self;
  21721. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  21722. },
  21723. args: ["aClass", "aSelector", "anObject"],
  21724. 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)",
  21725. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  21726. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  21727. }),
  21728. $globals.Announcer);
  21729. $core.addMethod(
  21730. $core.method({
  21731. selector: "unsubscribe:",
  21732. protocol: 'subscribing',
  21733. fn: function (anObject){
  21734. var self=this;
  21735. return $core.withContext(function($ctx1) {
  21736. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  21737. return $core.withContext(function($ctx2) {
  21738. return $recv($recv(each)._receiver()).__eq(anObject);
  21739. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21740. }));
  21741. return self;
  21742. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  21743. },
  21744. args: ["anObject"],
  21745. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  21746. referencedClasses: [],
  21747. messageSends: ["reject:", "=", "receiver"]
  21748. }),
  21749. $globals.Announcer);
  21750. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  21751. $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`";
  21752. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  21753. $core.addMethod(
  21754. $core.method({
  21755. selector: "current",
  21756. protocol: 'accessing',
  21757. fn: function (){
  21758. var self=this;
  21759. return $core.withContext(function($ctx1) {
  21760. var $1,$receiver;
  21761. $1=self["@current"];
  21762. if(($receiver = $1) == null || $receiver.isNil){
  21763. self["@current"]=(
  21764. $ctx1.supercall = true,
  21765. ($globals.SystemAnnouncer.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  21766. $ctx1.supercall = false;
  21767. return self["@current"];
  21768. } else {
  21769. return $1;
  21770. }
  21771. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21772. },
  21773. args: [],
  21774. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21775. referencedClasses: [],
  21776. messageSends: ["ifNil:", "new"]
  21777. }),
  21778. $globals.SystemAnnouncer.klass);
  21779. $core.addMethod(
  21780. $core.method({
  21781. selector: "new",
  21782. protocol: 'instance creation',
  21783. fn: function (){
  21784. var self=this;
  21785. return $core.withContext(function($ctx1) {
  21786. self._shouldNotImplement();
  21787. return self;
  21788. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21789. },
  21790. args: [],
  21791. source: "new\x0a\x09self shouldNotImplement",
  21792. referencedClasses: [],
  21793. messageSends: ["shouldNotImplement"]
  21794. }),
  21795. $globals.SystemAnnouncer.klass);
  21796. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21797. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21798. $core.addMethod(
  21799. $core.method({
  21800. selector: "classTag",
  21801. protocol: 'accessing',
  21802. fn: function (){
  21803. var self=this;
  21804. return "announcement";
  21805. },
  21806. args: [],
  21807. 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'",
  21808. referencedClasses: [],
  21809. messageSends: []
  21810. }),
  21811. $globals.SystemAnnouncement.klass);
  21812. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21813. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21814. $core.addMethod(
  21815. $core.method({
  21816. selector: "theClass",
  21817. protocol: 'accessing',
  21818. fn: function (){
  21819. var self=this;
  21820. return self["@theClass"];
  21821. },
  21822. args: [],
  21823. source: "theClass\x0a\x09^ theClass",
  21824. referencedClasses: [],
  21825. messageSends: []
  21826. }),
  21827. $globals.ClassAnnouncement);
  21828. $core.addMethod(
  21829. $core.method({
  21830. selector: "theClass:",
  21831. protocol: 'accessing',
  21832. fn: function (aClass){
  21833. var self=this;
  21834. self["@theClass"]=aClass;
  21835. return self;
  21836. },
  21837. args: ["aClass"],
  21838. source: "theClass: aClass\x0a\x09theClass := aClass",
  21839. referencedClasses: [],
  21840. messageSends: []
  21841. }),
  21842. $globals.ClassAnnouncement);
  21843. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21844. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21845. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21846. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21847. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21848. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21849. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21850. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21851. $core.addMethod(
  21852. $core.method({
  21853. selector: "oldClass",
  21854. protocol: 'accessing',
  21855. fn: function (){
  21856. var self=this;
  21857. return self["@oldClass"];
  21858. },
  21859. args: [],
  21860. source: "oldClass\x0a\x09^ oldClass",
  21861. referencedClasses: [],
  21862. messageSends: []
  21863. }),
  21864. $globals.ClassMigrated);
  21865. $core.addMethod(
  21866. $core.method({
  21867. selector: "oldClass:",
  21868. protocol: 'accessing',
  21869. fn: function (aClass){
  21870. var self=this;
  21871. self["@oldClass"]=aClass;
  21872. return self;
  21873. },
  21874. args: ["aClass"],
  21875. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21876. referencedClasses: [],
  21877. messageSends: []
  21878. }),
  21879. $globals.ClassMigrated);
  21880. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21881. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21882. $core.addMethod(
  21883. $core.method({
  21884. selector: "oldPackage",
  21885. protocol: 'accessing',
  21886. fn: function (){
  21887. var self=this;
  21888. return self["@oldPackage"];
  21889. },
  21890. args: [],
  21891. source: "oldPackage\x0a\x09^ oldPackage",
  21892. referencedClasses: [],
  21893. messageSends: []
  21894. }),
  21895. $globals.ClassMoved);
  21896. $core.addMethod(
  21897. $core.method({
  21898. selector: "oldPackage:",
  21899. protocol: 'accessing',
  21900. fn: function (aPackage){
  21901. var self=this;
  21902. self["@oldPackage"]=aPackage;
  21903. return self;
  21904. },
  21905. args: ["aPackage"],
  21906. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21907. referencedClasses: [],
  21908. messageSends: []
  21909. }),
  21910. $globals.ClassMoved);
  21911. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21912. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21913. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21914. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21915. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21916. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21917. $core.addMethod(
  21918. $core.method({
  21919. selector: "method",
  21920. protocol: 'accessing',
  21921. fn: function (){
  21922. var self=this;
  21923. return self["@method"];
  21924. },
  21925. args: [],
  21926. source: "method\x0a\x09^ method",
  21927. referencedClasses: [],
  21928. messageSends: []
  21929. }),
  21930. $globals.MethodAnnouncement);
  21931. $core.addMethod(
  21932. $core.method({
  21933. selector: "method:",
  21934. protocol: 'accessing',
  21935. fn: function (aCompiledMethod){
  21936. var self=this;
  21937. self["@method"]=aCompiledMethod;
  21938. return self;
  21939. },
  21940. args: ["aCompiledMethod"],
  21941. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21942. referencedClasses: [],
  21943. messageSends: []
  21944. }),
  21945. $globals.MethodAnnouncement);
  21946. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21947. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21948. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21949. $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.";
  21950. $core.addMethod(
  21951. $core.method({
  21952. selector: "oldMethod",
  21953. protocol: 'accessing',
  21954. fn: function (){
  21955. var self=this;
  21956. return self["@oldMethod"];
  21957. },
  21958. args: [],
  21959. source: "oldMethod\x0a\x09^ oldMethod",
  21960. referencedClasses: [],
  21961. messageSends: []
  21962. }),
  21963. $globals.MethodModified);
  21964. $core.addMethod(
  21965. $core.method({
  21966. selector: "oldMethod:",
  21967. protocol: 'accessing',
  21968. fn: function (aMethod){
  21969. var self=this;
  21970. self["@oldMethod"]=aMethod;
  21971. return self;
  21972. },
  21973. args: ["aMethod"],
  21974. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21975. referencedClasses: [],
  21976. messageSends: []
  21977. }),
  21978. $globals.MethodModified);
  21979. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21980. $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.";
  21981. $core.addMethod(
  21982. $core.method({
  21983. selector: "oldProtocol",
  21984. protocol: 'accessing',
  21985. fn: function (){
  21986. var self=this;
  21987. return self["@oldProtocol"];
  21988. },
  21989. args: [],
  21990. source: "oldProtocol\x0a\x09^ oldProtocol",
  21991. referencedClasses: [],
  21992. messageSends: []
  21993. }),
  21994. $globals.MethodMoved);
  21995. $core.addMethod(
  21996. $core.method({
  21997. selector: "oldProtocol:",
  21998. protocol: 'accessing',
  21999. fn: function (aString){
  22000. var self=this;
  22001. self["@oldProtocol"]=aString;
  22002. return self;
  22003. },
  22004. args: ["aString"],
  22005. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  22006. referencedClasses: [],
  22007. messageSends: []
  22008. }),
  22009. $globals.MethodMoved);
  22010. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  22011. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  22012. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  22013. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  22014. $core.addMethod(
  22015. $core.method({
  22016. selector: "package",
  22017. protocol: 'accessing',
  22018. fn: function (){
  22019. var self=this;
  22020. return self["@package"];
  22021. },
  22022. args: [],
  22023. source: "package\x0a\x09^ package",
  22024. referencedClasses: [],
  22025. messageSends: []
  22026. }),
  22027. $globals.PackageAnnouncement);
  22028. $core.addMethod(
  22029. $core.method({
  22030. selector: "package:",
  22031. protocol: 'accessing',
  22032. fn: function (aPackage){
  22033. var self=this;
  22034. self["@package"]=aPackage;
  22035. return self;
  22036. },
  22037. args: ["aPackage"],
  22038. source: "package: aPackage\x0a\x09package := aPackage",
  22039. referencedClasses: [],
  22040. messageSends: []
  22041. }),
  22042. $globals.PackageAnnouncement);
  22043. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  22044. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  22045. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  22046. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  22047. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  22048. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  22049. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  22050. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  22051. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  22052. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  22053. $core.addMethod(
  22054. $core.method({
  22055. selector: "package",
  22056. protocol: 'accessing',
  22057. fn: function (){
  22058. var self=this;
  22059. return $core.withContext(function($ctx1) {
  22060. var $1,$receiver;
  22061. $1=self._theClass();
  22062. if(($receiver = $1) == null || $receiver.isNil){
  22063. return $1;
  22064. } else {
  22065. var class_;
  22066. class_=$receiver;
  22067. return $recv(class_)._packageOfProtocol_(self._protocol());
  22068. }
  22069. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  22070. },
  22071. args: [],
  22072. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  22073. referencedClasses: [],
  22074. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  22075. }),
  22076. $globals.ProtocolAnnouncement);
  22077. $core.addMethod(
  22078. $core.method({
  22079. selector: "protocol",
  22080. protocol: 'accessing',
  22081. fn: function (){
  22082. var self=this;
  22083. return self["@protocol"];
  22084. },
  22085. args: [],
  22086. source: "protocol\x0a\x09^ protocol",
  22087. referencedClasses: [],
  22088. messageSends: []
  22089. }),
  22090. $globals.ProtocolAnnouncement);
  22091. $core.addMethod(
  22092. $core.method({
  22093. selector: "protocol:",
  22094. protocol: 'accessing',
  22095. fn: function (aString){
  22096. var self=this;
  22097. self["@protocol"]=aString;
  22098. return self;
  22099. },
  22100. args: ["aString"],
  22101. source: "protocol: aString\x0a\x09protocol := aString",
  22102. referencedClasses: [],
  22103. messageSends: []
  22104. }),
  22105. $globals.ProtocolAnnouncement);
  22106. $core.addMethod(
  22107. $core.method({
  22108. selector: "theClass",
  22109. protocol: 'accessing',
  22110. fn: function (){
  22111. var self=this;
  22112. return self["@theClass"];
  22113. },
  22114. args: [],
  22115. source: "theClass\x0a\x09^ theClass",
  22116. referencedClasses: [],
  22117. messageSends: []
  22118. }),
  22119. $globals.ProtocolAnnouncement);
  22120. $core.addMethod(
  22121. $core.method({
  22122. selector: "theClass:",
  22123. protocol: 'accessing',
  22124. fn: function (aClass){
  22125. var self=this;
  22126. self["@theClass"]=aClass;
  22127. return self;
  22128. },
  22129. args: ["aClass"],
  22130. source: "theClass: aClass\x0a\x09theClass := aClass",
  22131. referencedClasses: [],
  22132. messageSends: []
  22133. }),
  22134. $globals.ProtocolAnnouncement);
  22135. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  22136. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  22137. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  22138. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  22139. });
  22140. 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";
  22141. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  22142. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  22143. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  22144. $core.addPackage('Platform-Services');
  22145. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  22146. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  22147. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  22148. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  22149. $core.addMethod(
  22150. $core.method({
  22151. selector: "handleError:",
  22152. protocol: 'error handling',
  22153. fn: function (anError){
  22154. var self=this;
  22155. return $core.withContext(function($ctx1) {
  22156. var $1,$receiver;
  22157. $1=$recv(anError)._context();
  22158. $ctx1.sendIdx["context"]=1;
  22159. if(($receiver = $1) == null || $receiver.isNil){
  22160. $1;
  22161. } else {
  22162. self._logErrorContext_($recv(anError)._context());
  22163. }
  22164. self._logError_(anError);
  22165. return self;
  22166. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  22167. },
  22168. args: ["anError"],
  22169. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  22170. referencedClasses: [],
  22171. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  22172. }),
  22173. $globals.ConsoleErrorHandler);
  22174. $core.addMethod(
  22175. $core.method({
  22176. selector: "log:",
  22177. protocol: 'private',
  22178. fn: function (aString){
  22179. var self=this;
  22180. return $core.withContext(function($ctx1) {
  22181. $recv(console)._log_(aString);
  22182. return self;
  22183. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  22184. },
  22185. args: ["aString"],
  22186. source: "log: aString\x0a\x09console log: aString",
  22187. referencedClasses: [],
  22188. messageSends: ["log:"]
  22189. }),
  22190. $globals.ConsoleErrorHandler);
  22191. $core.addMethod(
  22192. $core.method({
  22193. selector: "logContext:",
  22194. protocol: 'private',
  22195. fn: function (aContext){
  22196. var self=this;
  22197. return $core.withContext(function($ctx1) {
  22198. var $1,$receiver;
  22199. $1=$recv(aContext)._home();
  22200. $ctx1.sendIdx["home"]=1;
  22201. if(($receiver = $1) == null || $receiver.isNil){
  22202. $1;
  22203. } else {
  22204. self._logContext_($recv(aContext)._home());
  22205. }
  22206. self._log_($recv(aContext)._asString());
  22207. return self;
  22208. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  22209. },
  22210. args: ["aContext"],
  22211. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  22212. referencedClasses: [],
  22213. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  22214. }),
  22215. $globals.ConsoleErrorHandler);
  22216. $core.addMethod(
  22217. $core.method({
  22218. selector: "logError:",
  22219. protocol: 'private',
  22220. fn: function (anError){
  22221. var self=this;
  22222. return $core.withContext(function($ctx1) {
  22223. self._log_($recv(anError)._messageText());
  22224. return self;
  22225. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  22226. },
  22227. args: ["anError"],
  22228. source: "logError: anError\x0a\x09self log: anError messageText",
  22229. referencedClasses: [],
  22230. messageSends: ["log:", "messageText"]
  22231. }),
  22232. $globals.ConsoleErrorHandler);
  22233. $core.addMethod(
  22234. $core.method({
  22235. selector: "logErrorContext:",
  22236. protocol: 'private',
  22237. fn: function (aContext){
  22238. var self=this;
  22239. return $core.withContext(function($ctx1) {
  22240. var $1,$receiver;
  22241. if(($receiver = aContext) == null || $receiver.isNil){
  22242. aContext;
  22243. } else {
  22244. $1=$recv(aContext)._home();
  22245. $ctx1.sendIdx["home"]=1;
  22246. if(($receiver = $1) == null || $receiver.isNil){
  22247. $1;
  22248. } else {
  22249. self._logContext_($recv(aContext)._home());
  22250. }
  22251. }
  22252. return self;
  22253. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  22254. },
  22255. args: ["aContext"],
  22256. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  22257. referencedClasses: [],
  22258. messageSends: ["ifNotNil:", "home", "logContext:"]
  22259. }),
  22260. $globals.ConsoleErrorHandler);
  22261. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  22262. $core.addMethod(
  22263. $core.method({
  22264. selector: "initialize",
  22265. protocol: 'initialization',
  22266. fn: function (){
  22267. var self=this;
  22268. return $core.withContext(function($ctx1) {
  22269. $recv($globals.ErrorHandler)._registerIfNone_(self._new());
  22270. return self;
  22271. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  22272. },
  22273. args: [],
  22274. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  22275. referencedClasses: ["ErrorHandler"],
  22276. messageSends: ["registerIfNone:", "new"]
  22277. }),
  22278. $globals.ConsoleErrorHandler.klass);
  22279. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  22280. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  22281. $core.addMethod(
  22282. $core.method({
  22283. selector: "clear",
  22284. protocol: 'printing',
  22285. fn: function (){
  22286. var self=this;
  22287. return self;
  22288. },
  22289. args: [],
  22290. source: "clear\x0a\x09\x22no op\x22",
  22291. referencedClasses: [],
  22292. messageSends: []
  22293. }),
  22294. $globals.ConsoleTranscript);
  22295. $core.addMethod(
  22296. $core.method({
  22297. selector: "cr",
  22298. protocol: 'printing',
  22299. fn: function (){
  22300. var self=this;
  22301. return self;
  22302. },
  22303. args: [],
  22304. source: "cr\x0a\x09\x22no op\x22",
  22305. referencedClasses: [],
  22306. messageSends: []
  22307. }),
  22308. $globals.ConsoleTranscript);
  22309. $core.addMethod(
  22310. $core.method({
  22311. selector: "open",
  22312. protocol: 'actions',
  22313. fn: function (){
  22314. var self=this;
  22315. return self;
  22316. },
  22317. args: [],
  22318. source: "open",
  22319. referencedClasses: [],
  22320. messageSends: []
  22321. }),
  22322. $globals.ConsoleTranscript);
  22323. $core.addMethod(
  22324. $core.method({
  22325. selector: "show:",
  22326. protocol: 'printing',
  22327. fn: function (anObject){
  22328. var self=this;
  22329. return $core.withContext(function($ctx1) {
  22330. console.log(String($recv(anObject)._asString()));
  22331. return self;
  22332. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  22333. },
  22334. args: ["anObject"],
  22335. 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()))'>",
  22336. referencedClasses: [],
  22337. messageSends: []
  22338. }),
  22339. $globals.ConsoleTranscript);
  22340. $core.addMethod(
  22341. $core.method({
  22342. selector: "initialize",
  22343. protocol: 'initialization',
  22344. fn: function (){
  22345. var self=this;
  22346. return $core.withContext(function($ctx1) {
  22347. $recv($globals.Transcript)._registerIfNone_(self._new());
  22348. return self;
  22349. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  22350. },
  22351. args: [],
  22352. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  22353. referencedClasses: ["Transcript"],
  22354. messageSends: ["registerIfNone:", "new"]
  22355. }),
  22356. $globals.ConsoleTranscript.klass);
  22357. $core.addClass('Environment', $globals.Object, [], 'Platform-Services');
  22358. $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.";
  22359. $core.addMethod(
  22360. $core.method({
  22361. selector: "addInstVarNamed:to:",
  22362. protocol: 'compiling',
  22363. fn: function (aString,aClass){
  22364. var self=this;
  22365. return $core.withContext(function($ctx1) {
  22366. var $1,$2,$3,$5,$4;
  22367. $1=self._classBuilder();
  22368. $2=$recv(aClass)._superclass();
  22369. $3=$recv(aClass)._name();
  22370. $ctx1.sendIdx["name"]=1;
  22371. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  22372. $recv($5)._add_(aString);
  22373. $4=$recv($5)._yourself();
  22374. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  22375. return self;
  22376. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  22377. },
  22378. args: ["aString", "aClass"],
  22379. 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",
  22380. referencedClasses: [],
  22381. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  22382. }),
  22383. $globals.Environment);
  22384. $core.addMethod(
  22385. $core.method({
  22386. selector: "allSelectors",
  22387. protocol: 'accessing',
  22388. fn: function (){
  22389. var self=this;
  22390. return $core.withContext(function($ctx1) {
  22391. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  22392. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  22393. },
  22394. args: [],
  22395. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  22396. referencedClasses: ["Smalltalk"],
  22397. messageSends: ["allSelectors", "core"]
  22398. }),
  22399. $globals.Environment);
  22400. $core.addMethod(
  22401. $core.method({
  22402. selector: "availableClassNames",
  22403. protocol: 'accessing',
  22404. fn: function (){
  22405. var self=this;
  22406. return $core.withContext(function($ctx1) {
  22407. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  22408. return $core.withContext(function($ctx2) {
  22409. return $recv(each)._name();
  22410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22411. }));
  22412. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  22413. },
  22414. args: [],
  22415. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  22416. referencedClasses: ["Smalltalk"],
  22417. messageSends: ["collect:", "classes", "name"]
  22418. }),
  22419. $globals.Environment);
  22420. $core.addMethod(
  22421. $core.method({
  22422. selector: "availablePackageNames",
  22423. protocol: 'accessing',
  22424. fn: function (){
  22425. var self=this;
  22426. return $core.withContext(function($ctx1) {
  22427. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  22428. return $core.withContext(function($ctx2) {
  22429. return $recv(each)._name();
  22430. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22431. }));
  22432. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  22433. },
  22434. args: [],
  22435. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  22436. referencedClasses: ["Smalltalk"],
  22437. messageSends: ["collect:", "packages", "name"]
  22438. }),
  22439. $globals.Environment);
  22440. $core.addMethod(
  22441. $core.method({
  22442. selector: "availableProtocolsFor:",
  22443. protocol: 'accessing',
  22444. fn: function (aClass){
  22445. var self=this;
  22446. var protocols;
  22447. return $core.withContext(function($ctx1) {
  22448. var $1,$receiver;
  22449. protocols=$recv(aClass)._protocols();
  22450. $1=$recv(aClass)._superclass();
  22451. $ctx1.sendIdx["superclass"]=1;
  22452. if(($receiver = $1) == null || $receiver.isNil){
  22453. $1;
  22454. } else {
  22455. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  22456. }
  22457. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  22458. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  22459. },
  22460. args: ["aClass"],
  22461. 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",
  22462. referencedClasses: [],
  22463. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  22464. }),
  22465. $globals.Environment);
  22466. $core.addMethod(
  22467. $core.method({
  22468. selector: "classBuilder",
  22469. protocol: 'accessing',
  22470. fn: function (){
  22471. var self=this;
  22472. return $core.withContext(function($ctx1) {
  22473. return $recv($globals.ClassBuilder)._new();
  22474. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  22475. },
  22476. args: [],
  22477. source: "classBuilder\x0a\x09^ ClassBuilder new",
  22478. referencedClasses: ["ClassBuilder"],
  22479. messageSends: ["new"]
  22480. }),
  22481. $globals.Environment);
  22482. $core.addMethod(
  22483. $core.method({
  22484. selector: "classNamed:",
  22485. protocol: 'accessing',
  22486. fn: function (aString){
  22487. var self=this;
  22488. return $core.withContext(function($ctx1) {
  22489. var $1,$receiver;
  22490. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  22491. if(($receiver = $1) == null || $receiver.isNil){
  22492. return self._error_("Invalid class name");
  22493. } else {
  22494. return $1;
  22495. }
  22496. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  22497. },
  22498. args: ["aString"],
  22499. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  22500. referencedClasses: ["Smalltalk"],
  22501. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  22502. }),
  22503. $globals.Environment);
  22504. $core.addMethod(
  22505. $core.method({
  22506. selector: "classes",
  22507. protocol: 'accessing',
  22508. fn: function (){
  22509. var self=this;
  22510. return $core.withContext(function($ctx1) {
  22511. return $recv($globals.Smalltalk)._classes();
  22512. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  22513. },
  22514. args: [],
  22515. source: "classes\x0a\x09^ Smalltalk classes",
  22516. referencedClasses: ["Smalltalk"],
  22517. messageSends: ["classes"]
  22518. }),
  22519. $globals.Environment);
  22520. $core.addMethod(
  22521. $core.method({
  22522. selector: "commitPackage:onSuccess:onError:",
  22523. protocol: 'actions',
  22524. fn: function (aPackage,aBlock,anotherBlock){
  22525. var self=this;
  22526. return $core.withContext(function($ctx1) {
  22527. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  22528. return self;
  22529. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  22530. },
  22531. args: ["aPackage", "aBlock", "anotherBlock"],
  22532. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  22533. referencedClasses: [],
  22534. messageSends: ["commitOnSuccess:onError:", "transport"]
  22535. }),
  22536. $globals.Environment);
  22537. $core.addMethod(
  22538. $core.method({
  22539. selector: "compileClassComment:for:",
  22540. protocol: 'compiling',
  22541. fn: function (aString,aClass){
  22542. var self=this;
  22543. return $core.withContext(function($ctx1) {
  22544. $recv(aClass)._comment_(aString);
  22545. return self;
  22546. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  22547. },
  22548. args: ["aString", "aClass"],
  22549. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  22550. referencedClasses: [],
  22551. messageSends: ["comment:"]
  22552. }),
  22553. $globals.Environment);
  22554. $core.addMethod(
  22555. $core.method({
  22556. selector: "compileClassDefinition:",
  22557. protocol: 'compiling',
  22558. fn: function (aString){
  22559. var self=this;
  22560. return $core.withContext(function($ctx1) {
  22561. $recv((function(){
  22562. return $core.withContext(function($ctx2) {
  22563. return self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  22564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22565. }))._on_do_($globals.Error,(function(error){
  22566. return $core.withContext(function($ctx2) {
  22567. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  22568. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  22569. }));
  22570. return self;
  22571. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  22572. },
  22573. args: ["aString"],
  22574. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  22575. referencedClasses: ["DoIt", "Error", "Terminal"],
  22576. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  22577. }),
  22578. $globals.Environment);
  22579. $core.addMethod(
  22580. $core.method({
  22581. selector: "compileMethod:for:protocol:",
  22582. protocol: 'compiling',
  22583. fn: function (sourceCode,class_,protocol){
  22584. var self=this;
  22585. return $core.withContext(function($ctx1) {
  22586. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  22587. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  22588. },
  22589. args: ["sourceCode", "class", "protocol"],
  22590. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  22591. referencedClasses: [],
  22592. messageSends: ["compile:protocol:"]
  22593. }),
  22594. $globals.Environment);
  22595. $core.addMethod(
  22596. $core.method({
  22597. selector: "copyClass:to:",
  22598. protocol: 'actions',
  22599. fn: function (aClass,aClassName){
  22600. var self=this;
  22601. return $core.withContext(function($ctx1) {
  22602. var $1,$2,$receiver;
  22603. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22604. if(($receiver = $1) == null || $receiver.isNil){
  22605. $1;
  22606. } else {
  22607. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22608. $ctx1.sendIdx[","]=1;
  22609. self._error_($2);
  22610. }
  22611. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  22612. return self;
  22613. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22614. },
  22615. args: ["aClass", "aClassName"],
  22616. 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",
  22617. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22618. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  22619. }),
  22620. $globals.Environment);
  22621. $core.addMethod(
  22622. $core.method({
  22623. selector: "doItReceiver",
  22624. protocol: 'accessing',
  22625. fn: function (){
  22626. var self=this;
  22627. return $core.withContext(function($ctx1) {
  22628. return $recv($globals.DoIt)._new();
  22629. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22630. },
  22631. args: [],
  22632. source: "doItReceiver\x0a\x09^ DoIt new",
  22633. referencedClasses: ["DoIt"],
  22634. messageSends: ["new"]
  22635. }),
  22636. $globals.Environment);
  22637. $core.addMethod(
  22638. $core.method({
  22639. selector: "evaluate:for:",
  22640. protocol: 'evaluating',
  22641. fn: function (aString,anObject){
  22642. var self=this;
  22643. return $core.withContext(function($ctx1) {
  22644. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  22645. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22646. },
  22647. args: ["aString", "anObject"],
  22648. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22649. referencedClasses: ["Evaluator"],
  22650. messageSends: ["evaluate:for:"]
  22651. }),
  22652. $globals.Environment);
  22653. $core.addMethod(
  22654. $core.method({
  22655. selector: "evaluate:on:do:",
  22656. protocol: 'error handling',
  22657. fn: function (aBlock,anErrorClass,exceptionBlock){
  22658. var self=this;
  22659. return $core.withContext(function($ctx1) {
  22660. var $1;
  22661. $recv(aBlock)._tryCatch_((function(exception){
  22662. return $core.withContext(function($ctx2) {
  22663. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22664. if($core.assert($1)){
  22665. return $recv(exceptionBlock)._value_(exception);
  22666. } else {
  22667. return $recv(exception)._resignal();
  22668. }
  22669. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22670. }));
  22671. return self;
  22672. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22673. },
  22674. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22675. 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 ] ]",
  22676. referencedClasses: [],
  22677. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22678. }),
  22679. $globals.Environment);
  22680. $core.addMethod(
  22681. $core.method({
  22682. selector: "inspect:",
  22683. protocol: 'actions',
  22684. fn: function (anObject){
  22685. var self=this;
  22686. return $core.withContext(function($ctx1) {
  22687. $recv($globals.Inspector)._inspect_(anObject);
  22688. return self;
  22689. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22690. },
  22691. args: ["anObject"],
  22692. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22693. referencedClasses: ["Inspector"],
  22694. messageSends: ["inspect:"]
  22695. }),
  22696. $globals.Environment);
  22697. $core.addMethod(
  22698. $core.method({
  22699. selector: "moveClass:toPackage:",
  22700. protocol: 'actions',
  22701. fn: function (aClass,aPackageName){
  22702. var self=this;
  22703. var package_;
  22704. return $core.withContext(function($ctx1) {
  22705. var $1,$2,$receiver;
  22706. package_=$recv($globals.Package)._named_(aPackageName);
  22707. $1=package_;
  22708. if(($receiver = $1) == null || $receiver.isNil){
  22709. self._error_("Invalid package name");
  22710. } else {
  22711. $1;
  22712. }
  22713. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22714. if($core.assert($2)){
  22715. return self;
  22716. }
  22717. $recv(aClass)._package_(package_);
  22718. return self;
  22719. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22720. },
  22721. args: ["aClass", "aPackageName"],
  22722. 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",
  22723. referencedClasses: ["Package"],
  22724. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22725. }),
  22726. $globals.Environment);
  22727. $core.addMethod(
  22728. $core.method({
  22729. selector: "moveMethod:toClass:",
  22730. protocol: 'actions',
  22731. fn: function (aMethod,aClassName){
  22732. var self=this;
  22733. var destinationClass;
  22734. return $core.withContext(function($ctx1) {
  22735. var $2,$3,$1,$5,$4;
  22736. destinationClass=self._classNamed_(aClassName);
  22737. $2=destinationClass;
  22738. $3=$recv(aMethod)._methodClass();
  22739. $ctx1.sendIdx["methodClass"]=1;
  22740. $1=$recv($2).__eq_eq($3);
  22741. if($core.assert($1)){
  22742. return self;
  22743. }
  22744. $5=$recv(aMethod)._methodClass();
  22745. $ctx1.sendIdx["methodClass"]=2;
  22746. $4=$recv($5)._isMetaclass();
  22747. if($core.assert($4)){
  22748. destinationClass=$recv(destinationClass)._class();
  22749. destinationClass;
  22750. }
  22751. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22752. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22753. return self;
  22754. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22755. },
  22756. args: ["aMethod", "aClassName"],
  22757. 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 class ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  22758. referencedClasses: [],
  22759. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22760. }),
  22761. $globals.Environment);
  22762. $core.addMethod(
  22763. $core.method({
  22764. selector: "moveMethod:toProtocol:",
  22765. protocol: 'actions',
  22766. fn: function (aMethod,aProtocol){
  22767. var self=this;
  22768. return $core.withContext(function($ctx1) {
  22769. $recv(aMethod)._protocol_(aProtocol);
  22770. return self;
  22771. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22772. },
  22773. args: ["aMethod", "aProtocol"],
  22774. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22775. referencedClasses: [],
  22776. messageSends: ["protocol:"]
  22777. }),
  22778. $globals.Environment);
  22779. $core.addMethod(
  22780. $core.method({
  22781. selector: "packages",
  22782. protocol: 'accessing',
  22783. fn: function (){
  22784. var self=this;
  22785. return $core.withContext(function($ctx1) {
  22786. return $recv($globals.Smalltalk)._packages();
  22787. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22788. },
  22789. args: [],
  22790. source: "packages\x0a\x09^ Smalltalk packages",
  22791. referencedClasses: ["Smalltalk"],
  22792. messageSends: ["packages"]
  22793. }),
  22794. $globals.Environment);
  22795. $core.addMethod(
  22796. $core.method({
  22797. selector: "registerErrorHandler:",
  22798. protocol: 'services',
  22799. fn: function (anErrorHandler){
  22800. var self=this;
  22801. return $core.withContext(function($ctx1) {
  22802. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  22803. return self;
  22804. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22805. },
  22806. args: ["anErrorHandler"],
  22807. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22808. referencedClasses: ["ErrorHandler"],
  22809. messageSends: ["register:"]
  22810. }),
  22811. $globals.Environment);
  22812. $core.addMethod(
  22813. $core.method({
  22814. selector: "registerFinder:",
  22815. protocol: 'services',
  22816. fn: function (aFinder){
  22817. var self=this;
  22818. return $core.withContext(function($ctx1) {
  22819. $recv($globals.Finder)._register_(aFinder);
  22820. return self;
  22821. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22822. },
  22823. args: ["aFinder"],
  22824. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22825. referencedClasses: ["Finder"],
  22826. messageSends: ["register:"]
  22827. }),
  22828. $globals.Environment);
  22829. $core.addMethod(
  22830. $core.method({
  22831. selector: "registerInspector:",
  22832. protocol: 'services',
  22833. fn: function (anInspector){
  22834. var self=this;
  22835. return $core.withContext(function($ctx1) {
  22836. $recv($globals.Inspector)._register_(anInspector);
  22837. return self;
  22838. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22839. },
  22840. args: ["anInspector"],
  22841. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22842. referencedClasses: ["Inspector"],
  22843. messageSends: ["register:"]
  22844. }),
  22845. $globals.Environment);
  22846. $core.addMethod(
  22847. $core.method({
  22848. selector: "registerProgressHandler:",
  22849. protocol: 'services',
  22850. fn: function (aProgressHandler){
  22851. var self=this;
  22852. return $core.withContext(function($ctx1) {
  22853. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  22854. return self;
  22855. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22856. },
  22857. args: ["aProgressHandler"],
  22858. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22859. referencedClasses: ["ProgressHandler"],
  22860. messageSends: ["register:"]
  22861. }),
  22862. $globals.Environment);
  22863. $core.addMethod(
  22864. $core.method({
  22865. selector: "registerTranscript:",
  22866. protocol: 'services',
  22867. fn: function (aTranscript){
  22868. var self=this;
  22869. return $core.withContext(function($ctx1) {
  22870. $recv($globals.Transcript)._register_(aTranscript);
  22871. return self;
  22872. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22873. },
  22874. args: ["aTranscript"],
  22875. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22876. referencedClasses: ["Transcript"],
  22877. messageSends: ["register:"]
  22878. }),
  22879. $globals.Environment);
  22880. $core.addMethod(
  22881. $core.method({
  22882. selector: "removeClass:",
  22883. protocol: 'actions',
  22884. fn: function (aClass){
  22885. var self=this;
  22886. return $core.withContext(function($ctx1) {
  22887. $recv($globals.Smalltalk)._removeClass_(aClass);
  22888. return self;
  22889. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22890. },
  22891. args: ["aClass"],
  22892. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22893. referencedClasses: ["Smalltalk"],
  22894. messageSends: ["removeClass:"]
  22895. }),
  22896. $globals.Environment);
  22897. $core.addMethod(
  22898. $core.method({
  22899. selector: "removeMethod:",
  22900. protocol: 'actions',
  22901. fn: function (aMethod){
  22902. var self=this;
  22903. return $core.withContext(function($ctx1) {
  22904. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22905. return self;
  22906. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22907. },
  22908. args: ["aMethod"],
  22909. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22910. referencedClasses: [],
  22911. messageSends: ["removeCompiledMethod:", "methodClass"]
  22912. }),
  22913. $globals.Environment);
  22914. $core.addMethod(
  22915. $core.method({
  22916. selector: "removeProtocol:from:",
  22917. protocol: 'actions',
  22918. fn: function (aString,aClass){
  22919. var self=this;
  22920. return $core.withContext(function($ctx1) {
  22921. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22922. return $core.withContext(function($ctx2) {
  22923. return $recv(aClass)._removeCompiledMethod_(each);
  22924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22925. }));
  22926. return self;
  22927. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22928. },
  22929. args: ["aString", "aClass"],
  22930. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22931. referencedClasses: [],
  22932. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22933. }),
  22934. $globals.Environment);
  22935. $core.addMethod(
  22936. $core.method({
  22937. selector: "renameClass:to:",
  22938. protocol: 'actions',
  22939. fn: function (aClass,aClassName){
  22940. var self=this;
  22941. return $core.withContext(function($ctx1) {
  22942. var $1,$2,$receiver;
  22943. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22944. if(($receiver = $1) == null || $receiver.isNil){
  22945. $1;
  22946. } else {
  22947. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22948. $ctx1.sendIdx[","]=1;
  22949. self._error_($2);
  22950. }
  22951. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  22952. return self;
  22953. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22954. },
  22955. args: ["aClass", "aClassName"],
  22956. 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",
  22957. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22958. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22959. }),
  22960. $globals.Environment);
  22961. $core.addMethod(
  22962. $core.method({
  22963. selector: "renamePackage:to:",
  22964. protocol: 'actions',
  22965. fn: function (aPackageName,aNewPackageName){
  22966. var self=this;
  22967. return $core.withContext(function($ctx1) {
  22968. var $1,$2,$receiver;
  22969. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aNewPackageName);
  22970. if(($receiver = $1) == null || $receiver.isNil){
  22971. $1;
  22972. } else {
  22973. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22974. $ctx1.sendIdx[","]=1;
  22975. self._error_($2);
  22976. }
  22977. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  22978. return self;
  22979. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22980. },
  22981. args: ["aPackageName", "aNewPackageName"],
  22982. 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",
  22983. referencedClasses: ["Smalltalk"],
  22984. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22985. }),
  22986. $globals.Environment);
  22987. $core.addMethod(
  22988. $core.method({
  22989. selector: "renameProtocol:to:in:",
  22990. protocol: 'actions',
  22991. fn: function (aString,anotherString,aClass){
  22992. var self=this;
  22993. return $core.withContext(function($ctx1) {
  22994. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22995. return $core.withContext(function($ctx2) {
  22996. return $recv(each)._protocol_(anotherString);
  22997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22998. }));
  22999. return self;
  23000. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  23001. },
  23002. args: ["aString", "anotherString", "aClass"],
  23003. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  23004. referencedClasses: [],
  23005. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  23006. }),
  23007. $globals.Environment);
  23008. $core.addMethod(
  23009. $core.method({
  23010. selector: "setClassCommentOf:to:",
  23011. protocol: 'actions',
  23012. fn: function (aClass,aString){
  23013. var self=this;
  23014. return $core.withContext(function($ctx1) {
  23015. $recv(aClass)._comment_(aString);
  23016. return self;
  23017. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  23018. },
  23019. args: ["aClass", "aString"],
  23020. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  23021. referencedClasses: [],
  23022. messageSends: ["comment:"]
  23023. }),
  23024. $globals.Environment);
  23025. $core.addMethod(
  23026. $core.method({
  23027. selector: "systemAnnouncer",
  23028. protocol: 'accessing',
  23029. fn: function (){
  23030. var self=this;
  23031. return $core.withContext(function($ctx1) {
  23032. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  23033. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  23034. },
  23035. args: [],
  23036. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  23037. referencedClasses: ["Smalltalk"],
  23038. messageSends: ["current", "at:", "globals"]
  23039. }),
  23040. $globals.Environment);
  23041. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  23042. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  23043. $core.addMethod(
  23044. $core.method({
  23045. selector: "do:on:displaying:",
  23046. protocol: 'progress handling',
  23047. fn: function (aBlock,aCollection,aString){
  23048. var self=this;
  23049. return $core.withContext(function($ctx1) {
  23050. $recv(aCollection)._do_(aBlock);
  23051. return self;
  23052. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  23053. },
  23054. args: ["aBlock", "aCollection", "aString"],
  23055. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  23056. referencedClasses: [],
  23057. messageSends: ["do:"]
  23058. }),
  23059. $globals.NullProgressHandler);
  23060. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  23061. $core.addMethod(
  23062. $core.method({
  23063. selector: "initialize",
  23064. protocol: 'initialization',
  23065. fn: function (){
  23066. var self=this;
  23067. return $core.withContext(function($ctx1) {
  23068. $recv($globals.ProgressHandler)._registerIfNone_(self._new());
  23069. return self;
  23070. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  23071. },
  23072. args: [],
  23073. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  23074. referencedClasses: ["ProgressHandler"],
  23075. messageSends: ["registerIfNone:", "new"]
  23076. }),
  23077. $globals.NullProgressHandler.klass);
  23078. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  23079. $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.";
  23080. $globals.Service.klass.iVarNames = ['current'];
  23081. $core.addMethod(
  23082. $core.method({
  23083. selector: "current",
  23084. protocol: 'accessing',
  23085. fn: function (){
  23086. var self=this;
  23087. return self["@current"];
  23088. },
  23089. args: [],
  23090. source: "current\x0a\x09^ current",
  23091. referencedClasses: [],
  23092. messageSends: []
  23093. }),
  23094. $globals.Service.klass);
  23095. $core.addMethod(
  23096. $core.method({
  23097. selector: "new",
  23098. protocol: 'instance creation',
  23099. fn: function (){
  23100. var self=this;
  23101. return $core.withContext(function($ctx1) {
  23102. self._shouldNotImplement();
  23103. return self;
  23104. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  23105. },
  23106. args: [],
  23107. source: "new\x0a\x09self shouldNotImplement",
  23108. referencedClasses: [],
  23109. messageSends: ["shouldNotImplement"]
  23110. }),
  23111. $globals.Service.klass);
  23112. $core.addMethod(
  23113. $core.method({
  23114. selector: "register:",
  23115. protocol: 'registration',
  23116. fn: function (anObject){
  23117. var self=this;
  23118. self["@current"]=anObject;
  23119. return self;
  23120. },
  23121. args: ["anObject"],
  23122. source: "register: anObject\x0a\x09current := anObject",
  23123. referencedClasses: [],
  23124. messageSends: []
  23125. }),
  23126. $globals.Service.klass);
  23127. $core.addMethod(
  23128. $core.method({
  23129. selector: "registerIfNone:",
  23130. protocol: 'registration',
  23131. fn: function (anObject){
  23132. var self=this;
  23133. return $core.withContext(function($ctx1) {
  23134. var $1,$receiver;
  23135. $1=self._current();
  23136. if(($receiver = $1) == null || $receiver.isNil){
  23137. self._register_(anObject);
  23138. } else {
  23139. $1;
  23140. }
  23141. return self;
  23142. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  23143. },
  23144. args: ["anObject"],
  23145. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  23146. referencedClasses: [],
  23147. messageSends: ["ifNil:", "current", "register:"]
  23148. }),
  23149. $globals.Service.klass);
  23150. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  23151. $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.";
  23152. $core.addMethod(
  23153. $core.method({
  23154. selector: "handleError:",
  23155. protocol: 'error handling',
  23156. fn: function (anError){
  23157. var self=this;
  23158. return $core.withContext(function($ctx1) {
  23159. self._handleUnhandledError_(anError);
  23160. return self;
  23161. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  23162. },
  23163. args: ["anError"],
  23164. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  23165. referencedClasses: [],
  23166. messageSends: ["handleUnhandledError:"]
  23167. }),
  23168. $globals.ErrorHandler.klass);
  23169. $core.addMethod(
  23170. $core.method({
  23171. selector: "handleUnhandledError:",
  23172. protocol: 'error handling',
  23173. fn: function (anError){
  23174. var self=this;
  23175. return $core.withContext(function($ctx1) {
  23176. var $1;
  23177. $1=$recv(anError)._wasHandled();
  23178. if($core.assert($1)){
  23179. return self;
  23180. }
  23181. return $recv(self._current())._handleError_(anError);
  23182. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  23183. },
  23184. args: ["anError"],
  23185. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  23186. referencedClasses: [],
  23187. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  23188. }),
  23189. $globals.ErrorHandler.klass);
  23190. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  23191. $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.";
  23192. $core.addMethod(
  23193. $core.method({
  23194. selector: "findClass:",
  23195. protocol: 'finding',
  23196. fn: function (aClass){
  23197. var self=this;
  23198. return $core.withContext(function($ctx1) {
  23199. return $recv(self._current())._findClass_(aClass);
  23200. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  23201. },
  23202. args: ["aClass"],
  23203. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  23204. referencedClasses: [],
  23205. messageSends: ["findClass:", "current"]
  23206. }),
  23207. $globals.Finder.klass);
  23208. $core.addMethod(
  23209. $core.method({
  23210. selector: "findMethod:",
  23211. protocol: 'finding',
  23212. fn: function (aCompiledMethod){
  23213. var self=this;
  23214. return $core.withContext(function($ctx1) {
  23215. return $recv(self._current())._findMethod_(aCompiledMethod);
  23216. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  23217. },
  23218. args: ["aCompiledMethod"],
  23219. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  23220. referencedClasses: [],
  23221. messageSends: ["findMethod:", "current"]
  23222. }),
  23223. $globals.Finder.klass);
  23224. $core.addMethod(
  23225. $core.method({
  23226. selector: "findString:",
  23227. protocol: 'finding',
  23228. fn: function (aString){
  23229. var self=this;
  23230. return $core.withContext(function($ctx1) {
  23231. return $recv(self._current())._findString_(aString);
  23232. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  23233. },
  23234. args: ["aString"],
  23235. source: "findString: aString\x0a\x09^ self current findString: aString",
  23236. referencedClasses: [],
  23237. messageSends: ["findString:", "current"]
  23238. }),
  23239. $globals.Finder.klass);
  23240. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  23241. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  23242. $core.addMethod(
  23243. $core.method({
  23244. selector: "inspect:",
  23245. protocol: 'inspecting',
  23246. fn: function (anObject){
  23247. var self=this;
  23248. return $core.withContext(function($ctx1) {
  23249. return $recv(self._current())._inspect_(anObject);
  23250. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  23251. },
  23252. args: ["anObject"],
  23253. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  23254. referencedClasses: [],
  23255. messageSends: ["inspect:", "current"]
  23256. }),
  23257. $globals.Inspector.klass);
  23258. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  23259. $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";
  23260. $core.addMethod(
  23261. $core.method({
  23262. selector: "globals",
  23263. protocol: 'accessing',
  23264. fn: function (){
  23265. var self=this;
  23266. return $core.withContext(function($ctx1) {
  23267. return $recv(self._current())._globals();
  23268. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  23269. },
  23270. args: [],
  23271. source: "globals\x0a\x09^ self current globals",
  23272. referencedClasses: [],
  23273. messageSends: ["globals", "current"]
  23274. }),
  23275. $globals.Platform.klass);
  23276. $core.addMethod(
  23277. $core.method({
  23278. selector: "newXhr",
  23279. protocol: 'accessing',
  23280. fn: function (){
  23281. var self=this;
  23282. return $core.withContext(function($ctx1) {
  23283. return $recv(self._current())._newXhr();
  23284. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  23285. },
  23286. args: [],
  23287. source: "newXhr\x0a\x09^ self current newXhr",
  23288. referencedClasses: [],
  23289. messageSends: ["newXhr", "current"]
  23290. }),
  23291. $globals.Platform.klass);
  23292. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  23293. $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`.";
  23294. $core.addMethod(
  23295. $core.method({
  23296. selector: "do:on:displaying:",
  23297. protocol: 'progress handling',
  23298. fn: function (aBlock,aCollection,aString){
  23299. var self=this;
  23300. return $core.withContext(function($ctx1) {
  23301. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  23302. return self;
  23303. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  23304. },
  23305. args: ["aBlock", "aCollection", "aString"],
  23306. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  23307. referencedClasses: [],
  23308. messageSends: ["do:on:displaying:", "current"]
  23309. }),
  23310. $globals.ProgressHandler.klass);
  23311. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  23312. $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:'.";
  23313. $core.addMethod(
  23314. $core.method({
  23315. selector: "alert:",
  23316. protocol: 'dialogs',
  23317. fn: function (aString){
  23318. var self=this;
  23319. return $core.withContext(function($ctx1) {
  23320. return $recv(self._current())._alert_(aString);
  23321. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  23322. },
  23323. args: ["aString"],
  23324. source: "alert: aString\x0a\x09^ self current alert: aString",
  23325. referencedClasses: [],
  23326. messageSends: ["alert:", "current"]
  23327. }),
  23328. $globals.Terminal.klass);
  23329. $core.addMethod(
  23330. $core.method({
  23331. selector: "confirm:",
  23332. protocol: 'dialogs',
  23333. fn: function (aString){
  23334. var self=this;
  23335. return $core.withContext(function($ctx1) {
  23336. return $recv(self._current())._confirm_(aString);
  23337. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  23338. },
  23339. args: ["aString"],
  23340. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  23341. referencedClasses: [],
  23342. messageSends: ["confirm:", "current"]
  23343. }),
  23344. $globals.Terminal.klass);
  23345. $core.addMethod(
  23346. $core.method({
  23347. selector: "prompt:",
  23348. protocol: 'dialogs',
  23349. fn: function (aString){
  23350. var self=this;
  23351. return $core.withContext(function($ctx1) {
  23352. return $recv(self._current())._prompt_(aString);
  23353. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  23354. },
  23355. args: ["aString"],
  23356. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  23357. referencedClasses: [],
  23358. messageSends: ["prompt:", "current"]
  23359. }),
  23360. $globals.Terminal.klass);
  23361. $core.addMethod(
  23362. $core.method({
  23363. selector: "prompt:default:",
  23364. protocol: 'dialogs',
  23365. fn: function (aString,defaultString){
  23366. var self=this;
  23367. return $core.withContext(function($ctx1) {
  23368. return $recv(self._current())._prompt_default_(aString,defaultString);
  23369. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  23370. },
  23371. args: ["aString", "defaultString"],
  23372. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  23373. referencedClasses: [],
  23374. messageSends: ["prompt:default:", "current"]
  23375. }),
  23376. $globals.Terminal.klass);
  23377. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  23378. $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.";
  23379. $core.addMethod(
  23380. $core.method({
  23381. selector: "clear",
  23382. protocol: 'printing',
  23383. fn: function (){
  23384. var self=this;
  23385. return $core.withContext(function($ctx1) {
  23386. $recv(self._current())._clear();
  23387. return self;
  23388. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  23389. },
  23390. args: [],
  23391. source: "clear\x0a\x09self current clear",
  23392. referencedClasses: [],
  23393. messageSends: ["clear", "current"]
  23394. }),
  23395. $globals.Transcript.klass);
  23396. $core.addMethod(
  23397. $core.method({
  23398. selector: "cr",
  23399. protocol: 'printing',
  23400. fn: function (){
  23401. var self=this;
  23402. return $core.withContext(function($ctx1) {
  23403. $recv(self._current())._show_($recv($globals.String)._cr());
  23404. return self;
  23405. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  23406. },
  23407. args: [],
  23408. source: "cr\x0a\x09self current show: String cr",
  23409. referencedClasses: ["String"],
  23410. messageSends: ["show:", "current", "cr"]
  23411. }),
  23412. $globals.Transcript.klass);
  23413. $core.addMethod(
  23414. $core.method({
  23415. selector: "inspect:",
  23416. protocol: 'printing',
  23417. fn: function (anObject){
  23418. var self=this;
  23419. return $core.withContext(function($ctx1) {
  23420. self._show_(anObject);
  23421. return self;
  23422. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23423. },
  23424. args: ["anObject"],
  23425. source: "inspect: anObject\x0a\x09self show: anObject",
  23426. referencedClasses: [],
  23427. messageSends: ["show:"]
  23428. }),
  23429. $globals.Transcript.klass);
  23430. $core.addMethod(
  23431. $core.method({
  23432. selector: "open",
  23433. protocol: 'instance creation',
  23434. fn: function (){
  23435. var self=this;
  23436. return $core.withContext(function($ctx1) {
  23437. $recv(self._current())._open();
  23438. return self;
  23439. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23440. },
  23441. args: [],
  23442. source: "open\x0a\x09self current open",
  23443. referencedClasses: [],
  23444. messageSends: ["open", "current"]
  23445. }),
  23446. $globals.Transcript.klass);
  23447. $core.addMethod(
  23448. $core.method({
  23449. selector: "show:",
  23450. protocol: 'printing',
  23451. fn: function (anObject){
  23452. var self=this;
  23453. return $core.withContext(function($ctx1) {
  23454. $recv(self._current())._show_(anObject);
  23455. return self;
  23456. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23457. },
  23458. args: ["anObject"],
  23459. source: "show: anObject\x0a\x09self current show: anObject",
  23460. referencedClasses: [],
  23461. messageSends: ["show:", "current"]
  23462. }),
  23463. $globals.Transcript.klass);
  23464. $core.addMethod(
  23465. $core.method({
  23466. selector: "inspectOn:",
  23467. protocol: '*Platform-Services',
  23468. fn: function (anInspector){
  23469. var self=this;
  23470. var variables;
  23471. return $core.withContext(function($ctx1) {
  23472. variables=$recv($globals.Dictionary)._new();
  23473. $recv(variables)._at_put_("#self",self);
  23474. $ctx1.sendIdx["at:put:"]=1;
  23475. $recv(variables)._at_put_("#keys",self._keys());
  23476. $ctx1.sendIdx["at:put:"]=2;
  23477. self._keysAndValuesDo_((function(key,value){
  23478. return $core.withContext(function($ctx2) {
  23479. return $recv(variables)._at_put_(key,value);
  23480. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23481. }));
  23482. $recv(anInspector)._setLabel_(self._printString());
  23483. $recv(anInspector)._setVariables_(variables);
  23484. return self;
  23485. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23486. },
  23487. args: ["anInspector"],
  23488. 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",
  23489. referencedClasses: ["Dictionary"],
  23490. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23491. }),
  23492. $globals.AssociativeCollection);
  23493. $core.addMethod(
  23494. $core.method({
  23495. selector: "inspectOn:",
  23496. protocol: '*Platform-Services',
  23497. fn: function (anInspector){
  23498. var self=this;
  23499. var variables;
  23500. return $core.withContext(function($ctx1) {
  23501. variables=$recv($globals.Dictionary)._new();
  23502. $recv(variables)._at_put_("#self",self);
  23503. $ctx1.sendIdx["at:put:"]=1;
  23504. self._withIndexDo_((function(each,i){
  23505. return $core.withContext(function($ctx2) {
  23506. return $recv(variables)._at_put_(i,each);
  23507. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23508. }));
  23509. $recv(anInspector)._setLabel_(self._printString());
  23510. $recv(anInspector)._setVariables_(variables);
  23511. return self;
  23512. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23513. },
  23514. args: ["anInspector"],
  23515. 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",
  23516. referencedClasses: ["Dictionary"],
  23517. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23518. }),
  23519. $globals.Collection);
  23520. $core.addMethod(
  23521. $core.method({
  23522. selector: "inspectOn:",
  23523. protocol: '*Platform-Services',
  23524. fn: function (anInspector){
  23525. var self=this;
  23526. var variables;
  23527. return $core.withContext(function($ctx1) {
  23528. variables=$recv($globals.Dictionary)._new();
  23529. $recv(variables)._at_put_("#self",self);
  23530. $ctx1.sendIdx["at:put:"]=1;
  23531. $recv(variables)._at_put_("#year",self._year());
  23532. $ctx1.sendIdx["at:put:"]=2;
  23533. $recv(variables)._at_put_("#month",self._month());
  23534. $ctx1.sendIdx["at:put:"]=3;
  23535. $recv(variables)._at_put_("#day",self._day());
  23536. $ctx1.sendIdx["at:put:"]=4;
  23537. $recv(variables)._at_put_("#hours",self._hours());
  23538. $ctx1.sendIdx["at:put:"]=5;
  23539. $recv(variables)._at_put_("#minutes",self._minutes());
  23540. $ctx1.sendIdx["at:put:"]=6;
  23541. $recv(variables)._at_put_("#seconds",self._seconds());
  23542. $ctx1.sendIdx["at:put:"]=7;
  23543. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23544. $recv(anInspector)._setLabel_(self._printString());
  23545. $recv(anInspector)._setVariables_(variables);
  23546. return self;
  23547. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23548. },
  23549. args: ["anInspector"],
  23550. 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",
  23551. referencedClasses: ["Dictionary"],
  23552. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23553. }),
  23554. $globals.Date);
  23555. $core.addMethod(
  23556. $core.method({
  23557. selector: "inspectOn:",
  23558. protocol: '*Platform-Services',
  23559. fn: function (anInspector){
  23560. var self=this;
  23561. var variables;
  23562. return $core.withContext(function($ctx1) {
  23563. variables=$recv($globals.Dictionary)._new();
  23564. $recv(variables)._at_put_("#self",self._jsObject());
  23565. $recv(anInspector)._setLabel_(self._printString());
  23566. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  23567. $recv(anInspector)._setVariables_(variables);
  23568. return self;
  23569. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23570. },
  23571. args: ["anInspector"],
  23572. 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",
  23573. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23574. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23575. }),
  23576. $globals.JSObjectProxy);
  23577. $core.addMethod(
  23578. $core.method({
  23579. selector: "inspectOn:",
  23580. protocol: '*Platform-Services',
  23581. fn: function (anInspector){
  23582. var self=this;
  23583. var variables;
  23584. return $core.withContext(function($ctx1) {
  23585. variables=$recv($globals.Dictionary)._new();
  23586. $recv(variables)._at_put_("#self",self);
  23587. $ctx1.sendIdx["at:put:"]=1;
  23588. $recv(variables)._at_put_("#home",self._home());
  23589. $ctx1.sendIdx["at:put:"]=2;
  23590. $recv(variables)._at_put_("#receiver",self._receiver());
  23591. $ctx1.sendIdx["at:put:"]=3;
  23592. $recv(variables)._at_put_("#selector",self._selector());
  23593. $ctx1.sendIdx["at:put:"]=4;
  23594. $recv(variables)._at_put_("#locals",self._locals());
  23595. $ctx1.sendIdx["at:put:"]=5;
  23596. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23597. return $core.withContext(function($ctx2) {
  23598. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23600. }));
  23601. $recv(anInspector)._setLabel_(self._printString());
  23602. $recv(anInspector)._setVariables_(variables);
  23603. return self;
  23604. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23605. },
  23606. args: ["anInspector"],
  23607. 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",
  23608. referencedClasses: ["Dictionary"],
  23609. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23610. }),
  23611. $globals.MethodContext);
  23612. $core.addMethod(
  23613. $core.method({
  23614. selector: "inspectOn:",
  23615. protocol: '*Platform-Services',
  23616. fn: function (anInspector){
  23617. var self=this;
  23618. var variables;
  23619. return $core.withContext(function($ctx1) {
  23620. variables=$recv($globals.Dictionary)._new();
  23621. $recv(variables)._at_put_("#self",self);
  23622. $ctx1.sendIdx["at:put:"]=1;
  23623. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23624. return $core.withContext(function($ctx2) {
  23625. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23626. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23627. }));
  23628. $recv(anInspector)._setLabel_(self._printString());
  23629. $recv(anInspector)._setVariables_(variables);
  23630. return self;
  23631. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23632. },
  23633. args: ["anInspector"],
  23634. 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",
  23635. referencedClasses: ["Dictionary"],
  23636. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23637. }),
  23638. $globals.Object);
  23639. $core.addMethod(
  23640. $core.method({
  23641. selector: "do:displayingProgress:",
  23642. protocol: '*Platform-Services',
  23643. fn: function (aBlock,aString){
  23644. var self=this;
  23645. return $core.withContext(function($ctx1) {
  23646. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  23647. return self;
  23648. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23649. },
  23650. args: ["aBlock", "aString"],
  23651. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23652. referencedClasses: ["ProgressHandler"],
  23653. messageSends: ["do:on:displaying:"]
  23654. }),
  23655. $globals.SequenceableCollection);
  23656. $core.addMethod(
  23657. $core.method({
  23658. selector: "inspectOn:",
  23659. protocol: '*Platform-Services',
  23660. fn: function (anInspector){
  23661. var self=this;
  23662. var variables,i;
  23663. return $core.withContext(function($ctx1) {
  23664. variables=$recv($globals.Dictionary)._new();
  23665. $recv(variables)._at_put_("#self",self);
  23666. $ctx1.sendIdx["at:put:"]=1;
  23667. i=(1);
  23668. self._do_((function(each){
  23669. return $core.withContext(function($ctx2) {
  23670. $recv(variables)._at_put_(i,each);
  23671. i=$recv(i).__plus((1));
  23672. return i;
  23673. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23674. }));
  23675. $recv(anInspector)._setLabel_(self._printString());
  23676. $recv(anInspector)._setVariables_(variables);
  23677. return self;
  23678. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23679. },
  23680. args: ["anInspector"],
  23681. 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",
  23682. referencedClasses: ["Dictionary"],
  23683. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23684. }),
  23685. $globals.Set);
  23686. $core.addMethod(
  23687. $core.method({
  23688. selector: "inspectOn:",
  23689. protocol: '*Platform-Services',
  23690. fn: function (anInspector){
  23691. var self=this;
  23692. var label;
  23693. return $core.withContext(function($ctx1) {
  23694. var $3,$2,$1,$5,$4;
  23695. (
  23696. $ctx1.supercall = true,
  23697. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23698. $ctx1.supercall = false;
  23699. $3=self._printString();
  23700. $ctx1.sendIdx["printString"]=1;
  23701. $2=$recv($3)._size();
  23702. $1=$recv($2).__gt((30));
  23703. if($core.assert($1)){
  23704. $5=self._printString();
  23705. $ctx1.sendIdx["printString"]=2;
  23706. $4=$recv($5)._copyFrom_to_((1),(30));
  23707. label=$recv($4).__comma("...'");
  23708. label;
  23709. } else {
  23710. label=self._printString();
  23711. label;
  23712. }
  23713. $recv(anInspector)._setLabel_(label);
  23714. return self;
  23715. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23716. },
  23717. args: ["anInspector"],
  23718. 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",
  23719. referencedClasses: [],
  23720. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23721. }),
  23722. $globals.String);
  23723. });
  23724. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23725. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  23726. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  23727. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  23728. $core.addPackage('Platform-Node');
  23729. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23730. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23731. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23732. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23733. $core.addMethod(
  23734. $core.method({
  23735. selector: "globals",
  23736. protocol: 'accessing',
  23737. fn: function (){
  23738. var self=this;
  23739. return global;
  23740. },
  23741. args: [],
  23742. source: "globals\x0a\x09^ global",
  23743. referencedClasses: [],
  23744. messageSends: []
  23745. }),
  23746. $globals.NodePlatform);
  23747. $core.addMethod(
  23748. $core.method({
  23749. selector: "newXhr",
  23750. protocol: 'accessing',
  23751. fn: function (){
  23752. var self=this;
  23753. return $core.withContext(function($ctx1) {
  23754. var $receiver;
  23755. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.isNil){
  23756. self._error_("XMLHttpRequest not available.");
  23757. } else {
  23758. return $recv($globals.XMLHttpRequest)._new();
  23759. }
  23760. return self;
  23761. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23762. },
  23763. args: [],
  23764. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23765. referencedClasses: ["XMLHttpRequest"],
  23766. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23767. }),
  23768. $globals.NodePlatform);
  23769. $core.addMethod(
  23770. $core.method({
  23771. selector: "initialize",
  23772. protocol: 'testing',
  23773. fn: function (){
  23774. var self=this;
  23775. return $core.withContext(function($ctx1) {
  23776. var $1;
  23777. $1=self._isFeasible();
  23778. if($core.assert($1)){
  23779. $recv($globals.Platform)._registerIfNone_(self._new());
  23780. }
  23781. return self;
  23782. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23783. },
  23784. args: [],
  23785. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23786. referencedClasses: ["Platform"],
  23787. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23788. }),
  23789. $globals.NodePlatform.klass);
  23790. $core.addMethod(
  23791. $core.method({
  23792. selector: "isFeasible",
  23793. protocol: 'testing',
  23794. fn: function (){
  23795. var self=this;
  23796. return $core.withContext(function($ctx1) {
  23797. return typeof global !== "undefined";
  23798. return self;
  23799. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23800. },
  23801. args: [],
  23802. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  23803. referencedClasses: [],
  23804. messageSends: []
  23805. }),
  23806. $globals.NodePlatform.klass);
  23807. });
  23808. define('amber/deploy',[
  23809. './helpers',
  23810. './compatibility', // pre-fetch, dep of ./boot
  23811. './boot', // pre-fetch, dep of ./helpers
  23812. // --- packages of the core Amber begin here ---
  23813. 'amber_core/Kernel-Objects',
  23814. 'amber_core/Kernel-Classes',
  23815. 'amber_core/Kernel-Methods',
  23816. 'amber_core/Kernel-Collections',
  23817. 'amber_core/Kernel-Dag',
  23818. 'amber_core/Kernel-Infrastructure',
  23819. 'amber_core/Kernel-Promises',
  23820. 'amber_core/Kernel-Exceptions',
  23821. 'amber_core/Kernel-Announcements',
  23822. 'amber_core/Platform-Services',
  23823. 'amber/Platform'
  23824. // --- packages of the core Amber end here ---
  23825. ], function (amber) { return amber; });
  23826. define('amber/parser',['./boot'], function($boot) {
  23827. var $globals = $boot.globals, nil = $boot.nilAsReceiver;
  23828. $globals.SmalltalkParser = (function() {
  23829. "use strict";
  23830. /*
  23831. * Generated by PEG.js 0.9.0.
  23832. *
  23833. * http://pegjs.org/
  23834. */
  23835. function peg$subclass(child, parent) {
  23836. function ctor() { this.constructor = child; }
  23837. ctor.prototype = parent.prototype;
  23838. child.prototype = new ctor();
  23839. }
  23840. function peg$SyntaxError(message, expected, found, location) {
  23841. this.message = message;
  23842. this.expected = expected;
  23843. this.found = found;
  23844. this.location = location;
  23845. this.name = "SyntaxError";
  23846. if (typeof Error.captureStackTrace === "function") {
  23847. Error.captureStackTrace(this, peg$SyntaxError);
  23848. }
  23849. }
  23850. peg$subclass(peg$SyntaxError, Error);
  23851. function peg$parse(input) {
  23852. var options = arguments.length > 1 ? arguments[1] : {},
  23853. parser = this,
  23854. peg$FAILED = {},
  23855. peg$startRuleFunctions = { start: peg$parsestart },
  23856. peg$startRuleFunction = peg$parsestart,
  23857. peg$c0 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23858. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23859. peg$c2 = "\"",
  23860. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23861. peg$c4 = /^[^"]/,
  23862. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23863. peg$c6 = ".",
  23864. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  23865. peg$c8 = /^[a-zA-Z]/,
  23866. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23867. peg$c10 = /^[a-zA-Z0-9]/,
  23868. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23869. peg$c12 = function(first, others) {return first + others.join("");},
  23870. peg$c13 = ":",
  23871. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23872. peg$c15 = function(first, last) {return first + last;},
  23873. peg$c16 = /^[a-zA-Z0-9:]/,
  23874. peg$c17 = { type: "class", value: "[a-zA-Z0-9\\:]", description: "[a-zA-Z0-9\\:]" },
  23875. peg$c18 = /^[A-Z]/,
  23876. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23877. peg$c20 = "'",
  23878. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23879. peg$c22 = "''",
  23880. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23881. peg$c24 = function() {return "'";},
  23882. peg$c25 = /^[^']/,
  23883. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23884. peg$c27 = function(val) {
  23885. return $globals.ValueNode._new()
  23886. ._location_(location())
  23887. ._source_(text())
  23888. ._value_(val.join(""));
  23889. },
  23890. peg$c28 = "$",
  23891. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23892. peg$c30 = { type: "any", description: "any character" },
  23893. peg$c31 = function(char) {
  23894. return $globals.ValueNode._new()
  23895. ._location_(location())
  23896. ._source_(text())
  23897. ._value_(char);
  23898. },
  23899. peg$c32 = "#",
  23900. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23901. peg$c34 = function(rest) {return rest;},
  23902. peg$c35 = function(node) {return node._value();},
  23903. peg$c36 = function(val) {
  23904. return $globals.ValueNode._new()
  23905. ._location_(location())
  23906. ._source_(text())
  23907. ._value_(val);
  23908. },
  23909. peg$c37 = function(n) {
  23910. return $globals.ValueNode._new()
  23911. ._location_(location())
  23912. ._source_(text())
  23913. ._value_(n);
  23914. },
  23915. peg$c38 = "e",
  23916. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23917. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23918. peg$c41 = "-",
  23919. peg$c42 = { type: "literal", value: "-", description: "\"-\"" },
  23920. peg$c43 = "16r",
  23921. peg$c44 = { type: "literal", value: "16r", description: "\"16r\"" },
  23922. peg$c45 = /^[0-9a-fA-F]/,
  23923. peg$c46 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23924. peg$c47 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23925. peg$c48 = /^[0-9]/,
  23926. peg$c49 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23927. peg$c50 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23928. peg$c51 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23929. peg$c52 = "#(",
  23930. peg$c53 = { type: "literal", value: "#(", description: "\"#(\"" },
  23931. peg$c54 = ")",
  23932. peg$c55 = { type: "literal", value: ")", description: "\")\"" },
  23933. peg$c56 = function(rest) {
  23934. return rest
  23935. ._location_(location())
  23936. ._source_(text());
  23937. },
  23938. peg$c57 = "(",
  23939. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23940. peg$c59 = function(lit) {return lit._value();},
  23941. peg$c60 = function(lits) {
  23942. return $globals.ValueNode._new()
  23943. ._value_(lits);
  23944. },
  23945. peg$c61 = "{",
  23946. peg$c62 = { type: "literal", value: "{", description: "\"{\"" },
  23947. peg$c63 = "}",
  23948. peg$c64 = { type: "literal", value: "}", description: "\"}\"" },
  23949. peg$c65 = function(expressions) {
  23950. return $globals.DynamicArrayNode._new()
  23951. ._location_(location())
  23952. ._source_(text())
  23953. ._dagChildren_(expressions || []);
  23954. },
  23955. peg$c66 = "#{",
  23956. peg$c67 = { type: "literal", value: "#{", description: "\"#{\"" },
  23957. peg$c68 = function(expressions) {
  23958. return $globals.DynamicDictionaryNode._new()
  23959. ._location_(location())
  23960. ._source_(text())
  23961. ._dagChildren_(expressions || []);
  23962. },
  23963. peg$c69 = "true",
  23964. peg$c70 = { type: "literal", value: "true", description: "\"true\"" },
  23965. peg$c71 = function() {return true;},
  23966. peg$c72 = "false",
  23967. peg$c73 = { type: "literal", value: "false", description: "\"false\"" },
  23968. peg$c74 = function() {return false;},
  23969. peg$c75 = "nil",
  23970. peg$c76 = { type: "literal", value: "nil", description: "\"nil\"" },
  23971. peg$c77 = function() {return nil;},
  23972. peg$c78 = function(val) {
  23973. return $globals.ValueNode._new()
  23974. ._location_(location())
  23975. ._source_(text())
  23976. ._value_(val);
  23977. },
  23978. peg$c79 = function(identifier) {
  23979. return $globals.VariableNode._new()
  23980. ._location_(location())
  23981. ._source_(text())
  23982. ._value_(identifier);
  23983. },
  23984. peg$c80 = /^[\\+*\/=><,@%~|&\-]/,
  23985. peg$c81 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  23986. peg$c82 = function(bin) {return bin.join("");},
  23987. peg$c83 = function(key, arg) {return {key:key, arg:arg};},
  23988. peg$c84 = function(pairs) {
  23989. var selector = "";
  23990. var params = [];
  23991. for(var i = 0; i < pairs.length; i++){
  23992. selector += pairs[i].key;
  23993. params.push(pairs[i].arg);
  23994. }
  23995. return [selector, params];
  23996. },
  23997. peg$c85 = function(selector, arg) {return [selector, [arg]];},
  23998. peg$c86 = function(selector) {return [selector, []];},
  23999. peg$c87 = function(expression) {return expression;},
  24000. peg$c88 = function(first, others) { return [first].concat(others); },
  24001. peg$c89 = ":=",
  24002. peg$c90 = { type: "literal", value: ":=", description: "\":=\"" },
  24003. peg$c91 = function(variable, expression) {
  24004. return $globals.AssignmentNode._new()
  24005. ._location_(location())
  24006. ._source_(text())
  24007. ._left_(variable)
  24008. ._right_(expression);
  24009. },
  24010. peg$c92 = "^",
  24011. peg$c93 = { type: "literal", value: "^", description: "\"^\"" },
  24012. peg$c94 = function(expression) {
  24013. return $globals.ReturnNode._new()
  24014. ._location_(location())
  24015. ._source_(text())
  24016. ._dagChildren_([expression]);
  24017. },
  24018. peg$c95 = "|",
  24019. peg$c96 = { type: "literal", value: "|", description: "\"|\"" },
  24020. peg$c97 = function(variable) {return variable;},
  24021. peg$c98 = function(vars) {return vars;},
  24022. peg$c99 = function(param) {return param;},
  24023. peg$c100 = function(params) {return params;},
  24024. peg$c101 = function(ret) {return [ret];},
  24025. peg$c102 = function(exps, ret) {
  24026. var expressions = exps;
  24027. expressions.push(ret);
  24028. return expressions;
  24029. },
  24030. peg$c103 = function(expressions) {
  24031. return expressions || [];
  24032. },
  24033. peg$c104 = function(js) { return js; },
  24034. peg$c105 = function(temps, statements) {
  24035. return $globals.SequenceNode._new()
  24036. ._location_(location())
  24037. ._source_(text())
  24038. ._temps_(temps || [])
  24039. ._dagChildren_(statements || []);
  24040. },
  24041. peg$c106 = "[",
  24042. peg$c107 = { type: "literal", value: "[", description: "\"[\"" },
  24043. peg$c108 = "]",
  24044. peg$c109 = { type: "literal", value: "]", description: "\"]\"" },
  24045. peg$c110 = function(params, sequence) {
  24046. return $globals.BlockNode._new()
  24047. ._location_(location())
  24048. ._source_(text())
  24049. ._parameters_(params || [])
  24050. ._dagChildren_([sequence._asBlockSequenceNode()]);
  24051. },
  24052. peg$c111 = function(selector) {
  24053. return $globals.SendNode._new()
  24054. ._location_(location())
  24055. ._source_(text())
  24056. ._selector_(selector);
  24057. },
  24058. peg$c112 = function(receiver, tail) {
  24059. return receiver._withTail_(tail);
  24060. },
  24061. peg$c113 = function(selector, arg) {
  24062. return $globals.SendNode._new()
  24063. ._location_(location())
  24064. ._source_(text())
  24065. ._selector_(selector)
  24066. ._arguments_([arg]);
  24067. },
  24068. peg$c114 = function(pairs) {
  24069. var selector = "";
  24070. var args = [];
  24071. for(var i = 0; i < pairs.length; i++) {
  24072. selector += pairs[i].key;
  24073. args.push(pairs[i].arg);
  24074. }
  24075. return $globals.SendNode._new()
  24076. ._location_(location())
  24077. ._source_(text())
  24078. ._selector_(selector)
  24079. ._arguments_(args);
  24080. },
  24081. peg$c115 = function(receiver, tail) {
  24082. return tail ? receiver._withTail_([tail]) : receiver;
  24083. },
  24084. peg$c116 = function(send) { return send._isSendNode(); },
  24085. peg$c117 = ";",
  24086. peg$c118 = { type: "literal", value: ";", description: "\";\"" },
  24087. peg$c119 = function(send, mess) {return mess;},
  24088. peg$c120 = function(send, messages) {
  24089. messages.unshift(send);
  24090. return $globals.CascadeNode._new()
  24091. ._location_(location())
  24092. ._source_(text())
  24093. ._dagChildren_(messages);
  24094. },
  24095. peg$c121 = "<",
  24096. peg$c122 = { type: "literal", value: "<", description: "\"<\"" },
  24097. peg$c123 = ">>",
  24098. peg$c124 = { type: "literal", value: ">>", description: "\">>\"" },
  24099. peg$c125 = function() {return ">";},
  24100. peg$c126 = /^[^>]/,
  24101. peg$c127 = { type: "class", value: "[^>]", description: "[^>]" },
  24102. peg$c128 = ">",
  24103. peg$c129 = { type: "literal", value: ">", description: "\">\"" },
  24104. peg$c130 = function(val) { return !/^\s*inlineJS/.test(val.join("")) },
  24105. peg$c131 = function(val) {
  24106. console.warn("Use of <...js code...> is deprecated, in:\n" + val.join(""));
  24107. return $globals.JSStatementNode._new()
  24108. ._location_(location())
  24109. ._source_(val.join(""))
  24110. },
  24111. peg$c132 = "inlineJS:",
  24112. peg$c133 = { type: "literal", value: "inlineJS:", description: "\"inlineJS:\"" },
  24113. peg$c134 = function(val) {
  24114. return $globals.JSStatementNode._new()
  24115. ._location_(location())
  24116. ._source_(val._value())
  24117. },
  24118. peg$c135 = function(pattern, sequence) {
  24119. return $globals.MethodNode._new()
  24120. ._location_(location())
  24121. ._source_(text())
  24122. ._selector_(pattern[0])
  24123. ._arguments_(pattern[1])
  24124. ._dagChildren_([sequence]);
  24125. },
  24126. peg$c136 = function(send) { return send._isSendNode() && send._selector() === "->" },
  24127. peg$c137 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  24128. peg$c138 = function(first, others) { return first.concat.apply(first, others); },
  24129. peg$currPos = 0,
  24130. peg$savedPos = 0,
  24131. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  24132. peg$maxFailPos = 0,
  24133. peg$maxFailExpected = [],
  24134. peg$silentFails = 0,
  24135. peg$resultsCache = {},
  24136. peg$result;
  24137. if ("startRule" in options) {
  24138. if (!(options.startRule in peg$startRuleFunctions)) {
  24139. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  24140. }
  24141. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  24142. }
  24143. function text() {
  24144. return input.substring(peg$savedPos, peg$currPos);
  24145. }
  24146. function location() {
  24147. return peg$computeLocation(peg$savedPos, peg$currPos);
  24148. }
  24149. function expected(description) {
  24150. throw peg$buildException(
  24151. null,
  24152. [{ type: "other", description: description }],
  24153. input.substring(peg$savedPos, peg$currPos),
  24154. peg$computeLocation(peg$savedPos, peg$currPos)
  24155. );
  24156. }
  24157. function error(message) {
  24158. throw peg$buildException(
  24159. message,
  24160. null,
  24161. input.substring(peg$savedPos, peg$currPos),
  24162. peg$computeLocation(peg$savedPos, peg$currPos)
  24163. );
  24164. }
  24165. function peg$computePosDetails(pos) {
  24166. var details = peg$posDetailsCache[pos],
  24167. p, ch;
  24168. if (details) {
  24169. return details;
  24170. } else {
  24171. p = pos - 1;
  24172. while (!peg$posDetailsCache[p]) {
  24173. p--;
  24174. }
  24175. details = peg$posDetailsCache[p];
  24176. details = {
  24177. line: details.line,
  24178. column: details.column,
  24179. seenCR: details.seenCR
  24180. };
  24181. while (p < pos) {
  24182. ch = input.charAt(p);
  24183. if (ch === "\n") {
  24184. if (!details.seenCR) { details.line++; }
  24185. details.column = 1;
  24186. details.seenCR = false;
  24187. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  24188. details.line++;
  24189. details.column = 1;
  24190. details.seenCR = true;
  24191. } else {
  24192. details.column++;
  24193. details.seenCR = false;
  24194. }
  24195. p++;
  24196. }
  24197. peg$posDetailsCache[pos] = details;
  24198. return details;
  24199. }
  24200. }
  24201. function peg$computeLocation(startPos, endPos) {
  24202. var startPosDetails = peg$computePosDetails(startPos),
  24203. endPosDetails = peg$computePosDetails(endPos);
  24204. return {
  24205. start: {
  24206. offset: startPos,
  24207. line: startPosDetails.line,
  24208. column: startPosDetails.column
  24209. },
  24210. end: {
  24211. offset: endPos,
  24212. line: endPosDetails.line,
  24213. column: endPosDetails.column
  24214. }
  24215. };
  24216. }
  24217. function peg$fail(expected) {
  24218. if (peg$currPos < peg$maxFailPos) { return; }
  24219. if (peg$currPos > peg$maxFailPos) {
  24220. peg$maxFailPos = peg$currPos;
  24221. peg$maxFailExpected = [];
  24222. }
  24223. peg$maxFailExpected.push(expected);
  24224. }
  24225. function peg$buildException(message, expected, found, location) {
  24226. function cleanupExpected(expected) {
  24227. var i = 1;
  24228. expected.sort(function(a, b) {
  24229. if (a.description < b.description) {
  24230. return -1;
  24231. } else if (a.description > b.description) {
  24232. return 1;
  24233. } else {
  24234. return 0;
  24235. }
  24236. });
  24237. while (i < expected.length) {
  24238. if (expected[i - 1] === expected[i]) {
  24239. expected.splice(i, 1);
  24240. } else {
  24241. i++;
  24242. }
  24243. }
  24244. }
  24245. function buildMessage(expected, found) {
  24246. function stringEscape(s) {
  24247. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  24248. return s
  24249. .replace(/\\/g, '\\\\')
  24250. .replace(/"/g, '\\"')
  24251. .replace(/\x08/g, '\\b')
  24252. .replace(/\t/g, '\\t')
  24253. .replace(/\n/g, '\\n')
  24254. .replace(/\f/g, '\\f')
  24255. .replace(/\r/g, '\\r')
  24256. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  24257. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  24258. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  24259. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  24260. }
  24261. var expectedDescs = new Array(expected.length),
  24262. expectedDesc, foundDesc, i;
  24263. for (i = 0; i < expected.length; i++) {
  24264. expectedDescs[i] = expected[i].description;
  24265. }
  24266. expectedDesc = expected.length > 1
  24267. ? expectedDescs.slice(0, -1).join(", ")
  24268. + " or "
  24269. + expectedDescs[expected.length - 1]
  24270. : expectedDescs[0];
  24271. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  24272. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  24273. }
  24274. if (expected !== null) {
  24275. cleanupExpected(expected);
  24276. }
  24277. return new peg$SyntaxError(
  24278. message !== null ? message : buildMessage(expected, found),
  24279. expected,
  24280. found,
  24281. location
  24282. );
  24283. }
  24284. function peg$parsestart() {
  24285. var s0;
  24286. var key = peg$currPos * 61 + 0,
  24287. cached = peg$resultsCache[key];
  24288. if (cached) {
  24289. peg$currPos = cached.nextPos;
  24290. return cached.result;
  24291. }
  24292. s0 = peg$parsemethod();
  24293. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24294. return s0;
  24295. }
  24296. function peg$parseseparator() {
  24297. var s0, s1;
  24298. var key = peg$currPos * 61 + 1,
  24299. cached = peg$resultsCache[key];
  24300. if (cached) {
  24301. peg$currPos = cached.nextPos;
  24302. return cached.result;
  24303. }
  24304. s0 = [];
  24305. if (peg$c0.test(input.charAt(peg$currPos))) {
  24306. s1 = input.charAt(peg$currPos);
  24307. peg$currPos++;
  24308. } else {
  24309. s1 = peg$FAILED;
  24310. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  24311. }
  24312. if (s1 !== peg$FAILED) {
  24313. while (s1 !== peg$FAILED) {
  24314. s0.push(s1);
  24315. if (peg$c0.test(input.charAt(peg$currPos))) {
  24316. s1 = input.charAt(peg$currPos);
  24317. peg$currPos++;
  24318. } else {
  24319. s1 = peg$FAILED;
  24320. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  24321. }
  24322. }
  24323. } else {
  24324. s0 = peg$FAILED;
  24325. }
  24326. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24327. return s0;
  24328. }
  24329. function peg$parsecomments() {
  24330. var s0, s1, s2, s3, s4;
  24331. var key = peg$currPos * 61 + 2,
  24332. cached = peg$resultsCache[key];
  24333. if (cached) {
  24334. peg$currPos = cached.nextPos;
  24335. return cached.result;
  24336. }
  24337. s0 = [];
  24338. s1 = peg$currPos;
  24339. if (input.charCodeAt(peg$currPos) === 34) {
  24340. s2 = peg$c2;
  24341. peg$currPos++;
  24342. } else {
  24343. s2 = peg$FAILED;
  24344. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24345. }
  24346. if (s2 !== peg$FAILED) {
  24347. s3 = [];
  24348. if (peg$c4.test(input.charAt(peg$currPos))) {
  24349. s4 = input.charAt(peg$currPos);
  24350. peg$currPos++;
  24351. } else {
  24352. s4 = peg$FAILED;
  24353. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24354. }
  24355. while (s4 !== peg$FAILED) {
  24356. s3.push(s4);
  24357. if (peg$c4.test(input.charAt(peg$currPos))) {
  24358. s4 = input.charAt(peg$currPos);
  24359. peg$currPos++;
  24360. } else {
  24361. s4 = peg$FAILED;
  24362. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24363. }
  24364. }
  24365. if (s3 !== peg$FAILED) {
  24366. if (input.charCodeAt(peg$currPos) === 34) {
  24367. s4 = peg$c2;
  24368. peg$currPos++;
  24369. } else {
  24370. s4 = peg$FAILED;
  24371. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24372. }
  24373. if (s4 !== peg$FAILED) {
  24374. s2 = [s2, s3, s4];
  24375. s1 = s2;
  24376. } else {
  24377. peg$currPos = s1;
  24378. s1 = peg$FAILED;
  24379. }
  24380. } else {
  24381. peg$currPos = s1;
  24382. s1 = peg$FAILED;
  24383. }
  24384. } else {
  24385. peg$currPos = s1;
  24386. s1 = peg$FAILED;
  24387. }
  24388. if (s1 !== peg$FAILED) {
  24389. while (s1 !== peg$FAILED) {
  24390. s0.push(s1);
  24391. s1 = peg$currPos;
  24392. if (input.charCodeAt(peg$currPos) === 34) {
  24393. s2 = peg$c2;
  24394. peg$currPos++;
  24395. } else {
  24396. s2 = peg$FAILED;
  24397. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24398. }
  24399. if (s2 !== peg$FAILED) {
  24400. s3 = [];
  24401. if (peg$c4.test(input.charAt(peg$currPos))) {
  24402. s4 = input.charAt(peg$currPos);
  24403. peg$currPos++;
  24404. } else {
  24405. s4 = peg$FAILED;
  24406. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24407. }
  24408. while (s4 !== peg$FAILED) {
  24409. s3.push(s4);
  24410. if (peg$c4.test(input.charAt(peg$currPos))) {
  24411. s4 = input.charAt(peg$currPos);
  24412. peg$currPos++;
  24413. } else {
  24414. s4 = peg$FAILED;
  24415. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24416. }
  24417. }
  24418. if (s3 !== peg$FAILED) {
  24419. if (input.charCodeAt(peg$currPos) === 34) {
  24420. s4 = peg$c2;
  24421. peg$currPos++;
  24422. } else {
  24423. s4 = peg$FAILED;
  24424. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24425. }
  24426. if (s4 !== peg$FAILED) {
  24427. s2 = [s2, s3, s4];
  24428. s1 = s2;
  24429. } else {
  24430. peg$currPos = s1;
  24431. s1 = peg$FAILED;
  24432. }
  24433. } else {
  24434. peg$currPos = s1;
  24435. s1 = peg$FAILED;
  24436. }
  24437. } else {
  24438. peg$currPos = s1;
  24439. s1 = peg$FAILED;
  24440. }
  24441. }
  24442. } else {
  24443. s0 = peg$FAILED;
  24444. }
  24445. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24446. return s0;
  24447. }
  24448. function peg$parsews() {
  24449. var s0, s1;
  24450. var key = peg$currPos * 61 + 3,
  24451. cached = peg$resultsCache[key];
  24452. if (cached) {
  24453. peg$currPos = cached.nextPos;
  24454. return cached.result;
  24455. }
  24456. s0 = [];
  24457. s1 = peg$parseseparator();
  24458. if (s1 === peg$FAILED) {
  24459. s1 = peg$parsecomments();
  24460. }
  24461. while (s1 !== peg$FAILED) {
  24462. s0.push(s1);
  24463. s1 = peg$parseseparator();
  24464. if (s1 === peg$FAILED) {
  24465. s1 = peg$parsecomments();
  24466. }
  24467. }
  24468. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24469. return s0;
  24470. }
  24471. function peg$parsemaybeDotsWs() {
  24472. var s0, s1;
  24473. var key = peg$currPos * 61 + 4,
  24474. cached = peg$resultsCache[key];
  24475. if (cached) {
  24476. peg$currPos = cached.nextPos;
  24477. return cached.result;
  24478. }
  24479. s0 = [];
  24480. if (input.charCodeAt(peg$currPos) === 46) {
  24481. s1 = peg$c6;
  24482. peg$currPos++;
  24483. } else {
  24484. s1 = peg$FAILED;
  24485. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24486. }
  24487. if (s1 === peg$FAILED) {
  24488. s1 = peg$parseseparator();
  24489. if (s1 === peg$FAILED) {
  24490. s1 = peg$parsecomments();
  24491. }
  24492. }
  24493. while (s1 !== peg$FAILED) {
  24494. s0.push(s1);
  24495. if (input.charCodeAt(peg$currPos) === 46) {
  24496. s1 = peg$c6;
  24497. peg$currPos++;
  24498. } else {
  24499. s1 = peg$FAILED;
  24500. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24501. }
  24502. if (s1 === peg$FAILED) {
  24503. s1 = peg$parseseparator();
  24504. if (s1 === peg$FAILED) {
  24505. s1 = peg$parsecomments();
  24506. }
  24507. }
  24508. }
  24509. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24510. return s0;
  24511. }
  24512. function peg$parseidentifier() {
  24513. var s0, s1, s2, s3;
  24514. var key = peg$currPos * 61 + 5,
  24515. cached = peg$resultsCache[key];
  24516. if (cached) {
  24517. peg$currPos = cached.nextPos;
  24518. return cached.result;
  24519. }
  24520. s0 = peg$currPos;
  24521. if (peg$c8.test(input.charAt(peg$currPos))) {
  24522. s1 = input.charAt(peg$currPos);
  24523. peg$currPos++;
  24524. } else {
  24525. s1 = peg$FAILED;
  24526. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24527. }
  24528. if (s1 !== peg$FAILED) {
  24529. s2 = [];
  24530. if (peg$c10.test(input.charAt(peg$currPos))) {
  24531. s3 = input.charAt(peg$currPos);
  24532. peg$currPos++;
  24533. } else {
  24534. s3 = peg$FAILED;
  24535. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24536. }
  24537. while (s3 !== peg$FAILED) {
  24538. s2.push(s3);
  24539. if (peg$c10.test(input.charAt(peg$currPos))) {
  24540. s3 = input.charAt(peg$currPos);
  24541. peg$currPos++;
  24542. } else {
  24543. s3 = peg$FAILED;
  24544. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24545. }
  24546. }
  24547. if (s2 !== peg$FAILED) {
  24548. peg$savedPos = s0;
  24549. s1 = peg$c12(s1, s2);
  24550. s0 = s1;
  24551. } else {
  24552. peg$currPos = s0;
  24553. s0 = peg$FAILED;
  24554. }
  24555. } else {
  24556. peg$currPos = s0;
  24557. s0 = peg$FAILED;
  24558. }
  24559. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24560. return s0;
  24561. }
  24562. function peg$parsekeyword() {
  24563. var s0, s1, s2;
  24564. var key = peg$currPos * 61 + 6,
  24565. cached = peg$resultsCache[key];
  24566. if (cached) {
  24567. peg$currPos = cached.nextPos;
  24568. return cached.result;
  24569. }
  24570. s0 = peg$currPos;
  24571. s1 = peg$parseidentifier();
  24572. if (s1 !== peg$FAILED) {
  24573. if (input.charCodeAt(peg$currPos) === 58) {
  24574. s2 = peg$c13;
  24575. peg$currPos++;
  24576. } else {
  24577. s2 = peg$FAILED;
  24578. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24579. }
  24580. if (s2 !== peg$FAILED) {
  24581. peg$savedPos = s0;
  24582. s1 = peg$c15(s1, s2);
  24583. s0 = s1;
  24584. } else {
  24585. peg$currPos = s0;
  24586. s0 = peg$FAILED;
  24587. }
  24588. } else {
  24589. peg$currPos = s0;
  24590. s0 = peg$FAILED;
  24591. }
  24592. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24593. return s0;
  24594. }
  24595. function peg$parseselector() {
  24596. var s0, s1, s2, s3;
  24597. var key = peg$currPos * 61 + 7,
  24598. cached = peg$resultsCache[key];
  24599. if (cached) {
  24600. peg$currPos = cached.nextPos;
  24601. return cached.result;
  24602. }
  24603. s0 = peg$currPos;
  24604. if (peg$c8.test(input.charAt(peg$currPos))) {
  24605. s1 = input.charAt(peg$currPos);
  24606. peg$currPos++;
  24607. } else {
  24608. s1 = peg$FAILED;
  24609. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24610. }
  24611. if (s1 !== peg$FAILED) {
  24612. s2 = [];
  24613. if (peg$c16.test(input.charAt(peg$currPos))) {
  24614. s3 = input.charAt(peg$currPos);
  24615. peg$currPos++;
  24616. } else {
  24617. s3 = peg$FAILED;
  24618. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24619. }
  24620. while (s3 !== peg$FAILED) {
  24621. s2.push(s3);
  24622. if (peg$c16.test(input.charAt(peg$currPos))) {
  24623. s3 = input.charAt(peg$currPos);
  24624. peg$currPos++;
  24625. } else {
  24626. s3 = peg$FAILED;
  24627. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24628. }
  24629. }
  24630. if (s2 !== peg$FAILED) {
  24631. peg$savedPos = s0;
  24632. s1 = peg$c12(s1, s2);
  24633. s0 = s1;
  24634. } else {
  24635. peg$currPos = s0;
  24636. s0 = peg$FAILED;
  24637. }
  24638. } else {
  24639. peg$currPos = s0;
  24640. s0 = peg$FAILED;
  24641. }
  24642. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24643. return s0;
  24644. }
  24645. function peg$parseclassName() {
  24646. var s0, s1, s2, s3;
  24647. var key = peg$currPos * 61 + 8,
  24648. cached = peg$resultsCache[key];
  24649. if (cached) {
  24650. peg$currPos = cached.nextPos;
  24651. return cached.result;
  24652. }
  24653. s0 = peg$currPos;
  24654. if (peg$c18.test(input.charAt(peg$currPos))) {
  24655. s1 = input.charAt(peg$currPos);
  24656. peg$currPos++;
  24657. } else {
  24658. s1 = peg$FAILED;
  24659. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24660. }
  24661. if (s1 !== peg$FAILED) {
  24662. s2 = [];
  24663. if (peg$c10.test(input.charAt(peg$currPos))) {
  24664. s3 = input.charAt(peg$currPos);
  24665. peg$currPos++;
  24666. } else {
  24667. s3 = peg$FAILED;
  24668. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24669. }
  24670. while (s3 !== peg$FAILED) {
  24671. s2.push(s3);
  24672. if (peg$c10.test(input.charAt(peg$currPos))) {
  24673. s3 = input.charAt(peg$currPos);
  24674. peg$currPos++;
  24675. } else {
  24676. s3 = peg$FAILED;
  24677. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24678. }
  24679. }
  24680. if (s2 !== peg$FAILED) {
  24681. peg$savedPos = s0;
  24682. s1 = peg$c12(s1, s2);
  24683. s0 = s1;
  24684. } else {
  24685. peg$currPos = s0;
  24686. s0 = peg$FAILED;
  24687. }
  24688. } else {
  24689. peg$currPos = s0;
  24690. s0 = peg$FAILED;
  24691. }
  24692. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24693. return s0;
  24694. }
  24695. function peg$parsestring() {
  24696. var s0, s1, s2, s3, s4;
  24697. var key = peg$currPos * 61 + 9,
  24698. cached = peg$resultsCache[key];
  24699. if (cached) {
  24700. peg$currPos = cached.nextPos;
  24701. return cached.result;
  24702. }
  24703. s0 = peg$currPos;
  24704. if (input.charCodeAt(peg$currPos) === 39) {
  24705. s1 = peg$c20;
  24706. peg$currPos++;
  24707. } else {
  24708. s1 = peg$FAILED;
  24709. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24710. }
  24711. if (s1 !== peg$FAILED) {
  24712. s2 = [];
  24713. s3 = peg$currPos;
  24714. if (input.substr(peg$currPos, 2) === peg$c22) {
  24715. s4 = peg$c22;
  24716. peg$currPos += 2;
  24717. } else {
  24718. s4 = peg$FAILED;
  24719. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24720. }
  24721. if (s4 !== peg$FAILED) {
  24722. peg$savedPos = s3;
  24723. s4 = peg$c24();
  24724. }
  24725. s3 = s4;
  24726. if (s3 === peg$FAILED) {
  24727. if (peg$c25.test(input.charAt(peg$currPos))) {
  24728. s3 = input.charAt(peg$currPos);
  24729. peg$currPos++;
  24730. } else {
  24731. s3 = peg$FAILED;
  24732. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24733. }
  24734. }
  24735. while (s3 !== peg$FAILED) {
  24736. s2.push(s3);
  24737. s3 = peg$currPos;
  24738. if (input.substr(peg$currPos, 2) === peg$c22) {
  24739. s4 = peg$c22;
  24740. peg$currPos += 2;
  24741. } else {
  24742. s4 = peg$FAILED;
  24743. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24744. }
  24745. if (s4 !== peg$FAILED) {
  24746. peg$savedPos = s3;
  24747. s4 = peg$c24();
  24748. }
  24749. s3 = s4;
  24750. if (s3 === peg$FAILED) {
  24751. if (peg$c25.test(input.charAt(peg$currPos))) {
  24752. s3 = input.charAt(peg$currPos);
  24753. peg$currPos++;
  24754. } else {
  24755. s3 = peg$FAILED;
  24756. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24757. }
  24758. }
  24759. }
  24760. if (s2 !== peg$FAILED) {
  24761. if (input.charCodeAt(peg$currPos) === 39) {
  24762. s3 = peg$c20;
  24763. peg$currPos++;
  24764. } else {
  24765. s3 = peg$FAILED;
  24766. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24767. }
  24768. if (s3 !== peg$FAILED) {
  24769. peg$savedPos = s0;
  24770. s1 = peg$c27(s2);
  24771. s0 = s1;
  24772. } else {
  24773. peg$currPos = s0;
  24774. s0 = peg$FAILED;
  24775. }
  24776. } else {
  24777. peg$currPos = s0;
  24778. s0 = peg$FAILED;
  24779. }
  24780. } else {
  24781. peg$currPos = s0;
  24782. s0 = peg$FAILED;
  24783. }
  24784. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24785. return s0;
  24786. }
  24787. function peg$parsecharacter() {
  24788. var s0, s1, s2;
  24789. var key = peg$currPos * 61 + 10,
  24790. cached = peg$resultsCache[key];
  24791. if (cached) {
  24792. peg$currPos = cached.nextPos;
  24793. return cached.result;
  24794. }
  24795. s0 = peg$currPos;
  24796. if (input.charCodeAt(peg$currPos) === 36) {
  24797. s1 = peg$c28;
  24798. peg$currPos++;
  24799. } else {
  24800. s1 = peg$FAILED;
  24801. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24802. }
  24803. if (s1 !== peg$FAILED) {
  24804. if (input.length > peg$currPos) {
  24805. s2 = input.charAt(peg$currPos);
  24806. peg$currPos++;
  24807. } else {
  24808. s2 = peg$FAILED;
  24809. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24810. }
  24811. if (s2 !== peg$FAILED) {
  24812. peg$savedPos = s0;
  24813. s1 = peg$c31(s2);
  24814. s0 = s1;
  24815. } else {
  24816. peg$currPos = s0;
  24817. s0 = peg$FAILED;
  24818. }
  24819. } else {
  24820. peg$currPos = s0;
  24821. s0 = peg$FAILED;
  24822. }
  24823. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24824. return s0;
  24825. }
  24826. function peg$parsesymbol() {
  24827. var s0, s1, s2;
  24828. var key = peg$currPos * 61 + 11,
  24829. cached = peg$resultsCache[key];
  24830. if (cached) {
  24831. peg$currPos = cached.nextPos;
  24832. return cached.result;
  24833. }
  24834. s0 = peg$currPos;
  24835. if (input.charCodeAt(peg$currPos) === 35) {
  24836. s1 = peg$c32;
  24837. peg$currPos++;
  24838. } else {
  24839. s1 = peg$FAILED;
  24840. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24841. }
  24842. if (s1 !== peg$FAILED) {
  24843. s2 = peg$parsebareSymbol();
  24844. if (s2 !== peg$FAILED) {
  24845. peg$savedPos = s0;
  24846. s1 = peg$c34(s2);
  24847. s0 = s1;
  24848. } else {
  24849. peg$currPos = s0;
  24850. s0 = peg$FAILED;
  24851. }
  24852. } else {
  24853. peg$currPos = s0;
  24854. s0 = peg$FAILED;
  24855. }
  24856. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24857. return s0;
  24858. }
  24859. function peg$parsebareSymbol() {
  24860. var s0, s1, s2;
  24861. var key = peg$currPos * 61 + 12,
  24862. cached = peg$resultsCache[key];
  24863. if (cached) {
  24864. peg$currPos = cached.nextPos;
  24865. return cached.result;
  24866. }
  24867. s0 = peg$currPos;
  24868. s1 = peg$parseselector();
  24869. if (s1 === peg$FAILED) {
  24870. s1 = peg$parsebinarySelector();
  24871. if (s1 === peg$FAILED) {
  24872. s1 = peg$currPos;
  24873. s2 = peg$parsestring();
  24874. if (s2 !== peg$FAILED) {
  24875. peg$savedPos = s1;
  24876. s2 = peg$c35(s2);
  24877. }
  24878. s1 = s2;
  24879. }
  24880. }
  24881. if (s1 !== peg$FAILED) {
  24882. peg$savedPos = s0;
  24883. s1 = peg$c36(s1);
  24884. }
  24885. s0 = s1;
  24886. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24887. return s0;
  24888. }
  24889. function peg$parsenumber() {
  24890. var s0, s1;
  24891. var key = peg$currPos * 61 + 13,
  24892. cached = peg$resultsCache[key];
  24893. if (cached) {
  24894. peg$currPos = cached.nextPos;
  24895. return cached.result;
  24896. }
  24897. s0 = peg$currPos;
  24898. s1 = peg$parsenumberExp();
  24899. if (s1 === peg$FAILED) {
  24900. s1 = peg$parsehex();
  24901. if (s1 === peg$FAILED) {
  24902. s1 = peg$parsefloat();
  24903. if (s1 === peg$FAILED) {
  24904. s1 = peg$parseinteger();
  24905. }
  24906. }
  24907. }
  24908. if (s1 !== peg$FAILED) {
  24909. peg$savedPos = s0;
  24910. s1 = peg$c37(s1);
  24911. }
  24912. s0 = s1;
  24913. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24914. return s0;
  24915. }
  24916. function peg$parsenumberExp() {
  24917. var s0, s1, s2, s3, s4;
  24918. var key = peg$currPos * 61 + 14,
  24919. cached = peg$resultsCache[key];
  24920. if (cached) {
  24921. peg$currPos = cached.nextPos;
  24922. return cached.result;
  24923. }
  24924. s0 = peg$currPos;
  24925. s1 = peg$currPos;
  24926. s2 = peg$parsefloat();
  24927. if (s2 === peg$FAILED) {
  24928. s2 = peg$parseinteger();
  24929. }
  24930. if (s2 !== peg$FAILED) {
  24931. if (input.charCodeAt(peg$currPos) === 101) {
  24932. s3 = peg$c38;
  24933. peg$currPos++;
  24934. } else {
  24935. s3 = peg$FAILED;
  24936. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24937. }
  24938. if (s3 !== peg$FAILED) {
  24939. s4 = peg$parseinteger();
  24940. if (s4 !== peg$FAILED) {
  24941. s2 = [s2, s3, s4];
  24942. s1 = s2;
  24943. } else {
  24944. peg$currPos = s1;
  24945. s1 = peg$FAILED;
  24946. }
  24947. } else {
  24948. peg$currPos = s1;
  24949. s1 = peg$FAILED;
  24950. }
  24951. } else {
  24952. peg$currPos = s1;
  24953. s1 = peg$FAILED;
  24954. }
  24955. if (s1 !== peg$FAILED) {
  24956. peg$savedPos = s0;
  24957. s1 = peg$c40(s1);
  24958. }
  24959. s0 = s1;
  24960. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24961. return s0;
  24962. }
  24963. function peg$parsehex() {
  24964. var s0, s1, s2, s3, s4;
  24965. var key = peg$currPos * 61 + 15,
  24966. cached = peg$resultsCache[key];
  24967. if (cached) {
  24968. peg$currPos = cached.nextPos;
  24969. return cached.result;
  24970. }
  24971. s0 = peg$currPos;
  24972. if (input.charCodeAt(peg$currPos) === 45) {
  24973. s1 = peg$c41;
  24974. peg$currPos++;
  24975. } else {
  24976. s1 = peg$FAILED;
  24977. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24978. }
  24979. if (s1 === peg$FAILED) {
  24980. s1 = null;
  24981. }
  24982. if (s1 !== peg$FAILED) {
  24983. if (input.substr(peg$currPos, 3) === peg$c43) {
  24984. s2 = peg$c43;
  24985. peg$currPos += 3;
  24986. } else {
  24987. s2 = peg$FAILED;
  24988. if (peg$silentFails === 0) { peg$fail(peg$c44); }
  24989. }
  24990. if (s2 !== peg$FAILED) {
  24991. s3 = [];
  24992. if (peg$c45.test(input.charAt(peg$currPos))) {
  24993. s4 = input.charAt(peg$currPos);
  24994. peg$currPos++;
  24995. } else {
  24996. s4 = peg$FAILED;
  24997. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  24998. }
  24999. if (s4 !== peg$FAILED) {
  25000. while (s4 !== peg$FAILED) {
  25001. s3.push(s4);
  25002. if (peg$c45.test(input.charAt(peg$currPos))) {
  25003. s4 = input.charAt(peg$currPos);
  25004. peg$currPos++;
  25005. } else {
  25006. s4 = peg$FAILED;
  25007. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  25008. }
  25009. }
  25010. } else {
  25011. s3 = peg$FAILED;
  25012. }
  25013. if (s3 !== peg$FAILED) {
  25014. peg$savedPos = s0;
  25015. s1 = peg$c47(s1, s3);
  25016. s0 = s1;
  25017. } else {
  25018. peg$currPos = s0;
  25019. s0 = peg$FAILED;
  25020. }
  25021. } else {
  25022. peg$currPos = s0;
  25023. s0 = peg$FAILED;
  25024. }
  25025. } else {
  25026. peg$currPos = s0;
  25027. s0 = peg$FAILED;
  25028. }
  25029. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25030. return s0;
  25031. }
  25032. function peg$parsefloat() {
  25033. var s0, s1, s2, s3, s4, s5;
  25034. var key = peg$currPos * 61 + 16,
  25035. cached = peg$resultsCache[key];
  25036. if (cached) {
  25037. peg$currPos = cached.nextPos;
  25038. return cached.result;
  25039. }
  25040. s0 = peg$currPos;
  25041. if (input.charCodeAt(peg$currPos) === 45) {
  25042. s1 = peg$c41;
  25043. peg$currPos++;
  25044. } else {
  25045. s1 = peg$FAILED;
  25046. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  25047. }
  25048. if (s1 === peg$FAILED) {
  25049. s1 = null;
  25050. }
  25051. if (s1 !== peg$FAILED) {
  25052. s2 = [];
  25053. if (peg$c48.test(input.charAt(peg$currPos))) {
  25054. s3 = input.charAt(peg$currPos);
  25055. peg$currPos++;
  25056. } else {
  25057. s3 = peg$FAILED;
  25058. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25059. }
  25060. if (s3 !== peg$FAILED) {
  25061. while (s3 !== peg$FAILED) {
  25062. s2.push(s3);
  25063. if (peg$c48.test(input.charAt(peg$currPos))) {
  25064. s3 = input.charAt(peg$currPos);
  25065. peg$currPos++;
  25066. } else {
  25067. s3 = peg$FAILED;
  25068. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25069. }
  25070. }
  25071. } else {
  25072. s2 = peg$FAILED;
  25073. }
  25074. if (s2 !== peg$FAILED) {
  25075. if (input.charCodeAt(peg$currPos) === 46) {
  25076. s3 = peg$c6;
  25077. peg$currPos++;
  25078. } else {
  25079. s3 = peg$FAILED;
  25080. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25081. }
  25082. if (s3 !== peg$FAILED) {
  25083. s4 = [];
  25084. if (peg$c48.test(input.charAt(peg$currPos))) {
  25085. s5 = input.charAt(peg$currPos);
  25086. peg$currPos++;
  25087. } else {
  25088. s5 = peg$FAILED;
  25089. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25090. }
  25091. if (s5 !== peg$FAILED) {
  25092. while (s5 !== peg$FAILED) {
  25093. s4.push(s5);
  25094. if (peg$c48.test(input.charAt(peg$currPos))) {
  25095. s5 = input.charAt(peg$currPos);
  25096. peg$currPos++;
  25097. } else {
  25098. s5 = peg$FAILED;
  25099. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25100. }
  25101. }
  25102. } else {
  25103. s4 = peg$FAILED;
  25104. }
  25105. if (s4 !== peg$FAILED) {
  25106. peg$savedPos = s0;
  25107. s1 = peg$c50(s1, s2, s4);
  25108. s0 = s1;
  25109. } else {
  25110. peg$currPos = s0;
  25111. s0 = peg$FAILED;
  25112. }
  25113. } else {
  25114. peg$currPos = s0;
  25115. s0 = peg$FAILED;
  25116. }
  25117. } else {
  25118. peg$currPos = s0;
  25119. s0 = peg$FAILED;
  25120. }
  25121. } else {
  25122. peg$currPos = s0;
  25123. s0 = peg$FAILED;
  25124. }
  25125. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25126. return s0;
  25127. }
  25128. function peg$parseinteger() {
  25129. var s0, s1, s2, s3;
  25130. var key = peg$currPos * 61 + 17,
  25131. cached = peg$resultsCache[key];
  25132. if (cached) {
  25133. peg$currPos = cached.nextPos;
  25134. return cached.result;
  25135. }
  25136. s0 = peg$currPos;
  25137. if (input.charCodeAt(peg$currPos) === 45) {
  25138. s1 = peg$c41;
  25139. peg$currPos++;
  25140. } else {
  25141. s1 = peg$FAILED;
  25142. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  25143. }
  25144. if (s1 === peg$FAILED) {
  25145. s1 = null;
  25146. }
  25147. if (s1 !== peg$FAILED) {
  25148. s2 = [];
  25149. if (peg$c48.test(input.charAt(peg$currPos))) {
  25150. s3 = input.charAt(peg$currPos);
  25151. peg$currPos++;
  25152. } else {
  25153. s3 = peg$FAILED;
  25154. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25155. }
  25156. if (s3 !== peg$FAILED) {
  25157. while (s3 !== peg$FAILED) {
  25158. s2.push(s3);
  25159. if (peg$c48.test(input.charAt(peg$currPos))) {
  25160. s3 = input.charAt(peg$currPos);
  25161. peg$currPos++;
  25162. } else {
  25163. s3 = peg$FAILED;
  25164. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  25165. }
  25166. }
  25167. } else {
  25168. s2 = peg$FAILED;
  25169. }
  25170. if (s2 !== peg$FAILED) {
  25171. peg$savedPos = s0;
  25172. s1 = peg$c51(s1, s2);
  25173. s0 = s1;
  25174. } else {
  25175. peg$currPos = s0;
  25176. s0 = peg$FAILED;
  25177. }
  25178. } else {
  25179. peg$currPos = s0;
  25180. s0 = peg$FAILED;
  25181. }
  25182. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25183. return s0;
  25184. }
  25185. function peg$parseliteralArray() {
  25186. var s0, s1, s2, s3, s4;
  25187. var key = peg$currPos * 61 + 18,
  25188. cached = peg$resultsCache[key];
  25189. if (cached) {
  25190. peg$currPos = cached.nextPos;
  25191. return cached.result;
  25192. }
  25193. s0 = peg$currPos;
  25194. if (input.substr(peg$currPos, 2) === peg$c52) {
  25195. s1 = peg$c52;
  25196. peg$currPos += 2;
  25197. } else {
  25198. s1 = peg$FAILED;
  25199. if (peg$silentFails === 0) { peg$fail(peg$c53); }
  25200. }
  25201. if (s1 !== peg$FAILED) {
  25202. s2 = peg$parsewsLiteralArrayContents();
  25203. if (s2 !== peg$FAILED) {
  25204. s3 = peg$parsews();
  25205. if (s3 !== peg$FAILED) {
  25206. if (input.charCodeAt(peg$currPos) === 41) {
  25207. s4 = peg$c54;
  25208. peg$currPos++;
  25209. } else {
  25210. s4 = peg$FAILED;
  25211. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25212. }
  25213. if (s4 !== peg$FAILED) {
  25214. peg$savedPos = s0;
  25215. s1 = peg$c56(s2);
  25216. s0 = s1;
  25217. } else {
  25218. peg$currPos = s0;
  25219. s0 = peg$FAILED;
  25220. }
  25221. } else {
  25222. peg$currPos = s0;
  25223. s0 = peg$FAILED;
  25224. }
  25225. } else {
  25226. peg$currPos = s0;
  25227. s0 = peg$FAILED;
  25228. }
  25229. } else {
  25230. peg$currPos = s0;
  25231. s0 = peg$FAILED;
  25232. }
  25233. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25234. return s0;
  25235. }
  25236. function peg$parsebareLiteralArray() {
  25237. var s0, s1, s2, s3, s4;
  25238. var key = peg$currPos * 61 + 19,
  25239. cached = peg$resultsCache[key];
  25240. if (cached) {
  25241. peg$currPos = cached.nextPos;
  25242. return cached.result;
  25243. }
  25244. s0 = peg$currPos;
  25245. if (input.charCodeAt(peg$currPos) === 40) {
  25246. s1 = peg$c57;
  25247. peg$currPos++;
  25248. } else {
  25249. s1 = peg$FAILED;
  25250. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25251. }
  25252. if (s1 !== peg$FAILED) {
  25253. s2 = peg$parsewsLiteralArrayContents();
  25254. if (s2 !== peg$FAILED) {
  25255. s3 = peg$parsews();
  25256. if (s3 !== peg$FAILED) {
  25257. if (input.charCodeAt(peg$currPos) === 41) {
  25258. s4 = peg$c54;
  25259. peg$currPos++;
  25260. } else {
  25261. s4 = peg$FAILED;
  25262. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25263. }
  25264. if (s4 !== peg$FAILED) {
  25265. peg$savedPos = s0;
  25266. s1 = peg$c56(s2);
  25267. s0 = s1;
  25268. } else {
  25269. peg$currPos = s0;
  25270. s0 = peg$FAILED;
  25271. }
  25272. } else {
  25273. peg$currPos = s0;
  25274. s0 = peg$FAILED;
  25275. }
  25276. } else {
  25277. peg$currPos = s0;
  25278. s0 = peg$FAILED;
  25279. }
  25280. } else {
  25281. peg$currPos = s0;
  25282. s0 = peg$FAILED;
  25283. }
  25284. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25285. return s0;
  25286. }
  25287. function peg$parseliteralArrayElement() {
  25288. var s0;
  25289. var key = peg$currPos * 61 + 20,
  25290. cached = peg$resultsCache[key];
  25291. if (cached) {
  25292. peg$currPos = cached.nextPos;
  25293. return cached.result;
  25294. }
  25295. s0 = peg$parseparseTimeLiteral();
  25296. if (s0 === peg$FAILED) {
  25297. s0 = peg$parsebareLiteralArray();
  25298. if (s0 === peg$FAILED) {
  25299. s0 = peg$parsebareSymbol();
  25300. }
  25301. }
  25302. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25303. return s0;
  25304. }
  25305. function peg$parsewsLiteralArrayContents() {
  25306. var s0, s1, s2, s3, s4;
  25307. var key = peg$currPos * 61 + 21,
  25308. cached = peg$resultsCache[key];
  25309. if (cached) {
  25310. peg$currPos = cached.nextPos;
  25311. return cached.result;
  25312. }
  25313. s0 = peg$currPos;
  25314. s1 = [];
  25315. s2 = peg$currPos;
  25316. s3 = peg$parsews();
  25317. if (s3 !== peg$FAILED) {
  25318. s4 = peg$parseliteralArrayElement();
  25319. if (s4 !== peg$FAILED) {
  25320. peg$savedPos = s2;
  25321. s3 = peg$c59(s4);
  25322. s2 = s3;
  25323. } else {
  25324. peg$currPos = s2;
  25325. s2 = peg$FAILED;
  25326. }
  25327. } else {
  25328. peg$currPos = s2;
  25329. s2 = peg$FAILED;
  25330. }
  25331. while (s2 !== peg$FAILED) {
  25332. s1.push(s2);
  25333. s2 = peg$currPos;
  25334. s3 = peg$parsews();
  25335. if (s3 !== peg$FAILED) {
  25336. s4 = peg$parseliteralArrayElement();
  25337. if (s4 !== peg$FAILED) {
  25338. peg$savedPos = s2;
  25339. s3 = peg$c59(s4);
  25340. s2 = s3;
  25341. } else {
  25342. peg$currPos = s2;
  25343. s2 = peg$FAILED;
  25344. }
  25345. } else {
  25346. peg$currPos = s2;
  25347. s2 = peg$FAILED;
  25348. }
  25349. }
  25350. if (s1 !== peg$FAILED) {
  25351. peg$savedPos = s0;
  25352. s1 = peg$c60(s1);
  25353. }
  25354. s0 = s1;
  25355. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25356. return s0;
  25357. }
  25358. function peg$parsedynamicArray() {
  25359. var s0, s1, s2, s3, s4, s5;
  25360. var key = peg$currPos * 61 + 22,
  25361. cached = peg$resultsCache[key];
  25362. if (cached) {
  25363. peg$currPos = cached.nextPos;
  25364. return cached.result;
  25365. }
  25366. s0 = peg$currPos;
  25367. if (input.charCodeAt(peg$currPos) === 123) {
  25368. s1 = peg$c61;
  25369. peg$currPos++;
  25370. } else {
  25371. s1 = peg$FAILED;
  25372. if (peg$silentFails === 0) { peg$fail(peg$c62); }
  25373. }
  25374. if (s1 !== peg$FAILED) {
  25375. s2 = peg$parsews();
  25376. if (s2 !== peg$FAILED) {
  25377. s3 = peg$parseexpressions();
  25378. if (s3 === peg$FAILED) {
  25379. s3 = null;
  25380. }
  25381. if (s3 !== peg$FAILED) {
  25382. s4 = peg$parsemaybeDotsWs();
  25383. if (s4 !== peg$FAILED) {
  25384. if (input.charCodeAt(peg$currPos) === 125) {
  25385. s5 = peg$c63;
  25386. peg$currPos++;
  25387. } else {
  25388. s5 = peg$FAILED;
  25389. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25390. }
  25391. if (s5 !== peg$FAILED) {
  25392. peg$savedPos = s0;
  25393. s1 = peg$c65(s3);
  25394. s0 = s1;
  25395. } else {
  25396. peg$currPos = s0;
  25397. s0 = peg$FAILED;
  25398. }
  25399. } else {
  25400. peg$currPos = s0;
  25401. s0 = peg$FAILED;
  25402. }
  25403. } else {
  25404. peg$currPos = s0;
  25405. s0 = peg$FAILED;
  25406. }
  25407. } else {
  25408. peg$currPos = s0;
  25409. s0 = peg$FAILED;
  25410. }
  25411. } else {
  25412. peg$currPos = s0;
  25413. s0 = peg$FAILED;
  25414. }
  25415. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25416. return s0;
  25417. }
  25418. function peg$parsedynamicDictionary() {
  25419. var s0, s1, s2, s3, s4, s5;
  25420. var key = peg$currPos * 61 + 23,
  25421. cached = peg$resultsCache[key];
  25422. if (cached) {
  25423. peg$currPos = cached.nextPos;
  25424. return cached.result;
  25425. }
  25426. s0 = peg$currPos;
  25427. if (input.substr(peg$currPos, 2) === peg$c66) {
  25428. s1 = peg$c66;
  25429. peg$currPos += 2;
  25430. } else {
  25431. s1 = peg$FAILED;
  25432. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  25433. }
  25434. if (s1 !== peg$FAILED) {
  25435. s2 = peg$parsews();
  25436. if (s2 !== peg$FAILED) {
  25437. s3 = peg$parseassociations();
  25438. if (s3 === peg$FAILED) {
  25439. s3 = null;
  25440. }
  25441. if (s3 !== peg$FAILED) {
  25442. s4 = peg$parsemaybeDotsWs();
  25443. if (s4 !== peg$FAILED) {
  25444. if (input.charCodeAt(peg$currPos) === 125) {
  25445. s5 = peg$c63;
  25446. peg$currPos++;
  25447. } else {
  25448. s5 = peg$FAILED;
  25449. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25450. }
  25451. if (s5 !== peg$FAILED) {
  25452. peg$savedPos = s0;
  25453. s1 = peg$c68(s3);
  25454. s0 = s1;
  25455. } else {
  25456. peg$currPos = s0;
  25457. s0 = peg$FAILED;
  25458. }
  25459. } else {
  25460. peg$currPos = s0;
  25461. s0 = peg$FAILED;
  25462. }
  25463. } else {
  25464. peg$currPos = s0;
  25465. s0 = peg$FAILED;
  25466. }
  25467. } else {
  25468. peg$currPos = s0;
  25469. s0 = peg$FAILED;
  25470. }
  25471. } else {
  25472. peg$currPos = s0;
  25473. s0 = peg$FAILED;
  25474. }
  25475. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25476. return s0;
  25477. }
  25478. function peg$parsepseudoVariable() {
  25479. var s0, s1, s2;
  25480. var key = peg$currPos * 61 + 24,
  25481. cached = peg$resultsCache[key];
  25482. if (cached) {
  25483. peg$currPos = cached.nextPos;
  25484. return cached.result;
  25485. }
  25486. s0 = peg$currPos;
  25487. s1 = peg$currPos;
  25488. if (input.substr(peg$currPos, 4) === peg$c69) {
  25489. s2 = peg$c69;
  25490. peg$currPos += 4;
  25491. } else {
  25492. s2 = peg$FAILED;
  25493. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  25494. }
  25495. if (s2 !== peg$FAILED) {
  25496. peg$savedPos = s1;
  25497. s2 = peg$c71();
  25498. }
  25499. s1 = s2;
  25500. if (s1 === peg$FAILED) {
  25501. s1 = peg$currPos;
  25502. if (input.substr(peg$currPos, 5) === peg$c72) {
  25503. s2 = peg$c72;
  25504. peg$currPos += 5;
  25505. } else {
  25506. s2 = peg$FAILED;
  25507. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  25508. }
  25509. if (s2 !== peg$FAILED) {
  25510. peg$savedPos = s1;
  25511. s2 = peg$c74();
  25512. }
  25513. s1 = s2;
  25514. if (s1 === peg$FAILED) {
  25515. s1 = peg$currPos;
  25516. if (input.substr(peg$currPos, 3) === peg$c75) {
  25517. s2 = peg$c75;
  25518. peg$currPos += 3;
  25519. } else {
  25520. s2 = peg$FAILED;
  25521. if (peg$silentFails === 0) { peg$fail(peg$c76); }
  25522. }
  25523. if (s2 !== peg$FAILED) {
  25524. peg$savedPos = s1;
  25525. s2 = peg$c77();
  25526. }
  25527. s1 = s2;
  25528. }
  25529. }
  25530. if (s1 !== peg$FAILED) {
  25531. peg$savedPos = s0;
  25532. s1 = peg$c78(s1);
  25533. }
  25534. s0 = s1;
  25535. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25536. return s0;
  25537. }
  25538. function peg$parseparseTimeLiteral() {
  25539. var s0;
  25540. var key = peg$currPos * 61 + 25,
  25541. cached = peg$resultsCache[key];
  25542. if (cached) {
  25543. peg$currPos = cached.nextPos;
  25544. return cached.result;
  25545. }
  25546. s0 = peg$parsepseudoVariable();
  25547. if (s0 === peg$FAILED) {
  25548. s0 = peg$parsenumber();
  25549. if (s0 === peg$FAILED) {
  25550. s0 = peg$parseliteralArray();
  25551. if (s0 === peg$FAILED) {
  25552. s0 = peg$parsestring();
  25553. if (s0 === peg$FAILED) {
  25554. s0 = peg$parsesymbol();
  25555. if (s0 === peg$FAILED) {
  25556. s0 = peg$parsecharacter();
  25557. }
  25558. }
  25559. }
  25560. }
  25561. }
  25562. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25563. return s0;
  25564. }
  25565. function peg$parseruntimeLiteral() {
  25566. var s0;
  25567. var key = peg$currPos * 61 + 26,
  25568. cached = peg$resultsCache[key];
  25569. if (cached) {
  25570. peg$currPos = cached.nextPos;
  25571. return cached.result;
  25572. }
  25573. s0 = peg$parsedynamicDictionary();
  25574. if (s0 === peg$FAILED) {
  25575. s0 = peg$parsedynamicArray();
  25576. if (s0 === peg$FAILED) {
  25577. s0 = peg$parseblock();
  25578. }
  25579. }
  25580. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25581. return s0;
  25582. }
  25583. function peg$parseliteral() {
  25584. var s0;
  25585. var key = peg$currPos * 61 + 27,
  25586. cached = peg$resultsCache[key];
  25587. if (cached) {
  25588. peg$currPos = cached.nextPos;
  25589. return cached.result;
  25590. }
  25591. s0 = peg$parseruntimeLiteral();
  25592. if (s0 === peg$FAILED) {
  25593. s0 = peg$parseparseTimeLiteral();
  25594. }
  25595. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25596. return s0;
  25597. }
  25598. function peg$parsevariable() {
  25599. var s0, s1;
  25600. var key = peg$currPos * 61 + 28,
  25601. cached = peg$resultsCache[key];
  25602. if (cached) {
  25603. peg$currPos = cached.nextPos;
  25604. return cached.result;
  25605. }
  25606. s0 = peg$currPos;
  25607. s1 = peg$parseidentifier();
  25608. if (s1 !== peg$FAILED) {
  25609. peg$savedPos = s0;
  25610. s1 = peg$c79(s1);
  25611. }
  25612. s0 = s1;
  25613. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25614. return s0;
  25615. }
  25616. function peg$parsebinarySelector() {
  25617. var s0, s1, s2;
  25618. var key = peg$currPos * 61 + 29,
  25619. cached = peg$resultsCache[key];
  25620. if (cached) {
  25621. peg$currPos = cached.nextPos;
  25622. return cached.result;
  25623. }
  25624. s0 = peg$currPos;
  25625. s1 = [];
  25626. if (peg$c80.test(input.charAt(peg$currPos))) {
  25627. s2 = input.charAt(peg$currPos);
  25628. peg$currPos++;
  25629. } else {
  25630. s2 = peg$FAILED;
  25631. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25632. }
  25633. if (s2 !== peg$FAILED) {
  25634. while (s2 !== peg$FAILED) {
  25635. s1.push(s2);
  25636. if (peg$c80.test(input.charAt(peg$currPos))) {
  25637. s2 = input.charAt(peg$currPos);
  25638. peg$currPos++;
  25639. } else {
  25640. s2 = peg$FAILED;
  25641. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25642. }
  25643. }
  25644. } else {
  25645. s1 = peg$FAILED;
  25646. }
  25647. if (s1 !== peg$FAILED) {
  25648. peg$savedPos = s0;
  25649. s1 = peg$c82(s1);
  25650. }
  25651. s0 = s1;
  25652. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25653. return s0;
  25654. }
  25655. function peg$parsewsKeywordPattern() {
  25656. var s0, s1, s2, s3, s4, s5, s6;
  25657. var key = peg$currPos * 61 + 30,
  25658. cached = peg$resultsCache[key];
  25659. if (cached) {
  25660. peg$currPos = cached.nextPos;
  25661. return cached.result;
  25662. }
  25663. s0 = peg$currPos;
  25664. s1 = [];
  25665. s2 = peg$currPos;
  25666. s3 = peg$parsews();
  25667. if (s3 !== peg$FAILED) {
  25668. s4 = peg$parsekeyword();
  25669. if (s4 !== peg$FAILED) {
  25670. s5 = peg$parsews();
  25671. if (s5 !== peg$FAILED) {
  25672. s6 = peg$parseidentifier();
  25673. if (s6 !== peg$FAILED) {
  25674. peg$savedPos = s2;
  25675. s3 = peg$c83(s4, s6);
  25676. s2 = s3;
  25677. } else {
  25678. peg$currPos = s2;
  25679. s2 = peg$FAILED;
  25680. }
  25681. } else {
  25682. peg$currPos = s2;
  25683. s2 = peg$FAILED;
  25684. }
  25685. } else {
  25686. peg$currPos = s2;
  25687. s2 = peg$FAILED;
  25688. }
  25689. } else {
  25690. peg$currPos = s2;
  25691. s2 = peg$FAILED;
  25692. }
  25693. if (s2 !== peg$FAILED) {
  25694. while (s2 !== peg$FAILED) {
  25695. s1.push(s2);
  25696. s2 = peg$currPos;
  25697. s3 = peg$parsews();
  25698. if (s3 !== peg$FAILED) {
  25699. s4 = peg$parsekeyword();
  25700. if (s4 !== peg$FAILED) {
  25701. s5 = peg$parsews();
  25702. if (s5 !== peg$FAILED) {
  25703. s6 = peg$parseidentifier();
  25704. if (s6 !== peg$FAILED) {
  25705. peg$savedPos = s2;
  25706. s3 = peg$c83(s4, s6);
  25707. s2 = s3;
  25708. } else {
  25709. peg$currPos = s2;
  25710. s2 = peg$FAILED;
  25711. }
  25712. } else {
  25713. peg$currPos = s2;
  25714. s2 = peg$FAILED;
  25715. }
  25716. } else {
  25717. peg$currPos = s2;
  25718. s2 = peg$FAILED;
  25719. }
  25720. } else {
  25721. peg$currPos = s2;
  25722. s2 = peg$FAILED;
  25723. }
  25724. }
  25725. } else {
  25726. s1 = peg$FAILED;
  25727. }
  25728. if (s1 !== peg$FAILED) {
  25729. peg$savedPos = s0;
  25730. s1 = peg$c84(s1);
  25731. }
  25732. s0 = s1;
  25733. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25734. return s0;
  25735. }
  25736. function peg$parsewsBinaryPattern() {
  25737. var s0, s1, s2, s3, s4;
  25738. var key = peg$currPos * 61 + 31,
  25739. cached = peg$resultsCache[key];
  25740. if (cached) {
  25741. peg$currPos = cached.nextPos;
  25742. return cached.result;
  25743. }
  25744. s0 = peg$currPos;
  25745. s1 = peg$parsews();
  25746. if (s1 !== peg$FAILED) {
  25747. s2 = peg$parsebinarySelector();
  25748. if (s2 !== peg$FAILED) {
  25749. s3 = peg$parsews();
  25750. if (s3 !== peg$FAILED) {
  25751. s4 = peg$parseidentifier();
  25752. if (s4 !== peg$FAILED) {
  25753. peg$savedPos = s0;
  25754. s1 = peg$c85(s2, s4);
  25755. s0 = s1;
  25756. } else {
  25757. peg$currPos = s0;
  25758. s0 = peg$FAILED;
  25759. }
  25760. } else {
  25761. peg$currPos = s0;
  25762. s0 = peg$FAILED;
  25763. }
  25764. } else {
  25765. peg$currPos = s0;
  25766. s0 = peg$FAILED;
  25767. }
  25768. } else {
  25769. peg$currPos = s0;
  25770. s0 = peg$FAILED;
  25771. }
  25772. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25773. return s0;
  25774. }
  25775. function peg$parsewsUnaryPattern() {
  25776. var s0, s1, s2;
  25777. var key = peg$currPos * 61 + 32,
  25778. cached = peg$resultsCache[key];
  25779. if (cached) {
  25780. peg$currPos = cached.nextPos;
  25781. return cached.result;
  25782. }
  25783. s0 = peg$currPos;
  25784. s1 = peg$parsews();
  25785. if (s1 !== peg$FAILED) {
  25786. s2 = peg$parseidentifier();
  25787. if (s2 !== peg$FAILED) {
  25788. peg$savedPos = s0;
  25789. s1 = peg$c86(s2);
  25790. s0 = s1;
  25791. } else {
  25792. peg$currPos = s0;
  25793. s0 = peg$FAILED;
  25794. }
  25795. } else {
  25796. peg$currPos = s0;
  25797. s0 = peg$FAILED;
  25798. }
  25799. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25800. return s0;
  25801. }
  25802. function peg$parseexpression() {
  25803. var s0;
  25804. var key = peg$currPos * 61 + 33,
  25805. cached = peg$resultsCache[key];
  25806. if (cached) {
  25807. peg$currPos = cached.nextPos;
  25808. return cached.result;
  25809. }
  25810. s0 = peg$parseassignment();
  25811. if (s0 === peg$FAILED) {
  25812. s0 = peg$parsecascade();
  25813. if (s0 === peg$FAILED) {
  25814. s0 = peg$parsekeywordSend();
  25815. }
  25816. }
  25817. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25818. return s0;
  25819. }
  25820. function peg$parsewsExpressionsRest() {
  25821. var s0, s1, s2, s3, s4;
  25822. var key = peg$currPos * 61 + 34,
  25823. cached = peg$resultsCache[key];
  25824. if (cached) {
  25825. peg$currPos = cached.nextPos;
  25826. return cached.result;
  25827. }
  25828. s0 = peg$currPos;
  25829. s1 = peg$parsews();
  25830. if (s1 !== peg$FAILED) {
  25831. if (input.charCodeAt(peg$currPos) === 46) {
  25832. s2 = peg$c6;
  25833. peg$currPos++;
  25834. } else {
  25835. s2 = peg$FAILED;
  25836. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25837. }
  25838. if (s2 !== peg$FAILED) {
  25839. s3 = peg$parsemaybeDotsWs();
  25840. if (s3 !== peg$FAILED) {
  25841. s4 = peg$parseexpression();
  25842. if (s4 !== peg$FAILED) {
  25843. peg$savedPos = s0;
  25844. s1 = peg$c87(s4);
  25845. s0 = s1;
  25846. } else {
  25847. peg$currPos = s0;
  25848. s0 = peg$FAILED;
  25849. }
  25850. } else {
  25851. peg$currPos = s0;
  25852. s0 = peg$FAILED;
  25853. }
  25854. } else {
  25855. peg$currPos = s0;
  25856. s0 = peg$FAILED;
  25857. }
  25858. } else {
  25859. peg$currPos = s0;
  25860. s0 = peg$FAILED;
  25861. }
  25862. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25863. return s0;
  25864. }
  25865. function peg$parseexpressions() {
  25866. var s0, s1, s2, s3;
  25867. var key = peg$currPos * 61 + 35,
  25868. cached = peg$resultsCache[key];
  25869. if (cached) {
  25870. peg$currPos = cached.nextPos;
  25871. return cached.result;
  25872. }
  25873. s0 = peg$currPos;
  25874. s1 = peg$parseexpression();
  25875. if (s1 !== peg$FAILED) {
  25876. s2 = [];
  25877. s3 = peg$parsewsExpressionsRest();
  25878. while (s3 !== peg$FAILED) {
  25879. s2.push(s3);
  25880. s3 = peg$parsewsExpressionsRest();
  25881. }
  25882. if (s2 !== peg$FAILED) {
  25883. peg$savedPos = s0;
  25884. s1 = peg$c88(s1, s2);
  25885. s0 = s1;
  25886. } else {
  25887. peg$currPos = s0;
  25888. s0 = peg$FAILED;
  25889. }
  25890. } else {
  25891. peg$currPos = s0;
  25892. s0 = peg$FAILED;
  25893. }
  25894. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25895. return s0;
  25896. }
  25897. function peg$parseassignment() {
  25898. var s0, s1, s2, s3, s4, s5;
  25899. var key = peg$currPos * 61 + 36,
  25900. cached = peg$resultsCache[key];
  25901. if (cached) {
  25902. peg$currPos = cached.nextPos;
  25903. return cached.result;
  25904. }
  25905. s0 = peg$currPos;
  25906. s1 = peg$parsevariable();
  25907. if (s1 !== peg$FAILED) {
  25908. s2 = peg$parsews();
  25909. if (s2 !== peg$FAILED) {
  25910. if (input.substr(peg$currPos, 2) === peg$c89) {
  25911. s3 = peg$c89;
  25912. peg$currPos += 2;
  25913. } else {
  25914. s3 = peg$FAILED;
  25915. if (peg$silentFails === 0) { peg$fail(peg$c90); }
  25916. }
  25917. if (s3 !== peg$FAILED) {
  25918. s4 = peg$parsews();
  25919. if (s4 !== peg$FAILED) {
  25920. s5 = peg$parseexpression();
  25921. if (s5 !== peg$FAILED) {
  25922. peg$savedPos = s0;
  25923. s1 = peg$c91(s1, s5);
  25924. s0 = s1;
  25925. } else {
  25926. peg$currPos = s0;
  25927. s0 = peg$FAILED;
  25928. }
  25929. } else {
  25930. peg$currPos = s0;
  25931. s0 = peg$FAILED;
  25932. }
  25933. } else {
  25934. peg$currPos = s0;
  25935. s0 = peg$FAILED;
  25936. }
  25937. } else {
  25938. peg$currPos = s0;
  25939. s0 = peg$FAILED;
  25940. }
  25941. } else {
  25942. peg$currPos = s0;
  25943. s0 = peg$FAILED;
  25944. }
  25945. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25946. return s0;
  25947. }
  25948. function peg$parseret() {
  25949. var s0, s1, s2, s3;
  25950. var key = peg$currPos * 61 + 37,
  25951. cached = peg$resultsCache[key];
  25952. if (cached) {
  25953. peg$currPos = cached.nextPos;
  25954. return cached.result;
  25955. }
  25956. s0 = peg$currPos;
  25957. if (input.charCodeAt(peg$currPos) === 94) {
  25958. s1 = peg$c92;
  25959. peg$currPos++;
  25960. } else {
  25961. s1 = peg$FAILED;
  25962. if (peg$silentFails === 0) { peg$fail(peg$c93); }
  25963. }
  25964. if (s1 !== peg$FAILED) {
  25965. s2 = peg$parsews();
  25966. if (s2 !== peg$FAILED) {
  25967. s3 = peg$parseexpression();
  25968. if (s3 !== peg$FAILED) {
  25969. peg$savedPos = s0;
  25970. s1 = peg$c94(s3);
  25971. s0 = s1;
  25972. } else {
  25973. peg$currPos = s0;
  25974. s0 = peg$FAILED;
  25975. }
  25976. } else {
  25977. peg$currPos = s0;
  25978. s0 = peg$FAILED;
  25979. }
  25980. } else {
  25981. peg$currPos = s0;
  25982. s0 = peg$FAILED;
  25983. }
  25984. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25985. return s0;
  25986. }
  25987. function peg$parsetemps() {
  25988. var s0, s1, s2, s3, s4, s5;
  25989. var key = peg$currPos * 61 + 38,
  25990. cached = peg$resultsCache[key];
  25991. if (cached) {
  25992. peg$currPos = cached.nextPos;
  25993. return cached.result;
  25994. }
  25995. s0 = peg$currPos;
  25996. if (input.charCodeAt(peg$currPos) === 124) {
  25997. s1 = peg$c95;
  25998. peg$currPos++;
  25999. } else {
  26000. s1 = peg$FAILED;
  26001. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  26002. }
  26003. if (s1 !== peg$FAILED) {
  26004. s2 = [];
  26005. s3 = peg$currPos;
  26006. s4 = peg$parsews();
  26007. if (s4 !== peg$FAILED) {
  26008. s5 = peg$parseidentifier();
  26009. if (s5 !== peg$FAILED) {
  26010. peg$savedPos = s3;
  26011. s4 = peg$c97(s5);
  26012. s3 = s4;
  26013. } else {
  26014. peg$currPos = s3;
  26015. s3 = peg$FAILED;
  26016. }
  26017. } else {
  26018. peg$currPos = s3;
  26019. s3 = peg$FAILED;
  26020. }
  26021. while (s3 !== peg$FAILED) {
  26022. s2.push(s3);
  26023. s3 = peg$currPos;
  26024. s4 = peg$parsews();
  26025. if (s4 !== peg$FAILED) {
  26026. s5 = peg$parseidentifier();
  26027. if (s5 !== peg$FAILED) {
  26028. peg$savedPos = s3;
  26029. s4 = peg$c97(s5);
  26030. s3 = s4;
  26031. } else {
  26032. peg$currPos = s3;
  26033. s3 = peg$FAILED;
  26034. }
  26035. } else {
  26036. peg$currPos = s3;
  26037. s3 = peg$FAILED;
  26038. }
  26039. }
  26040. if (s2 !== peg$FAILED) {
  26041. s3 = peg$parsews();
  26042. if (s3 !== peg$FAILED) {
  26043. if (input.charCodeAt(peg$currPos) === 124) {
  26044. s4 = peg$c95;
  26045. peg$currPos++;
  26046. } else {
  26047. s4 = peg$FAILED;
  26048. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  26049. }
  26050. if (s4 !== peg$FAILED) {
  26051. peg$savedPos = s0;
  26052. s1 = peg$c98(s2);
  26053. s0 = s1;
  26054. } else {
  26055. peg$currPos = s0;
  26056. s0 = peg$FAILED;
  26057. }
  26058. } else {
  26059. peg$currPos = s0;
  26060. s0 = peg$FAILED;
  26061. }
  26062. } else {
  26063. peg$currPos = s0;
  26064. s0 = peg$FAILED;
  26065. }
  26066. } else {
  26067. peg$currPos = s0;
  26068. s0 = peg$FAILED;
  26069. }
  26070. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26071. return s0;
  26072. }
  26073. function peg$parsewsBlockParamList() {
  26074. var s0, s1, s2, s3, s4, s5, s6;
  26075. var key = peg$currPos * 61 + 39,
  26076. cached = peg$resultsCache[key];
  26077. if (cached) {
  26078. peg$currPos = cached.nextPos;
  26079. return cached.result;
  26080. }
  26081. s0 = peg$currPos;
  26082. s1 = [];
  26083. s2 = peg$currPos;
  26084. s3 = peg$parsews();
  26085. if (s3 !== peg$FAILED) {
  26086. if (input.charCodeAt(peg$currPos) === 58) {
  26087. s4 = peg$c13;
  26088. peg$currPos++;
  26089. } else {
  26090. s4 = peg$FAILED;
  26091. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26092. }
  26093. if (s4 !== peg$FAILED) {
  26094. s5 = peg$parsews();
  26095. if (s5 !== peg$FAILED) {
  26096. s6 = peg$parseidentifier();
  26097. if (s6 !== peg$FAILED) {
  26098. peg$savedPos = s2;
  26099. s3 = peg$c99(s6);
  26100. s2 = s3;
  26101. } else {
  26102. peg$currPos = s2;
  26103. s2 = peg$FAILED;
  26104. }
  26105. } else {
  26106. peg$currPos = s2;
  26107. s2 = peg$FAILED;
  26108. }
  26109. } else {
  26110. peg$currPos = s2;
  26111. s2 = peg$FAILED;
  26112. }
  26113. } else {
  26114. peg$currPos = s2;
  26115. s2 = peg$FAILED;
  26116. }
  26117. if (s2 !== peg$FAILED) {
  26118. while (s2 !== peg$FAILED) {
  26119. s1.push(s2);
  26120. s2 = peg$currPos;
  26121. s3 = peg$parsews();
  26122. if (s3 !== peg$FAILED) {
  26123. if (input.charCodeAt(peg$currPos) === 58) {
  26124. s4 = peg$c13;
  26125. peg$currPos++;
  26126. } else {
  26127. s4 = peg$FAILED;
  26128. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26129. }
  26130. if (s4 !== peg$FAILED) {
  26131. s5 = peg$parsews();
  26132. if (s5 !== peg$FAILED) {
  26133. s6 = peg$parseidentifier();
  26134. if (s6 !== peg$FAILED) {
  26135. peg$savedPos = s2;
  26136. s3 = peg$c99(s6);
  26137. s2 = s3;
  26138. } else {
  26139. peg$currPos = s2;
  26140. s2 = peg$FAILED;
  26141. }
  26142. } else {
  26143. peg$currPos = s2;
  26144. s2 = peg$FAILED;
  26145. }
  26146. } else {
  26147. peg$currPos = s2;
  26148. s2 = peg$FAILED;
  26149. }
  26150. } else {
  26151. peg$currPos = s2;
  26152. s2 = peg$FAILED;
  26153. }
  26154. }
  26155. } else {
  26156. s1 = peg$FAILED;
  26157. }
  26158. if (s1 !== peg$FAILED) {
  26159. s2 = peg$parsews();
  26160. if (s2 !== peg$FAILED) {
  26161. if (input.charCodeAt(peg$currPos) === 124) {
  26162. s3 = peg$c95;
  26163. peg$currPos++;
  26164. } else {
  26165. s3 = peg$FAILED;
  26166. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  26167. }
  26168. if (s3 !== peg$FAILED) {
  26169. peg$savedPos = s0;
  26170. s1 = peg$c100(s1);
  26171. s0 = s1;
  26172. } else {
  26173. peg$currPos = s0;
  26174. s0 = peg$FAILED;
  26175. }
  26176. } else {
  26177. peg$currPos = s0;
  26178. s0 = peg$FAILED;
  26179. }
  26180. } else {
  26181. peg$currPos = s0;
  26182. s0 = peg$FAILED;
  26183. }
  26184. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26185. return s0;
  26186. }
  26187. function peg$parsesubexpression() {
  26188. var s0, s1, s2, s3, s4, s5;
  26189. var key = peg$currPos * 61 + 40,
  26190. cached = peg$resultsCache[key];
  26191. if (cached) {
  26192. peg$currPos = cached.nextPos;
  26193. return cached.result;
  26194. }
  26195. s0 = peg$currPos;
  26196. if (input.charCodeAt(peg$currPos) === 40) {
  26197. s1 = peg$c57;
  26198. peg$currPos++;
  26199. } else {
  26200. s1 = peg$FAILED;
  26201. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  26202. }
  26203. if (s1 !== peg$FAILED) {
  26204. s2 = peg$parsews();
  26205. if (s2 !== peg$FAILED) {
  26206. s3 = peg$parseexpression();
  26207. if (s3 !== peg$FAILED) {
  26208. s4 = peg$parsews();
  26209. if (s4 !== peg$FAILED) {
  26210. if (input.charCodeAt(peg$currPos) === 41) {
  26211. s5 = peg$c54;
  26212. peg$currPos++;
  26213. } else {
  26214. s5 = peg$FAILED;
  26215. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  26216. }
  26217. if (s5 !== peg$FAILED) {
  26218. peg$savedPos = s0;
  26219. s1 = peg$c87(s3);
  26220. s0 = s1;
  26221. } else {
  26222. peg$currPos = s0;
  26223. s0 = peg$FAILED;
  26224. }
  26225. } else {
  26226. peg$currPos = s0;
  26227. s0 = peg$FAILED;
  26228. }
  26229. } else {
  26230. peg$currPos = s0;
  26231. s0 = peg$FAILED;
  26232. }
  26233. } else {
  26234. peg$currPos = s0;
  26235. s0 = peg$FAILED;
  26236. }
  26237. } else {
  26238. peg$currPos = s0;
  26239. s0 = peg$FAILED;
  26240. }
  26241. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26242. return s0;
  26243. }
  26244. function peg$parsestatementsWs() {
  26245. var s0, s1, s2, s3, s4, s5, s6;
  26246. var key = peg$currPos * 61 + 41,
  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$parseret();
  26254. if (s1 !== peg$FAILED) {
  26255. s2 = peg$parsemaybeDotsWs();
  26256. if (s2 !== peg$FAILED) {
  26257. peg$savedPos = s0;
  26258. s1 = peg$c101(s1);
  26259. s0 = s1;
  26260. } else {
  26261. peg$currPos = s0;
  26262. s0 = peg$FAILED;
  26263. }
  26264. } else {
  26265. peg$currPos = s0;
  26266. s0 = peg$FAILED;
  26267. }
  26268. if (s0 === peg$FAILED) {
  26269. s0 = peg$currPos;
  26270. s1 = peg$parseexpressions();
  26271. if (s1 !== peg$FAILED) {
  26272. s2 = peg$parsews();
  26273. if (s2 !== peg$FAILED) {
  26274. if (input.charCodeAt(peg$currPos) === 46) {
  26275. s3 = peg$c6;
  26276. peg$currPos++;
  26277. } else {
  26278. s3 = peg$FAILED;
  26279. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26280. }
  26281. if (s3 !== peg$FAILED) {
  26282. s4 = peg$parsemaybeDotsWs();
  26283. if (s4 !== peg$FAILED) {
  26284. s5 = peg$parseret();
  26285. if (s5 !== peg$FAILED) {
  26286. s6 = peg$parsemaybeDotsWs();
  26287. if (s6 !== peg$FAILED) {
  26288. peg$savedPos = s0;
  26289. s1 = peg$c102(s1, s5);
  26290. s0 = s1;
  26291. } else {
  26292. peg$currPos = s0;
  26293. s0 = peg$FAILED;
  26294. }
  26295. } else {
  26296. peg$currPos = s0;
  26297. s0 = peg$FAILED;
  26298. }
  26299. } else {
  26300. peg$currPos = s0;
  26301. s0 = peg$FAILED;
  26302. }
  26303. } else {
  26304. peg$currPos = s0;
  26305. s0 = peg$FAILED;
  26306. }
  26307. } else {
  26308. peg$currPos = s0;
  26309. s0 = peg$FAILED;
  26310. }
  26311. } else {
  26312. peg$currPos = s0;
  26313. s0 = peg$FAILED;
  26314. }
  26315. if (s0 === peg$FAILED) {
  26316. s0 = peg$currPos;
  26317. s1 = peg$parseexpressions();
  26318. if (s1 === peg$FAILED) {
  26319. s1 = null;
  26320. }
  26321. if (s1 !== peg$FAILED) {
  26322. s2 = peg$parsemaybeDotsWs();
  26323. if (s2 !== peg$FAILED) {
  26324. peg$savedPos = s0;
  26325. s1 = peg$c103(s1);
  26326. s0 = s1;
  26327. } else {
  26328. peg$currPos = s0;
  26329. s0 = peg$FAILED;
  26330. }
  26331. } else {
  26332. peg$currPos = s0;
  26333. s0 = peg$FAILED;
  26334. }
  26335. }
  26336. }
  26337. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26338. return s0;
  26339. }
  26340. function peg$parsewsSequenceWs() {
  26341. var s0, s1, s2, s3;
  26342. var key = peg$currPos * 61 + 42,
  26343. cached = peg$resultsCache[key];
  26344. if (cached) {
  26345. peg$currPos = cached.nextPos;
  26346. return cached.result;
  26347. }
  26348. s0 = peg$currPos;
  26349. s1 = peg$parsews();
  26350. if (s1 !== peg$FAILED) {
  26351. s2 = peg$parsejsStatement();
  26352. if (s2 !== peg$FAILED) {
  26353. s3 = peg$parsews();
  26354. if (s3 !== peg$FAILED) {
  26355. peg$savedPos = s0;
  26356. s1 = peg$c104(s2);
  26357. s0 = s1;
  26358. } else {
  26359. peg$currPos = s0;
  26360. s0 = peg$FAILED;
  26361. }
  26362. } else {
  26363. peg$currPos = s0;
  26364. s0 = peg$FAILED;
  26365. }
  26366. } else {
  26367. peg$currPos = s0;
  26368. s0 = peg$FAILED;
  26369. }
  26370. if (s0 === peg$FAILED) {
  26371. s0 = peg$parsewsStSequenceWs();
  26372. }
  26373. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26374. return s0;
  26375. }
  26376. function peg$parsewsStSequenceWs() {
  26377. var s0, s1, s2, s3, s4;
  26378. var key = peg$currPos * 61 + 43,
  26379. cached = peg$resultsCache[key];
  26380. if (cached) {
  26381. peg$currPos = cached.nextPos;
  26382. return cached.result;
  26383. }
  26384. s0 = peg$currPos;
  26385. s1 = peg$parsews();
  26386. if (s1 !== peg$FAILED) {
  26387. s2 = peg$parsetemps();
  26388. if (s2 === peg$FAILED) {
  26389. s2 = null;
  26390. }
  26391. if (s2 !== peg$FAILED) {
  26392. s3 = peg$parsemaybeDotsWs();
  26393. if (s3 !== peg$FAILED) {
  26394. s4 = peg$parsestatementsWs();
  26395. if (s4 === peg$FAILED) {
  26396. s4 = null;
  26397. }
  26398. if (s4 !== peg$FAILED) {
  26399. peg$savedPos = s0;
  26400. s1 = peg$c105(s2, s4);
  26401. s0 = s1;
  26402. } else {
  26403. peg$currPos = s0;
  26404. s0 = peg$FAILED;
  26405. }
  26406. } else {
  26407. peg$currPos = s0;
  26408. s0 = peg$FAILED;
  26409. }
  26410. } else {
  26411. peg$currPos = s0;
  26412. s0 = peg$FAILED;
  26413. }
  26414. } else {
  26415. peg$currPos = s0;
  26416. s0 = peg$FAILED;
  26417. }
  26418. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26419. return s0;
  26420. }
  26421. function peg$parseblock() {
  26422. var s0, s1, s2, s3, s4;
  26423. var key = peg$currPos * 61 + 44,
  26424. cached = peg$resultsCache[key];
  26425. if (cached) {
  26426. peg$currPos = cached.nextPos;
  26427. return cached.result;
  26428. }
  26429. s0 = peg$currPos;
  26430. if (input.charCodeAt(peg$currPos) === 91) {
  26431. s1 = peg$c106;
  26432. peg$currPos++;
  26433. } else {
  26434. s1 = peg$FAILED;
  26435. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  26436. }
  26437. if (s1 !== peg$FAILED) {
  26438. s2 = peg$parsewsBlockParamList();
  26439. if (s2 === peg$FAILED) {
  26440. s2 = null;
  26441. }
  26442. if (s2 !== peg$FAILED) {
  26443. s3 = peg$parsewsSequenceWs();
  26444. if (s3 === peg$FAILED) {
  26445. s3 = null;
  26446. }
  26447. if (s3 !== peg$FAILED) {
  26448. if (input.charCodeAt(peg$currPos) === 93) {
  26449. s4 = peg$c108;
  26450. peg$currPos++;
  26451. } else {
  26452. s4 = peg$FAILED;
  26453. if (peg$silentFails === 0) { peg$fail(peg$c109); }
  26454. }
  26455. if (s4 !== peg$FAILED) {
  26456. peg$savedPos = s0;
  26457. s1 = peg$c110(s2, s3);
  26458. s0 = s1;
  26459. } else {
  26460. peg$currPos = s0;
  26461. s0 = peg$FAILED;
  26462. }
  26463. } else {
  26464. peg$currPos = s0;
  26465. s0 = peg$FAILED;
  26466. }
  26467. } else {
  26468. peg$currPos = s0;
  26469. s0 = peg$FAILED;
  26470. }
  26471. } else {
  26472. peg$currPos = s0;
  26473. s0 = peg$FAILED;
  26474. }
  26475. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26476. return s0;
  26477. }
  26478. function peg$parseoperand() {
  26479. var s0;
  26480. var key = peg$currPos * 61 + 45,
  26481. cached = peg$resultsCache[key];
  26482. if (cached) {
  26483. peg$currPos = cached.nextPos;
  26484. return cached.result;
  26485. }
  26486. s0 = peg$parseliteral();
  26487. if (s0 === peg$FAILED) {
  26488. s0 = peg$parsevariable();
  26489. if (s0 === peg$FAILED) {
  26490. s0 = peg$parsesubexpression();
  26491. }
  26492. }
  26493. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26494. return s0;
  26495. }
  26496. function peg$parsewsUnaryMessage() {
  26497. var s0, s1, s2, s3, s4;
  26498. var key = peg$currPos * 61 + 46,
  26499. cached = peg$resultsCache[key];
  26500. if (cached) {
  26501. peg$currPos = cached.nextPos;
  26502. return cached.result;
  26503. }
  26504. s0 = peg$currPos;
  26505. s1 = peg$parsews();
  26506. if (s1 !== peg$FAILED) {
  26507. s2 = peg$parseidentifier();
  26508. if (s2 !== peg$FAILED) {
  26509. s3 = peg$currPos;
  26510. peg$silentFails++;
  26511. if (input.charCodeAt(peg$currPos) === 58) {
  26512. s4 = peg$c13;
  26513. peg$currPos++;
  26514. } else {
  26515. s4 = peg$FAILED;
  26516. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26517. }
  26518. peg$silentFails--;
  26519. if (s4 === peg$FAILED) {
  26520. s3 = void 0;
  26521. } else {
  26522. peg$currPos = s3;
  26523. s3 = peg$FAILED;
  26524. }
  26525. if (s3 !== peg$FAILED) {
  26526. peg$savedPos = s0;
  26527. s1 = peg$c111(s2);
  26528. s0 = s1;
  26529. } else {
  26530. peg$currPos = s0;
  26531. s0 = peg$FAILED;
  26532. }
  26533. } else {
  26534. peg$currPos = s0;
  26535. s0 = peg$FAILED;
  26536. }
  26537. } else {
  26538. peg$currPos = s0;
  26539. s0 = peg$FAILED;
  26540. }
  26541. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26542. return s0;
  26543. }
  26544. function peg$parseunarySend() {
  26545. var s0, s1, s2, s3;
  26546. var key = peg$currPos * 61 + 47,
  26547. cached = peg$resultsCache[key];
  26548. if (cached) {
  26549. peg$currPos = cached.nextPos;
  26550. return cached.result;
  26551. }
  26552. s0 = peg$currPos;
  26553. s1 = peg$parseoperand();
  26554. if (s1 !== peg$FAILED) {
  26555. s2 = [];
  26556. s3 = peg$parsewsUnaryMessage();
  26557. while (s3 !== peg$FAILED) {
  26558. s2.push(s3);
  26559. s3 = peg$parsewsUnaryMessage();
  26560. }
  26561. if (s2 !== peg$FAILED) {
  26562. peg$savedPos = s0;
  26563. s1 = peg$c112(s1, s2);
  26564. s0 = s1;
  26565. } else {
  26566. peg$currPos = s0;
  26567. s0 = peg$FAILED;
  26568. }
  26569. } else {
  26570. peg$currPos = s0;
  26571. s0 = peg$FAILED;
  26572. }
  26573. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26574. return s0;
  26575. }
  26576. function peg$parsewsBinaryMessage() {
  26577. var s0, s1, s2, s3, s4;
  26578. var key = peg$currPos * 61 + 48,
  26579. cached = peg$resultsCache[key];
  26580. if (cached) {
  26581. peg$currPos = cached.nextPos;
  26582. return cached.result;
  26583. }
  26584. s0 = peg$currPos;
  26585. s1 = peg$parsews();
  26586. if (s1 !== peg$FAILED) {
  26587. s2 = peg$parsebinarySelector();
  26588. if (s2 !== peg$FAILED) {
  26589. s3 = peg$parsews();
  26590. if (s3 !== peg$FAILED) {
  26591. s4 = peg$parseunarySend();
  26592. if (s4 !== peg$FAILED) {
  26593. peg$savedPos = s0;
  26594. s1 = peg$c113(s2, s4);
  26595. s0 = s1;
  26596. } else {
  26597. peg$currPos = s0;
  26598. s0 = peg$FAILED;
  26599. }
  26600. } else {
  26601. peg$currPos = s0;
  26602. s0 = peg$FAILED;
  26603. }
  26604. } else {
  26605. peg$currPos = s0;
  26606. s0 = peg$FAILED;
  26607. }
  26608. } else {
  26609. peg$currPos = s0;
  26610. s0 = peg$FAILED;
  26611. }
  26612. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26613. return s0;
  26614. }
  26615. function peg$parsebinarySend() {
  26616. var s0, s1, s2, s3;
  26617. var key = peg$currPos * 61 + 49,
  26618. cached = peg$resultsCache[key];
  26619. if (cached) {
  26620. peg$currPos = cached.nextPos;
  26621. return cached.result;
  26622. }
  26623. s0 = peg$currPos;
  26624. s1 = peg$parseunarySend();
  26625. if (s1 !== peg$FAILED) {
  26626. s2 = [];
  26627. s3 = peg$parsewsBinaryMessage();
  26628. while (s3 !== peg$FAILED) {
  26629. s2.push(s3);
  26630. s3 = peg$parsewsBinaryMessage();
  26631. }
  26632. if (s2 !== peg$FAILED) {
  26633. peg$savedPos = s0;
  26634. s1 = peg$c112(s1, s2);
  26635. s0 = s1;
  26636. } else {
  26637. peg$currPos = s0;
  26638. s0 = peg$FAILED;
  26639. }
  26640. } else {
  26641. peg$currPos = s0;
  26642. s0 = peg$FAILED;
  26643. }
  26644. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26645. return s0;
  26646. }
  26647. function peg$parsewsKeywordMessage() {
  26648. var s0, s1, s2, s3, s4, s5, s6;
  26649. var key = peg$currPos * 61 + 50,
  26650. cached = peg$resultsCache[key];
  26651. if (cached) {
  26652. peg$currPos = cached.nextPos;
  26653. return cached.result;
  26654. }
  26655. s0 = peg$currPos;
  26656. s1 = [];
  26657. s2 = peg$currPos;
  26658. s3 = peg$parsews();
  26659. if (s3 !== peg$FAILED) {
  26660. s4 = peg$parsekeyword();
  26661. if (s4 !== peg$FAILED) {
  26662. s5 = peg$parsews();
  26663. if (s5 !== peg$FAILED) {
  26664. s6 = peg$parsebinarySend();
  26665. if (s6 !== peg$FAILED) {
  26666. peg$savedPos = s2;
  26667. s3 = peg$c83(s4, s6);
  26668. s2 = s3;
  26669. } else {
  26670. peg$currPos = s2;
  26671. s2 = peg$FAILED;
  26672. }
  26673. } else {
  26674. peg$currPos = s2;
  26675. s2 = peg$FAILED;
  26676. }
  26677. } else {
  26678. peg$currPos = s2;
  26679. s2 = peg$FAILED;
  26680. }
  26681. } else {
  26682. peg$currPos = s2;
  26683. s2 = peg$FAILED;
  26684. }
  26685. if (s2 !== peg$FAILED) {
  26686. while (s2 !== peg$FAILED) {
  26687. s1.push(s2);
  26688. s2 = peg$currPos;
  26689. s3 = peg$parsews();
  26690. if (s3 !== peg$FAILED) {
  26691. s4 = peg$parsekeyword();
  26692. if (s4 !== peg$FAILED) {
  26693. s5 = peg$parsews();
  26694. if (s5 !== peg$FAILED) {
  26695. s6 = peg$parsebinarySend();
  26696. if (s6 !== peg$FAILED) {
  26697. peg$savedPos = s2;
  26698. s3 = peg$c83(s4, s6);
  26699. s2 = s3;
  26700. } else {
  26701. peg$currPos = s2;
  26702. s2 = peg$FAILED;
  26703. }
  26704. } else {
  26705. peg$currPos = s2;
  26706. s2 = peg$FAILED;
  26707. }
  26708. } else {
  26709. peg$currPos = s2;
  26710. s2 = peg$FAILED;
  26711. }
  26712. } else {
  26713. peg$currPos = s2;
  26714. s2 = peg$FAILED;
  26715. }
  26716. }
  26717. } else {
  26718. s1 = peg$FAILED;
  26719. }
  26720. if (s1 !== peg$FAILED) {
  26721. peg$savedPos = s0;
  26722. s1 = peg$c114(s1);
  26723. }
  26724. s0 = s1;
  26725. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26726. return s0;
  26727. }
  26728. function peg$parsekeywordSend() {
  26729. var s0, s1, s2;
  26730. var key = peg$currPos * 61 + 51,
  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$parsebinarySend();
  26738. if (s1 !== peg$FAILED) {
  26739. s2 = peg$parsewsKeywordMessage();
  26740. if (s2 === peg$FAILED) {
  26741. s2 = null;
  26742. }
  26743. if (s2 !== peg$FAILED) {
  26744. peg$savedPos = s0;
  26745. s1 = peg$c115(s1, s2);
  26746. s0 = s1;
  26747. } else {
  26748. peg$currPos = s0;
  26749. s0 = peg$FAILED;
  26750. }
  26751. } else {
  26752. peg$currPos = s0;
  26753. s0 = peg$FAILED;
  26754. }
  26755. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26756. return s0;
  26757. }
  26758. function peg$parsewsMessage() {
  26759. var s0;
  26760. var key = peg$currPos * 61 + 52,
  26761. cached = peg$resultsCache[key];
  26762. if (cached) {
  26763. peg$currPos = cached.nextPos;
  26764. return cached.result;
  26765. }
  26766. s0 = peg$parsewsBinaryMessage();
  26767. if (s0 === peg$FAILED) {
  26768. s0 = peg$parsewsUnaryMessage();
  26769. if (s0 === peg$FAILED) {
  26770. s0 = peg$parsewsKeywordMessage();
  26771. }
  26772. }
  26773. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26774. return s0;
  26775. }
  26776. function peg$parsecascade() {
  26777. var s0, s1, s2, s3, s4, s5, s6, s7;
  26778. var key = peg$currPos * 61 + 53,
  26779. cached = peg$resultsCache[key];
  26780. if (cached) {
  26781. peg$currPos = cached.nextPos;
  26782. return cached.result;
  26783. }
  26784. s0 = peg$currPos;
  26785. s1 = peg$parsekeywordSend();
  26786. if (s1 !== peg$FAILED) {
  26787. peg$savedPos = peg$currPos;
  26788. s2 = peg$c116(s1);
  26789. if (s2) {
  26790. s2 = void 0;
  26791. } else {
  26792. s2 = peg$FAILED;
  26793. }
  26794. if (s2 !== peg$FAILED) {
  26795. s3 = [];
  26796. s4 = peg$currPos;
  26797. s5 = peg$parsews();
  26798. if (s5 !== peg$FAILED) {
  26799. if (input.charCodeAt(peg$currPos) === 59) {
  26800. s6 = peg$c117;
  26801. peg$currPos++;
  26802. } else {
  26803. s6 = peg$FAILED;
  26804. if (peg$silentFails === 0) { peg$fail(peg$c118); }
  26805. }
  26806. if (s6 !== peg$FAILED) {
  26807. s7 = peg$parsewsMessage();
  26808. if (s7 !== peg$FAILED) {
  26809. peg$savedPos = s4;
  26810. s5 = peg$c119(s1, s7);
  26811. s4 = s5;
  26812. } else {
  26813. peg$currPos = s4;
  26814. s4 = peg$FAILED;
  26815. }
  26816. } else {
  26817. peg$currPos = s4;
  26818. s4 = peg$FAILED;
  26819. }
  26820. } else {
  26821. peg$currPos = s4;
  26822. s4 = peg$FAILED;
  26823. }
  26824. if (s4 !== peg$FAILED) {
  26825. while (s4 !== peg$FAILED) {
  26826. s3.push(s4);
  26827. s4 = peg$currPos;
  26828. s5 = peg$parsews();
  26829. if (s5 !== peg$FAILED) {
  26830. if (input.charCodeAt(peg$currPos) === 59) {
  26831. s6 = peg$c117;
  26832. peg$currPos++;
  26833. } else {
  26834. s6 = peg$FAILED;
  26835. if (peg$silentFails === 0) { peg$fail(peg$c118); }
  26836. }
  26837. if (s6 !== peg$FAILED) {
  26838. s7 = peg$parsewsMessage();
  26839. if (s7 !== peg$FAILED) {
  26840. peg$savedPos = s4;
  26841. s5 = peg$c119(s1, s7);
  26842. s4 = s5;
  26843. } else {
  26844. peg$currPos = s4;
  26845. s4 = peg$FAILED;
  26846. }
  26847. } else {
  26848. peg$currPos = s4;
  26849. s4 = peg$FAILED;
  26850. }
  26851. } else {
  26852. peg$currPos = s4;
  26853. s4 = peg$FAILED;
  26854. }
  26855. }
  26856. } else {
  26857. s3 = peg$FAILED;
  26858. }
  26859. if (s3 !== peg$FAILED) {
  26860. peg$savedPos = s0;
  26861. s1 = peg$c120(s1, s3);
  26862. s0 = s1;
  26863. } else {
  26864. peg$currPos = s0;
  26865. s0 = peg$FAILED;
  26866. }
  26867. } else {
  26868. peg$currPos = s0;
  26869. s0 = peg$FAILED;
  26870. }
  26871. } else {
  26872. peg$currPos = s0;
  26873. s0 = peg$FAILED;
  26874. }
  26875. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26876. return s0;
  26877. }
  26878. function peg$parsejsStatement() {
  26879. var s0;
  26880. var key = peg$currPos * 61 + 54,
  26881. cached = peg$resultsCache[key];
  26882. if (cached) {
  26883. peg$currPos = cached.nextPos;
  26884. return cached.result;
  26885. }
  26886. s0 = peg$parsepragmaJsStatement();
  26887. if (s0 === peg$FAILED) {
  26888. s0 = peg$parselegacyJsStatement();
  26889. }
  26890. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26891. return s0;
  26892. }
  26893. function peg$parselegacyJsStatement() {
  26894. var s0, s1, s2, s3, s4;
  26895. var key = peg$currPos * 61 + 55,
  26896. cached = peg$resultsCache[key];
  26897. if (cached) {
  26898. peg$currPos = cached.nextPos;
  26899. return cached.result;
  26900. }
  26901. s0 = peg$currPos;
  26902. if (input.charCodeAt(peg$currPos) === 60) {
  26903. s1 = peg$c121;
  26904. peg$currPos++;
  26905. } else {
  26906. s1 = peg$FAILED;
  26907. if (peg$silentFails === 0) { peg$fail(peg$c122); }
  26908. }
  26909. if (s1 !== peg$FAILED) {
  26910. s2 = [];
  26911. s3 = peg$currPos;
  26912. if (input.substr(peg$currPos, 2) === peg$c123) {
  26913. s4 = peg$c123;
  26914. peg$currPos += 2;
  26915. } else {
  26916. s4 = peg$FAILED;
  26917. if (peg$silentFails === 0) { peg$fail(peg$c124); }
  26918. }
  26919. if (s4 !== peg$FAILED) {
  26920. peg$savedPos = s3;
  26921. s4 = peg$c125();
  26922. }
  26923. s3 = s4;
  26924. if (s3 === peg$FAILED) {
  26925. if (peg$c126.test(input.charAt(peg$currPos))) {
  26926. s3 = input.charAt(peg$currPos);
  26927. peg$currPos++;
  26928. } else {
  26929. s3 = peg$FAILED;
  26930. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26931. }
  26932. }
  26933. while (s3 !== peg$FAILED) {
  26934. s2.push(s3);
  26935. s3 = peg$currPos;
  26936. if (input.substr(peg$currPos, 2) === peg$c123) {
  26937. s4 = peg$c123;
  26938. peg$currPos += 2;
  26939. } else {
  26940. s4 = peg$FAILED;
  26941. if (peg$silentFails === 0) { peg$fail(peg$c124); }
  26942. }
  26943. if (s4 !== peg$FAILED) {
  26944. peg$savedPos = s3;
  26945. s4 = peg$c125();
  26946. }
  26947. s3 = s4;
  26948. if (s3 === peg$FAILED) {
  26949. if (peg$c126.test(input.charAt(peg$currPos))) {
  26950. s3 = input.charAt(peg$currPos);
  26951. peg$currPos++;
  26952. } else {
  26953. s3 = peg$FAILED;
  26954. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26955. }
  26956. }
  26957. }
  26958. if (s2 !== peg$FAILED) {
  26959. if (input.charCodeAt(peg$currPos) === 62) {
  26960. s3 = peg$c128;
  26961. peg$currPos++;
  26962. } else {
  26963. s3 = peg$FAILED;
  26964. if (peg$silentFails === 0) { peg$fail(peg$c129); }
  26965. }
  26966. if (s3 !== peg$FAILED) {
  26967. peg$savedPos = peg$currPos;
  26968. s4 = peg$c130(s2);
  26969. if (s4) {
  26970. s4 = void 0;
  26971. } else {
  26972. s4 = peg$FAILED;
  26973. }
  26974. if (s4 !== peg$FAILED) {
  26975. peg$savedPos = s0;
  26976. s1 = peg$c131(s2);
  26977. s0 = s1;
  26978. } else {
  26979. peg$currPos = s0;
  26980. s0 = peg$FAILED;
  26981. }
  26982. } else {
  26983. peg$currPos = s0;
  26984. s0 = peg$FAILED;
  26985. }
  26986. } else {
  26987. peg$currPos = s0;
  26988. s0 = peg$FAILED;
  26989. }
  26990. } else {
  26991. peg$currPos = s0;
  26992. s0 = peg$FAILED;
  26993. }
  26994. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26995. return s0;
  26996. }
  26997. function peg$parsepragmaJsStatement() {
  26998. var s0, s1, s2, s3, s4, s5, s6, s7;
  26999. var key = peg$currPos * 61 + 56,
  27000. cached = peg$resultsCache[key];
  27001. if (cached) {
  27002. peg$currPos = cached.nextPos;
  27003. return cached.result;
  27004. }
  27005. s0 = peg$currPos;
  27006. if (input.charCodeAt(peg$currPos) === 60) {
  27007. s1 = peg$c121;
  27008. peg$currPos++;
  27009. } else {
  27010. s1 = peg$FAILED;
  27011. if (peg$silentFails === 0) { peg$fail(peg$c122); }
  27012. }
  27013. if (s1 !== peg$FAILED) {
  27014. s2 = peg$parsews();
  27015. if (s2 !== peg$FAILED) {
  27016. if (input.substr(peg$currPos, 9) === peg$c132) {
  27017. s3 = peg$c132;
  27018. peg$currPos += 9;
  27019. } else {
  27020. s3 = peg$FAILED;
  27021. if (peg$silentFails === 0) { peg$fail(peg$c133); }
  27022. }
  27023. if (s3 !== peg$FAILED) {
  27024. s4 = peg$parsews();
  27025. if (s4 !== peg$FAILED) {
  27026. s5 = peg$parsestring();
  27027. if (s5 !== peg$FAILED) {
  27028. s6 = peg$parsews();
  27029. if (s6 !== peg$FAILED) {
  27030. if (input.charCodeAt(peg$currPos) === 62) {
  27031. s7 = peg$c128;
  27032. peg$currPos++;
  27033. } else {
  27034. s7 = peg$FAILED;
  27035. if (peg$silentFails === 0) { peg$fail(peg$c129); }
  27036. }
  27037. if (s7 !== peg$FAILED) {
  27038. peg$savedPos = s0;
  27039. s1 = peg$c134(s5);
  27040. s0 = s1;
  27041. } else {
  27042. peg$currPos = s0;
  27043. s0 = peg$FAILED;
  27044. }
  27045. } else {
  27046. peg$currPos = s0;
  27047. s0 = peg$FAILED;
  27048. }
  27049. } else {
  27050. peg$currPos = s0;
  27051. s0 = peg$FAILED;
  27052. }
  27053. } else {
  27054. peg$currPos = s0;
  27055. s0 = peg$FAILED;
  27056. }
  27057. } else {
  27058. peg$currPos = s0;
  27059. s0 = peg$FAILED;
  27060. }
  27061. } else {
  27062. peg$currPos = s0;
  27063. s0 = peg$FAILED;
  27064. }
  27065. } else {
  27066. peg$currPos = s0;
  27067. s0 = peg$FAILED;
  27068. }
  27069. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27070. return s0;
  27071. }
  27072. function peg$parsemethod() {
  27073. var s0, s1, s2;
  27074. var key = peg$currPos * 61 + 57,
  27075. cached = peg$resultsCache[key];
  27076. if (cached) {
  27077. peg$currPos = cached.nextPos;
  27078. return cached.result;
  27079. }
  27080. s0 = peg$currPos;
  27081. s1 = peg$parsewsKeywordPattern();
  27082. if (s1 === peg$FAILED) {
  27083. s1 = peg$parsewsBinaryPattern();
  27084. if (s1 === peg$FAILED) {
  27085. s1 = peg$parsewsUnaryPattern();
  27086. }
  27087. }
  27088. if (s1 !== peg$FAILED) {
  27089. s2 = peg$parsewsSequenceWs();
  27090. if (s2 === peg$FAILED) {
  27091. s2 = null;
  27092. }
  27093. if (s2 !== peg$FAILED) {
  27094. peg$savedPos = s0;
  27095. s1 = peg$c135(s1, s2);
  27096. s0 = s1;
  27097. } else {
  27098. peg$currPos = s0;
  27099. s0 = peg$FAILED;
  27100. }
  27101. } else {
  27102. peg$currPos = s0;
  27103. s0 = peg$FAILED;
  27104. }
  27105. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27106. return s0;
  27107. }
  27108. function peg$parseassociationSend() {
  27109. var s0, s1, s2;
  27110. var key = peg$currPos * 61 + 58,
  27111. cached = peg$resultsCache[key];
  27112. if (cached) {
  27113. peg$currPos = cached.nextPos;
  27114. return cached.result;
  27115. }
  27116. s0 = peg$currPos;
  27117. s1 = peg$parsebinarySend();
  27118. if (s1 !== peg$FAILED) {
  27119. peg$savedPos = peg$currPos;
  27120. s2 = peg$c136(s1);
  27121. if (s2) {
  27122. s2 = void 0;
  27123. } else {
  27124. s2 = peg$FAILED;
  27125. }
  27126. if (s2 !== peg$FAILED) {
  27127. peg$savedPos = s0;
  27128. s1 = peg$c137(s1);
  27129. s0 = s1;
  27130. } else {
  27131. peg$currPos = s0;
  27132. s0 = peg$FAILED;
  27133. }
  27134. } else {
  27135. peg$currPos = s0;
  27136. s0 = peg$FAILED;
  27137. }
  27138. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27139. return s0;
  27140. }
  27141. function peg$parsewsAssociationsRest() {
  27142. var s0, s1, s2, s3, s4;
  27143. var key = peg$currPos * 61 + 59,
  27144. cached = peg$resultsCache[key];
  27145. if (cached) {
  27146. peg$currPos = cached.nextPos;
  27147. return cached.result;
  27148. }
  27149. s0 = peg$currPos;
  27150. s1 = peg$parsews();
  27151. if (s1 !== peg$FAILED) {
  27152. if (input.charCodeAt(peg$currPos) === 46) {
  27153. s2 = peg$c6;
  27154. peg$currPos++;
  27155. } else {
  27156. s2 = peg$FAILED;
  27157. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27158. }
  27159. if (s2 !== peg$FAILED) {
  27160. s3 = peg$parsemaybeDotsWs();
  27161. if (s3 !== peg$FAILED) {
  27162. s4 = peg$parseassociationSend();
  27163. if (s4 !== peg$FAILED) {
  27164. peg$savedPos = s0;
  27165. s1 = peg$c87(s4);
  27166. s0 = s1;
  27167. } else {
  27168. peg$currPos = s0;
  27169. s0 = peg$FAILED;
  27170. }
  27171. } else {
  27172. peg$currPos = s0;
  27173. s0 = peg$FAILED;
  27174. }
  27175. } else {
  27176. peg$currPos = s0;
  27177. s0 = peg$FAILED;
  27178. }
  27179. } else {
  27180. peg$currPos = s0;
  27181. s0 = peg$FAILED;
  27182. }
  27183. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27184. return s0;
  27185. }
  27186. function peg$parseassociations() {
  27187. var s0, s1, s2, s3;
  27188. var key = peg$currPos * 61 + 60,
  27189. cached = peg$resultsCache[key];
  27190. if (cached) {
  27191. peg$currPos = cached.nextPos;
  27192. return cached.result;
  27193. }
  27194. s0 = peg$currPos;
  27195. s1 = peg$parseassociationSend();
  27196. if (s1 !== peg$FAILED) {
  27197. s2 = [];
  27198. s3 = peg$parsewsAssociationsRest();
  27199. while (s3 !== peg$FAILED) {
  27200. s2.push(s3);
  27201. s3 = peg$parsewsAssociationsRest();
  27202. }
  27203. if (s2 !== peg$FAILED) {
  27204. peg$savedPos = s0;
  27205. s1 = peg$c138(s1, s2);
  27206. s0 = s1;
  27207. } else {
  27208. peg$currPos = s0;
  27209. s0 = peg$FAILED;
  27210. }
  27211. } else {
  27212. peg$currPos = s0;
  27213. s0 = peg$FAILED;
  27214. }
  27215. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27216. return s0;
  27217. }
  27218. peg$result = peg$startRuleFunction();
  27219. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  27220. return peg$result;
  27221. } else {
  27222. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  27223. peg$fail({ type: "end", description: "end of input" });
  27224. }
  27225. throw peg$buildException(
  27226. null,
  27227. peg$maxFailExpected,
  27228. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  27229. peg$maxFailPos < input.length
  27230. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  27231. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  27232. );
  27233. }
  27234. }
  27235. return {
  27236. SyntaxError: peg$SyntaxError,
  27237. parse: peg$parse
  27238. };
  27239. })();
  27240. });
  27241. 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";
  27242. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  27243. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  27244. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  27245. $core.addPackage('Platform-ImportExport');
  27246. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  27247. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  27248. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  27249. $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.";
  27250. $core.addMethod(
  27251. $core.method({
  27252. selector: "classNameFor:",
  27253. protocol: 'convenience',
  27254. fn: function (aClass){
  27255. var self=this;
  27256. return $core.withContext(function($ctx1) {
  27257. var $1,$2,$receiver;
  27258. $1=$recv(aClass)._isMetaclass();
  27259. if($core.assert($1)){
  27260. $2=$recv($recv(aClass)._instanceClass())._name();
  27261. $ctx1.sendIdx["name"]=1;
  27262. return $recv($2).__comma(" class");
  27263. } else {
  27264. if(($receiver = aClass) == null || $receiver.isNil){
  27265. return "nil";
  27266. } else {
  27267. return $recv(aClass)._name();
  27268. }
  27269. }
  27270. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  27271. },
  27272. args: ["aClass"],
  27273. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'nil' ]\x0a\x09\x09\x09\x09ifNotNil: [ aClass name ] ]",
  27274. referencedClasses: [],
  27275. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "ifNil:ifNotNil:"]
  27276. }),
  27277. $globals.AbstractExporter);
  27278. $core.addMethod(
  27279. $core.method({
  27280. selector: "exportPackage:on:",
  27281. protocol: 'output',
  27282. fn: function (aPackage,aStream){
  27283. var self=this;
  27284. return $core.withContext(function($ctx1) {
  27285. self._subclassResponsibility();
  27286. return self;
  27287. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  27288. },
  27289. args: ["aPackage", "aStream"],
  27290. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27291. referencedClasses: [],
  27292. messageSends: ["subclassResponsibility"]
  27293. }),
  27294. $globals.AbstractExporter);
  27295. $core.addMethod(
  27296. $core.method({
  27297. selector: "extensionMethodsOfPackage:",
  27298. protocol: 'accessing',
  27299. fn: function (aPackage){
  27300. var self=this;
  27301. var result;
  27302. return $core.withContext(function($ctx1) {
  27303. result=$recv($globals.OrderedCollection)._new();
  27304. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  27305. return $core.withContext(function($ctx2) {
  27306. return $recv(result)._addAll_($recv(each)._methods());
  27307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27308. }));
  27309. return result;
  27310. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  27311. },
  27312. args: ["aPackage"],
  27313. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each methods ].\x0a\x09\x09\x0a\x09^ result",
  27314. referencedClasses: ["OrderedCollection"],
  27315. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  27316. }),
  27317. $globals.AbstractExporter);
  27318. $core.addMethod(
  27319. $core.method({
  27320. selector: "extensionProtocolsOfPackage:",
  27321. protocol: 'accessing',
  27322. fn: function (aPackage){
  27323. var self=this;
  27324. var extensionName,result;
  27325. return $core.withContext(function($ctx1) {
  27326. var $1,$2,$3;
  27327. $1=$recv(aPackage)._name();
  27328. $ctx1.sendIdx["name"]=1;
  27329. extensionName="*".__comma($1);
  27330. result=$recv($globals.OrderedCollection)._new();
  27331. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  27332. return $core.withContext(function($ctx2) {
  27333. $2=$recv(a)._name();
  27334. $ctx2.sendIdx["name"]=2;
  27335. return $recv($2).__lt($recv(b)._name());
  27336. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27337. })))._do_((function(each){
  27338. return $core.withContext(function($ctx2) {
  27339. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  27340. return $core.withContext(function($ctx3) {
  27341. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  27342. if($core.assert($3)){
  27343. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  27344. }
  27345. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  27346. }));
  27347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27348. }));
  27349. $ctx1.sendIdx["do:"]=1;
  27350. return result;
  27351. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  27352. },
  27353. args: ["aPackage"],
  27354. 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 class} 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",
  27355. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  27356. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  27357. }),
  27358. $globals.AbstractExporter);
  27359. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27360. $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.";
  27361. $core.addMethod(
  27362. $core.method({
  27363. selector: "chunkEscape:",
  27364. protocol: 'convenience',
  27365. fn: function (aString){
  27366. var self=this;
  27367. return $core.withContext(function($ctx1) {
  27368. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  27369. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  27370. },
  27371. args: ["aString"],
  27372. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  27373. referencedClasses: [],
  27374. messageSends: ["trimBoth", "replace:with:"]
  27375. }),
  27376. $globals.ChunkExporter);
  27377. $core.addMethod(
  27378. $core.method({
  27379. selector: "exportCategoryEpilogueOf:on:",
  27380. protocol: 'output',
  27381. fn: function (aCategory,aStream){
  27382. var self=this;
  27383. return $core.withContext(function($ctx1) {
  27384. $recv(aStream)._nextPutAll_(" !");
  27385. $recv(aStream)._lf();
  27386. $ctx1.sendIdx["lf"]=1;
  27387. $recv(aStream)._lf();
  27388. return self;
  27389. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27390. },
  27391. args: ["aCategory", "aStream"],
  27392. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27393. referencedClasses: [],
  27394. messageSends: ["nextPutAll:", "lf"]
  27395. }),
  27396. $globals.ChunkExporter);
  27397. $core.addMethod(
  27398. $core.method({
  27399. selector: "exportCategoryPrologueOf:on:",
  27400. protocol: 'output',
  27401. fn: function (aCategory,aStream){
  27402. var self=this;
  27403. return $core.withContext(function($ctx1) {
  27404. var $1,$2;
  27405. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  27406. $ctx1.sendIdx[","]=1;
  27407. $recv(aStream)._nextPutAll_($1);
  27408. $ctx1.sendIdx["nextPutAll:"]=1;
  27409. $2=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  27410. $ctx1.sendIdx[","]=2;
  27411. $recv(aStream)._nextPutAll_($2);
  27412. return self;
  27413. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27414. },
  27415. args: ["aCategory", "aStream"],
  27416. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  27417. referencedClasses: [],
  27418. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27419. }),
  27420. $globals.ChunkExporter);
  27421. $core.addMethod(
  27422. $core.method({
  27423. selector: "exportDefinitionOf:on:",
  27424. protocol: 'output',
  27425. fn: function (aClass,aStream){
  27426. var self=this;
  27427. return $core.withContext(function($ctx1) {
  27428. var $1,$3,$2,$4,$6,$5,$7,$8,$10,$9,$11;
  27429. $1=self._classNameFor_($recv(aClass)._superclass());
  27430. $ctx1.sendIdx["classNameFor:"]=1;
  27431. $recv(aStream)._nextPutAll_($1);
  27432. $ctx1.sendIdx["nextPutAll:"]=1;
  27433. $3=self._classNameFor_(aClass);
  27434. $ctx1.sendIdx["classNameFor:"]=2;
  27435. $2=" subclass: #".__comma($3);
  27436. $ctx1.sendIdx[","]=1;
  27437. $recv(aStream)._nextPutAll_($2);
  27438. $ctx1.sendIdx["nextPutAll:"]=2;
  27439. $recv(aStream)._lf();
  27440. $ctx1.sendIdx["lf"]=1;
  27441. $recv(aStream)._tab();
  27442. $ctx1.sendIdx["tab"]=1;
  27443. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  27444. $ctx1.sendIdx["nextPutAll:"]=3;
  27445. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27446. return $core.withContext(function($ctx2) {
  27447. return $recv(aStream)._nextPutAll_(each);
  27448. $ctx2.sendIdx["nextPutAll:"]=4;
  27449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27450. }),(function(){
  27451. return $core.withContext(function($ctx2) {
  27452. return $recv(aStream)._nextPutAll_(" ");
  27453. $ctx2.sendIdx["nextPutAll:"]=5;
  27454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27455. }));
  27456. $recv(aStream)._nextPutAll_("'");
  27457. $ctx1.sendIdx["nextPutAll:"]=6;
  27458. $recv(aStream)._lf();
  27459. $ctx1.sendIdx["lf"]=2;
  27460. $recv(aStream)._tab();
  27461. $6="package: '".__comma($recv(aClass)._category());
  27462. $ctx1.sendIdx[","]=3;
  27463. $5=$recv($6).__comma("'!");
  27464. $ctx1.sendIdx[","]=2;
  27465. $recv(aStream)._nextPutAll_($5);
  27466. $ctx1.sendIdx["nextPutAll:"]=7;
  27467. $7=$recv(aStream)._lf();
  27468. $ctx1.sendIdx["lf"]=3;
  27469. $8=$recv(aClass)._comment();
  27470. $ctx1.sendIdx["comment"]=1;
  27471. $recv($8)._ifNotEmpty_((function(){
  27472. return $core.withContext(function($ctx2) {
  27473. $10="!".__comma(self._classNameFor_(aClass));
  27474. $ctx2.sendIdx[","]=5;
  27475. $9=$recv($10).__comma(" commentStamp!");
  27476. $ctx2.sendIdx[","]=4;
  27477. $recv(aStream)._nextPutAll_($9);
  27478. $ctx2.sendIdx["nextPutAll:"]=8;
  27479. $recv(aStream)._lf();
  27480. $ctx2.sendIdx["lf"]=4;
  27481. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27482. $11=$recv(aStream)._lf();
  27483. $ctx2.sendIdx["lf"]=5;
  27484. return $11;
  27485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27486. }));
  27487. $recv(aStream)._lf();
  27488. return self;
  27489. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27490. },
  27491. args: ["aClass", "aStream"],
  27492. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a\x09\x09tab; nextPutAll: 'instanceVariableNames: '''.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: ''''; lf;\x0a\x09\x09tab; nextPutAll: 'package: ''', aClass category, '''!'; lf.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf",
  27493. referencedClasses: [],
  27494. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  27495. }),
  27496. $globals.ChunkExporter);
  27497. $core.addMethod(
  27498. $core.method({
  27499. selector: "exportMetaDefinitionOf:on:",
  27500. protocol: 'output',
  27501. fn: function (aClass,aStream){
  27502. var self=this;
  27503. return $core.withContext(function($ctx1) {
  27504. var $2,$1,$3;
  27505. $2=$recv(aClass)._class();
  27506. $ctx1.sendIdx["class"]=1;
  27507. $1=$recv($2)._instanceVariableNames();
  27508. $recv($1)._ifNotEmpty_((function(classIvars){
  27509. return $core.withContext(function($ctx2) {
  27510. $recv(aStream)._nextPutAll_(self._classNameFor_($recv(aClass)._class()));
  27511. $ctx2.sendIdx["nextPutAll:"]=1;
  27512. $3=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27513. $ctx2.sendIdx["nextPutAll:"]=2;
  27514. $3;
  27515. $recv(classIvars)._do_separatedBy_((function(each){
  27516. return $core.withContext(function($ctx3) {
  27517. return $recv(aStream)._nextPutAll_(each);
  27518. $ctx3.sendIdx["nextPutAll:"]=3;
  27519. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  27520. }),(function(){
  27521. return $core.withContext(function($ctx3) {
  27522. return $recv(aStream)._nextPutAll_(" ");
  27523. $ctx3.sendIdx["nextPutAll:"]=4;
  27524. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  27525. }));
  27526. $recv(aStream)._nextPutAll_("'!");
  27527. $recv(aStream)._lf();
  27528. $ctx2.sendIdx["lf"]=1;
  27529. return $recv(aStream)._lf();
  27530. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  27531. }));
  27532. return self;
  27533. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27534. },
  27535. args: ["aClass", "aStream"],
  27536. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames ifNotEmpty: [ :classIvars |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09classIvars\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]",
  27537. referencedClasses: [],
  27538. messageSends: ["ifNotEmpty:", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27539. }),
  27540. $globals.ChunkExporter);
  27541. $core.addMethod(
  27542. $core.method({
  27543. selector: "exportMethod:on:",
  27544. protocol: 'output',
  27545. fn: function (aMethod,aStream){
  27546. var self=this;
  27547. return $core.withContext(function($ctx1) {
  27548. $recv(aStream)._lf();
  27549. $ctx1.sendIdx["lf"]=1;
  27550. $recv(aStream)._lf();
  27551. $ctx1.sendIdx["lf"]=2;
  27552. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27553. $ctx1.sendIdx["nextPutAll:"]=1;
  27554. $recv(aStream)._lf();
  27555. $recv(aStream)._nextPutAll_("!");
  27556. return self;
  27557. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27558. },
  27559. args: ["aMethod", "aStream"],
  27560. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27561. referencedClasses: [],
  27562. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27563. }),
  27564. $globals.ChunkExporter);
  27565. $core.addMethod(
  27566. $core.method({
  27567. selector: "exportPackage:on:",
  27568. protocol: 'output',
  27569. fn: function (aPackage,aStream){
  27570. var self=this;
  27571. return $core.withContext(function($ctx1) {
  27572. var $1;
  27573. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27574. self._exportPackageImportsOf_on_(aPackage,aStream);
  27575. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27576. return $core.withContext(function($ctx2) {
  27577. self._exportDefinitionOf_on_(each,aStream);
  27578. $1=self._ownMethodProtocolsOfClass_(each);
  27579. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27580. self._exportProtocols_on_($1,aStream);
  27581. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27582. self._exportMetaDefinitionOf_on_(each,aStream);
  27583. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27584. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27585. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27586. }));
  27587. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27588. return self;
  27589. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27590. },
  27591. args: ["aPackage", "aStream"],
  27592. 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 exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  27593. referencedClasses: [],
  27594. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27595. }),
  27596. $globals.ChunkExporter);
  27597. $core.addMethod(
  27598. $core.method({
  27599. selector: "exportPackageDefinitionOf:on:",
  27600. protocol: 'output',
  27601. fn: function (aPackage,aStream){
  27602. var self=this;
  27603. return $core.withContext(function($ctx1) {
  27604. var $1;
  27605. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27606. $ctx1.sendIdx[","]=1;
  27607. $recv(aStream)._nextPutAll_($1);
  27608. $recv(aStream)._lf();
  27609. return self;
  27610. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27611. },
  27612. args: ["aPackage", "aStream"],
  27613. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27614. referencedClasses: [],
  27615. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27616. }),
  27617. $globals.ChunkExporter);
  27618. $core.addMethod(
  27619. $core.method({
  27620. selector: "exportPackageImportsOf:on:",
  27621. protocol: 'output',
  27622. fn: function (aPackage,aStream){
  27623. var self=this;
  27624. return $core.withContext(function($ctx1) {
  27625. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27626. return $core.withContext(function($ctx2) {
  27627. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27628. $ctx2.sendIdx["nextPutAll:"]=1;
  27629. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27630. $ctx2.sendIdx["nextPutAll:"]=2;
  27631. $recv(aStream)._nextPutAll_("') imports: ");
  27632. $ctx2.sendIdx["nextPutAll:"]=3;
  27633. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27634. $ctx2.sendIdx["nextPutAll:"]=4;
  27635. $recv(aStream)._nextPutAll_("!");
  27636. return $recv(aStream)._lf();
  27637. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27638. }));
  27639. return self;
  27640. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27641. },
  27642. args: ["aPackage", "aStream"],
  27643. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '(Smalltalk packageAt: ''';\x0a\x09\x09\x09nextPutAll: aPackage name;\x0a\x09\x09\x09nextPutAll: ''') imports: ';\x0a\x09\x09\x09nextPutAll: (self chunkEscape: aPackage importsDefinition);\x0a\x09\x09\x09nextPutAll: '!';\x0a\x09\x09\x09lf ]",
  27644. referencedClasses: [],
  27645. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27646. }),
  27647. $globals.ChunkExporter);
  27648. $core.addMethod(
  27649. $core.method({
  27650. selector: "exportProtocol:on:",
  27651. protocol: 'output',
  27652. fn: function (aProtocol,aStream){
  27653. var self=this;
  27654. return $core.withContext(function($ctx1) {
  27655. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27656. $recv($recv(aProtocol)._methods())._do_((function(method){
  27657. return $core.withContext(function($ctx2) {
  27658. return self._exportMethod_on_(method,aStream);
  27659. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27660. }));
  27661. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27662. return self;
  27663. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27664. },
  27665. args: ["aProtocol", "aStream"],
  27666. source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream",
  27667. referencedClasses: [],
  27668. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27669. }),
  27670. $globals.ChunkExporter);
  27671. $core.addMethod(
  27672. $core.method({
  27673. selector: "exportProtocolEpilogueOf:on:",
  27674. protocol: 'output',
  27675. fn: function (aProtocol,aStream){
  27676. var self=this;
  27677. return $core.withContext(function($ctx1) {
  27678. $recv(aStream)._nextPutAll_(" !");
  27679. $recv(aStream)._lf();
  27680. $ctx1.sendIdx["lf"]=1;
  27681. $recv(aStream)._lf();
  27682. return self;
  27683. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27684. },
  27685. args: ["aProtocol", "aStream"],
  27686. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27687. referencedClasses: [],
  27688. messageSends: ["nextPutAll:", "lf"]
  27689. }),
  27690. $globals.ChunkExporter);
  27691. $core.addMethod(
  27692. $core.method({
  27693. selector: "exportProtocolPrologueOf:on:",
  27694. protocol: 'output',
  27695. fn: function (aProtocol,aStream){
  27696. var self=this;
  27697. return $core.withContext(function($ctx1) {
  27698. var $1,$2;
  27699. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27700. $ctx1.sendIdx[","]=1;
  27701. $recv(aStream)._nextPutAll_($1);
  27702. $ctx1.sendIdx["nextPutAll:"]=1;
  27703. $2=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27704. $ctx1.sendIdx[","]=2;
  27705. $recv(aStream)._nextPutAll_($2);
  27706. return self;
  27707. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27708. },
  27709. args: ["aProtocol", "aStream"],
  27710. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27711. referencedClasses: [],
  27712. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27713. }),
  27714. $globals.ChunkExporter);
  27715. $core.addMethod(
  27716. $core.method({
  27717. selector: "exportProtocols:on:",
  27718. protocol: 'output',
  27719. fn: function (aCollection,aStream){
  27720. var self=this;
  27721. return $core.withContext(function($ctx1) {
  27722. $recv(aCollection)._do_((function(each){
  27723. return $core.withContext(function($ctx2) {
  27724. return self._exportProtocol_on_(each,aStream);
  27725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27726. }));
  27727. return self;
  27728. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27729. },
  27730. args: ["aCollection", "aStream"],
  27731. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27732. referencedClasses: [],
  27733. messageSends: ["do:", "exportProtocol:on:"]
  27734. }),
  27735. $globals.ChunkExporter);
  27736. $core.addMethod(
  27737. $core.method({
  27738. selector: "extensionCategoriesOfPackage:",
  27739. protocol: 'accessing',
  27740. fn: function (aPackage){
  27741. var self=this;
  27742. var name,map,result;
  27743. return $core.withContext(function($ctx1) {
  27744. var $1;
  27745. name=$recv(aPackage)._name();
  27746. result=$recv($globals.OrderedCollection)._new();
  27747. $ctx1.sendIdx["new"]=1;
  27748. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  27749. return $core.withContext(function($ctx2) {
  27750. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27751. return $core.withContext(function($ctx3) {
  27752. map=$recv($globals.Dictionary)._new();
  27753. map;
  27754. $recv(aClass)._protocolsDo_((function(category,methods){
  27755. return $core.withContext(function($ctx4) {
  27756. $1=$recv(category).__eq("*".__comma(name));
  27757. if($core.assert($1)){
  27758. return $recv(map)._at_put_(category,methods);
  27759. }
  27760. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27761. }));
  27762. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27763. return $core.withContext(function($ctx4) {
  27764. return $recv(a).__lt_eq(b);
  27765. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27766. })))._collect_((function(category){
  27767. return $core.withContext(function($ctx4) {
  27768. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27769. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27770. })));
  27771. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27772. }));
  27773. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27774. }));
  27775. $ctx1.sendIdx["do:"]=1;
  27776. return result;
  27777. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27778. },
  27779. args: ["aPackage"],
  27780. 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 class} 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",
  27781. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27782. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27783. }),
  27784. $globals.ChunkExporter);
  27785. $core.addMethod(
  27786. $core.method({
  27787. selector: "ownCategoriesOfClass:",
  27788. protocol: 'accessing',
  27789. fn: function (aClass){
  27790. var self=this;
  27791. var map;
  27792. return $core.withContext(function($ctx1) {
  27793. var $1;
  27794. map=$recv($globals.Dictionary)._new();
  27795. $recv(aClass)._protocolsDo_((function(each,methods){
  27796. return $core.withContext(function($ctx2) {
  27797. $1=$recv(each)._match_("^\x5c*");
  27798. if(!$core.assert($1)){
  27799. return $recv(map)._at_put_(each,methods);
  27800. }
  27801. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27802. }));
  27803. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27804. return $core.withContext(function($ctx2) {
  27805. return $recv(a).__lt_eq(b);
  27806. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27807. })))._collect_((function(each){
  27808. return $core.withContext(function($ctx2) {
  27809. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27810. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27811. }));
  27812. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27813. },
  27814. args: ["aClass"],
  27815. 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) ]",
  27816. referencedClasses: ["Dictionary", "MethodCategory"],
  27817. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27818. }),
  27819. $globals.ChunkExporter);
  27820. $core.addMethod(
  27821. $core.method({
  27822. selector: "ownCategoriesOfMetaClass:",
  27823. protocol: 'accessing',
  27824. fn: function (aClass){
  27825. var self=this;
  27826. return $core.withContext(function($ctx1) {
  27827. return self._ownCategoriesOfClass_($recv(aClass)._class());
  27828. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27829. },
  27830. args: ["aClass"],
  27831. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27832. referencedClasses: [],
  27833. messageSends: ["ownCategoriesOfClass:", "class"]
  27834. }),
  27835. $globals.ChunkExporter);
  27836. $core.addMethod(
  27837. $core.method({
  27838. selector: "ownMethodProtocolsOfClass:",
  27839. protocol: 'accessing',
  27840. fn: function (aClass){
  27841. var self=this;
  27842. return $core.withContext(function($ctx1) {
  27843. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27844. return $core.withContext(function($ctx2) {
  27845. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  27846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27847. }));
  27848. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27849. },
  27850. args: ["aClass"],
  27851. 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 ]",
  27852. referencedClasses: ["ExportMethodProtocol"],
  27853. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27854. }),
  27855. $globals.ChunkExporter);
  27856. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27857. $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.).";
  27858. $core.addMethod(
  27859. $core.method({
  27860. selector: "exportDefinitionOf:on:",
  27861. protocol: 'output',
  27862. fn: function (aClass,aStream){
  27863. var self=this;
  27864. return $core.withContext(function($ctx1) {
  27865. var $2,$1,$3,$4,$6,$5,$7,$8;
  27866. $recv(aStream)._lf();
  27867. $ctx1.sendIdx["lf"]=1;
  27868. $recv(aStream)._nextPutAll_("$core.addClass(");
  27869. $ctx1.sendIdx["nextPutAll:"]=1;
  27870. $2="'".__comma(self._classNameFor_(aClass));
  27871. $ctx1.sendIdx[","]=2;
  27872. $1=$recv($2).__comma("', ");
  27873. $ctx1.sendIdx[","]=1;
  27874. $recv(aStream)._nextPutAll_($1);
  27875. $ctx1.sendIdx["nextPutAll:"]=2;
  27876. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27877. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27878. $recv(aStream)._nextPutAll_($3);
  27879. $ctx1.sendIdx["nextPutAll:"]=3;
  27880. $4=$recv(aStream)._nextPutAll_(", [");
  27881. $ctx1.sendIdx["nextPutAll:"]=4;
  27882. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27883. return $core.withContext(function($ctx2) {
  27884. $6="'".__comma(each);
  27885. $ctx2.sendIdx[","]=4;
  27886. $5=$recv($6).__comma("'");
  27887. $ctx2.sendIdx[","]=3;
  27888. return $recv(aStream)._nextPutAll_($5);
  27889. $ctx2.sendIdx["nextPutAll:"]=5;
  27890. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27891. }),(function(){
  27892. return $core.withContext(function($ctx2) {
  27893. return $recv(aStream)._nextPutAll_(", ");
  27894. $ctx2.sendIdx["nextPutAll:"]=6;
  27895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27896. }));
  27897. $recv(aStream)._nextPutAll_("], '");
  27898. $ctx1.sendIdx["nextPutAll:"]=7;
  27899. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27900. $ctx1.sendIdx["nextPutAll:"]=8;
  27901. $7=$recv(aStream)._nextPutAll_(");");
  27902. $ctx1.sendIdx["nextPutAll:"]=9;
  27903. $8=$recv(aClass)._comment();
  27904. $ctx1.sendIdx["comment"]=1;
  27905. $recv($8)._ifNotEmpty_((function(){
  27906. return $core.withContext(function($ctx2) {
  27907. $recv(aStream)._lf();
  27908. $ctx2.sendIdx["lf"]=2;
  27909. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27910. $ctx2.sendIdx["nextPutAll:"]=10;
  27911. $recv(aStream)._lf();
  27912. $ctx2.sendIdx["lf"]=3;
  27913. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27914. $ctx2.sendIdx["nextPutAll:"]=11;
  27915. $recv(aStream)._nextPutAll_(".comment=");
  27916. $ctx2.sendIdx["nextPutAll:"]=12;
  27917. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27918. $ctx2.sendIdx["nextPutAll:"]=13;
  27919. $recv(aStream)._nextPutAll_(";");
  27920. $ctx2.sendIdx["nextPutAll:"]=14;
  27921. $recv(aStream)._lf();
  27922. $ctx2.sendIdx["lf"]=4;
  27923. return $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27925. }));
  27926. $recv(aStream)._lf();
  27927. return self;
  27928. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27929. },
  27930. args: ["aClass", "aStream"],
  27931. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '$core.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ', ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: (self jsClassNameFor: aClass);\x0a\x09\x09\x09nextPutAll: '.comment=';\x0a\x09\x09\x09nextPutAll: aClass comment crlfSanitized asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  27932. referencedClasses: [],
  27933. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "asJavascript", "crlfSanitized"]
  27934. }),
  27935. $globals.Exporter);
  27936. $core.addMethod(
  27937. $core.method({
  27938. selector: "exportMetaDefinitionOf:on:",
  27939. protocol: 'output',
  27940. fn: function (aClass,aStream){
  27941. var self=this;
  27942. return $core.withContext(function($ctx1) {
  27943. var $2,$1,$3,$5,$4;
  27944. $recv(aStream)._lf();
  27945. $ctx1.sendIdx["lf"]=1;
  27946. $2=$recv(aClass)._class();
  27947. $ctx1.sendIdx["class"]=1;
  27948. $1=$recv($2)._instanceVariableNames();
  27949. $recv($1)._ifNotEmpty_((function(classIvars){
  27950. return $core.withContext(function($ctx2) {
  27951. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aClass)._class()));
  27952. $ctx2.sendIdx["nextPutAll:"]=1;
  27953. $3=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27954. $ctx2.sendIdx["nextPutAll:"]=2;
  27955. $3;
  27956. $recv(classIvars)._do_separatedBy_((function(each){
  27957. return $core.withContext(function($ctx3) {
  27958. $5="'".__comma(each);
  27959. $ctx3.sendIdx[","]=2;
  27960. $4=$recv($5).__comma("'");
  27961. $ctx3.sendIdx[","]=1;
  27962. return $recv(aStream)._nextPutAll_($4);
  27963. $ctx3.sendIdx["nextPutAll:"]=3;
  27964. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  27965. }),(function(){
  27966. return $core.withContext(function($ctx3) {
  27967. return $recv(aStream)._nextPutAll_(",");
  27968. $ctx3.sendIdx["nextPutAll:"]=4;
  27969. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  27970. }));
  27971. return $recv(aStream)._nextPutAll_("];".__comma($recv($globals.String)._lf()));
  27972. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  27973. }));
  27974. return self;
  27975. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27976. },
  27977. args: ["aClass", "aStream"],
  27978. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames ifNotEmpty: [ :classIvars |\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09classIvars\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]",
  27979. referencedClasses: ["String"],
  27980. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  27981. }),
  27982. $globals.Exporter);
  27983. $core.addMethod(
  27984. $core.method({
  27985. selector: "exportMethod:on:",
  27986. protocol: 'output',
  27987. fn: function (aMethod,aStream){
  27988. var self=this;
  27989. return $core.withContext(function($ctx1) {
  27990. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14;
  27991. $recv(aStream)._nextPutAll_("$core.addMethod(");
  27992. $ctx1.sendIdx["nextPutAll:"]=1;
  27993. $recv(aStream)._lf();
  27994. $ctx1.sendIdx["lf"]=1;
  27995. $recv(aStream)._nextPutAll_("$core.method({");
  27996. $ctx1.sendIdx["nextPutAll:"]=2;
  27997. $recv(aStream)._lf();
  27998. $ctx1.sendIdx["lf"]=2;
  27999. $3=$recv($recv(aMethod)._selector())._asJavascript();
  28000. $ctx1.sendIdx["asJavascript"]=1;
  28001. $2="selector: ".__comma($3);
  28002. $ctx1.sendIdx[","]=2;
  28003. $1=$recv($2).__comma(",");
  28004. $ctx1.sendIdx[","]=1;
  28005. $recv(aStream)._nextPutAll_($1);
  28006. $ctx1.sendIdx["nextPutAll:"]=3;
  28007. $recv(aStream)._lf();
  28008. $ctx1.sendIdx["lf"]=3;
  28009. $5="protocol: '".__comma($recv(aMethod)._protocol());
  28010. $ctx1.sendIdx[","]=4;
  28011. $4=$recv($5).__comma("',");
  28012. $ctx1.sendIdx[","]=3;
  28013. $recv(aStream)._nextPutAll_($4);
  28014. $ctx1.sendIdx["nextPutAll:"]=4;
  28015. $recv(aStream)._lf();
  28016. $ctx1.sendIdx["lf"]=4;
  28017. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  28018. $ctx1.sendIdx[","]=6;
  28019. $6=$recv($7).__comma(",");
  28020. $ctx1.sendIdx[","]=5;
  28021. $recv(aStream)._nextPutAll_($6);
  28022. $ctx1.sendIdx["nextPutAll:"]=5;
  28023. $recv(aStream)._lf();
  28024. $ctx1.sendIdx["lf"]=5;
  28025. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  28026. $ctx1.sendIdx["nextPutAll:"]=6;
  28027. $recv(aStream)._lf();
  28028. $ctx1.sendIdx["lf"]=6;
  28029. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  28030. $ctx1.sendIdx["asJavascript"]=2;
  28031. $9="args: ".__comma($10);
  28032. $ctx1.sendIdx[","]=8;
  28033. $8=$recv($9).__comma(",");
  28034. $ctx1.sendIdx[","]=7;
  28035. $recv(aStream)._nextPutAll_($8);
  28036. $ctx1.sendIdx["nextPutAll:"]=7;
  28037. $recv(aStream)._lf();
  28038. $ctx1.sendIdx["lf"]=7;
  28039. $13=$recv($recv(aMethod)._source())._asJavascript();
  28040. $ctx1.sendIdx["asJavascript"]=3;
  28041. $12="source: ".__comma($13);
  28042. $ctx1.sendIdx[","]=10;
  28043. $11=$recv($12).__comma(",");
  28044. $ctx1.sendIdx[","]=9;
  28045. $recv(aStream)._nextPutAll_($11);
  28046. $ctx1.sendIdx["nextPutAll:"]=8;
  28047. $recv(aStream)._lf();
  28048. $ctx1.sendIdx["lf"]=8;
  28049. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  28050. $ctx1.sendIdx["asJavascript"]=4;
  28051. $15="referencedClasses: ".__comma($16);
  28052. $ctx1.sendIdx[","]=12;
  28053. $14=$recv($15).__comma(",");
  28054. $ctx1.sendIdx[","]=11;
  28055. $recv(aStream)._nextPutAll_($14);
  28056. $ctx1.sendIdx["nextPutAll:"]=9;
  28057. $recv(aStream)._lf();
  28058. $ctx1.sendIdx["lf"]=9;
  28059. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  28060. $ctx1.sendIdx["nextPutAll:"]=10;
  28061. $recv(aStream)._lf();
  28062. $ctx1.sendIdx["lf"]=10;
  28063. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  28064. $ctx1.sendIdx["nextPutAll:"]=11;
  28065. $recv(aStream)._lf();
  28066. $ctx1.sendIdx["lf"]=11;
  28067. $recv(aStream)._nextPutAll_("}),");
  28068. $ctx1.sendIdx["nextPutAll:"]=12;
  28069. $recv(aStream)._lf();
  28070. $ctx1.sendIdx["lf"]=12;
  28071. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  28072. $ctx1.sendIdx["nextPutAll:"]=13;
  28073. $recv(aStream)._nextPutAll_(");");
  28074. $recv(aStream)._lf();
  28075. $ctx1.sendIdx["lf"]=13;
  28076. $recv(aStream)._lf();
  28077. return self;
  28078. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  28079. },
  28080. args: ["aMethod", "aStream"],
  28081. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addMethod(';lf;\x0a\x09\x09nextPutAll: '$core.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'protocol: ''', aMethod protocol, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: (self jsClassNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  28082. referencedClasses: [],
  28083. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  28084. }),
  28085. $globals.Exporter);
  28086. $core.addMethod(
  28087. $core.method({
  28088. selector: "exportPackage:on:",
  28089. protocol: 'output',
  28090. fn: function (aPackage,aStream){
  28091. var self=this;
  28092. return $core.withContext(function($ctx1) {
  28093. var $1;
  28094. self._exportPackagePrologueOf_on_(aPackage,aStream);
  28095. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  28096. self._exportPackageContextOf_on_(aPackage,aStream);
  28097. self._exportPackageImportsOf_on_(aPackage,aStream);
  28098. self._exportPackageTransportOf_on_(aPackage,aStream);
  28099. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  28100. return $core.withContext(function($ctx2) {
  28101. self._exportDefinitionOf_on_(each,aStream);
  28102. $1=$recv(each)._ownMethods();
  28103. $ctx2.sendIdx["ownMethods"]=1;
  28104. $recv($1)._do_((function(method){
  28105. return $core.withContext(function($ctx3) {
  28106. return self._exportMethod_on_(method,aStream);
  28107. $ctx3.sendIdx["exportMethod:on:"]=1;
  28108. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  28109. }));
  28110. $ctx2.sendIdx["do:"]=2;
  28111. self._exportMetaDefinitionOf_on_(each,aStream);
  28112. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  28113. return $core.withContext(function($ctx3) {
  28114. return self._exportMethod_on_(method,aStream);
  28115. $ctx3.sendIdx["exportMethod:on:"]=2;
  28116. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  28117. }));
  28118. $ctx2.sendIdx["do:"]=3;
  28119. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28120. }));
  28121. $ctx1.sendIdx["do:"]=1;
  28122. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  28123. return $core.withContext(function($ctx2) {
  28124. return self._exportMethod_on_(each,aStream);
  28125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  28126. }));
  28127. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  28128. return self;
  28129. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28130. },
  28131. args: ["aPackage", "aStream"],
  28132. 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 exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  28133. referencedClasses: [],
  28134. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  28135. }),
  28136. $globals.Exporter);
  28137. $core.addMethod(
  28138. $core.method({
  28139. selector: "exportPackageBodyBlockPrologueOf:on:",
  28140. protocol: 'output',
  28141. fn: function (aPackage,aStream){
  28142. var self=this;
  28143. return $core.withContext(function($ctx1) {
  28144. $recv(aStream)._nextPutAll_("if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;");
  28145. $ctx1.sendIdx["nextPutAll:"]=1;
  28146. $recv(aStream)._lf();
  28147. $ctx1.sendIdx["lf"]=1;
  28148. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  28149. $ctx1.sendIdx["nextPutAll:"]=2;
  28150. $recv(aStream)._lf();
  28151. $ctx1.sendIdx["lf"]=2;
  28152. $recv(aStream)._nextPutAll_("if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;");
  28153. $recv(aStream)._lf();
  28154. return self;
  28155. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28156. },
  28157. args: ["aPackage", "aStream"],
  28158. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;';\x0a\x09\x09lf",
  28159. referencedClasses: [],
  28160. messageSends: ["nextPutAll:", "lf"]
  28161. }),
  28162. $globals.Exporter);
  28163. $core.addMethod(
  28164. $core.method({
  28165. selector: "exportPackageContextOf:on:",
  28166. protocol: 'output',
  28167. fn: function (aPackage,aStream){
  28168. var self=this;
  28169. return $core.withContext(function($ctx1) {
  28170. $recv(aStream)._nextPutAll_("$core.packages[");
  28171. $ctx1.sendIdx["nextPutAll:"]=1;
  28172. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  28173. $ctx1.sendIdx["nextPutAll:"]=2;
  28174. $recv(aStream)._nextPutAll_("].innerEval = ");
  28175. $ctx1.sendIdx["nextPutAll:"]=3;
  28176. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  28177. $ctx1.sendIdx["nextPutAll:"]=4;
  28178. $recv(aStream)._nextPutAll_(";");
  28179. $recv(aStream)._lf();
  28180. return self;
  28181. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28182. },
  28183. args: ["aPackage", "aStream"],
  28184. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].innerEval = ';\x0a\x09\x09nextPutAll: 'function (expr) { return eval(expr); }';\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  28185. referencedClasses: [],
  28186. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  28187. }),
  28188. $globals.Exporter);
  28189. $core.addMethod(
  28190. $core.method({
  28191. selector: "exportPackageDefinitionOf:on:",
  28192. protocol: 'output',
  28193. fn: function (aPackage,aStream){
  28194. var self=this;
  28195. return $core.withContext(function($ctx1) {
  28196. var $1;
  28197. $recv(aStream)._nextPutAll_("$core.addPackage(");
  28198. $ctx1.sendIdx["nextPutAll:"]=1;
  28199. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  28200. $ctx1.sendIdx[","]=1;
  28201. $recv(aStream)._nextPutAll_($1);
  28202. $recv(aStream)._lf();
  28203. return self;
  28204. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28205. },
  28206. args: ["aPackage", "aStream"],
  28207. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  28208. referencedClasses: [],
  28209. messageSends: ["nextPutAll:", ",", "name", "lf"]
  28210. }),
  28211. $globals.Exporter);
  28212. $core.addMethod(
  28213. $core.method({
  28214. selector: "exportPackageEpilogueOf:on:",
  28215. protocol: 'output',
  28216. fn: function (aPackage,aStream){
  28217. var self=this;
  28218. return $core.withContext(function($ctx1) {
  28219. self._subclassResponsibility();
  28220. return self;
  28221. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28222. },
  28223. args: ["aPackage", "aStream"],
  28224. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  28225. referencedClasses: [],
  28226. messageSends: ["subclassResponsibility"]
  28227. }),
  28228. $globals.Exporter);
  28229. $core.addMethod(
  28230. $core.method({
  28231. selector: "exportPackageImportsOf:on:",
  28232. protocol: 'output',
  28233. fn: function (aPackage,aStream){
  28234. var self=this;
  28235. return $core.withContext(function($ctx1) {
  28236. var $1;
  28237. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  28238. return $core.withContext(function($ctx2) {
  28239. $recv(aStream)._nextPutAll_("$core.packages[");
  28240. $ctx2.sendIdx["nextPutAll:"]=1;
  28241. $1=$recv($recv(aPackage)._name())._asJavascript();
  28242. $ctx2.sendIdx["asJavascript"]=1;
  28243. $recv(aStream)._nextPutAll_($1);
  28244. $ctx2.sendIdx["nextPutAll:"]=2;
  28245. $recv(aStream)._nextPutAll_("].imports = ");
  28246. $ctx2.sendIdx["nextPutAll:"]=3;
  28247. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  28248. $ctx2.sendIdx["nextPutAll:"]=4;
  28249. $recv(aStream)._nextPutAll_(";");
  28250. return $recv(aStream)._lf();
  28251. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  28252. }));
  28253. return self;
  28254. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28255. },
  28256. args: ["aPackage", "aStream"],
  28257. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09\x09nextPutAll: '].imports = ';\x0a\x09\x09\x09nextPutAll: imports asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf ]",
  28258. referencedClasses: [],
  28259. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  28260. }),
  28261. $globals.Exporter);
  28262. $core.addMethod(
  28263. $core.method({
  28264. selector: "exportPackagePrologueOf:on:",
  28265. protocol: 'output',
  28266. fn: function (aPackage,aStream){
  28267. var self=this;
  28268. return $core.withContext(function($ctx1) {
  28269. self._subclassResponsibility();
  28270. return self;
  28271. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28272. },
  28273. args: ["aPackage", "aStream"],
  28274. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  28275. referencedClasses: [],
  28276. messageSends: ["subclassResponsibility"]
  28277. }),
  28278. $globals.Exporter);
  28279. $core.addMethod(
  28280. $core.method({
  28281. selector: "exportPackageTransportOf:on:",
  28282. protocol: 'output',
  28283. fn: function (aPackage,aStream){
  28284. var self=this;
  28285. return $core.withContext(function($ctx1) {
  28286. $recv(aStream)._nextPutAll_("$core.packages[");
  28287. $ctx1.sendIdx["nextPutAll:"]=1;
  28288. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  28289. $ctx1.sendIdx["nextPutAll:"]=2;
  28290. $recv(aStream)._nextPutAll_("].transport = ");
  28291. $ctx1.sendIdx["nextPutAll:"]=3;
  28292. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  28293. $ctx1.sendIdx["nextPutAll:"]=4;
  28294. $recv(aStream)._nextPutAll_(";");
  28295. $recv(aStream)._lf();
  28296. return self;
  28297. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  28298. },
  28299. args: ["aPackage", "aStream"],
  28300. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  28301. referencedClasses: [],
  28302. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  28303. }),
  28304. $globals.Exporter);
  28305. $core.addMethod(
  28306. $core.method({
  28307. selector: "jsClassNameFor:",
  28308. protocol: 'convenience',
  28309. fn: function (aClass){
  28310. var self=this;
  28311. return $core.withContext(function($ctx1) {
  28312. var $1,$receiver;
  28313. $1=$recv(aClass)._isMetaclass();
  28314. if($core.assert($1)){
  28315. return $recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  28316. $ctx1.sendIdx[","]=1;
  28317. } else {
  28318. if(($receiver = aClass) == null || $receiver.isNil){
  28319. return "null";
  28320. } else {
  28321. return "$globals.".__comma($recv(aClass)._name());
  28322. }
  28323. }
  28324. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  28325. },
  28326. args: ["aClass"],
  28327. source: "jsClassNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ (self jsClassNameFor: aClass instanceClass), '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'null' ]\x0a\x09\x09\x09\x09ifNotNil: [ '$globals.', aClass name ] ]",
  28328. referencedClasses: [],
  28329. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  28330. }),
  28331. $globals.Exporter);
  28332. $core.addMethod(
  28333. $core.method({
  28334. selector: "ownMethodsOfClass:",
  28335. protocol: 'accessing',
  28336. fn: function (aClass){
  28337. var self=this;
  28338. return $core.withContext(function($ctx1) {
  28339. var $1;
  28340. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  28341. return $core.withContext(function($ctx2) {
  28342. $1=$recv(a)._selector();
  28343. $ctx2.sendIdx["selector"]=1;
  28344. return $recv($1).__lt_eq($recv(b)._selector());
  28345. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28346. })))._reject_((function(each){
  28347. return $core.withContext(function($ctx2) {
  28348. return $recv($recv(each)._protocol())._match_("^\x5c*");
  28349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28350. }));
  28351. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  28352. },
  28353. args: ["aClass"],
  28354. 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*') ]",
  28355. referencedClasses: [],
  28356. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  28357. }),
  28358. $globals.Exporter);
  28359. $core.addMethod(
  28360. $core.method({
  28361. selector: "ownMethodsOfMetaClass:",
  28362. protocol: 'accessing',
  28363. fn: function (aClass){
  28364. var self=this;
  28365. return $core.withContext(function($ctx1) {
  28366. return self._ownMethodsOfClass_($recv(aClass)._class());
  28367. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  28368. },
  28369. args: ["aClass"],
  28370. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  28371. referencedClasses: [],
  28372. messageSends: ["ownMethodsOfClass:", "class"]
  28373. }),
  28374. $globals.Exporter);
  28375. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  28376. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  28377. $core.addMethod(
  28378. $core.method({
  28379. selector: "amdNamesOfPackages:",
  28380. protocol: 'private',
  28381. fn: function (anArray){
  28382. var self=this;
  28383. return $core.withContext(function($ctx1) {
  28384. var $1;
  28385. return $recv($recv(anArray)._select_((function(each){
  28386. return $core.withContext(function($ctx2) {
  28387. $1=self._amdNamespaceOfPackage_(each);
  28388. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  28389. return $recv($1)._notNil();
  28390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28391. })))._collect_((function(each){
  28392. return $core.withContext(function($ctx2) {
  28393. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  28394. $ctx2.sendIdx[","]=1;
  28395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28396. }));
  28397. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  28398. },
  28399. args: ["anArray"],
  28400. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  28401. referencedClasses: [],
  28402. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  28403. }),
  28404. $globals.AmdExporter);
  28405. $core.addMethod(
  28406. $core.method({
  28407. selector: "amdNamespaceOfPackage:",
  28408. protocol: 'private',
  28409. fn: function (aPackage){
  28410. var self=this;
  28411. return $core.withContext(function($ctx1) {
  28412. var $3,$2,$1;
  28413. $3=$recv(aPackage)._transport();
  28414. $ctx1.sendIdx["transport"]=1;
  28415. $2=$recv($3)._type();
  28416. $1=$recv($2).__eq("amd");
  28417. if($core.assert($1)){
  28418. return $recv($recv(aPackage)._transport())._namespace();
  28419. } else {
  28420. return nil;
  28421. }
  28422. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  28423. },
  28424. args: ["aPackage"],
  28425. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  28426. referencedClasses: [],
  28427. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  28428. }),
  28429. $globals.AmdExporter);
  28430. $core.addMethod(
  28431. $core.method({
  28432. selector: "exportPackageEpilogueOf:on:",
  28433. protocol: 'output',
  28434. fn: function (aPackage,aStream){
  28435. var self=this;
  28436. return $core.withContext(function($ctx1) {
  28437. $recv(aStream)._nextPutAll_("});");
  28438. $recv(aStream)._lf();
  28439. return self;
  28440. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  28441. },
  28442. args: ["aPackage", "aStream"],
  28443. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  28444. referencedClasses: [],
  28445. messageSends: ["nextPutAll:", "lf"]
  28446. }),
  28447. $globals.AmdExporter);
  28448. $core.addMethod(
  28449. $core.method({
  28450. selector: "exportPackagePrologueOf:on:",
  28451. protocol: 'output',
  28452. fn: function (aPackage,aStream){
  28453. var self=this;
  28454. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  28455. return $core.withContext(function($ctx1) {
  28456. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14;
  28457. pragmaStart="";
  28458. pragmaEnd="";
  28459. importsForOutput=self._importsForOutput_(aPackage);
  28460. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  28461. $1=$recv(importsForOutput)._value();
  28462. $ctx1.sendIdx["value"]=1;
  28463. $recv($1)._ifNotEmpty_((function(){
  28464. return $core.withContext(function($ctx2) {
  28465. $3=$recv($globals.String)._lf();
  28466. $ctx2.sendIdx["lf"]=1;
  28467. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  28468. $ctx2.sendIdx[","]=2;
  28469. $4=$recv($globals.String)._lf();
  28470. $ctx2.sendIdx["lf"]=2;
  28471. pragmaStart=$recv($2).__comma($4);
  28472. $ctx2.sendIdx[","]=1;
  28473. pragmaStart;
  28474. $6=$recv($globals.String)._lf();
  28475. $ctx2.sendIdx["lf"]=3;
  28476. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28477. $ctx2.sendIdx[","]=4;
  28478. $7=$recv($globals.String)._lf();
  28479. $ctx2.sendIdx["lf"]=4;
  28480. pragmaEnd=$recv($5).__comma($7);
  28481. $ctx2.sendIdx[","]=3;
  28482. return pragmaEnd;
  28483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28484. }));
  28485. $recv(aStream)._nextPutAll_("define(");
  28486. $ctx1.sendIdx["nextPutAll:"]=1;
  28487. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28488. $ctx1.sendIdx[","]=7;
  28489. $12=$recv($13).__comma([":2:"]);
  28490. $ctx1.sendIdx[","]=6;
  28491. $11=$recv($12).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  28492. $ctx1.sendIdx[","]=5;
  28493. $10=$recv($11)._asJavascript();
  28494. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28495. $ctx1.sendIdx["replace:with:"]=2;
  28496. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28497. $ctx1.sendIdx["replace:with:"]=1;
  28498. $recv(aStream)._nextPutAll_($8);
  28499. $ctx1.sendIdx["nextPutAll:"]=2;
  28500. $recv(aStream)._nextPutAll_(", function(");
  28501. $ctx1.sendIdx["nextPutAll:"]=3;
  28502. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28503. $ctx1.sendIdx[","]=8;
  28504. $16=$recv($17)._join_(",");
  28505. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28506. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28507. $ctx1.sendIdx["replace:with:"]=3;
  28508. $recv(aStream)._nextPutAll_($14);
  28509. $ctx1.sendIdx["nextPutAll:"]=4;
  28510. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28511. $recv(aStream)._lf();
  28512. self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  28513. return self;
  28514. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28515. },
  28516. args: ["aPackage", "aStream"],
  28517. 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\x09nextPutAll: 'define(';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies asArray sorted) asJavascript)\x0a\x09\x09\x09replace: ',\x5cs*[\x22'']:1:[\x22'']' with: pragmaStart) replace: ',\x5cs*[\x22'']:2:[\x22'']' with: pragmaEnd);\x0a\x09\x09nextPutAll: ', function(';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('$boot' ':1:'), importsForOutput key, #(':2:')) join: ',')\x0a\x09\x09\x09replace: ',\x5cs*:1:' with: pragmaStart) replace: ',\x5cs*:2:' with: pragmaEnd);\x0a\x09\x09nextPutAll: '){\x22use strict\x22;';\x0a\x09\x09lf.\x0a\x09self exportPackageBodyBlockPrologueOf: aPackage on: aStream",
  28518. referencedClasses: ["String"],
  28519. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "replace:with:", "asJavascript", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  28520. }),
  28521. $globals.AmdExporter);
  28522. $core.addMethod(
  28523. $core.method({
  28524. selector: "importsForOutput:",
  28525. protocol: 'private',
  28526. fn: function (aPackage){
  28527. var self=this;
  28528. var namedImports,anonImports,importVarNames;
  28529. return $core.withContext(function($ctx1) {
  28530. var $1;
  28531. namedImports=[];
  28532. anonImports=[];
  28533. importVarNames=[];
  28534. $recv($recv(aPackage)._imports())._do_((function(each){
  28535. return $core.withContext(function($ctx2) {
  28536. $1=$recv(each)._isString();
  28537. if($core.assert($1)){
  28538. return $recv(anonImports)._add_(each);
  28539. $ctx2.sendIdx["add:"]=1;
  28540. } else {
  28541. $recv(namedImports)._add_($recv(each)._value());
  28542. $ctx2.sendIdx["add:"]=2;
  28543. return $recv(importVarNames)._add_($recv(each)._key());
  28544. }
  28545. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28546. }));
  28547. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28548. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28549. },
  28550. args: ["aPackage"],
  28551. 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)",
  28552. referencedClasses: [],
  28553. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28554. }),
  28555. $globals.AmdExporter);
  28556. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28557. $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";
  28558. $core.addMethod(
  28559. $core.method({
  28560. selector: "last",
  28561. protocol: 'accessing',
  28562. fn: function (){
  28563. var self=this;
  28564. return self["@last"];
  28565. },
  28566. args: [],
  28567. source: "last\x0a\x09^ last",
  28568. referencedClasses: [],
  28569. messageSends: []
  28570. }),
  28571. $globals.ChunkParser);
  28572. $core.addMethod(
  28573. $core.method({
  28574. selector: "nextChunk",
  28575. protocol: 'reading',
  28576. fn: function (){
  28577. var self=this;
  28578. var char,result,chunk;
  28579. return $core.withContext(function($ctx1) {
  28580. var $1,$2,$3,$4;
  28581. var $early={};
  28582. try {
  28583. result=""._writeStream();
  28584. $recv((function(){
  28585. return $core.withContext(function($ctx2) {
  28586. char=$recv(self["@stream"])._next();
  28587. $ctx2.sendIdx["next"]=1;
  28588. char;
  28589. return $recv(char)._notNil();
  28590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28591. }))._whileTrue_((function(){
  28592. return $core.withContext(function($ctx2) {
  28593. $1=$recv(char).__eq("!");
  28594. $ctx2.sendIdx["="]=1;
  28595. if($core.assert($1)){
  28596. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28597. if($core.assert($2)){
  28598. $recv(self["@stream"])._next();
  28599. } else {
  28600. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28601. $3=self["@last"];
  28602. throw $early=[$3];
  28603. }
  28604. }
  28605. return $recv(result)._nextPut_(char);
  28606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28607. }));
  28608. self["@last"]=nil;
  28609. $4=self["@last"];
  28610. return $4;
  28611. }
  28612. catch(e) {if(e===$early)return e[0]; throw e}
  28613. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28614. },
  28615. args: [],
  28616. 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",
  28617. referencedClasses: [],
  28618. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28619. }),
  28620. $globals.ChunkParser);
  28621. $core.addMethod(
  28622. $core.method({
  28623. selector: "stream:",
  28624. protocol: 'accessing',
  28625. fn: function (aStream){
  28626. var self=this;
  28627. self["@stream"]=aStream;
  28628. return self;
  28629. },
  28630. args: ["aStream"],
  28631. source: "stream: aStream\x0a\x09stream := aStream",
  28632. referencedClasses: [],
  28633. messageSends: []
  28634. }),
  28635. $globals.ChunkParser);
  28636. $core.addMethod(
  28637. $core.method({
  28638. selector: "on:",
  28639. protocol: 'instance creation',
  28640. fn: function (aStream){
  28641. var self=this;
  28642. return $core.withContext(function($ctx1) {
  28643. return $recv(self._new())._stream_(aStream);
  28644. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28645. },
  28646. args: ["aStream"],
  28647. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28648. referencedClasses: [],
  28649. messageSends: ["stream:", "new"]
  28650. }),
  28651. $globals.ChunkParser.klass);
  28652. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28653. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28654. $core.addMethod(
  28655. $core.method({
  28656. selector: "class:",
  28657. protocol: 'accessing',
  28658. fn: function (aClass){
  28659. var self=this;
  28660. self["@class"]=aClass;
  28661. return self;
  28662. },
  28663. args: ["aClass"],
  28664. source: "class: aClass\x0a\x09class := aClass",
  28665. referencedClasses: [],
  28666. messageSends: []
  28667. }),
  28668. $globals.ClassCommentReader);
  28669. $core.addMethod(
  28670. $core.method({
  28671. selector: "initialize",
  28672. protocol: 'initialization',
  28673. fn: function (){
  28674. var self=this;
  28675. return $core.withContext(function($ctx1) {
  28676. (
  28677. $ctx1.supercall = true,
  28678. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  28679. $ctx1.supercall = false;
  28680. return self;
  28681. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28682. },
  28683. args: [],
  28684. source: "initialize\x0a\x09super initialize.",
  28685. referencedClasses: [],
  28686. messageSends: ["initialize"]
  28687. }),
  28688. $globals.ClassCommentReader);
  28689. $core.addMethod(
  28690. $core.method({
  28691. selector: "scanFrom:",
  28692. protocol: 'fileIn',
  28693. fn: function (aChunkParser){
  28694. var self=this;
  28695. var chunk;
  28696. return $core.withContext(function($ctx1) {
  28697. chunk=$recv(aChunkParser)._nextChunk();
  28698. $recv(chunk)._ifNotEmpty_((function(){
  28699. return $core.withContext(function($ctx2) {
  28700. return self._setComment_(chunk);
  28701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28702. }));
  28703. return self;
  28704. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28705. },
  28706. args: ["aChunkParser"],
  28707. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  28708. referencedClasses: [],
  28709. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  28710. }),
  28711. $globals.ClassCommentReader);
  28712. $core.addMethod(
  28713. $core.method({
  28714. selector: "setComment:",
  28715. protocol: 'private',
  28716. fn: function (aString){
  28717. var self=this;
  28718. return $core.withContext(function($ctx1) {
  28719. $recv(self["@class"])._comment_(aString);
  28720. return self;
  28721. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28722. },
  28723. args: ["aString"],
  28724. source: "setComment: aString\x0a\x09class comment: aString",
  28725. referencedClasses: [],
  28726. messageSends: ["comment:"]
  28727. }),
  28728. $globals.ClassCommentReader);
  28729. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28730. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28731. $core.addMethod(
  28732. $core.method({
  28733. selector: "class:category:",
  28734. protocol: 'accessing',
  28735. fn: function (aClass,aString){
  28736. var self=this;
  28737. self["@class"]=aClass;
  28738. self["@category"]=aString;
  28739. return self;
  28740. },
  28741. args: ["aClass", "aString"],
  28742. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28743. referencedClasses: [],
  28744. messageSends: []
  28745. }),
  28746. $globals.ClassProtocolReader);
  28747. $core.addMethod(
  28748. $core.method({
  28749. selector: "compileMethod:",
  28750. protocol: 'private',
  28751. fn: function (aString){
  28752. var self=this;
  28753. return $core.withContext(function($ctx1) {
  28754. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28755. return self;
  28756. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28757. },
  28758. args: ["aString"],
  28759. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28760. referencedClasses: ["Compiler"],
  28761. messageSends: ["install:forClass:protocol:", "new"]
  28762. }),
  28763. $globals.ClassProtocolReader);
  28764. $core.addMethod(
  28765. $core.method({
  28766. selector: "initialize",
  28767. protocol: 'initialization',
  28768. fn: function (){
  28769. var self=this;
  28770. return $core.withContext(function($ctx1) {
  28771. (
  28772. $ctx1.supercall = true,
  28773. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  28774. $ctx1.supercall = false;
  28775. return self;
  28776. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28777. },
  28778. args: [],
  28779. source: "initialize\x0a\x09super initialize.",
  28780. referencedClasses: [],
  28781. messageSends: ["initialize"]
  28782. }),
  28783. $globals.ClassProtocolReader);
  28784. $core.addMethod(
  28785. $core.method({
  28786. selector: "scanFrom:",
  28787. protocol: 'fileIn',
  28788. fn: function (aChunkParser){
  28789. var self=this;
  28790. var chunk;
  28791. return $core.withContext(function($ctx1) {
  28792. $recv((function(){
  28793. return $core.withContext(function($ctx2) {
  28794. chunk=$recv(aChunkParser)._nextChunk();
  28795. chunk;
  28796. return $recv(chunk)._isEmpty();
  28797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28798. }))._whileFalse_((function(){
  28799. return $core.withContext(function($ctx2) {
  28800. return self._compileMethod_(chunk);
  28801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28802. }));
  28803. return self;
  28804. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28805. },
  28806. args: ["aChunkParser"],
  28807. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  28808. referencedClasses: [],
  28809. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  28810. }),
  28811. $globals.ClassProtocolReader);
  28812. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28813. $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.";
  28814. $core.addMethod(
  28815. $core.method({
  28816. selector: "methods",
  28817. protocol: 'accessing',
  28818. fn: function (){
  28819. var self=this;
  28820. return $core.withContext(function($ctx1) {
  28821. var $1;
  28822. return $recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28823. return $core.withContext(function($ctx2) {
  28824. $1=$recv(a)._selector();
  28825. $ctx2.sendIdx["selector"]=1;
  28826. return $recv($1).__lt_eq($recv(b)._selector());
  28827. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28828. }));
  28829. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28830. },
  28831. args: [],
  28832. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28833. referencedClasses: [],
  28834. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28835. }),
  28836. $globals.ExportMethodProtocol);
  28837. $core.addMethod(
  28838. $core.method({
  28839. selector: "name",
  28840. protocol: 'accessing',
  28841. fn: function (){
  28842. var self=this;
  28843. return self["@name"];
  28844. },
  28845. args: [],
  28846. source: "name\x0a\x09^ name",
  28847. referencedClasses: [],
  28848. messageSends: []
  28849. }),
  28850. $globals.ExportMethodProtocol);
  28851. $core.addMethod(
  28852. $core.method({
  28853. selector: "name:",
  28854. protocol: 'accessing',
  28855. fn: function (aString){
  28856. var self=this;
  28857. self["@name"]=aString;
  28858. return self;
  28859. },
  28860. args: ["aString"],
  28861. source: "name: aString\x0a\x09name := aString",
  28862. referencedClasses: [],
  28863. messageSends: []
  28864. }),
  28865. $globals.ExportMethodProtocol);
  28866. $core.addMethod(
  28867. $core.method({
  28868. selector: "theClass",
  28869. protocol: 'accessing',
  28870. fn: function (){
  28871. var self=this;
  28872. return self["@theClass"];
  28873. },
  28874. args: [],
  28875. source: "theClass\x0a\x09^ theClass",
  28876. referencedClasses: [],
  28877. messageSends: []
  28878. }),
  28879. $globals.ExportMethodProtocol);
  28880. $core.addMethod(
  28881. $core.method({
  28882. selector: "theClass:",
  28883. protocol: 'accessing',
  28884. fn: function (aClass){
  28885. var self=this;
  28886. self["@theClass"]=aClass;
  28887. return self;
  28888. },
  28889. args: ["aClass"],
  28890. source: "theClass: aClass\x0a\x09theClass := aClass",
  28891. referencedClasses: [],
  28892. messageSends: []
  28893. }),
  28894. $globals.ExportMethodProtocol);
  28895. $core.addMethod(
  28896. $core.method({
  28897. selector: "name:theClass:",
  28898. protocol: 'instance creation',
  28899. fn: function (aString,aClass){
  28900. var self=this;
  28901. return $core.withContext(function($ctx1) {
  28902. var $1;
  28903. $1=self._new();
  28904. $recv($1)._name_(aString);
  28905. $recv($1)._theClass_(aClass);
  28906. return $recv($1)._yourself();
  28907. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28908. },
  28909. args: ["aString", "aClass"],
  28910. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28911. referencedClasses: [],
  28912. messageSends: ["name:", "new", "theClass:", "yourself"]
  28913. }),
  28914. $globals.ExportMethodProtocol.klass);
  28915. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28916. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28917. $core.addMethod(
  28918. $core.method({
  28919. selector: "import:",
  28920. protocol: 'fileIn',
  28921. fn: function (aStream){
  28922. var self=this;
  28923. var chunk,result,parser,lastEmpty;
  28924. return $core.withContext(function($ctx1) {
  28925. var $1;
  28926. parser=$recv($globals.ChunkParser)._on_(aStream);
  28927. lastEmpty=false;
  28928. self["@lastSection"]="n/a, not started";
  28929. self["@lastChunk"]=nil;
  28930. $recv((function(){
  28931. return $core.withContext(function($ctx2) {
  28932. $recv((function(){
  28933. return $core.withContext(function($ctx3) {
  28934. chunk=$recv(parser)._nextChunk();
  28935. chunk;
  28936. return $recv(chunk)._isNil();
  28937. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28938. }))._whileFalse_((function(){
  28939. return $core.withContext(function($ctx3) {
  28940. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  28941. lastEmpty=true;
  28942. return lastEmpty;
  28943. }),(function(){
  28944. return $core.withContext(function($ctx4) {
  28945. self["@lastSection"]=chunk;
  28946. self["@lastSection"];
  28947. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  28948. result;
  28949. $1=lastEmpty;
  28950. if($core.assert($1)){
  28951. lastEmpty=false;
  28952. lastEmpty;
  28953. return $recv(result)._scanFrom_(parser);
  28954. }
  28955. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  28956. }));
  28957. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28958. }));
  28959. self["@lastSection"]="n/a, finished";
  28960. return self["@lastSection"];
  28961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28962. }))._on_do_($globals.Error,(function(e){
  28963. return $core.withContext(function($ctx2) {
  28964. self["@lastChunk"]=$recv(parser)._last();
  28965. self["@lastChunk"];
  28966. return $recv(e)._resignal();
  28967. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  28968. }));
  28969. return self;
  28970. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  28971. },
  28972. args: ["aStream"],
  28973. 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 ].",
  28974. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  28975. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  28976. }),
  28977. $globals.Importer);
  28978. $core.addMethod(
  28979. $core.method({
  28980. selector: "lastChunk",
  28981. protocol: 'accessing',
  28982. fn: function (){
  28983. var self=this;
  28984. return self["@lastChunk"];
  28985. },
  28986. args: [],
  28987. source: "lastChunk\x0a\x09^ lastChunk",
  28988. referencedClasses: [],
  28989. messageSends: []
  28990. }),
  28991. $globals.Importer);
  28992. $core.addMethod(
  28993. $core.method({
  28994. selector: "lastSection",
  28995. protocol: 'accessing',
  28996. fn: function (){
  28997. var self=this;
  28998. return self["@lastSection"];
  28999. },
  29000. args: [],
  29001. source: "lastSection\x0a\x09^ lastSection",
  29002. referencedClasses: [],
  29003. messageSends: []
  29004. }),
  29005. $globals.Importer);
  29006. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  29007. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  29008. $core.addClass('PackageHandler', $globals.Object, [], 'Platform-ImportExport');
  29009. $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.";
  29010. $core.addMethod(
  29011. $core.method({
  29012. selector: "ajaxPutAt:data:onSuccess:onError:",
  29013. protocol: 'private',
  29014. fn: function (aURL,aString,aBlock,anotherBlock){
  29015. var self=this;
  29016. var xhr;
  29017. return $core.withContext(function($ctx1) {
  29018. var $1,$4,$3,$2;
  29019. xhr=$recv($globals.Platform)._newXhr();
  29020. $recv(xhr)._open_url_async_("PUT",aURL,true);
  29021. $recv(xhr)._onreadystatechange_((function(){
  29022. return $core.withContext(function($ctx2) {
  29023. $1=$recv($recv(xhr)._readyState()).__eq((4));
  29024. if($core.assert($1)){
  29025. $4=$recv(xhr)._status();
  29026. $ctx2.sendIdx["status"]=1;
  29027. $3=$recv($4).__gt_eq((200));
  29028. $2=$recv($3)._and_((function(){
  29029. return $core.withContext(function($ctx3) {
  29030. return $recv($recv(xhr)._status()).__lt((300));
  29031. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  29032. }));
  29033. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  29034. }
  29035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29036. }));
  29037. $recv(xhr)._send_(aString);
  29038. return self;
  29039. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  29040. },
  29041. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  29042. 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",
  29043. referencedClasses: ["Platform"],
  29044. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  29045. }),
  29046. $globals.PackageHandler);
  29047. $core.addMethod(
  29048. $core.method({
  29049. selector: "chunkContentsFor:",
  29050. protocol: 'accessing',
  29051. fn: function (aPackage){
  29052. var self=this;
  29053. return $core.withContext(function($ctx1) {
  29054. return $recv($globals.String)._streamContents_((function(str){
  29055. return $core.withContext(function($ctx2) {
  29056. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  29057. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  29058. }));
  29059. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29060. },
  29061. args: ["aPackage"],
  29062. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  29063. referencedClasses: ["String"],
  29064. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  29065. }),
  29066. $globals.PackageHandler);
  29067. $core.addMethod(
  29068. $core.method({
  29069. selector: "chunkExporter",
  29070. protocol: 'factory',
  29071. fn: function (){
  29072. var self=this;
  29073. return $core.withContext(function($ctx1) {
  29074. return $recv(self._chunkExporterClass())._new();
  29075. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  29076. },
  29077. args: [],
  29078. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  29079. referencedClasses: [],
  29080. messageSends: ["new", "chunkExporterClass"]
  29081. }),
  29082. $globals.PackageHandler);
  29083. $core.addMethod(
  29084. $core.method({
  29085. selector: "chunkExporterClass",
  29086. protocol: 'accessing',
  29087. fn: function (){
  29088. var self=this;
  29089. return $globals.ChunkExporter;
  29090. },
  29091. args: [],
  29092. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  29093. referencedClasses: ["ChunkExporter"],
  29094. messageSends: []
  29095. }),
  29096. $globals.PackageHandler);
  29097. $core.addMethod(
  29098. $core.method({
  29099. selector: "commit:",
  29100. protocol: 'committing',
  29101. fn: function (aPackage){
  29102. var self=this;
  29103. return $core.withContext(function($ctx1) {
  29104. var $1,$2;
  29105. self._commit_onSuccess_onError_(aPackage,(function(){
  29106. }),(function(error){
  29107. return $core.withContext(function($ctx2) {
  29108. $1=$recv($globals.PackageCommitError)._new();
  29109. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  29110. $ctx2.sendIdx[","]=1;
  29111. $recv($1)._messageText_($2);
  29112. return $recv($1)._signal();
  29113. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  29114. }));
  29115. return self;
  29116. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  29117. },
  29118. args: ["aPackage"],
  29119. 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 ]",
  29120. referencedClasses: ["PackageCommitError"],
  29121. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  29122. }),
  29123. $globals.PackageHandler);
  29124. $core.addMethod(
  29125. $core.method({
  29126. selector: "commit:onSuccess:onError:",
  29127. protocol: 'committing',
  29128. fn: function (aPackage,aBlock,anotherBlock){
  29129. var self=this;
  29130. return $core.withContext(function($ctx1) {
  29131. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  29132. return $core.withContext(function($ctx2) {
  29133. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  29134. return $core.withContext(function($ctx3) {
  29135. $recv(aPackage)._beClean();
  29136. return $recv(aBlock)._value();
  29137. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  29138. }),anotherBlock);
  29139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  29140. }),anotherBlock);
  29141. return self;
  29142. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  29143. },
  29144. args: ["aPackage", "aBlock", "anotherBlock"],
  29145. 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",
  29146. referencedClasses: [],
  29147. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  29148. }),
  29149. $globals.PackageHandler);
  29150. $core.addMethod(
  29151. $core.method({
  29152. selector: "commitJsFileFor:onSuccess:onError:",
  29153. protocol: 'committing',
  29154. fn: function (aPackage,aBlock,anotherBlock){
  29155. var self=this;
  29156. return $core.withContext(function($ctx1) {
  29157. var $2,$1;
  29158. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29159. $ctx1.sendIdx[","]=2;
  29160. $1=$recv($2).__comma(".js");
  29161. $ctx1.sendIdx[","]=1;
  29162. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  29163. return self;
  29164. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  29165. },
  29166. args: ["aPackage", "aBlock", "anotherBlock"],
  29167. 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",
  29168. referencedClasses: [],
  29169. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  29170. }),
  29171. $globals.PackageHandler);
  29172. $core.addMethod(
  29173. $core.method({
  29174. selector: "commitPathJsFor:",
  29175. protocol: 'accessing',
  29176. fn: function (aPackage){
  29177. var self=this;
  29178. return $core.withContext(function($ctx1) {
  29179. self._subclassResponsibility();
  29180. return self;
  29181. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29182. },
  29183. args: ["aPackage"],
  29184. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  29185. referencedClasses: [],
  29186. messageSends: ["subclassResponsibility"]
  29187. }),
  29188. $globals.PackageHandler);
  29189. $core.addMethod(
  29190. $core.method({
  29191. selector: "commitPathStFor:",
  29192. protocol: 'accessing',
  29193. fn: function (aPackage){
  29194. var self=this;
  29195. return $core.withContext(function($ctx1) {
  29196. self._subclassResponsibility();
  29197. return self;
  29198. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29199. },
  29200. args: ["aPackage"],
  29201. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  29202. referencedClasses: [],
  29203. messageSends: ["subclassResponsibility"]
  29204. }),
  29205. $globals.PackageHandler);
  29206. $core.addMethod(
  29207. $core.method({
  29208. selector: "commitStFileFor:onSuccess:onError:",
  29209. protocol: 'committing',
  29210. fn: function (aPackage,aBlock,anotherBlock){
  29211. var self=this;
  29212. return $core.withContext(function($ctx1) {
  29213. var $2,$1;
  29214. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29215. $ctx1.sendIdx[","]=2;
  29216. $1=$recv($2).__comma(".st");
  29217. $ctx1.sendIdx[","]=1;
  29218. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  29219. return self;
  29220. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  29221. },
  29222. args: ["aPackage", "aBlock", "anotherBlock"],
  29223. 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",
  29224. referencedClasses: [],
  29225. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  29226. }),
  29227. $globals.PackageHandler);
  29228. $core.addMethod(
  29229. $core.method({
  29230. selector: "contentsFor:",
  29231. protocol: 'accessing',
  29232. fn: function (aPackage){
  29233. var self=this;
  29234. return $core.withContext(function($ctx1) {
  29235. return $recv($globals.String)._streamContents_((function(str){
  29236. return $core.withContext(function($ctx2) {
  29237. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  29238. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  29239. }));
  29240. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  29241. },
  29242. args: ["aPackage"],
  29243. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  29244. referencedClasses: ["String"],
  29245. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  29246. }),
  29247. $globals.PackageHandler);
  29248. $core.addMethod(
  29249. $core.method({
  29250. selector: "exporter",
  29251. protocol: 'factory',
  29252. fn: function (){
  29253. var self=this;
  29254. return $core.withContext(function($ctx1) {
  29255. return $recv(self._exporterClass())._new();
  29256. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  29257. },
  29258. args: [],
  29259. source: "exporter\x0a\x09^ self exporterClass new",
  29260. referencedClasses: [],
  29261. messageSends: ["new", "exporterClass"]
  29262. }),
  29263. $globals.PackageHandler);
  29264. $core.addMethod(
  29265. $core.method({
  29266. selector: "exporterClass",
  29267. protocol: 'accessing',
  29268. fn: function (){
  29269. var self=this;
  29270. return $core.withContext(function($ctx1) {
  29271. self._subclassResponsibility();
  29272. return self;
  29273. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  29274. },
  29275. args: [],
  29276. source: "exporterClass\x0a\x09self subclassResponsibility",
  29277. referencedClasses: [],
  29278. messageSends: ["subclassResponsibility"]
  29279. }),
  29280. $globals.PackageHandler);
  29281. $core.addMethod(
  29282. $core.method({
  29283. selector: "load:",
  29284. protocol: 'loading',
  29285. fn: function (aPackage){
  29286. var self=this;
  29287. return $core.withContext(function($ctx1) {
  29288. self._subclassResponsibility();
  29289. return self;
  29290. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  29291. },
  29292. args: ["aPackage"],
  29293. source: "load: aPackage\x0a\x09self subclassResponsibility",
  29294. referencedClasses: [],
  29295. messageSends: ["subclassResponsibility"]
  29296. }),
  29297. $globals.PackageHandler);
  29298. $core.addMethod(
  29299. $core.method({
  29300. selector: "onCommitError:",
  29301. protocol: 'error handling',
  29302. fn: function (anError){
  29303. var self=this;
  29304. return $core.withContext(function($ctx1) {
  29305. var $1,$2;
  29306. $1=$recv($globals.PackageCommitError)._new();
  29307. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  29308. $ctx1.sendIdx[","]=1;
  29309. $recv($1)._messageText_($2);
  29310. $recv($1)._signal();
  29311. return self;
  29312. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  29313. },
  29314. args: ["anError"],
  29315. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  29316. referencedClasses: ["PackageCommitError"],
  29317. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  29318. }),
  29319. $globals.PackageHandler);
  29320. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  29321. $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.";
  29322. $core.addMethod(
  29323. $core.method({
  29324. selector: "commitPathJsFor:",
  29325. protocol: 'accessing',
  29326. fn: function (aPackage){
  29327. var self=this;
  29328. return $core.withContext(function($ctx1) {
  29329. return self._toUrl_(self._namespaceFor_(aPackage));
  29330. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29331. },
  29332. args: ["aPackage"],
  29333. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  29334. referencedClasses: [],
  29335. messageSends: ["toUrl:", "namespaceFor:"]
  29336. }),
  29337. $globals.AmdPackageHandler);
  29338. $core.addMethod(
  29339. $core.method({
  29340. selector: "commitPathStFor:",
  29341. protocol: 'accessing',
  29342. fn: function (aPackage){
  29343. var self=this;
  29344. var path,pathWithout;
  29345. return $core.withContext(function($ctx1) {
  29346. var $1,$2;
  29347. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  29348. $ctx1.sendIdx[","]=1;
  29349. path=self._toUrl_($1);
  29350. pathWithout=self._commitPathJsFor_(aPackage);
  29351. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  29352. if($core.assert($2)){
  29353. return pathWithout;
  29354. } else {
  29355. return path;
  29356. }
  29357. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  29358. },
  29359. args: ["aPackage"],
  29360. 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 ]",
  29361. referencedClasses: [],
  29362. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  29363. }),
  29364. $globals.AmdPackageHandler);
  29365. $core.addMethod(
  29366. $core.method({
  29367. selector: "exporterClass",
  29368. protocol: 'accessing',
  29369. fn: function (){
  29370. var self=this;
  29371. return $globals.AmdExporter;
  29372. },
  29373. args: [],
  29374. source: "exporterClass\x0a\x09^ AmdExporter",
  29375. referencedClasses: ["AmdExporter"],
  29376. messageSends: []
  29377. }),
  29378. $globals.AmdPackageHandler);
  29379. $core.addMethod(
  29380. $core.method({
  29381. selector: "load:",
  29382. protocol: 'loading',
  29383. fn: function (aPackage){
  29384. var self=this;
  29385. return $core.withContext(function($ctx1) {
  29386. var $1,$3,$2,$receiver;
  29387. $1=$recv($globals.Smalltalk)._amdRequire();
  29388. if(($receiver = $1) == null || $receiver.isNil){
  29389. self._error_("AMD loader not present");
  29390. } else {
  29391. var require;
  29392. require=$receiver;
  29393. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29394. $ctx1.sendIdx[","]=1;
  29395. $2=$recv($globals.Array)._with_($3);
  29396. $recv(require)._value_($2);
  29397. }
  29398. return self;
  29399. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29400. },
  29401. args: ["aPackage"],
  29402. 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 ) ]",
  29403. referencedClasses: ["Smalltalk", "Array"],
  29404. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  29405. }),
  29406. $globals.AmdPackageHandler);
  29407. $core.addMethod(
  29408. $core.method({
  29409. selector: "namespaceFor:",
  29410. protocol: 'committing',
  29411. fn: function (aPackage){
  29412. var self=this;
  29413. return $core.withContext(function($ctx1) {
  29414. return $recv($recv(aPackage)._transport())._namespace();
  29415. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29416. },
  29417. args: ["aPackage"],
  29418. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  29419. referencedClasses: [],
  29420. messageSends: ["namespace", "transport"]
  29421. }),
  29422. $globals.AmdPackageHandler);
  29423. $core.addMethod(
  29424. $core.method({
  29425. selector: "toUrl:",
  29426. protocol: 'private',
  29427. fn: function (aString){
  29428. var self=this;
  29429. return $core.withContext(function($ctx1) {
  29430. var $1,$receiver;
  29431. $1=$recv($globals.Smalltalk)._amdRequire();
  29432. if(($receiver = $1) == null || $receiver.isNil){
  29433. return self._error_("AMD loader not present");
  29434. } else {
  29435. var require;
  29436. require=$receiver;
  29437. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  29438. }
  29439. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  29440. },
  29441. args: ["aString"],
  29442. 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 ]",
  29443. referencedClasses: ["Smalltalk"],
  29444. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  29445. }),
  29446. $globals.AmdPackageHandler);
  29447. $core.addMethod(
  29448. $core.method({
  29449. selector: "defaultNamespace",
  29450. protocol: 'commit paths',
  29451. fn: function (){
  29452. var self=this;
  29453. return $core.withContext(function($ctx1) {
  29454. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29455. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  29456. },
  29457. args: [],
  29458. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29459. referencedClasses: ["Smalltalk"],
  29460. messageSends: ["defaultAmdNamespace"]
  29461. }),
  29462. $globals.AmdPackageHandler.klass);
  29463. $core.addMethod(
  29464. $core.method({
  29465. selector: "defaultNamespace:",
  29466. protocol: 'commit paths',
  29467. fn: function (aString){
  29468. var self=this;
  29469. return $core.withContext(function($ctx1) {
  29470. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  29471. return self;
  29472. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29473. },
  29474. args: ["aString"],
  29475. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29476. referencedClasses: ["Smalltalk"],
  29477. messageSends: ["defaultAmdNamespace:"]
  29478. }),
  29479. $globals.AmdPackageHandler.klass);
  29480. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29481. $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.";
  29482. $core.addMethod(
  29483. $core.method({
  29484. selector: "asJSON",
  29485. protocol: 'converting',
  29486. fn: function (){
  29487. var self=this;
  29488. return $core.withContext(function($ctx1) {
  29489. return $globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29490. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29491. },
  29492. args: [],
  29493. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29494. referencedClasses: [],
  29495. messageSends: ["type"]
  29496. }),
  29497. $globals.PackageTransport);
  29498. $core.addMethod(
  29499. $core.method({
  29500. selector: "commit",
  29501. protocol: 'committing',
  29502. fn: function (){
  29503. var self=this;
  29504. return $core.withContext(function($ctx1) {
  29505. $recv(self._commitHandler())._commit_(self._package());
  29506. return self;
  29507. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29508. },
  29509. args: [],
  29510. source: "commit\x0a\x09self commitHandler commit: self package",
  29511. referencedClasses: [],
  29512. messageSends: ["commit:", "commitHandler", "package"]
  29513. }),
  29514. $globals.PackageTransport);
  29515. $core.addMethod(
  29516. $core.method({
  29517. selector: "commitHandler",
  29518. protocol: 'factory',
  29519. fn: function (){
  29520. var self=this;
  29521. return $core.withContext(function($ctx1) {
  29522. return $recv(self._commitHandlerClass())._new();
  29523. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29524. },
  29525. args: [],
  29526. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29527. referencedClasses: [],
  29528. messageSends: ["new", "commitHandlerClass"]
  29529. }),
  29530. $globals.PackageTransport);
  29531. $core.addMethod(
  29532. $core.method({
  29533. selector: "commitHandlerClass",
  29534. protocol: 'accessing',
  29535. fn: function (){
  29536. var self=this;
  29537. return $core.withContext(function($ctx1) {
  29538. self._subclassResponsibility();
  29539. return self;
  29540. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29541. },
  29542. args: [],
  29543. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29544. referencedClasses: [],
  29545. messageSends: ["subclassResponsibility"]
  29546. }),
  29547. $globals.PackageTransport);
  29548. $core.addMethod(
  29549. $core.method({
  29550. selector: "commitOnSuccess:onError:",
  29551. protocol: 'committing',
  29552. fn: function (aBlock,anotherBlock){
  29553. var self=this;
  29554. return $core.withContext(function($ctx1) {
  29555. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29556. return self;
  29557. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29558. },
  29559. args: ["aBlock", "anotherBlock"],
  29560. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29561. referencedClasses: [],
  29562. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29563. }),
  29564. $globals.PackageTransport);
  29565. $core.addMethod(
  29566. $core.method({
  29567. selector: "definition",
  29568. protocol: 'accessing',
  29569. fn: function (){
  29570. var self=this;
  29571. return "";
  29572. },
  29573. args: [],
  29574. source: "definition\x0a\x09^ ''",
  29575. referencedClasses: [],
  29576. messageSends: []
  29577. }),
  29578. $globals.PackageTransport);
  29579. $core.addMethod(
  29580. $core.method({
  29581. selector: "load",
  29582. protocol: 'loading',
  29583. fn: function (){
  29584. var self=this;
  29585. return $core.withContext(function($ctx1) {
  29586. $recv(self._commitHandler())._load_(self._package());
  29587. return self;
  29588. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29589. },
  29590. args: [],
  29591. source: "load\x0a\x09self commitHandler load: self package",
  29592. referencedClasses: [],
  29593. messageSends: ["load:", "commitHandler", "package"]
  29594. }),
  29595. $globals.PackageTransport);
  29596. $core.addMethod(
  29597. $core.method({
  29598. selector: "package",
  29599. protocol: 'accessing',
  29600. fn: function (){
  29601. var self=this;
  29602. return self["@package"];
  29603. },
  29604. args: [],
  29605. source: "package\x0a\x09^ package",
  29606. referencedClasses: [],
  29607. messageSends: []
  29608. }),
  29609. $globals.PackageTransport);
  29610. $core.addMethod(
  29611. $core.method({
  29612. selector: "package:",
  29613. protocol: 'accessing',
  29614. fn: function (aPackage){
  29615. var self=this;
  29616. self["@package"]=aPackage;
  29617. return self;
  29618. },
  29619. args: ["aPackage"],
  29620. source: "package: aPackage\x0a\x09package := aPackage",
  29621. referencedClasses: [],
  29622. messageSends: []
  29623. }),
  29624. $globals.PackageTransport);
  29625. $core.addMethod(
  29626. $core.method({
  29627. selector: "setupFromJson:",
  29628. protocol: 'initialization',
  29629. fn: function (anObject){
  29630. var self=this;
  29631. return self;
  29632. },
  29633. args: ["anObject"],
  29634. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29635. referencedClasses: [],
  29636. messageSends: []
  29637. }),
  29638. $globals.PackageTransport);
  29639. $core.addMethod(
  29640. $core.method({
  29641. selector: "type",
  29642. protocol: 'accessing',
  29643. fn: function (){
  29644. var self=this;
  29645. return $core.withContext(function($ctx1) {
  29646. return $recv(self._class())._type();
  29647. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29648. },
  29649. args: [],
  29650. source: "type\x0a\x09^ self class type",
  29651. referencedClasses: [],
  29652. messageSends: ["type", "class"]
  29653. }),
  29654. $globals.PackageTransport);
  29655. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29656. $core.addMethod(
  29657. $core.method({
  29658. selector: "classRegisteredFor:",
  29659. protocol: 'accessing',
  29660. fn: function (aString){
  29661. var self=this;
  29662. return $core.withContext(function($ctx1) {
  29663. return $recv(self["@registry"])._at_(aString);
  29664. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29665. },
  29666. args: ["aString"],
  29667. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29668. referencedClasses: [],
  29669. messageSends: ["at:"]
  29670. }),
  29671. $globals.PackageTransport.klass);
  29672. $core.addMethod(
  29673. $core.method({
  29674. selector: "defaultType",
  29675. protocol: 'accessing',
  29676. fn: function (){
  29677. var self=this;
  29678. return $core.withContext(function($ctx1) {
  29679. return $recv($globals.AmdPackageTransport)._type();
  29680. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29681. },
  29682. args: [],
  29683. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29684. referencedClasses: ["AmdPackageTransport"],
  29685. messageSends: ["type"]
  29686. }),
  29687. $globals.PackageTransport.klass);
  29688. $core.addMethod(
  29689. $core.method({
  29690. selector: "for:",
  29691. protocol: 'instance creation',
  29692. fn: function (aString){
  29693. var self=this;
  29694. return $core.withContext(function($ctx1) {
  29695. return $recv(self._classRegisteredFor_(aString))._new();
  29696. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29697. },
  29698. args: ["aString"],
  29699. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29700. referencedClasses: [],
  29701. messageSends: ["new", "classRegisteredFor:"]
  29702. }),
  29703. $globals.PackageTransport.klass);
  29704. $core.addMethod(
  29705. $core.method({
  29706. selector: "fromJson:",
  29707. protocol: 'instance creation',
  29708. fn: function (anObject){
  29709. var self=this;
  29710. return $core.withContext(function($ctx1) {
  29711. var $1,$2,$receiver;
  29712. if(($receiver = anObject) == null || $receiver.isNil){
  29713. $1=self._for_(self._defaultType());
  29714. $ctx1.sendIdx["for:"]=1;
  29715. return $1;
  29716. } else {
  29717. anObject;
  29718. }
  29719. $2=self._for_($recv(anObject)._type());
  29720. $recv($2)._setupFromJson_(anObject);
  29721. return $recv($2)._yourself();
  29722. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29723. },
  29724. args: ["anObject"],
  29725. 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",
  29726. referencedClasses: [],
  29727. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29728. }),
  29729. $globals.PackageTransport.klass);
  29730. $core.addMethod(
  29731. $core.method({
  29732. selector: "initialize",
  29733. protocol: 'initialization',
  29734. fn: function (){
  29735. var self=this;
  29736. return $core.withContext(function($ctx1) {
  29737. var $1;
  29738. (
  29739. $ctx1.supercall = true,
  29740. ($globals.PackageTransport.klass.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  29741. $ctx1.supercall = false;
  29742. $1=self.__eq_eq($globals.PackageTransport);
  29743. if($core.assert($1)){
  29744. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29745. self["@registry"];
  29746. } else {
  29747. self._register();
  29748. }
  29749. return self;
  29750. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29751. },
  29752. args: [],
  29753. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29754. referencedClasses: ["PackageTransport"],
  29755. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29756. }),
  29757. $globals.PackageTransport.klass);
  29758. $core.addMethod(
  29759. $core.method({
  29760. selector: "register",
  29761. protocol: 'registration',
  29762. fn: function (){
  29763. var self=this;
  29764. return $core.withContext(function($ctx1) {
  29765. $recv($globals.PackageTransport)._register_(self);
  29766. return self;
  29767. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29768. },
  29769. args: [],
  29770. source: "register\x0a\x09PackageTransport register: self",
  29771. referencedClasses: ["PackageTransport"],
  29772. messageSends: ["register:"]
  29773. }),
  29774. $globals.PackageTransport.klass);
  29775. $core.addMethod(
  29776. $core.method({
  29777. selector: "register:",
  29778. protocol: 'registration',
  29779. fn: function (aClass){
  29780. var self=this;
  29781. return $core.withContext(function($ctx1) {
  29782. var $1,$receiver;
  29783. $1=$recv(aClass)._type();
  29784. $ctx1.sendIdx["type"]=1;
  29785. if(($receiver = $1) == null || $receiver.isNil){
  29786. $1;
  29787. } else {
  29788. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29789. }
  29790. return self;
  29791. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29792. },
  29793. args: ["aClass"],
  29794. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29795. referencedClasses: [],
  29796. messageSends: ["ifNotNil:", "type", "at:put:"]
  29797. }),
  29798. $globals.PackageTransport.klass);
  29799. $core.addMethod(
  29800. $core.method({
  29801. selector: "type",
  29802. protocol: 'accessing',
  29803. fn: function (){
  29804. var self=this;
  29805. return nil;
  29806. },
  29807. args: [],
  29808. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29809. referencedClasses: [],
  29810. messageSends: []
  29811. }),
  29812. $globals.PackageTransport.klass);
  29813. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29814. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29815. $core.addMethod(
  29816. $core.method({
  29817. selector: "asJSON",
  29818. protocol: 'converting',
  29819. fn: function (){
  29820. var self=this;
  29821. return $core.withContext(function($ctx1) {
  29822. var $1;
  29823. $1=(
  29824. $ctx1.supercall = true,
  29825. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJSON.apply($recv(self), []));
  29826. $ctx1.supercall = false;
  29827. $recv($1)._at_put_("amdNamespace",self._namespace());
  29828. return $recv($1)._yourself();
  29829. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29830. },
  29831. args: [],
  29832. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29833. referencedClasses: [],
  29834. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29835. }),
  29836. $globals.AmdPackageTransport);
  29837. $core.addMethod(
  29838. $core.method({
  29839. selector: "commitHandlerClass",
  29840. protocol: 'accessing',
  29841. fn: function (){
  29842. var self=this;
  29843. return $globals.AmdPackageHandler;
  29844. },
  29845. args: [],
  29846. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29847. referencedClasses: ["AmdPackageHandler"],
  29848. messageSends: []
  29849. }),
  29850. $globals.AmdPackageTransport);
  29851. $core.addMethod(
  29852. $core.method({
  29853. selector: "defaultNamespace",
  29854. protocol: 'defaults',
  29855. fn: function (){
  29856. var self=this;
  29857. return $core.withContext(function($ctx1) {
  29858. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29859. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29860. },
  29861. args: [],
  29862. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29863. referencedClasses: ["Smalltalk"],
  29864. messageSends: ["defaultAmdNamespace"]
  29865. }),
  29866. $globals.AmdPackageTransport);
  29867. $core.addMethod(
  29868. $core.method({
  29869. selector: "definition",
  29870. protocol: 'accessing',
  29871. fn: function (){
  29872. var self=this;
  29873. return $core.withContext(function($ctx1) {
  29874. var $1;
  29875. return $recv($globals.String)._streamContents_((function(stream){
  29876. return $core.withContext(function($ctx2) {
  29877. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29878. $ctx2.sendIdx["nextPutAll:"]=1;
  29879. $recv(stream)._nextPutAll_(" namespace: ");
  29880. $ctx2.sendIdx["nextPutAll:"]=2;
  29881. $1=$recv("'".__comma(self._namespace())).__comma("'");
  29882. $ctx2.sendIdx[","]=1;
  29883. return $recv(stream)._nextPutAll_($1);
  29884. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29885. }));
  29886. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29887. },
  29888. args: [],
  29889. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]",
  29890. referencedClasses: ["String"],
  29891. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29892. }),
  29893. $globals.AmdPackageTransport);
  29894. $core.addMethod(
  29895. $core.method({
  29896. selector: "namespace",
  29897. protocol: 'accessing',
  29898. fn: function (){
  29899. var self=this;
  29900. return $core.withContext(function($ctx1) {
  29901. var $1,$receiver;
  29902. $1=self["@namespace"];
  29903. if(($receiver = $1) == null || $receiver.isNil){
  29904. return self._defaultNamespace();
  29905. } else {
  29906. return $1;
  29907. }
  29908. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29909. },
  29910. args: [],
  29911. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29912. referencedClasses: [],
  29913. messageSends: ["ifNil:", "defaultNamespace"]
  29914. }),
  29915. $globals.AmdPackageTransport);
  29916. $core.addMethod(
  29917. $core.method({
  29918. selector: "namespace:",
  29919. protocol: 'accessing',
  29920. fn: function (aString){
  29921. var self=this;
  29922. self["@namespace"]=aString;
  29923. return self;
  29924. },
  29925. args: ["aString"],
  29926. source: "namespace: aString\x0a\x09namespace := aString",
  29927. referencedClasses: [],
  29928. messageSends: []
  29929. }),
  29930. $globals.AmdPackageTransport);
  29931. $core.addMethod(
  29932. $core.method({
  29933. selector: "printOn:",
  29934. protocol: 'printing',
  29935. fn: function (aStream){
  29936. var self=this;
  29937. return $core.withContext(function($ctx1) {
  29938. (
  29939. $ctx1.supercall = true,
  29940. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  29941. $ctx1.supercall = false;
  29942. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29943. $ctx1.sendIdx["nextPutAll:"]=1;
  29944. $recv(aStream)._nextPutAll_(self._namespace());
  29945. $ctx1.sendIdx["nextPutAll:"]=2;
  29946. $recv(aStream)._nextPutAll_(")");
  29947. return self;
  29948. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29949. },
  29950. args: ["aStream"],
  29951. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29952. referencedClasses: [],
  29953. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29954. }),
  29955. $globals.AmdPackageTransport);
  29956. $core.addMethod(
  29957. $core.method({
  29958. selector: "setPath:",
  29959. protocol: 'actions',
  29960. fn: function (aString){
  29961. var self=this;
  29962. return $core.withContext(function($ctx1) {
  29963. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  29964. return self;
  29965. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  29966. },
  29967. args: ["aString"],
  29968. 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}.",
  29969. referencedClasses: [],
  29970. messageSends: ["value:", "basicAt:", "namespace"]
  29971. }),
  29972. $globals.AmdPackageTransport);
  29973. $core.addMethod(
  29974. $core.method({
  29975. selector: "setupFromJson:",
  29976. protocol: 'initialization',
  29977. fn: function (anObject){
  29978. var self=this;
  29979. return $core.withContext(function($ctx1) {
  29980. self._namespace_($recv(anObject)._at_("amdNamespace"));
  29981. return self;
  29982. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  29983. },
  29984. args: ["anObject"],
  29985. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  29986. referencedClasses: [],
  29987. messageSends: ["namespace:", "at:"]
  29988. }),
  29989. $globals.AmdPackageTransport);
  29990. $core.addMethod(
  29991. $core.method({
  29992. selector: "namespace:",
  29993. protocol: 'instance creation',
  29994. fn: function (aString){
  29995. var self=this;
  29996. return $core.withContext(function($ctx1) {
  29997. var $1;
  29998. $1=self._new();
  29999. $recv($1)._namespace_(aString);
  30000. return $recv($1)._yourself();
  30001. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  30002. },
  30003. args: ["aString"],
  30004. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  30005. referencedClasses: [],
  30006. messageSends: ["namespace:", "new", "yourself"]
  30007. }),
  30008. $globals.AmdPackageTransport.klass);
  30009. $core.addMethod(
  30010. $core.method({
  30011. selector: "type",
  30012. protocol: 'accessing',
  30013. fn: function (){
  30014. var self=this;
  30015. return "amd";
  30016. },
  30017. args: [],
  30018. source: "type\x0a\x09^ 'amd'",
  30019. referencedClasses: [],
  30020. messageSends: []
  30021. }),
  30022. $globals.AmdPackageTransport.klass);
  30023. $core.addMethod(
  30024. $core.method({
  30025. selector: "commentStamp",
  30026. protocol: '*Platform-ImportExport',
  30027. fn: function (){
  30028. var self=this;
  30029. return $core.withContext(function($ctx1) {
  30030. var $1;
  30031. $1=$recv($globals.ClassCommentReader)._new();
  30032. $recv($1)._class_(self);
  30033. return $recv($1)._yourself();
  30034. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  30035. },
  30036. args: [],
  30037. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  30038. referencedClasses: ["ClassCommentReader"],
  30039. messageSends: ["class:", "new", "yourself"]
  30040. }),
  30041. $globals.Behavior);
  30042. $core.addMethod(
  30043. $core.method({
  30044. selector: "commentStamp:prior:",
  30045. protocol: '*Platform-ImportExport',
  30046. fn: function (aStamp,prior){
  30047. var self=this;
  30048. return $core.withContext(function($ctx1) {
  30049. return self._commentStamp();
  30050. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  30051. },
  30052. args: ["aStamp", "prior"],
  30053. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  30054. referencedClasses: [],
  30055. messageSends: ["commentStamp"]
  30056. }),
  30057. $globals.Behavior);
  30058. $core.addMethod(
  30059. $core.method({
  30060. selector: "methodsFor:",
  30061. protocol: '*Platform-ImportExport',
  30062. fn: function (aString){
  30063. var self=this;
  30064. return $core.withContext(function($ctx1) {
  30065. var $1;
  30066. $1=$recv($globals.ClassProtocolReader)._new();
  30067. $recv($1)._class_category_(self,aString);
  30068. return $recv($1)._yourself();
  30069. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  30070. },
  30071. args: ["aString"],
  30072. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  30073. referencedClasses: ["ClassProtocolReader"],
  30074. messageSends: ["class:category:", "new", "yourself"]
  30075. }),
  30076. $globals.Behavior);
  30077. $core.addMethod(
  30078. $core.method({
  30079. selector: "methodsFor:stamp:",
  30080. protocol: '*Platform-ImportExport',
  30081. fn: function (aString,aStamp){
  30082. var self=this;
  30083. return $core.withContext(function($ctx1) {
  30084. return self._methodsFor_(aString);
  30085. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  30086. },
  30087. args: ["aString", "aStamp"],
  30088. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  30089. referencedClasses: [],
  30090. messageSends: ["methodsFor:"]
  30091. }),
  30092. $globals.Behavior);
  30093. $core.addMethod(
  30094. $core.method({
  30095. selector: "commit",
  30096. protocol: '*Platform-ImportExport',
  30097. fn: function (){
  30098. var self=this;
  30099. return $core.withContext(function($ctx1) {
  30100. return $recv(self._transport())._commit();
  30101. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  30102. },
  30103. args: [],
  30104. source: "commit\x0a\x09^ self transport commit",
  30105. referencedClasses: [],
  30106. messageSends: ["commit", "transport"]
  30107. }),
  30108. $globals.Package);
  30109. $core.addMethod(
  30110. $core.method({
  30111. selector: "load",
  30112. protocol: '*Platform-ImportExport',
  30113. fn: function (){
  30114. var self=this;
  30115. return $core.withContext(function($ctx1) {
  30116. return $recv(self._transport())._load();
  30117. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  30118. },
  30119. args: [],
  30120. source: "load\x0a\x09^ self transport load",
  30121. referencedClasses: [],
  30122. messageSends: ["load", "transport"]
  30123. }),
  30124. $globals.Package);
  30125. $core.addMethod(
  30126. $core.method({
  30127. selector: "loadFromNamespace:",
  30128. protocol: '*Platform-ImportExport',
  30129. fn: function (aString){
  30130. var self=this;
  30131. return $core.withContext(function($ctx1) {
  30132. var $1;
  30133. $1=self._transport();
  30134. $recv($1)._namespace_(aString);
  30135. return $recv($1)._load();
  30136. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  30137. },
  30138. args: ["aString"],
  30139. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  30140. referencedClasses: [],
  30141. messageSends: ["namespace:", "transport", "load"]
  30142. }),
  30143. $globals.Package);
  30144. $core.addMethod(
  30145. $core.method({
  30146. selector: "load:",
  30147. protocol: '*Platform-ImportExport',
  30148. fn: function (aPackageName){
  30149. var self=this;
  30150. return $core.withContext(function($ctx1) {
  30151. $recv(self._named_(aPackageName))._load();
  30152. return self;
  30153. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  30154. },
  30155. args: ["aPackageName"],
  30156. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  30157. referencedClasses: [],
  30158. messageSends: ["load", "named:"]
  30159. }),
  30160. $globals.Package.klass);
  30161. $core.addMethod(
  30162. $core.method({
  30163. selector: "load:fromNamespace:",
  30164. protocol: '*Platform-ImportExport',
  30165. fn: function (aPackageName,aString){
  30166. var self=this;
  30167. return $core.withContext(function($ctx1) {
  30168. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  30169. return self;
  30170. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  30171. },
  30172. args: ["aPackageName", "aString"],
  30173. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  30174. referencedClasses: [],
  30175. messageSends: ["loadFromNamespace:", "named:"]
  30176. }),
  30177. $globals.Package.klass);
  30178. });
  30179. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  30180. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  30181. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30182. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  30183. $core.addPackage('Compiler-Core');
  30184. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  30185. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30186. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  30187. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  30188. $core.addMethod(
  30189. $core.method({
  30190. selector: "compileNode:",
  30191. protocol: 'compiling',
  30192. fn: function (aNode){
  30193. var self=this;
  30194. return $core.withContext(function($ctx1) {
  30195. return $recv(self._transformers())._inject_into_(aNode,(function(input,transformer){
  30196. return $core.withContext(function($ctx2) {
  30197. return $recv(transformer)._value_(input);
  30198. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  30199. }));
  30200. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  30201. },
  30202. args: ["aNode"],
  30203. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  30204. referencedClasses: [],
  30205. messageSends: ["inject:into:", "transformers", "value:"]
  30206. }),
  30207. $globals.AbstractCodeGenerator);
  30208. $core.addMethod(
  30209. $core.method({
  30210. selector: "currentClass",
  30211. protocol: 'accessing',
  30212. fn: function (){
  30213. var self=this;
  30214. return self["@currentClass"];
  30215. },
  30216. args: [],
  30217. source: "currentClass\x0a\x09^ currentClass",
  30218. referencedClasses: [],
  30219. messageSends: []
  30220. }),
  30221. $globals.AbstractCodeGenerator);
  30222. $core.addMethod(
  30223. $core.method({
  30224. selector: "currentClass:",
  30225. protocol: 'accessing',
  30226. fn: function (aClass){
  30227. var self=this;
  30228. self["@currentClass"]=aClass;
  30229. return self;
  30230. },
  30231. args: ["aClass"],
  30232. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30233. referencedClasses: [],
  30234. messageSends: []
  30235. }),
  30236. $globals.AbstractCodeGenerator);
  30237. $core.addMethod(
  30238. $core.method({
  30239. selector: "currentPackage",
  30240. protocol: 'accessing',
  30241. fn: function (){
  30242. var self=this;
  30243. return self["@currentPackage"];
  30244. },
  30245. args: [],
  30246. source: "currentPackage\x0a\x09^ currentPackage",
  30247. referencedClasses: [],
  30248. messageSends: []
  30249. }),
  30250. $globals.AbstractCodeGenerator);
  30251. $core.addMethod(
  30252. $core.method({
  30253. selector: "currentPackage:",
  30254. protocol: 'accessing',
  30255. fn: function (anObject){
  30256. var self=this;
  30257. self["@currentPackage"]=anObject;
  30258. return self;
  30259. },
  30260. args: ["anObject"],
  30261. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30262. referencedClasses: [],
  30263. messageSends: []
  30264. }),
  30265. $globals.AbstractCodeGenerator);
  30266. $core.addMethod(
  30267. $core.method({
  30268. selector: "pseudoVariables",
  30269. protocol: 'accessing',
  30270. fn: function (){
  30271. var self=this;
  30272. return $core.withContext(function($ctx1) {
  30273. return $recv($globals.Smalltalk)._pseudoVariableNames();
  30274. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  30275. },
  30276. args: [],
  30277. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30278. referencedClasses: ["Smalltalk"],
  30279. messageSends: ["pseudoVariableNames"]
  30280. }),
  30281. $globals.AbstractCodeGenerator);
  30282. $core.addMethod(
  30283. $core.method({
  30284. selector: "source",
  30285. protocol: 'accessing',
  30286. fn: function (){
  30287. var self=this;
  30288. return $core.withContext(function($ctx1) {
  30289. var $1,$receiver;
  30290. $1=self["@source"];
  30291. if(($receiver = $1) == null || $receiver.isNil){
  30292. return "";
  30293. } else {
  30294. return $1;
  30295. }
  30296. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  30297. },
  30298. args: [],
  30299. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30300. referencedClasses: [],
  30301. messageSends: ["ifNil:"]
  30302. }),
  30303. $globals.AbstractCodeGenerator);
  30304. $core.addMethod(
  30305. $core.method({
  30306. selector: "source:",
  30307. protocol: 'accessing',
  30308. fn: function (aString){
  30309. var self=this;
  30310. self["@source"]=aString;
  30311. return self;
  30312. },
  30313. args: ["aString"],
  30314. source: "source: aString\x0a\x09source := aString",
  30315. referencedClasses: [],
  30316. messageSends: []
  30317. }),
  30318. $globals.AbstractCodeGenerator);
  30319. $core.addMethod(
  30320. $core.method({
  30321. selector: "transformers",
  30322. protocol: 'compiling',
  30323. fn: function (){
  30324. var self=this;
  30325. var dict;
  30326. return $core.withContext(function($ctx1) {
  30327. dict=self._transformersDictionary();
  30328. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  30329. return $core.withContext(function($ctx2) {
  30330. return $recv(dict)._at_(each);
  30331. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30332. }));
  30333. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  30334. },
  30335. args: [],
  30336. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  30337. referencedClasses: [],
  30338. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  30339. }),
  30340. $globals.AbstractCodeGenerator);
  30341. $core.addMethod(
  30342. $core.method({
  30343. selector: "transformersDictionary",
  30344. protocol: 'compiling',
  30345. fn: function (){
  30346. var self=this;
  30347. return $core.withContext(function($ctx1) {
  30348. self._subclassResponsibility();
  30349. return self;
  30350. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  30351. },
  30352. args: [],
  30353. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  30354. referencedClasses: [],
  30355. messageSends: ["subclassResponsibility"]
  30356. }),
  30357. $globals.AbstractCodeGenerator);
  30358. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30359. $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.";
  30360. $core.addMethod(
  30361. $core.method({
  30362. selector: "irTranslator",
  30363. protocol: 'compiling',
  30364. fn: function (){
  30365. var self=this;
  30366. return $core.withContext(function($ctx1) {
  30367. var $1;
  30368. $1=$recv(self._irTranslatorClass())._new();
  30369. $recv($1)._currentClass_(self._currentClass());
  30370. return $recv($1)._yourself();
  30371. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  30372. },
  30373. args: [],
  30374. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  30375. referencedClasses: [],
  30376. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  30377. }),
  30378. $globals.CodeGenerator);
  30379. $core.addMethod(
  30380. $core.method({
  30381. selector: "irTranslatorClass",
  30382. protocol: 'compiling',
  30383. fn: function (){
  30384. var self=this;
  30385. return $globals.IRJSTranslator;
  30386. },
  30387. args: [],
  30388. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  30389. referencedClasses: ["IRJSTranslator"],
  30390. messageSends: []
  30391. }),
  30392. $globals.CodeGenerator);
  30393. $core.addMethod(
  30394. $core.method({
  30395. selector: "semanticAnalyzer",
  30396. protocol: 'compiling',
  30397. fn: function (){
  30398. var self=this;
  30399. return $core.withContext(function($ctx1) {
  30400. var $1;
  30401. $1=$recv($globals.SemanticAnalyzer)._on_(self._currentClass());
  30402. $recv($1)._thePackage_(self._currentPackage());
  30403. return $recv($1)._yourself();
  30404. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  30405. },
  30406. args: [],
  30407. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  30408. referencedClasses: ["SemanticAnalyzer"],
  30409. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  30410. }),
  30411. $globals.CodeGenerator);
  30412. $core.addMethod(
  30413. $core.method({
  30414. selector: "transformersDictionary",
  30415. protocol: 'compiling',
  30416. fn: function (){
  30417. var self=this;
  30418. return $core.withContext(function($ctx1) {
  30419. var $1;
  30420. $1=$recv($globals.Dictionary)._new();
  30421. $recv($1)._at_put_("2000-semantic",self._semanticAnalyzer());
  30422. $ctx1.sendIdx["at:put:"]=1;
  30423. $recv($1)._at_put_("5000-astToIr",self._translator());
  30424. $ctx1.sendIdx["at:put:"]=2;
  30425. $recv($1)._at_put_("8000-irToJs",self._irTranslator());
  30426. return $recv($1)._yourself();
  30427. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  30428. },
  30429. args: [],
  30430. source: "transformersDictionary\x0a\x09^ Dictionary new\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself",
  30431. referencedClasses: ["Dictionary"],
  30432. messageSends: ["at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  30433. }),
  30434. $globals.CodeGenerator);
  30435. $core.addMethod(
  30436. $core.method({
  30437. selector: "translator",
  30438. protocol: 'compiling',
  30439. fn: function (){
  30440. var self=this;
  30441. return $core.withContext(function($ctx1) {
  30442. var $1;
  30443. $1=$recv($globals.IRASTTranslator)._new();
  30444. $recv($1)._source_(self._source());
  30445. $recv($1)._theClass_(self._currentClass());
  30446. return $recv($1)._yourself();
  30447. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  30448. },
  30449. args: [],
  30450. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30451. referencedClasses: ["IRASTTranslator"],
  30452. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30453. }),
  30454. $globals.CodeGenerator);
  30455. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30456. $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`";
  30457. $core.addMethod(
  30458. $core.method({
  30459. selector: "codeGeneratorClass",
  30460. protocol: 'accessing',
  30461. fn: function (){
  30462. var self=this;
  30463. return $core.withContext(function($ctx1) {
  30464. var $1,$receiver;
  30465. $1=self["@codeGeneratorClass"];
  30466. if(($receiver = $1) == null || $receiver.isNil){
  30467. return $globals.InliningCodeGenerator;
  30468. } else {
  30469. return $1;
  30470. }
  30471. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  30472. },
  30473. args: [],
  30474. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30475. referencedClasses: ["InliningCodeGenerator"],
  30476. messageSends: ["ifNil:"]
  30477. }),
  30478. $globals.Compiler);
  30479. $core.addMethod(
  30480. $core.method({
  30481. selector: "codeGeneratorClass:",
  30482. protocol: 'accessing',
  30483. fn: function (aClass){
  30484. var self=this;
  30485. self["@codeGeneratorClass"]=aClass;
  30486. return self;
  30487. },
  30488. args: ["aClass"],
  30489. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30490. referencedClasses: [],
  30491. messageSends: []
  30492. }),
  30493. $globals.Compiler);
  30494. $core.addMethod(
  30495. $core.method({
  30496. selector: "compile:forClass:protocol:",
  30497. protocol: 'compiling',
  30498. fn: function (aString,aClass,anotherString){
  30499. var self=this;
  30500. return $core.withContext(function($ctx1) {
  30501. self._source_(aString);
  30502. return self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30503. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30504. },
  30505. args: ["aString", "aClass", "anotherString"],
  30506. 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)",
  30507. referencedClasses: [],
  30508. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30509. }),
  30510. $globals.Compiler);
  30511. $core.addMethod(
  30512. $core.method({
  30513. selector: "compileExpression:on:",
  30514. protocol: 'compiling',
  30515. fn: function (aString,anObject){
  30516. var self=this;
  30517. return $core.withContext(function($ctx1) {
  30518. var $1;
  30519. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30520. $ctx1.sendIdx[","]=1;
  30521. return self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  30522. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30523. },
  30524. args: ["aString", "anObject"],
  30525. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30526. referencedClasses: [],
  30527. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30528. }),
  30529. $globals.Compiler);
  30530. $core.addMethod(
  30531. $core.method({
  30532. selector: "compileNode:",
  30533. protocol: 'compiling',
  30534. fn: function (aNode){
  30535. var self=this;
  30536. var generator,result;
  30537. return $core.withContext(function($ctx1) {
  30538. var $1;
  30539. generator=$recv(self._codeGeneratorClass())._new();
  30540. $1=generator;
  30541. $recv($1)._source_(self._source());
  30542. $recv($1)._currentClass_(self._currentClass());
  30543. $recv($1)._currentPackage_(self._currentPackage());
  30544. result=$recv(generator)._compileNode_(aNode);
  30545. self._unknownVariables_([]);
  30546. return result;
  30547. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30548. },
  30549. args: ["aNode"],
  30550. 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",
  30551. referencedClasses: [],
  30552. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30553. }),
  30554. $globals.Compiler);
  30555. $core.addMethod(
  30556. $core.method({
  30557. selector: "compileNode:forClass:package:",
  30558. protocol: 'compiling',
  30559. fn: function (aNode,aClass,aPackage){
  30560. var self=this;
  30561. return $core.withContext(function($ctx1) {
  30562. self._currentClass_(aClass);
  30563. self._currentPackage_(aPackage);
  30564. return self._compileNode_(aNode);
  30565. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30566. },
  30567. args: ["aNode", "aClass", "aPackage"],
  30568. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30569. referencedClasses: [],
  30570. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30571. }),
  30572. $globals.Compiler);
  30573. $core.addMethod(
  30574. $core.method({
  30575. selector: "currentClass",
  30576. protocol: 'accessing',
  30577. fn: function (){
  30578. var self=this;
  30579. return self["@currentClass"];
  30580. },
  30581. args: [],
  30582. source: "currentClass\x0a\x09^ currentClass",
  30583. referencedClasses: [],
  30584. messageSends: []
  30585. }),
  30586. $globals.Compiler);
  30587. $core.addMethod(
  30588. $core.method({
  30589. selector: "currentClass:",
  30590. protocol: 'accessing',
  30591. fn: function (aClass){
  30592. var self=this;
  30593. self["@currentClass"]=aClass;
  30594. return self;
  30595. },
  30596. args: ["aClass"],
  30597. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30598. referencedClasses: [],
  30599. messageSends: []
  30600. }),
  30601. $globals.Compiler);
  30602. $core.addMethod(
  30603. $core.method({
  30604. selector: "currentPackage",
  30605. protocol: 'accessing',
  30606. fn: function (){
  30607. var self=this;
  30608. return self["@currentPackage"];
  30609. },
  30610. args: [],
  30611. source: "currentPackage\x0a\x09^ currentPackage",
  30612. referencedClasses: [],
  30613. messageSends: []
  30614. }),
  30615. $globals.Compiler);
  30616. $core.addMethod(
  30617. $core.method({
  30618. selector: "currentPackage:",
  30619. protocol: 'accessing',
  30620. fn: function (anObject){
  30621. var self=this;
  30622. self["@currentPackage"]=anObject;
  30623. return self;
  30624. },
  30625. args: ["anObject"],
  30626. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30627. referencedClasses: [],
  30628. messageSends: []
  30629. }),
  30630. $globals.Compiler);
  30631. $core.addMethod(
  30632. $core.method({
  30633. selector: "eval:",
  30634. protocol: 'compiling',
  30635. fn: function (aString){
  30636. var self=this;
  30637. return $core.withContext(function($ctx1) {
  30638. return eval(aString);
  30639. return self;
  30640. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30641. },
  30642. args: ["aString"],
  30643. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  30644. referencedClasses: [],
  30645. messageSends: []
  30646. }),
  30647. $globals.Compiler);
  30648. $core.addMethod(
  30649. $core.method({
  30650. selector: "eval:forPackage:",
  30651. protocol: 'compiling',
  30652. fn: function (aString,aPackage){
  30653. var self=this;
  30654. return $core.withContext(function($ctx1) {
  30655. return aPackage && aPackage.innerEval
  30656. ? aPackage.innerEval(aString)
  30657. : eval(aString);
  30658. return self;
  30659. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30660. },
  30661. args: ["aString", "aPackage"],
  30662. source: "eval: aString forPackage: aPackage\x0a\x09<inlineJS: 'return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)'>",
  30663. referencedClasses: [],
  30664. messageSends: []
  30665. }),
  30666. $globals.Compiler);
  30667. $core.addMethod(
  30668. $core.method({
  30669. selector: "evaluateExpression:",
  30670. protocol: 'compiling',
  30671. fn: function (aString){
  30672. var self=this;
  30673. return $core.withContext(function($ctx1) {
  30674. return self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  30675. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30676. },
  30677. args: ["aString"],
  30678. 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",
  30679. referencedClasses: ["DoIt"],
  30680. messageSends: ["evaluateExpression:on:", "new"]
  30681. }),
  30682. $globals.Compiler);
  30683. $core.addMethod(
  30684. $core.method({
  30685. selector: "evaluateExpression:on:",
  30686. protocol: 'compiling',
  30687. fn: function (aString,anObject){
  30688. var self=this;
  30689. var result,method;
  30690. return $core.withContext(function($ctx1) {
  30691. var $1;
  30692. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30693. $recv(method)._protocol_("**xxxDoIt");
  30694. $1=$recv(anObject)._class();
  30695. $ctx1.sendIdx["class"]=1;
  30696. $recv($1)._addCompiledMethod_(method);
  30697. result=$recv(anObject)._xxxDoIt();
  30698. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30699. return result;
  30700. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30701. },
  30702. args: ["aString", "anObject"],
  30703. 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",
  30704. referencedClasses: [],
  30705. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30706. }),
  30707. $globals.Compiler);
  30708. $core.addMethod(
  30709. $core.method({
  30710. selector: "install:forClass:protocol:",
  30711. protocol: 'compiling',
  30712. fn: function (aString,aBehavior,anotherString){
  30713. var self=this;
  30714. var compiledMethod;
  30715. return $core.withContext(function($ctx1) {
  30716. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30717. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30718. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30719. },
  30720. args: ["aString", "aBehavior", "anotherString"],
  30721. 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",
  30722. referencedClasses: ["ClassBuilder"],
  30723. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30724. }),
  30725. $globals.Compiler);
  30726. $core.addMethod(
  30727. $core.method({
  30728. selector: "parse:",
  30729. protocol: 'compiling',
  30730. fn: function (aString){
  30731. var self=this;
  30732. return $core.withContext(function($ctx1) {
  30733. return $recv($globals.Smalltalk)._parse_(aString);
  30734. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30735. },
  30736. args: ["aString"],
  30737. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30738. referencedClasses: ["Smalltalk"],
  30739. messageSends: ["parse:"]
  30740. }),
  30741. $globals.Compiler);
  30742. $core.addMethod(
  30743. $core.method({
  30744. selector: "parseExpression:",
  30745. protocol: 'compiling',
  30746. fn: function (aString){
  30747. var self=this;
  30748. return $core.withContext(function($ctx1) {
  30749. var $1;
  30750. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30751. $ctx1.sendIdx[","]=1;
  30752. return self._parse_($1);
  30753. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30754. },
  30755. args: ["aString"],
  30756. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30757. referencedClasses: [],
  30758. messageSends: ["parse:", ","]
  30759. }),
  30760. $globals.Compiler);
  30761. $core.addMethod(
  30762. $core.method({
  30763. selector: "recompile:",
  30764. protocol: 'compiling',
  30765. fn: function (aClass){
  30766. var self=this;
  30767. return $core.withContext(function($ctx1) {
  30768. var $1;
  30769. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30770. return $core.withContext(function($ctx2) {
  30771. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30772. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30773. }),"Recompiling ".__comma($recv(aClass)._name()));
  30774. $1=$recv(aClass)._isMetaclass();
  30775. if(!$core.assert($1)){
  30776. self._recompile_($recv(aClass)._class());
  30777. }
  30778. return self;
  30779. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30780. },
  30781. args: ["aClass"],
  30782. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \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 isMetaclass ifFalse: [ self recompile: aClass class ]",
  30783. referencedClasses: [],
  30784. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30785. }),
  30786. $globals.Compiler);
  30787. $core.addMethod(
  30788. $core.method({
  30789. selector: "recompileAll",
  30790. protocol: 'compiling',
  30791. fn: function (){
  30792. var self=this;
  30793. return $core.withContext(function($ctx1) {
  30794. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  30795. return $core.withContext(function($ctx2) {
  30796. return self._recompile_(each);
  30797. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30798. }),"Compiling all classes...");
  30799. return self;
  30800. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30801. },
  30802. args: [],
  30803. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30804. referencedClasses: ["Smalltalk"],
  30805. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30806. }),
  30807. $globals.Compiler);
  30808. $core.addMethod(
  30809. $core.method({
  30810. selector: "source",
  30811. protocol: 'accessing',
  30812. fn: function (){
  30813. var self=this;
  30814. return $core.withContext(function($ctx1) {
  30815. var $1,$receiver;
  30816. $1=self["@source"];
  30817. if(($receiver = $1) == null || $receiver.isNil){
  30818. return "";
  30819. } else {
  30820. return $1;
  30821. }
  30822. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30823. },
  30824. args: [],
  30825. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30826. referencedClasses: [],
  30827. messageSends: ["ifNil:"]
  30828. }),
  30829. $globals.Compiler);
  30830. $core.addMethod(
  30831. $core.method({
  30832. selector: "source:",
  30833. protocol: 'accessing',
  30834. fn: function (aString){
  30835. var self=this;
  30836. self["@source"]=aString;
  30837. return self;
  30838. },
  30839. args: ["aString"],
  30840. source: "source: aString\x0a\x09source := aString",
  30841. referencedClasses: [],
  30842. messageSends: []
  30843. }),
  30844. $globals.Compiler);
  30845. $core.addMethod(
  30846. $core.method({
  30847. selector: "unknownVariables",
  30848. protocol: 'accessing',
  30849. fn: function (){
  30850. var self=this;
  30851. return self["@unknownVariables"];
  30852. },
  30853. args: [],
  30854. source: "unknownVariables\x0a\x09^ unknownVariables",
  30855. referencedClasses: [],
  30856. messageSends: []
  30857. }),
  30858. $globals.Compiler);
  30859. $core.addMethod(
  30860. $core.method({
  30861. selector: "unknownVariables:",
  30862. protocol: 'accessing',
  30863. fn: function (aCollection){
  30864. var self=this;
  30865. self["@unknownVariables"]=aCollection;
  30866. return self;
  30867. },
  30868. args: ["aCollection"],
  30869. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30870. referencedClasses: [],
  30871. messageSends: []
  30872. }),
  30873. $globals.Compiler);
  30874. $core.addMethod(
  30875. $core.method({
  30876. selector: "recompile:",
  30877. protocol: 'compiling',
  30878. fn: function (aClass){
  30879. var self=this;
  30880. return $core.withContext(function($ctx1) {
  30881. $recv(self._new())._recompile_(aClass);
  30882. return self;
  30883. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30884. },
  30885. args: ["aClass"],
  30886. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30887. referencedClasses: [],
  30888. messageSends: ["recompile:", "new"]
  30889. }),
  30890. $globals.Compiler.klass);
  30891. $core.addMethod(
  30892. $core.method({
  30893. selector: "recompileAll",
  30894. protocol: 'compiling',
  30895. fn: function (){
  30896. var self=this;
  30897. return $core.withContext(function($ctx1) {
  30898. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  30899. return $core.withContext(function($ctx2) {
  30900. return self._recompile_(each);
  30901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30902. }));
  30903. return self;
  30904. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30905. },
  30906. args: [],
  30907. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30908. referencedClasses: ["Smalltalk"],
  30909. messageSends: ["do:", "classes", "recompile:"]
  30910. }),
  30911. $globals.Compiler.klass);
  30912. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Core');
  30913. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  30914. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30915. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30916. $core.addClass('Evaluator', $globals.Object, [], 'Compiler-Core');
  30917. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30918. $core.addMethod(
  30919. $core.method({
  30920. selector: "evaluate:context:",
  30921. protocol: 'evaluating',
  30922. fn: function (aString,aContext){
  30923. var self=this;
  30924. var compiler,ast;
  30925. return $core.withContext(function($ctx1) {
  30926. var $1;
  30927. var $early={};
  30928. try {
  30929. compiler=$recv($globals.Compiler)._new();
  30930. $recv((function(){
  30931. return $core.withContext(function($ctx2) {
  30932. ast=$recv(compiler)._parseExpression_(aString);
  30933. return ast;
  30934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30935. }))._on_do_($globals.Error,(function(ex){
  30936. return $core.withContext(function($ctx2) {
  30937. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  30938. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30939. }));
  30940. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  30941. $recv($1)._context_(aContext);
  30942. $recv($1)._visit_(ast);
  30943. return $recv(aContext)._evaluateNode_(ast);
  30944. }
  30945. catch(e) {if(e===$early)return e[0]; throw e}
  30946. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30947. },
  30948. args: ["aString", "aContext"],
  30949. 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",
  30950. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  30951. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  30952. }),
  30953. $globals.Evaluator);
  30954. $core.addMethod(
  30955. $core.method({
  30956. selector: "evaluate:for:",
  30957. protocol: 'evaluating',
  30958. fn: function (aString,anObject){
  30959. var self=this;
  30960. return $core.withContext(function($ctx1) {
  30961. return $recv(anObject)._evaluate_on_(aString,self);
  30962. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  30963. },
  30964. args: ["aString", "anObject"],
  30965. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  30966. referencedClasses: [],
  30967. messageSends: ["evaluate:on:"]
  30968. }),
  30969. $globals.Evaluator);
  30970. $core.addMethod(
  30971. $core.method({
  30972. selector: "evaluate:receiver:",
  30973. protocol: 'evaluating',
  30974. fn: function (aString,anObject){
  30975. var self=this;
  30976. var compiler;
  30977. return $core.withContext(function($ctx1) {
  30978. var $early={};
  30979. try {
  30980. compiler=$recv($globals.Compiler)._new();
  30981. $recv((function(){
  30982. return $core.withContext(function($ctx2) {
  30983. return $recv(compiler)._parseExpression_(aString);
  30984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30985. }))._on_do_($globals.Error,(function(ex){
  30986. return $core.withContext(function($ctx2) {
  30987. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  30988. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30989. }));
  30990. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  30991. }
  30992. catch(e) {if(e===$early)return e[0]; throw e}
  30993. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  30994. },
  30995. args: ["aString", "anObject"],
  30996. 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",
  30997. referencedClasses: ["Compiler", "Error", "Terminal"],
  30998. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  30999. }),
  31000. $globals.Evaluator);
  31001. $core.addMethod(
  31002. $core.method({
  31003. selector: "evaluate:for:",
  31004. protocol: 'instance creation',
  31005. fn: function (aString,anObject){
  31006. var self=this;
  31007. return $core.withContext(function($ctx1) {
  31008. return $recv(self._new())._evaluate_for_(aString,anObject);
  31009. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  31010. },
  31011. args: ["aString", "anObject"],
  31012. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  31013. referencedClasses: [],
  31014. messageSends: ["evaluate:for:", "new"]
  31015. }),
  31016. $globals.Evaluator.klass);
  31017. $core.addMethod(
  31018. $core.method({
  31019. selector: "asVariableName",
  31020. protocol: '*Compiler-Core',
  31021. fn: function (){
  31022. var self=this;
  31023. return $core.withContext(function($ctx1) {
  31024. var $1;
  31025. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  31026. if($core.assert($1)){
  31027. return self.__comma("_");
  31028. } else {
  31029. return self;
  31030. }
  31031. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  31032. },
  31033. args: [],
  31034. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  31035. referencedClasses: ["Smalltalk"],
  31036. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  31037. }),
  31038. $globals.String);
  31039. });
  31040. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods"], function($boot){"use strict";
  31041. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  31042. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  31043. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  31044. $core.addPackage('Compiler-AST');
  31045. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  31046. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  31047. $core.addClass('ASTNode', $globals.DagParentNode, ['parent', 'position', 'source', 'shouldBeAliased'], 'Compiler-AST');
  31048. $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.";
  31049. $core.addMethod(
  31050. $core.method({
  31051. selector: "inPosition:",
  31052. protocol: 'testing',
  31053. fn: function (aPoint){
  31054. var self=this;
  31055. return $core.withContext(function($ctx1) {
  31056. return $recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  31057. return $core.withContext(function($ctx2) {
  31058. return $recv(self._positionEnd()).__gt_eq(aPoint);
  31059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31060. }));
  31061. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  31062. },
  31063. args: ["aPoint"],
  31064. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  31065. referencedClasses: [],
  31066. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  31067. }),
  31068. $globals.ASTNode);
  31069. $core.addMethod(
  31070. $core.method({
  31071. selector: "isAssignmentNode",
  31072. protocol: 'testing',
  31073. fn: function (){
  31074. var self=this;
  31075. return false;
  31076. },
  31077. args: [],
  31078. source: "isAssignmentNode\x0a\x09^ false",
  31079. referencedClasses: [],
  31080. messageSends: []
  31081. }),
  31082. $globals.ASTNode);
  31083. $core.addMethod(
  31084. $core.method({
  31085. selector: "isBlockNode",
  31086. protocol: 'testing',
  31087. fn: function (){
  31088. var self=this;
  31089. return false;
  31090. },
  31091. args: [],
  31092. source: "isBlockNode\x0a\x09^ false",
  31093. referencedClasses: [],
  31094. messageSends: []
  31095. }),
  31096. $globals.ASTNode);
  31097. $core.addMethod(
  31098. $core.method({
  31099. selector: "isBlockSequenceNode",
  31100. protocol: 'testing',
  31101. fn: function (){
  31102. var self=this;
  31103. return false;
  31104. },
  31105. args: [],
  31106. source: "isBlockSequenceNode\x0a\x09^ false",
  31107. referencedClasses: [],
  31108. messageSends: []
  31109. }),
  31110. $globals.ASTNode);
  31111. $core.addMethod(
  31112. $core.method({
  31113. selector: "isCascadeNode",
  31114. protocol: 'testing',
  31115. fn: function (){
  31116. var self=this;
  31117. return false;
  31118. },
  31119. args: [],
  31120. source: "isCascadeNode\x0a\x09^ false",
  31121. referencedClasses: [],
  31122. messageSends: []
  31123. }),
  31124. $globals.ASTNode);
  31125. $core.addMethod(
  31126. $core.method({
  31127. selector: "isImmutable",
  31128. protocol: 'testing',
  31129. fn: function (){
  31130. var self=this;
  31131. return false;
  31132. },
  31133. args: [],
  31134. source: "isImmutable\x0a\x09^ false",
  31135. referencedClasses: [],
  31136. messageSends: []
  31137. }),
  31138. $globals.ASTNode);
  31139. $core.addMethod(
  31140. $core.method({
  31141. selector: "isJSStatementNode",
  31142. protocol: 'testing',
  31143. fn: function (){
  31144. var self=this;
  31145. return false;
  31146. },
  31147. args: [],
  31148. source: "isJSStatementNode\x0a\x09^ false",
  31149. referencedClasses: [],
  31150. messageSends: []
  31151. }),
  31152. $globals.ASTNode);
  31153. $core.addMethod(
  31154. $core.method({
  31155. selector: "isNavigationNode",
  31156. protocol: 'testing',
  31157. fn: function (){
  31158. var self=this;
  31159. return false;
  31160. },
  31161. args: [],
  31162. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  31163. referencedClasses: [],
  31164. messageSends: []
  31165. }),
  31166. $globals.ASTNode);
  31167. $core.addMethod(
  31168. $core.method({
  31169. selector: "isReturnNode",
  31170. protocol: 'testing',
  31171. fn: function (){
  31172. var self=this;
  31173. return false;
  31174. },
  31175. args: [],
  31176. source: "isReturnNode\x0a\x09^ false",
  31177. referencedClasses: [],
  31178. messageSends: []
  31179. }),
  31180. $globals.ASTNode);
  31181. $core.addMethod(
  31182. $core.method({
  31183. selector: "isSendNode",
  31184. protocol: 'testing',
  31185. fn: function (){
  31186. var self=this;
  31187. return false;
  31188. },
  31189. args: [],
  31190. source: "isSendNode\x0a\x09^ false",
  31191. referencedClasses: [],
  31192. messageSends: []
  31193. }),
  31194. $globals.ASTNode);
  31195. $core.addMethod(
  31196. $core.method({
  31197. selector: "isSequenceNode",
  31198. protocol: 'testing',
  31199. fn: function (){
  31200. var self=this;
  31201. return false;
  31202. },
  31203. args: [],
  31204. source: "isSequenceNode\x0a\x09^ false",
  31205. referencedClasses: [],
  31206. messageSends: []
  31207. }),
  31208. $globals.ASTNode);
  31209. $core.addMethod(
  31210. $core.method({
  31211. selector: "isSuperKeyword",
  31212. protocol: 'testing',
  31213. fn: function (){
  31214. var self=this;
  31215. return false;
  31216. },
  31217. args: [],
  31218. source: "isSuperKeyword\x0a\x09^ false",
  31219. referencedClasses: [],
  31220. messageSends: []
  31221. }),
  31222. $globals.ASTNode);
  31223. $core.addMethod(
  31224. $core.method({
  31225. selector: "isValueNode",
  31226. protocol: 'testing',
  31227. fn: function (){
  31228. var self=this;
  31229. return false;
  31230. },
  31231. args: [],
  31232. source: "isValueNode\x0a\x09^ false",
  31233. referencedClasses: [],
  31234. messageSends: []
  31235. }),
  31236. $globals.ASTNode);
  31237. $core.addMethod(
  31238. $core.method({
  31239. selector: "isVariableNode",
  31240. protocol: 'testing',
  31241. fn: function (){
  31242. var self=this;
  31243. return false;
  31244. },
  31245. args: [],
  31246. source: "isVariableNode\x0a\x09^ false",
  31247. referencedClasses: [],
  31248. messageSends: []
  31249. }),
  31250. $globals.ASTNode);
  31251. $core.addMethod(
  31252. $core.method({
  31253. selector: "location:",
  31254. protocol: 'accessing',
  31255. fn: function (aLocation){
  31256. var self=this;
  31257. return $core.withContext(function($ctx1) {
  31258. var $3,$2,$1;
  31259. $3=$recv(aLocation)._start();
  31260. $ctx1.sendIdx["start"]=1;
  31261. $2=$recv($3)._line();
  31262. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  31263. self._position_($1);
  31264. return self;
  31265. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  31266. },
  31267. args: ["aLocation"],
  31268. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  31269. referencedClasses: [],
  31270. messageSends: ["position:", "@", "line", "start", "column"]
  31271. }),
  31272. $globals.ASTNode);
  31273. $core.addMethod(
  31274. $core.method({
  31275. selector: "method",
  31276. protocol: 'accessing',
  31277. fn: function (){
  31278. var self=this;
  31279. return $core.withContext(function($ctx1) {
  31280. var $1,$receiver;
  31281. $1=self._parent();
  31282. if(($receiver = $1) == null || $receiver.isNil){
  31283. return $1;
  31284. } else {
  31285. var node;
  31286. node=$receiver;
  31287. return $recv(node)._method();
  31288. }
  31289. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  31290. },
  31291. args: [],
  31292. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  31293. referencedClasses: [],
  31294. messageSends: ["ifNotNil:", "parent", "method"]
  31295. }),
  31296. $globals.ASTNode);
  31297. $core.addMethod(
  31298. $core.method({
  31299. selector: "navigationNodeAt:ifAbsent:",
  31300. protocol: 'accessing',
  31301. fn: function (aPoint,aBlock){
  31302. var self=this;
  31303. var children;
  31304. return $core.withContext(function($ctx1) {
  31305. var $2,$1;
  31306. var $early={};
  31307. try {
  31308. children=$recv(self._allDagChildren())._select_((function(each){
  31309. return $core.withContext(function($ctx2) {
  31310. return $recv($recv(each)._isNavigationNode())._and_((function(){
  31311. return $core.withContext(function($ctx3) {
  31312. return $recv(each)._inPosition_(aPoint);
  31313. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31314. }));
  31315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31316. }));
  31317. $recv(children)._ifEmpty_((function(){
  31318. return $core.withContext(function($ctx2) {
  31319. throw $early=[$recv(aBlock)._value()];
  31320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31321. }));
  31322. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  31323. return $core.withContext(function($ctx2) {
  31324. $2=$recv(a)._positionStart();
  31325. $ctx2.sendIdx["positionStart"]=1;
  31326. $1=$recv($2)._dist_(aPoint);
  31327. $ctx2.sendIdx["dist:"]=1;
  31328. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  31329. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  31330. })))._first();
  31331. }
  31332. catch(e) {if(e===$early)return e[0]; throw e}
  31333. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  31334. },
  31335. args: ["aPoint", "aBlock"],
  31336. 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",
  31337. referencedClasses: [],
  31338. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  31339. }),
  31340. $globals.ASTNode);
  31341. $core.addMethod(
  31342. $core.method({
  31343. selector: "parent",
  31344. protocol: 'accessing',
  31345. fn: function (){
  31346. var self=this;
  31347. return self["@parent"];
  31348. },
  31349. args: [],
  31350. source: "parent\x0a\x09^ parent",
  31351. referencedClasses: [],
  31352. messageSends: []
  31353. }),
  31354. $globals.ASTNode);
  31355. $core.addMethod(
  31356. $core.method({
  31357. selector: "parent:",
  31358. protocol: 'accessing',
  31359. fn: function (aNode){
  31360. var self=this;
  31361. self["@parent"]=aNode;
  31362. return self;
  31363. },
  31364. args: ["aNode"],
  31365. source: "parent: aNode\x0a\x09parent := aNode",
  31366. referencedClasses: [],
  31367. messageSends: []
  31368. }),
  31369. $globals.ASTNode);
  31370. $core.addMethod(
  31371. $core.method({
  31372. selector: "position",
  31373. protocol: 'accessing',
  31374. fn: function (){
  31375. var self=this;
  31376. return $core.withContext(function($ctx1) {
  31377. var $1,$2,$receiver;
  31378. $1=self["@position"];
  31379. if(($receiver = $1) == null || $receiver.isNil){
  31380. $2=self._parent();
  31381. if(($receiver = $2) == null || $receiver.isNil){
  31382. return $2;
  31383. } else {
  31384. var node;
  31385. node=$receiver;
  31386. return $recv(node)._position();
  31387. }
  31388. } else {
  31389. return $1;
  31390. }
  31391. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  31392. },
  31393. args: [],
  31394. 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 ] ]",
  31395. referencedClasses: [],
  31396. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31397. }),
  31398. $globals.ASTNode);
  31399. $core.addMethod(
  31400. $core.method({
  31401. selector: "position:",
  31402. protocol: 'accessing',
  31403. fn: function (aPosition){
  31404. var self=this;
  31405. self["@position"]=aPosition;
  31406. return self;
  31407. },
  31408. args: ["aPosition"],
  31409. source: "position: aPosition\x0a\x09position := aPosition",
  31410. referencedClasses: [],
  31411. messageSends: []
  31412. }),
  31413. $globals.ASTNode);
  31414. $core.addMethod(
  31415. $core.method({
  31416. selector: "positionEnd",
  31417. protocol: 'accessing',
  31418. fn: function (){
  31419. var self=this;
  31420. return $core.withContext(function($ctx1) {
  31421. var $1,$6,$5,$4,$3,$2;
  31422. $1=self._positionStart();
  31423. $6=self._source();
  31424. $ctx1.sendIdx["source"]=1;
  31425. $5=$recv($6)._lines();
  31426. $ctx1.sendIdx["lines"]=1;
  31427. $4=$recv($5)._size();
  31428. $ctx1.sendIdx["size"]=1;
  31429. $3=$recv($4).__minus((1));
  31430. $ctx1.sendIdx["-"]=1;
  31431. $2=$recv($3).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  31432. return $recv($1).__plus($2);
  31433. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  31434. },
  31435. args: [],
  31436. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  31437. referencedClasses: [],
  31438. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  31439. }),
  31440. $globals.ASTNode);
  31441. $core.addMethod(
  31442. $core.method({
  31443. selector: "positionStart",
  31444. protocol: 'accessing',
  31445. fn: function (){
  31446. var self=this;
  31447. return $core.withContext(function($ctx1) {
  31448. return self._position();
  31449. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  31450. },
  31451. args: [],
  31452. source: "positionStart\x0a\x09^ self position",
  31453. referencedClasses: [],
  31454. messageSends: ["position"]
  31455. }),
  31456. $globals.ASTNode);
  31457. $core.addMethod(
  31458. $core.method({
  31459. selector: "requiresSmalltalkContext",
  31460. protocol: 'testing',
  31461. fn: function (){
  31462. var self=this;
  31463. return $core.withContext(function($ctx1) {
  31464. return $recv($recv(self._dagChildren())._detect_ifNone_((function(each){
  31465. return $core.withContext(function($ctx2) {
  31466. return $recv(each)._requiresSmalltalkContext();
  31467. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31468. }),(function(){
  31469. return nil;
  31470. })))._notNil();
  31471. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  31472. },
  31473. args: [],
  31474. 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",
  31475. referencedClasses: [],
  31476. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  31477. }),
  31478. $globals.ASTNode);
  31479. $core.addMethod(
  31480. $core.method({
  31481. selector: "shouldBeAliased",
  31482. protocol: 'accessing',
  31483. fn: function (){
  31484. var self=this;
  31485. return $core.withContext(function($ctx1) {
  31486. var $1,$receiver;
  31487. $1=self["@shouldBeAliased"];
  31488. if(($receiver = $1) == null || $receiver.isNil){
  31489. return false;
  31490. } else {
  31491. return $1;
  31492. }
  31493. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  31494. },
  31495. args: [],
  31496. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  31497. referencedClasses: [],
  31498. messageSends: ["ifNil:"]
  31499. }),
  31500. $globals.ASTNode);
  31501. $core.addMethod(
  31502. $core.method({
  31503. selector: "shouldBeAliased:",
  31504. protocol: 'accessing',
  31505. fn: function (aBoolean){
  31506. var self=this;
  31507. self["@shouldBeAliased"]=aBoolean;
  31508. return self;
  31509. },
  31510. args: ["aBoolean"],
  31511. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  31512. referencedClasses: [],
  31513. messageSends: []
  31514. }),
  31515. $globals.ASTNode);
  31516. $core.addMethod(
  31517. $core.method({
  31518. selector: "size",
  31519. protocol: 'accessing',
  31520. fn: function (){
  31521. var self=this;
  31522. return $core.withContext(function($ctx1) {
  31523. return $recv(self._source())._size();
  31524. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  31525. },
  31526. args: [],
  31527. source: "size\x0a\x09^ self source size",
  31528. referencedClasses: [],
  31529. messageSends: ["size", "source"]
  31530. }),
  31531. $globals.ASTNode);
  31532. $core.addMethod(
  31533. $core.method({
  31534. selector: "source",
  31535. protocol: 'accessing',
  31536. fn: function (){
  31537. var self=this;
  31538. return $core.withContext(function($ctx1) {
  31539. var $1,$receiver;
  31540. $1=self["@source"];
  31541. if(($receiver = $1) == null || $receiver.isNil){
  31542. return "";
  31543. } else {
  31544. return $1;
  31545. }
  31546. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  31547. },
  31548. args: [],
  31549. source: "source\x0a\x09^ source ifNil: [ '' ]",
  31550. referencedClasses: [],
  31551. messageSends: ["ifNil:"]
  31552. }),
  31553. $globals.ASTNode);
  31554. $core.addMethod(
  31555. $core.method({
  31556. selector: "source:",
  31557. protocol: 'accessing',
  31558. fn: function (aString){
  31559. var self=this;
  31560. self["@source"]=aString;
  31561. return self;
  31562. },
  31563. args: ["aString"],
  31564. source: "source: aString\x0a\x09source := aString",
  31565. referencedClasses: [],
  31566. messageSends: []
  31567. }),
  31568. $globals.ASTNode);
  31569. $core.addMethod(
  31570. $core.method({
  31571. selector: "withTail:",
  31572. protocol: 'building',
  31573. fn: function (aCollection){
  31574. var self=this;
  31575. return $core.withContext(function($ctx1) {
  31576. var $1;
  31577. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  31578. return $core.withContext(function($ctx2) {
  31579. $1=$recv($globals.SendNode)._new();
  31580. $recv($1)._position_($recv(send)._position());
  31581. $recv($1)._source_($recv(send)._source());
  31582. $recv($1)._receiver_(receiver);
  31583. $recv($1)._selector_($recv(send)._selector());
  31584. $recv($1)._arguments_($recv(send)._arguments());
  31585. return $recv($1)._yourself();
  31586. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  31587. }));
  31588. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  31589. },
  31590. args: ["aCollection"],
  31591. 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 ]",
  31592. referencedClasses: ["SendNode"],
  31593. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  31594. }),
  31595. $globals.ASTNode);
  31596. $core.addClass('AssignmentNode', $globals.ASTNode, ['left', 'right'], 'Compiler-AST');
  31597. $globals.AssignmentNode.comment="I represent an assignment node.";
  31598. $core.addMethod(
  31599. $core.method({
  31600. selector: "acceptDagVisitor:",
  31601. protocol: 'visiting',
  31602. fn: function (aVisitor){
  31603. var self=this;
  31604. return $core.withContext(function($ctx1) {
  31605. return $recv(aVisitor)._visitAssignmentNode_(self);
  31606. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  31607. },
  31608. args: ["aVisitor"],
  31609. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  31610. referencedClasses: [],
  31611. messageSends: ["visitAssignmentNode:"]
  31612. }),
  31613. $globals.AssignmentNode);
  31614. $core.addMethod(
  31615. $core.method({
  31616. selector: "dagChildren",
  31617. protocol: 'accessing',
  31618. fn: function (){
  31619. var self=this;
  31620. return $core.withContext(function($ctx1) {
  31621. return $recv($globals.Array)._with_with_(self._left(),self._right());
  31622. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  31623. },
  31624. args: [],
  31625. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  31626. referencedClasses: ["Array"],
  31627. messageSends: ["with:with:", "left", "right"]
  31628. }),
  31629. $globals.AssignmentNode);
  31630. $core.addMethod(
  31631. $core.method({
  31632. selector: "isAssignmentNode",
  31633. protocol: 'testing',
  31634. fn: function (){
  31635. var self=this;
  31636. return true;
  31637. },
  31638. args: [],
  31639. source: "isAssignmentNode\x0a\x09^ true",
  31640. referencedClasses: [],
  31641. messageSends: []
  31642. }),
  31643. $globals.AssignmentNode);
  31644. $core.addMethod(
  31645. $core.method({
  31646. selector: "left",
  31647. protocol: 'accessing',
  31648. fn: function (){
  31649. var self=this;
  31650. return self["@left"];
  31651. },
  31652. args: [],
  31653. source: "left\x0a\x09^ left",
  31654. referencedClasses: [],
  31655. messageSends: []
  31656. }),
  31657. $globals.AssignmentNode);
  31658. $core.addMethod(
  31659. $core.method({
  31660. selector: "left:",
  31661. protocol: 'accessing',
  31662. fn: function (aNode){
  31663. var self=this;
  31664. self["@left"]=aNode;
  31665. return self;
  31666. },
  31667. args: ["aNode"],
  31668. source: "left: aNode\x0a\x09left := aNode",
  31669. referencedClasses: [],
  31670. messageSends: []
  31671. }),
  31672. $globals.AssignmentNode);
  31673. $core.addMethod(
  31674. $core.method({
  31675. selector: "right",
  31676. protocol: 'accessing',
  31677. fn: function (){
  31678. var self=this;
  31679. return self["@right"];
  31680. },
  31681. args: [],
  31682. source: "right\x0a\x09^ right",
  31683. referencedClasses: [],
  31684. messageSends: []
  31685. }),
  31686. $globals.AssignmentNode);
  31687. $core.addMethod(
  31688. $core.method({
  31689. selector: "right:",
  31690. protocol: 'accessing',
  31691. fn: function (aNode){
  31692. var self=this;
  31693. self["@right"]=aNode;
  31694. return self;
  31695. },
  31696. args: ["aNode"],
  31697. source: "right: aNode\x0a\x09right := aNode",
  31698. referencedClasses: [],
  31699. messageSends: []
  31700. }),
  31701. $globals.AssignmentNode);
  31702. $core.addClass('BlockNode', $globals.ASTNode, ['parameters', 'scope'], 'Compiler-AST');
  31703. $globals.BlockNode.comment="I represent an block closure node.";
  31704. $core.addMethod(
  31705. $core.method({
  31706. selector: "acceptDagVisitor:",
  31707. protocol: 'visiting',
  31708. fn: function (aVisitor){
  31709. var self=this;
  31710. return $core.withContext(function($ctx1) {
  31711. return $recv(aVisitor)._visitBlockNode_(self);
  31712. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  31713. },
  31714. args: ["aVisitor"],
  31715. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  31716. referencedClasses: [],
  31717. messageSends: ["visitBlockNode:"]
  31718. }),
  31719. $globals.BlockNode);
  31720. $core.addMethod(
  31721. $core.method({
  31722. selector: "isBlockNode",
  31723. protocol: 'testing',
  31724. fn: function (){
  31725. var self=this;
  31726. return true;
  31727. },
  31728. args: [],
  31729. source: "isBlockNode\x0a\x09^ true",
  31730. referencedClasses: [],
  31731. messageSends: []
  31732. }),
  31733. $globals.BlockNode);
  31734. $core.addMethod(
  31735. $core.method({
  31736. selector: "parameters",
  31737. protocol: 'accessing',
  31738. fn: function (){
  31739. var self=this;
  31740. return $core.withContext(function($ctx1) {
  31741. var $1,$receiver;
  31742. $1=self["@parameters"];
  31743. if(($receiver = $1) == null || $receiver.isNil){
  31744. self["@parameters"]=$recv($globals.Array)._new();
  31745. return self["@parameters"];
  31746. } else {
  31747. return $1;
  31748. }
  31749. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  31750. },
  31751. args: [],
  31752. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  31753. referencedClasses: ["Array"],
  31754. messageSends: ["ifNil:", "new"]
  31755. }),
  31756. $globals.BlockNode);
  31757. $core.addMethod(
  31758. $core.method({
  31759. selector: "parameters:",
  31760. protocol: 'accessing',
  31761. fn: function (aCollection){
  31762. var self=this;
  31763. self["@parameters"]=aCollection;
  31764. return self;
  31765. },
  31766. args: ["aCollection"],
  31767. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  31768. referencedClasses: [],
  31769. messageSends: []
  31770. }),
  31771. $globals.BlockNode);
  31772. $core.addMethod(
  31773. $core.method({
  31774. selector: "scope",
  31775. protocol: 'accessing',
  31776. fn: function (){
  31777. var self=this;
  31778. return self["@scope"];
  31779. },
  31780. args: [],
  31781. source: "scope\x0a\x09^ scope",
  31782. referencedClasses: [],
  31783. messageSends: []
  31784. }),
  31785. $globals.BlockNode);
  31786. $core.addMethod(
  31787. $core.method({
  31788. selector: "scope:",
  31789. protocol: 'accessing',
  31790. fn: function (aLexicalScope){
  31791. var self=this;
  31792. self["@scope"]=aLexicalScope;
  31793. return self;
  31794. },
  31795. args: ["aLexicalScope"],
  31796. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  31797. referencedClasses: [],
  31798. messageSends: []
  31799. }),
  31800. $globals.BlockNode);
  31801. $core.addClass('CascadeNode', $globals.ASTNode, ['receiver'], 'Compiler-AST');
  31802. $globals.CascadeNode.comment="I represent an cascade node.";
  31803. $core.addMethod(
  31804. $core.method({
  31805. selector: "acceptDagVisitor:",
  31806. protocol: 'visiting',
  31807. fn: function (aVisitor){
  31808. var self=this;
  31809. return $core.withContext(function($ctx1) {
  31810. return $recv(aVisitor)._visitCascadeNode_(self);
  31811. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  31812. },
  31813. args: ["aVisitor"],
  31814. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  31815. referencedClasses: [],
  31816. messageSends: ["visitCascadeNode:"]
  31817. }),
  31818. $globals.CascadeNode);
  31819. $core.addMethod(
  31820. $core.method({
  31821. selector: "isCascadeNode",
  31822. protocol: 'testing',
  31823. fn: function (){
  31824. var self=this;
  31825. return true;
  31826. },
  31827. args: [],
  31828. source: "isCascadeNode\x0a\x09^ true",
  31829. referencedClasses: [],
  31830. messageSends: []
  31831. }),
  31832. $globals.CascadeNode);
  31833. $core.addMethod(
  31834. $core.method({
  31835. selector: "receiver",
  31836. protocol: 'accessing',
  31837. fn: function (){
  31838. var self=this;
  31839. return self["@receiver"];
  31840. },
  31841. args: [],
  31842. source: "receiver\x0a\x09^ receiver",
  31843. referencedClasses: [],
  31844. messageSends: []
  31845. }),
  31846. $globals.CascadeNode);
  31847. $core.addMethod(
  31848. $core.method({
  31849. selector: "receiver:",
  31850. protocol: 'accessing',
  31851. fn: function (aNode){
  31852. var self=this;
  31853. self["@receiver"]=aNode;
  31854. return self;
  31855. },
  31856. args: ["aNode"],
  31857. source: "receiver: aNode\x0a\x09receiver := aNode",
  31858. referencedClasses: [],
  31859. messageSends: []
  31860. }),
  31861. $globals.CascadeNode);
  31862. $core.addClass('DynamicArrayNode', $globals.ASTNode, [], 'Compiler-AST');
  31863. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  31864. $core.addMethod(
  31865. $core.method({
  31866. selector: "acceptDagVisitor:",
  31867. protocol: 'visiting',
  31868. fn: function (aVisitor){
  31869. var self=this;
  31870. return $core.withContext(function($ctx1) {
  31871. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  31872. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  31873. },
  31874. args: ["aVisitor"],
  31875. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  31876. referencedClasses: [],
  31877. messageSends: ["visitDynamicArrayNode:"]
  31878. }),
  31879. $globals.DynamicArrayNode);
  31880. $core.addClass('DynamicDictionaryNode', $globals.ASTNode, [], 'Compiler-AST');
  31881. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  31882. $core.addMethod(
  31883. $core.method({
  31884. selector: "acceptDagVisitor:",
  31885. protocol: 'visiting',
  31886. fn: function (aVisitor){
  31887. var self=this;
  31888. return $core.withContext(function($ctx1) {
  31889. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  31890. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  31891. },
  31892. args: ["aVisitor"],
  31893. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  31894. referencedClasses: [],
  31895. messageSends: ["visitDynamicDictionaryNode:"]
  31896. }),
  31897. $globals.DynamicDictionaryNode);
  31898. $core.addClass('JSStatementNode', $globals.ASTNode, [], 'Compiler-AST');
  31899. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  31900. $core.addMethod(
  31901. $core.method({
  31902. selector: "acceptDagVisitor:",
  31903. protocol: 'visiting',
  31904. fn: function (aVisitor){
  31905. var self=this;
  31906. return $core.withContext(function($ctx1) {
  31907. return $recv(aVisitor)._visitJSStatementNode_(self);
  31908. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  31909. },
  31910. args: ["aVisitor"],
  31911. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  31912. referencedClasses: [],
  31913. messageSends: ["visitJSStatementNode:"]
  31914. }),
  31915. $globals.JSStatementNode);
  31916. $core.addMethod(
  31917. $core.method({
  31918. selector: "isJSStatementNode",
  31919. protocol: 'testing',
  31920. fn: function (){
  31921. var self=this;
  31922. return true;
  31923. },
  31924. args: [],
  31925. source: "isJSStatementNode\x0a\x09^ true",
  31926. referencedClasses: [],
  31927. messageSends: []
  31928. }),
  31929. $globals.JSStatementNode);
  31930. $core.addMethod(
  31931. $core.method({
  31932. selector: "requiresSmalltalkContext",
  31933. protocol: 'testing',
  31934. fn: function (){
  31935. var self=this;
  31936. return true;
  31937. },
  31938. args: [],
  31939. source: "requiresSmalltalkContext\x0a\x09^ true",
  31940. referencedClasses: [],
  31941. messageSends: []
  31942. }),
  31943. $globals.JSStatementNode);
  31944. $core.addClass('MethodNode', $globals.ASTNode, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes'], 'Compiler-AST');
  31945. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  31946. $core.addMethod(
  31947. $core.method({
  31948. selector: "acceptDagVisitor:",
  31949. protocol: 'visiting',
  31950. fn: function (aVisitor){
  31951. var self=this;
  31952. return $core.withContext(function($ctx1) {
  31953. return $recv(aVisitor)._visitMethodNode_(self);
  31954. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  31955. },
  31956. args: ["aVisitor"],
  31957. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  31958. referencedClasses: [],
  31959. messageSends: ["visitMethodNode:"]
  31960. }),
  31961. $globals.MethodNode);
  31962. $core.addMethod(
  31963. $core.method({
  31964. selector: "arguments",
  31965. protocol: 'accessing',
  31966. fn: function (){
  31967. var self=this;
  31968. return $core.withContext(function($ctx1) {
  31969. var $1,$receiver;
  31970. $1=self["@arguments"];
  31971. if(($receiver = $1) == null || $receiver.isNil){
  31972. return [];
  31973. } else {
  31974. return $1;
  31975. }
  31976. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  31977. },
  31978. args: [],
  31979. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  31980. referencedClasses: [],
  31981. messageSends: ["ifNil:"]
  31982. }),
  31983. $globals.MethodNode);
  31984. $core.addMethod(
  31985. $core.method({
  31986. selector: "arguments:",
  31987. protocol: 'accessing',
  31988. fn: function (aCollection){
  31989. var self=this;
  31990. self["@arguments"]=aCollection;
  31991. return self;
  31992. },
  31993. args: ["aCollection"],
  31994. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  31995. referencedClasses: [],
  31996. messageSends: []
  31997. }),
  31998. $globals.MethodNode);
  31999. $core.addMethod(
  32000. $core.method({
  32001. selector: "classReferences",
  32002. protocol: 'accessing',
  32003. fn: function (){
  32004. var self=this;
  32005. return self["@classReferences"];
  32006. },
  32007. args: [],
  32008. source: "classReferences\x0a\x09^ classReferences",
  32009. referencedClasses: [],
  32010. messageSends: []
  32011. }),
  32012. $globals.MethodNode);
  32013. $core.addMethod(
  32014. $core.method({
  32015. selector: "classReferences:",
  32016. protocol: 'accessing',
  32017. fn: function (aCollection){
  32018. var self=this;
  32019. self["@classReferences"]=aCollection;
  32020. return self;
  32021. },
  32022. args: ["aCollection"],
  32023. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  32024. referencedClasses: [],
  32025. messageSends: []
  32026. }),
  32027. $globals.MethodNode);
  32028. $core.addMethod(
  32029. $core.method({
  32030. selector: "messageSends",
  32031. protocol: 'accessing',
  32032. fn: function (){
  32033. var self=this;
  32034. return $core.withContext(function($ctx1) {
  32035. return $recv(self._sendIndexes())._keys();
  32036. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  32037. },
  32038. args: [],
  32039. source: "messageSends\x0a\x09^ self sendIndexes keys",
  32040. referencedClasses: [],
  32041. messageSends: ["keys", "sendIndexes"]
  32042. }),
  32043. $globals.MethodNode);
  32044. $core.addMethod(
  32045. $core.method({
  32046. selector: "method",
  32047. protocol: 'accessing',
  32048. fn: function (){
  32049. var self=this;
  32050. return self;
  32051. },
  32052. args: [],
  32053. source: "method\x0a\x09^ self",
  32054. referencedClasses: [],
  32055. messageSends: []
  32056. }),
  32057. $globals.MethodNode);
  32058. $core.addMethod(
  32059. $core.method({
  32060. selector: "scope",
  32061. protocol: 'accessing',
  32062. fn: function (){
  32063. var self=this;
  32064. return self["@scope"];
  32065. },
  32066. args: [],
  32067. source: "scope\x0a\x09^ scope",
  32068. referencedClasses: [],
  32069. messageSends: []
  32070. }),
  32071. $globals.MethodNode);
  32072. $core.addMethod(
  32073. $core.method({
  32074. selector: "scope:",
  32075. protocol: 'accessing',
  32076. fn: function (aMethodScope){
  32077. var self=this;
  32078. self["@scope"]=aMethodScope;
  32079. return self;
  32080. },
  32081. args: ["aMethodScope"],
  32082. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  32083. referencedClasses: [],
  32084. messageSends: []
  32085. }),
  32086. $globals.MethodNode);
  32087. $core.addMethod(
  32088. $core.method({
  32089. selector: "selector",
  32090. protocol: 'accessing',
  32091. fn: function (){
  32092. var self=this;
  32093. return self["@selector"];
  32094. },
  32095. args: [],
  32096. source: "selector\x0a\x09^ selector",
  32097. referencedClasses: [],
  32098. messageSends: []
  32099. }),
  32100. $globals.MethodNode);
  32101. $core.addMethod(
  32102. $core.method({
  32103. selector: "selector:",
  32104. protocol: 'accessing',
  32105. fn: function (aString){
  32106. var self=this;
  32107. self["@selector"]=aString;
  32108. return self;
  32109. },
  32110. args: ["aString"],
  32111. source: "selector: aString\x0a\x09selector := aString",
  32112. referencedClasses: [],
  32113. messageSends: []
  32114. }),
  32115. $globals.MethodNode);
  32116. $core.addMethod(
  32117. $core.method({
  32118. selector: "sendIndexes",
  32119. protocol: 'accessing',
  32120. fn: function (){
  32121. var self=this;
  32122. return self["@sendIndexes"];
  32123. },
  32124. args: [],
  32125. source: "sendIndexes\x0a\x09^ sendIndexes",
  32126. referencedClasses: [],
  32127. messageSends: []
  32128. }),
  32129. $globals.MethodNode);
  32130. $core.addMethod(
  32131. $core.method({
  32132. selector: "sendIndexes:",
  32133. protocol: 'accessing',
  32134. fn: function (aDictionary){
  32135. var self=this;
  32136. self["@sendIndexes"]=aDictionary;
  32137. return self;
  32138. },
  32139. args: ["aDictionary"],
  32140. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  32141. referencedClasses: [],
  32142. messageSends: []
  32143. }),
  32144. $globals.MethodNode);
  32145. $core.addMethod(
  32146. $core.method({
  32147. selector: "sequenceNode",
  32148. protocol: 'accessing',
  32149. fn: function (){
  32150. var self=this;
  32151. return $core.withContext(function($ctx1) {
  32152. var $1;
  32153. var $early={};
  32154. try {
  32155. $recv(self._dagChildren())._do_((function(each){
  32156. return $core.withContext(function($ctx2) {
  32157. $1=$recv(each)._isSequenceNode();
  32158. if($core.assert($1)){
  32159. throw $early=[each];
  32160. }
  32161. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32162. }));
  32163. return nil;
  32164. }
  32165. catch(e) {if(e===$early)return e[0]; throw e}
  32166. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  32167. },
  32168. args: [],
  32169. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  32170. referencedClasses: [],
  32171. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  32172. }),
  32173. $globals.MethodNode);
  32174. $core.addMethod(
  32175. $core.method({
  32176. selector: "source",
  32177. protocol: 'accessing',
  32178. fn: function (){
  32179. var self=this;
  32180. return self["@source"];
  32181. },
  32182. args: [],
  32183. source: "source\x0a\x09^ source",
  32184. referencedClasses: [],
  32185. messageSends: []
  32186. }),
  32187. $globals.MethodNode);
  32188. $core.addMethod(
  32189. $core.method({
  32190. selector: "source:",
  32191. protocol: 'accessing',
  32192. fn: function (aString){
  32193. var self=this;
  32194. self["@source"]=aString;
  32195. return self;
  32196. },
  32197. args: ["aString"],
  32198. source: "source: aString\x0a\x09source := aString",
  32199. referencedClasses: [],
  32200. messageSends: []
  32201. }),
  32202. $globals.MethodNode);
  32203. $core.addClass('ReturnNode', $globals.ASTNode, ['scope'], 'Compiler-AST');
  32204. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  32205. $core.addMethod(
  32206. $core.method({
  32207. selector: "acceptDagVisitor:",
  32208. protocol: 'visiting',
  32209. fn: function (aVisitor){
  32210. var self=this;
  32211. return $core.withContext(function($ctx1) {
  32212. return $recv(aVisitor)._visitReturnNode_(self);
  32213. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  32214. },
  32215. args: ["aVisitor"],
  32216. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  32217. referencedClasses: [],
  32218. messageSends: ["visitReturnNode:"]
  32219. }),
  32220. $globals.ReturnNode);
  32221. $core.addMethod(
  32222. $core.method({
  32223. selector: "isReturnNode",
  32224. protocol: 'testing',
  32225. fn: function (){
  32226. var self=this;
  32227. return true;
  32228. },
  32229. args: [],
  32230. source: "isReturnNode\x0a\x09^ true",
  32231. referencedClasses: [],
  32232. messageSends: []
  32233. }),
  32234. $globals.ReturnNode);
  32235. $core.addMethod(
  32236. $core.method({
  32237. selector: "nonLocalReturn",
  32238. protocol: 'testing',
  32239. fn: function (){
  32240. var self=this;
  32241. return $core.withContext(function($ctx1) {
  32242. return $recv($recv(self._scope())._isMethodScope())._not();
  32243. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  32244. },
  32245. args: [],
  32246. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  32247. referencedClasses: [],
  32248. messageSends: ["not", "isMethodScope", "scope"]
  32249. }),
  32250. $globals.ReturnNode);
  32251. $core.addMethod(
  32252. $core.method({
  32253. selector: "scope",
  32254. protocol: 'accessing',
  32255. fn: function (){
  32256. var self=this;
  32257. return self["@scope"];
  32258. },
  32259. args: [],
  32260. source: "scope\x0a\x09^ scope",
  32261. referencedClasses: [],
  32262. messageSends: []
  32263. }),
  32264. $globals.ReturnNode);
  32265. $core.addMethod(
  32266. $core.method({
  32267. selector: "scope:",
  32268. protocol: 'accessing',
  32269. fn: function (aLexicalScope){
  32270. var self=this;
  32271. self["@scope"]=aLexicalScope;
  32272. return self;
  32273. },
  32274. args: ["aLexicalScope"],
  32275. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32276. referencedClasses: [],
  32277. messageSends: []
  32278. }),
  32279. $globals.ReturnNode);
  32280. $core.addClass('SendNode', $globals.ASTNode, ['selector', 'arguments', 'receiver', 'index', 'shouldBeInlined'], 'Compiler-AST');
  32281. $globals.SendNode.comment="I represent an message send node.";
  32282. $core.addMethod(
  32283. $core.method({
  32284. selector: "acceptDagVisitor:",
  32285. protocol: 'visiting',
  32286. fn: function (aVisitor){
  32287. var self=this;
  32288. return $core.withContext(function($ctx1) {
  32289. return $recv(aVisitor)._visitSendNode_(self);
  32290. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  32291. },
  32292. args: ["aVisitor"],
  32293. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  32294. referencedClasses: [],
  32295. messageSends: ["visitSendNode:"]
  32296. }),
  32297. $globals.SendNode);
  32298. $core.addMethod(
  32299. $core.method({
  32300. selector: "arguments",
  32301. protocol: 'accessing',
  32302. fn: function (){
  32303. var self=this;
  32304. return $core.withContext(function($ctx1) {
  32305. var $1,$receiver;
  32306. $1=self["@arguments"];
  32307. if(($receiver = $1) == null || $receiver.isNil){
  32308. self["@arguments"]=[];
  32309. return self["@arguments"];
  32310. } else {
  32311. return $1;
  32312. }
  32313. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  32314. },
  32315. args: [],
  32316. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  32317. referencedClasses: [],
  32318. messageSends: ["ifNil:"]
  32319. }),
  32320. $globals.SendNode);
  32321. $core.addMethod(
  32322. $core.method({
  32323. selector: "arguments:",
  32324. protocol: 'accessing',
  32325. fn: function (aCollection){
  32326. var self=this;
  32327. self["@arguments"]=aCollection;
  32328. return self;
  32329. },
  32330. args: ["aCollection"],
  32331. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  32332. referencedClasses: [],
  32333. messageSends: []
  32334. }),
  32335. $globals.SendNode);
  32336. $core.addMethod(
  32337. $core.method({
  32338. selector: "dagChildren",
  32339. protocol: 'accessing',
  32340. fn: function (){
  32341. var self=this;
  32342. return $core.withContext(function($ctx1) {
  32343. var $1,$2,$3,$receiver;
  32344. $1=self._receiver();
  32345. $ctx1.sendIdx["receiver"]=1;
  32346. if(($receiver = $1) == null || $receiver.isNil){
  32347. $2=self._arguments();
  32348. $ctx1.sendIdx["arguments"]=1;
  32349. return $recv($2)._copy();
  32350. } else {
  32351. $1;
  32352. }
  32353. $3=$recv($globals.Array)._with_(self._receiver());
  32354. $recv($3)._addAll_(self._arguments());
  32355. return $recv($3)._yourself();
  32356. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  32357. },
  32358. args: [],
  32359. 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",
  32360. referencedClasses: ["Array"],
  32361. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  32362. }),
  32363. $globals.SendNode);
  32364. $core.addMethod(
  32365. $core.method({
  32366. selector: "index",
  32367. protocol: 'accessing',
  32368. fn: function (){
  32369. var self=this;
  32370. return self["@index"];
  32371. },
  32372. args: [],
  32373. source: "index\x0a\x09^ index",
  32374. referencedClasses: [],
  32375. messageSends: []
  32376. }),
  32377. $globals.SendNode);
  32378. $core.addMethod(
  32379. $core.method({
  32380. selector: "index:",
  32381. protocol: 'accessing',
  32382. fn: function (anInteger){
  32383. var self=this;
  32384. self["@index"]=anInteger;
  32385. return self;
  32386. },
  32387. args: ["anInteger"],
  32388. source: "index: anInteger\x0a\x09index := anInteger",
  32389. referencedClasses: [],
  32390. messageSends: []
  32391. }),
  32392. $globals.SendNode);
  32393. $core.addMethod(
  32394. $core.method({
  32395. selector: "isNavigationNode",
  32396. protocol: 'testing',
  32397. fn: function (){
  32398. var self=this;
  32399. return true;
  32400. },
  32401. args: [],
  32402. source: "isNavigationNode\x0a\x09^ true",
  32403. referencedClasses: [],
  32404. messageSends: []
  32405. }),
  32406. $globals.SendNode);
  32407. $core.addMethod(
  32408. $core.method({
  32409. selector: "isSendNode",
  32410. protocol: 'testing',
  32411. fn: function (){
  32412. var self=this;
  32413. return true;
  32414. },
  32415. args: [],
  32416. source: "isSendNode\x0a\x09^ true",
  32417. referencedClasses: [],
  32418. messageSends: []
  32419. }),
  32420. $globals.SendNode);
  32421. $core.addMethod(
  32422. $core.method({
  32423. selector: "navigationLink",
  32424. protocol: 'accessing',
  32425. fn: function (){
  32426. var self=this;
  32427. return $core.withContext(function($ctx1) {
  32428. return self._selector();
  32429. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  32430. },
  32431. args: [],
  32432. source: "navigationLink\x0a\x09^ self selector",
  32433. referencedClasses: [],
  32434. messageSends: ["selector"]
  32435. }),
  32436. $globals.SendNode);
  32437. $core.addMethod(
  32438. $core.method({
  32439. selector: "receiver",
  32440. protocol: 'accessing',
  32441. fn: function (){
  32442. var self=this;
  32443. return self["@receiver"];
  32444. },
  32445. args: [],
  32446. source: "receiver\x0a\x09^ receiver",
  32447. referencedClasses: [],
  32448. messageSends: []
  32449. }),
  32450. $globals.SendNode);
  32451. $core.addMethod(
  32452. $core.method({
  32453. selector: "receiver:",
  32454. protocol: 'accessing',
  32455. fn: function (aNode){
  32456. var self=this;
  32457. self["@receiver"]=aNode;
  32458. return self;
  32459. },
  32460. args: ["aNode"],
  32461. source: "receiver: aNode\x0a\x09receiver := aNode",
  32462. referencedClasses: [],
  32463. messageSends: []
  32464. }),
  32465. $globals.SendNode);
  32466. $core.addMethod(
  32467. $core.method({
  32468. selector: "requiresSmalltalkContext",
  32469. protocol: 'testing',
  32470. fn: function (){
  32471. var self=this;
  32472. return true;
  32473. },
  32474. args: [],
  32475. source: "requiresSmalltalkContext\x0a\x09^ true",
  32476. referencedClasses: [],
  32477. messageSends: []
  32478. }),
  32479. $globals.SendNode);
  32480. $core.addMethod(
  32481. $core.method({
  32482. selector: "selector",
  32483. protocol: 'accessing',
  32484. fn: function (){
  32485. var self=this;
  32486. return self["@selector"];
  32487. },
  32488. args: [],
  32489. source: "selector\x0a\x09^ selector",
  32490. referencedClasses: [],
  32491. messageSends: []
  32492. }),
  32493. $globals.SendNode);
  32494. $core.addMethod(
  32495. $core.method({
  32496. selector: "selector:",
  32497. protocol: 'accessing',
  32498. fn: function (aString){
  32499. var self=this;
  32500. self["@selector"]=aString;
  32501. return self;
  32502. },
  32503. args: ["aString"],
  32504. source: "selector: aString\x0a\x09selector := aString",
  32505. referencedClasses: [],
  32506. messageSends: []
  32507. }),
  32508. $globals.SendNode);
  32509. $core.addMethod(
  32510. $core.method({
  32511. selector: "shouldBeInlined",
  32512. protocol: 'accessing',
  32513. fn: function (){
  32514. var self=this;
  32515. return $core.withContext(function($ctx1) {
  32516. var $1,$receiver;
  32517. $1=self["@shouldBeInlined"];
  32518. if(($receiver = $1) == null || $receiver.isNil){
  32519. return false;
  32520. } else {
  32521. return $1;
  32522. }
  32523. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  32524. },
  32525. args: [],
  32526. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  32527. referencedClasses: [],
  32528. messageSends: ["ifNil:"]
  32529. }),
  32530. $globals.SendNode);
  32531. $core.addMethod(
  32532. $core.method({
  32533. selector: "shouldBeInlined:",
  32534. protocol: 'accessing',
  32535. fn: function (aBoolean){
  32536. var self=this;
  32537. self["@shouldBeInlined"]=aBoolean;
  32538. return self;
  32539. },
  32540. args: ["aBoolean"],
  32541. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  32542. referencedClasses: [],
  32543. messageSends: []
  32544. }),
  32545. $globals.SendNode);
  32546. $core.addMethod(
  32547. $core.method({
  32548. selector: "superSend",
  32549. protocol: 'accessing',
  32550. fn: function (){
  32551. var self=this;
  32552. return $core.withContext(function($ctx1) {
  32553. var $2,$1;
  32554. $2=self._receiver();
  32555. $ctx1.sendIdx["receiver"]=1;
  32556. $1=$recv($2)._notNil();
  32557. return $recv($1)._and_((function(){
  32558. return $core.withContext(function($ctx2) {
  32559. return $recv(self._receiver())._isSuperKeyword();
  32560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32561. }));
  32562. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  32563. },
  32564. args: [],
  32565. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  32566. referencedClasses: [],
  32567. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  32568. }),
  32569. $globals.SendNode);
  32570. $core.addClass('SequenceNode', $globals.ASTNode, ['temps', 'scope'], 'Compiler-AST');
  32571. $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).";
  32572. $core.addMethod(
  32573. $core.method({
  32574. selector: "acceptDagVisitor:",
  32575. protocol: 'visiting',
  32576. fn: function (aVisitor){
  32577. var self=this;
  32578. return $core.withContext(function($ctx1) {
  32579. return $recv(aVisitor)._visitSequenceNode_(self);
  32580. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  32581. },
  32582. args: ["aVisitor"],
  32583. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  32584. referencedClasses: [],
  32585. messageSends: ["visitSequenceNode:"]
  32586. }),
  32587. $globals.SequenceNode);
  32588. $core.addMethod(
  32589. $core.method({
  32590. selector: "asBlockSequenceNode",
  32591. protocol: 'building',
  32592. fn: function (){
  32593. var self=this;
  32594. return $core.withContext(function($ctx1) {
  32595. var $1;
  32596. $1=$recv($globals.BlockSequenceNode)._new();
  32597. $recv($1)._position_(self._position());
  32598. $recv($1)._source_(self._source());
  32599. $recv($1)._dagChildren_(self._dagChildren());
  32600. $recv($1)._temps_(self._temps());
  32601. return $recv($1)._yourself();
  32602. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  32603. },
  32604. args: [],
  32605. 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",
  32606. referencedClasses: ["BlockSequenceNode"],
  32607. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "yourself"]
  32608. }),
  32609. $globals.SequenceNode);
  32610. $core.addMethod(
  32611. $core.method({
  32612. selector: "isSequenceNode",
  32613. protocol: 'testing',
  32614. fn: function (){
  32615. var self=this;
  32616. return true;
  32617. },
  32618. args: [],
  32619. source: "isSequenceNode\x0a\x09^ true",
  32620. referencedClasses: [],
  32621. messageSends: []
  32622. }),
  32623. $globals.SequenceNode);
  32624. $core.addMethod(
  32625. $core.method({
  32626. selector: "scope",
  32627. protocol: 'accessing',
  32628. fn: function (){
  32629. var self=this;
  32630. return self["@scope"];
  32631. },
  32632. args: [],
  32633. source: "scope\x0a\x09^ scope",
  32634. referencedClasses: [],
  32635. messageSends: []
  32636. }),
  32637. $globals.SequenceNode);
  32638. $core.addMethod(
  32639. $core.method({
  32640. selector: "scope:",
  32641. protocol: 'accessing',
  32642. fn: function (aLexicalScope){
  32643. var self=this;
  32644. self["@scope"]=aLexicalScope;
  32645. return self;
  32646. },
  32647. args: ["aLexicalScope"],
  32648. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32649. referencedClasses: [],
  32650. messageSends: []
  32651. }),
  32652. $globals.SequenceNode);
  32653. $core.addMethod(
  32654. $core.method({
  32655. selector: "temps",
  32656. protocol: 'accessing',
  32657. fn: function (){
  32658. var self=this;
  32659. return $core.withContext(function($ctx1) {
  32660. var $1,$receiver;
  32661. $1=self["@temps"];
  32662. if(($receiver = $1) == null || $receiver.isNil){
  32663. return [];
  32664. } else {
  32665. return $1;
  32666. }
  32667. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  32668. },
  32669. args: [],
  32670. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  32671. referencedClasses: [],
  32672. messageSends: ["ifNil:"]
  32673. }),
  32674. $globals.SequenceNode);
  32675. $core.addMethod(
  32676. $core.method({
  32677. selector: "temps:",
  32678. protocol: 'accessing',
  32679. fn: function (aCollection){
  32680. var self=this;
  32681. self["@temps"]=aCollection;
  32682. return self;
  32683. },
  32684. args: ["aCollection"],
  32685. source: "temps: aCollection\x0a\x09temps := aCollection",
  32686. referencedClasses: [],
  32687. messageSends: []
  32688. }),
  32689. $globals.SequenceNode);
  32690. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  32691. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  32692. $core.addMethod(
  32693. $core.method({
  32694. selector: "acceptDagVisitor:",
  32695. protocol: 'visiting',
  32696. fn: function (aVisitor){
  32697. var self=this;
  32698. return $core.withContext(function($ctx1) {
  32699. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  32700. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  32701. },
  32702. args: ["aVisitor"],
  32703. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  32704. referencedClasses: [],
  32705. messageSends: ["visitBlockSequenceNode:"]
  32706. }),
  32707. $globals.BlockSequenceNode);
  32708. $core.addMethod(
  32709. $core.method({
  32710. selector: "isBlockSequenceNode",
  32711. protocol: 'testing',
  32712. fn: function (){
  32713. var self=this;
  32714. return true;
  32715. },
  32716. args: [],
  32717. source: "isBlockSequenceNode\x0a\x09^ true",
  32718. referencedClasses: [],
  32719. messageSends: []
  32720. }),
  32721. $globals.BlockSequenceNode);
  32722. $core.addClass('ValueNode', $globals.ASTNode, ['value'], 'Compiler-AST');
  32723. $globals.ValueNode.comment="I represent a value node.";
  32724. $core.addMethod(
  32725. $core.method({
  32726. selector: "acceptDagVisitor:",
  32727. protocol: 'visiting',
  32728. fn: function (aVisitor){
  32729. var self=this;
  32730. return $core.withContext(function($ctx1) {
  32731. return $recv(aVisitor)._visitValueNode_(self);
  32732. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  32733. },
  32734. args: ["aVisitor"],
  32735. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  32736. referencedClasses: [],
  32737. messageSends: ["visitValueNode:"]
  32738. }),
  32739. $globals.ValueNode);
  32740. $core.addMethod(
  32741. $core.method({
  32742. selector: "isImmutable",
  32743. protocol: 'testing',
  32744. fn: function (){
  32745. var self=this;
  32746. return $core.withContext(function($ctx1) {
  32747. return $recv(self._value())._isImmutable();
  32748. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  32749. },
  32750. args: [],
  32751. source: "isImmutable\x0a\x09^ self value isImmutable",
  32752. referencedClasses: [],
  32753. messageSends: ["isImmutable", "value"]
  32754. }),
  32755. $globals.ValueNode);
  32756. $core.addMethod(
  32757. $core.method({
  32758. selector: "isValueNode",
  32759. protocol: 'testing',
  32760. fn: function (){
  32761. var self=this;
  32762. return true;
  32763. },
  32764. args: [],
  32765. source: "isValueNode\x0a\x09^ true",
  32766. referencedClasses: [],
  32767. messageSends: []
  32768. }),
  32769. $globals.ValueNode);
  32770. $core.addMethod(
  32771. $core.method({
  32772. selector: "value",
  32773. protocol: 'accessing',
  32774. fn: function (){
  32775. var self=this;
  32776. return self["@value"];
  32777. },
  32778. args: [],
  32779. source: "value\x0a\x09^ value",
  32780. referencedClasses: [],
  32781. messageSends: []
  32782. }),
  32783. $globals.ValueNode);
  32784. $core.addMethod(
  32785. $core.method({
  32786. selector: "value:",
  32787. protocol: 'accessing',
  32788. fn: function (anObject){
  32789. var self=this;
  32790. self["@value"]=anObject;
  32791. return self;
  32792. },
  32793. args: ["anObject"],
  32794. source: "value: anObject\x0a\x09value := anObject",
  32795. referencedClasses: [],
  32796. messageSends: []
  32797. }),
  32798. $globals.ValueNode);
  32799. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  32800. $globals.VariableNode.comment="I represent an variable node.";
  32801. $core.addMethod(
  32802. $core.method({
  32803. selector: "acceptDagVisitor:",
  32804. protocol: 'visiting',
  32805. fn: function (aVisitor){
  32806. var self=this;
  32807. return $core.withContext(function($ctx1) {
  32808. return $recv(aVisitor)._visitVariableNode_(self);
  32809. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  32810. },
  32811. args: ["aVisitor"],
  32812. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  32813. referencedClasses: [],
  32814. messageSends: ["visitVariableNode:"]
  32815. }),
  32816. $globals.VariableNode);
  32817. $core.addMethod(
  32818. $core.method({
  32819. selector: "alias",
  32820. protocol: 'accessing',
  32821. fn: function (){
  32822. var self=this;
  32823. return $core.withContext(function($ctx1) {
  32824. return $recv(self._binding())._alias();
  32825. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  32826. },
  32827. args: [],
  32828. source: "alias\x0a\x09^ self binding alias",
  32829. referencedClasses: [],
  32830. messageSends: ["alias", "binding"]
  32831. }),
  32832. $globals.VariableNode);
  32833. $core.addMethod(
  32834. $core.method({
  32835. selector: "assigned",
  32836. protocol: 'accessing',
  32837. fn: function (){
  32838. var self=this;
  32839. return $core.withContext(function($ctx1) {
  32840. var $1,$receiver;
  32841. $1=self["@assigned"];
  32842. if(($receiver = $1) == null || $receiver.isNil){
  32843. return false;
  32844. } else {
  32845. return $1;
  32846. }
  32847. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  32848. },
  32849. args: [],
  32850. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  32851. referencedClasses: [],
  32852. messageSends: ["ifNil:"]
  32853. }),
  32854. $globals.VariableNode);
  32855. $core.addMethod(
  32856. $core.method({
  32857. selector: "assigned:",
  32858. protocol: 'accessing',
  32859. fn: function (aBoolean){
  32860. var self=this;
  32861. self["@assigned"]=aBoolean;
  32862. return self;
  32863. },
  32864. args: ["aBoolean"],
  32865. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  32866. referencedClasses: [],
  32867. messageSends: []
  32868. }),
  32869. $globals.VariableNode);
  32870. $core.addMethod(
  32871. $core.method({
  32872. selector: "beAssigned",
  32873. protocol: 'accessing',
  32874. fn: function (){
  32875. var self=this;
  32876. return $core.withContext(function($ctx1) {
  32877. $recv(self._binding())._validateAssignment();
  32878. self["@assigned"]=true;
  32879. return self;
  32880. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  32881. },
  32882. args: [],
  32883. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  32884. referencedClasses: [],
  32885. messageSends: ["validateAssignment", "binding"]
  32886. }),
  32887. $globals.VariableNode);
  32888. $core.addMethod(
  32889. $core.method({
  32890. selector: "binding",
  32891. protocol: 'accessing',
  32892. fn: function (){
  32893. var self=this;
  32894. return self["@binding"];
  32895. },
  32896. args: [],
  32897. source: "binding\x0a\x09^ binding",
  32898. referencedClasses: [],
  32899. messageSends: []
  32900. }),
  32901. $globals.VariableNode);
  32902. $core.addMethod(
  32903. $core.method({
  32904. selector: "binding:",
  32905. protocol: 'accessing',
  32906. fn: function (aScopeVar){
  32907. var self=this;
  32908. self["@binding"]=aScopeVar;
  32909. return self;
  32910. },
  32911. args: ["aScopeVar"],
  32912. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  32913. referencedClasses: [],
  32914. messageSends: []
  32915. }),
  32916. $globals.VariableNode);
  32917. $core.addMethod(
  32918. $core.method({
  32919. selector: "isArgument",
  32920. protocol: 'testing',
  32921. fn: function (){
  32922. var self=this;
  32923. return $core.withContext(function($ctx1) {
  32924. return $recv(self._binding())._isArgVar();
  32925. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  32926. },
  32927. args: [],
  32928. source: "isArgument\x0a\x09^ self binding isArgVar",
  32929. referencedClasses: [],
  32930. messageSends: ["isArgVar", "binding"]
  32931. }),
  32932. $globals.VariableNode);
  32933. $core.addMethod(
  32934. $core.method({
  32935. selector: "isImmutable",
  32936. protocol: 'testing',
  32937. fn: function (){
  32938. var self=this;
  32939. return $core.withContext(function($ctx1) {
  32940. return $recv(self._binding())._isImmutable();
  32941. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  32942. },
  32943. args: [],
  32944. source: "isImmutable\x0a\x09^ self binding isImmutable",
  32945. referencedClasses: [],
  32946. messageSends: ["isImmutable", "binding"]
  32947. }),
  32948. $globals.VariableNode);
  32949. $core.addMethod(
  32950. $core.method({
  32951. selector: "isNavigationNode",
  32952. protocol: 'testing',
  32953. fn: function (){
  32954. var self=this;
  32955. return true;
  32956. },
  32957. args: [],
  32958. source: "isNavigationNode\x0a\x09^ true",
  32959. referencedClasses: [],
  32960. messageSends: []
  32961. }),
  32962. $globals.VariableNode);
  32963. $core.addMethod(
  32964. $core.method({
  32965. selector: "isSuperKeyword",
  32966. protocol: 'testing',
  32967. fn: function (){
  32968. var self=this;
  32969. return $core.withContext(function($ctx1) {
  32970. return $recv(self._value()).__eq("super");
  32971. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  32972. },
  32973. args: [],
  32974. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  32975. referencedClasses: [],
  32976. messageSends: ["=", "value"]
  32977. }),
  32978. $globals.VariableNode);
  32979. $core.addMethod(
  32980. $core.method({
  32981. selector: "isVariableNode",
  32982. protocol: 'testing',
  32983. fn: function (){
  32984. var self=this;
  32985. return true;
  32986. },
  32987. args: [],
  32988. source: "isVariableNode\x0a\x09^ true",
  32989. referencedClasses: [],
  32990. messageSends: []
  32991. }),
  32992. $globals.VariableNode);
  32993. $core.addMethod(
  32994. $core.method({
  32995. selector: "navigationLink",
  32996. protocol: 'accessing',
  32997. fn: function (){
  32998. var self=this;
  32999. return $core.withContext(function($ctx1) {
  33000. return self._value();
  33001. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  33002. },
  33003. args: [],
  33004. source: "navigationLink\x0a\x09^ self value",
  33005. referencedClasses: [],
  33006. messageSends: ["value"]
  33007. }),
  33008. $globals.VariableNode);
  33009. $core.addClass('ParentFakingPathDagVisitor', $globals.PathDagVisitor, ['setParentSelector'], 'Compiler-AST');
  33010. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  33011. $core.addMethod(
  33012. $core.method({
  33013. selector: "visit:",
  33014. protocol: 'visiting',
  33015. fn: function (aNode){
  33016. var self=this;
  33017. return $core.withContext(function($ctx1) {
  33018. var $1;
  33019. $recv(self._path())._ifNotEmpty_((function(p){
  33020. return $core.withContext(function($ctx2) {
  33021. return $recv(aNode)._parent_($recv(p)._last());
  33022. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  33023. }));
  33024. $1=(
  33025. $ctx1.supercall = true,
  33026. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  33027. $ctx1.supercall = false;
  33028. return $1;
  33029. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  33030. },
  33031. args: ["aNode"],
  33032. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  33033. referencedClasses: [],
  33034. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  33035. }),
  33036. $globals.ParentFakingPathDagVisitor);
  33037. $core.addClass('NodeVisitor', $globals.ParentFakingPathDagVisitor, [], 'Compiler-AST');
  33038. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  33039. $core.addMethod(
  33040. $core.method({
  33041. selector: "visitAssignmentNode:",
  33042. protocol: 'visiting',
  33043. fn: function (aNode){
  33044. var self=this;
  33045. return $core.withContext(function($ctx1) {
  33046. return self._visitDagNode_(aNode);
  33047. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  33048. },
  33049. args: ["aNode"],
  33050. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33051. referencedClasses: [],
  33052. messageSends: ["visitDagNode:"]
  33053. }),
  33054. $globals.NodeVisitor);
  33055. $core.addMethod(
  33056. $core.method({
  33057. selector: "visitBlockNode:",
  33058. protocol: 'visiting',
  33059. fn: function (aNode){
  33060. var self=this;
  33061. return $core.withContext(function($ctx1) {
  33062. return self._visitDagNode_(aNode);
  33063. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  33064. },
  33065. args: ["aNode"],
  33066. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33067. referencedClasses: [],
  33068. messageSends: ["visitDagNode:"]
  33069. }),
  33070. $globals.NodeVisitor);
  33071. $core.addMethod(
  33072. $core.method({
  33073. selector: "visitBlockSequenceNode:",
  33074. protocol: 'visiting',
  33075. fn: function (aNode){
  33076. var self=this;
  33077. return $core.withContext(function($ctx1) {
  33078. return self._visitSequenceNode_(aNode);
  33079. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33080. },
  33081. args: ["aNode"],
  33082. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  33083. referencedClasses: [],
  33084. messageSends: ["visitSequenceNode:"]
  33085. }),
  33086. $globals.NodeVisitor);
  33087. $core.addMethod(
  33088. $core.method({
  33089. selector: "visitCascadeNode:",
  33090. protocol: 'visiting',
  33091. fn: function (aNode){
  33092. var self=this;
  33093. return $core.withContext(function($ctx1) {
  33094. return self._visitDagNode_(aNode);
  33095. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  33096. },
  33097. args: ["aNode"],
  33098. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33099. referencedClasses: [],
  33100. messageSends: ["visitDagNode:"]
  33101. }),
  33102. $globals.NodeVisitor);
  33103. $core.addMethod(
  33104. $core.method({
  33105. selector: "visitDagNode:",
  33106. protocol: 'visiting',
  33107. fn: function (aNode){
  33108. var self=this;
  33109. return $core.withContext(function($ctx1) {
  33110. return self._visitDagNodeVariantSimple_(aNode);
  33111. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  33112. },
  33113. args: ["aNode"],
  33114. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  33115. referencedClasses: [],
  33116. messageSends: ["visitDagNodeVariantSimple:"]
  33117. }),
  33118. $globals.NodeVisitor);
  33119. $core.addMethod(
  33120. $core.method({
  33121. selector: "visitDynamicArrayNode:",
  33122. protocol: 'visiting',
  33123. fn: function (aNode){
  33124. var self=this;
  33125. return $core.withContext(function($ctx1) {
  33126. return self._visitDagNode_(aNode);
  33127. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  33128. },
  33129. args: ["aNode"],
  33130. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33131. referencedClasses: [],
  33132. messageSends: ["visitDagNode:"]
  33133. }),
  33134. $globals.NodeVisitor);
  33135. $core.addMethod(
  33136. $core.method({
  33137. selector: "visitDynamicDictionaryNode:",
  33138. protocol: 'visiting',
  33139. fn: function (aNode){
  33140. var self=this;
  33141. return $core.withContext(function($ctx1) {
  33142. return self._visitDagNode_(aNode);
  33143. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  33144. },
  33145. args: ["aNode"],
  33146. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33147. referencedClasses: [],
  33148. messageSends: ["visitDagNode:"]
  33149. }),
  33150. $globals.NodeVisitor);
  33151. $core.addMethod(
  33152. $core.method({
  33153. selector: "visitJSStatementNode:",
  33154. protocol: 'visiting',
  33155. fn: function (aNode){
  33156. var self=this;
  33157. return $core.withContext(function($ctx1) {
  33158. return self._visitDagNode_(aNode);
  33159. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  33160. },
  33161. args: ["aNode"],
  33162. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33163. referencedClasses: [],
  33164. messageSends: ["visitDagNode:"]
  33165. }),
  33166. $globals.NodeVisitor);
  33167. $core.addMethod(
  33168. $core.method({
  33169. selector: "visitMethodNode:",
  33170. protocol: 'visiting',
  33171. fn: function (aNode){
  33172. var self=this;
  33173. return $core.withContext(function($ctx1) {
  33174. return self._visitDagNode_(aNode);
  33175. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  33176. },
  33177. args: ["aNode"],
  33178. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33179. referencedClasses: [],
  33180. messageSends: ["visitDagNode:"]
  33181. }),
  33182. $globals.NodeVisitor);
  33183. $core.addMethod(
  33184. $core.method({
  33185. selector: "visitReturnNode:",
  33186. protocol: 'visiting',
  33187. fn: function (aNode){
  33188. var self=this;
  33189. return $core.withContext(function($ctx1) {
  33190. return self._visitDagNode_(aNode);
  33191. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  33192. },
  33193. args: ["aNode"],
  33194. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33195. referencedClasses: [],
  33196. messageSends: ["visitDagNode:"]
  33197. }),
  33198. $globals.NodeVisitor);
  33199. $core.addMethod(
  33200. $core.method({
  33201. selector: "visitSendNode:",
  33202. protocol: 'visiting',
  33203. fn: function (aNode){
  33204. var self=this;
  33205. return $core.withContext(function($ctx1) {
  33206. return self._visitDagNode_(aNode);
  33207. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  33208. },
  33209. args: ["aNode"],
  33210. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33211. referencedClasses: [],
  33212. messageSends: ["visitDagNode:"]
  33213. }),
  33214. $globals.NodeVisitor);
  33215. $core.addMethod(
  33216. $core.method({
  33217. selector: "visitSequenceNode:",
  33218. protocol: 'visiting',
  33219. fn: function (aNode){
  33220. var self=this;
  33221. return $core.withContext(function($ctx1) {
  33222. return self._visitDagNode_(aNode);
  33223. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33224. },
  33225. args: ["aNode"],
  33226. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33227. referencedClasses: [],
  33228. messageSends: ["visitDagNode:"]
  33229. }),
  33230. $globals.NodeVisitor);
  33231. $core.addMethod(
  33232. $core.method({
  33233. selector: "visitValueNode:",
  33234. protocol: 'visiting',
  33235. fn: function (aNode){
  33236. var self=this;
  33237. return $core.withContext(function($ctx1) {
  33238. return self._visitDagNode_(aNode);
  33239. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  33240. },
  33241. args: ["aNode"],
  33242. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33243. referencedClasses: [],
  33244. messageSends: ["visitDagNode:"]
  33245. }),
  33246. $globals.NodeVisitor);
  33247. $core.addMethod(
  33248. $core.method({
  33249. selector: "visitVariableNode:",
  33250. protocol: 'visiting',
  33251. fn: function (aNode){
  33252. var self=this;
  33253. return $core.withContext(function($ctx1) {
  33254. return self._visitDagNode_(aNode);
  33255. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  33256. },
  33257. args: ["aNode"],
  33258. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  33259. referencedClasses: [],
  33260. messageSends: ["visitDagNode:"]
  33261. }),
  33262. $globals.NodeVisitor);
  33263. $core.addMethod(
  33264. $core.method({
  33265. selector: "ast",
  33266. protocol: '*Compiler-AST',
  33267. fn: function (){
  33268. var self=this;
  33269. return $core.withContext(function($ctx1) {
  33270. var $1;
  33271. $1=self._source();
  33272. $ctx1.sendIdx["source"]=1;
  33273. $recv($1)._ifEmpty_((function(){
  33274. return $core.withContext(function($ctx2) {
  33275. return self._error_("Method source is empty");
  33276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33277. }));
  33278. return $recv($globals.Smalltalk)._parse_(self._source());
  33279. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  33280. },
  33281. args: [],
  33282. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  33283. referencedClasses: ["Smalltalk"],
  33284. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  33285. }),
  33286. $globals.CompiledMethod);
  33287. });
  33288. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  33289. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  33290. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33291. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  33292. $core.addPackage('Compiler-Semantic');
  33293. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  33294. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33295. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  33296. $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.";
  33297. $core.addMethod(
  33298. $core.method({
  33299. selector: "addArg:",
  33300. protocol: 'adding',
  33301. fn: function (aString){
  33302. var self=this;
  33303. return $core.withContext(function($ctx1) {
  33304. var $1;
  33305. $1=self._args();
  33306. $ctx1.sendIdx["args"]=1;
  33307. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  33308. $recv($recv(self._args())._at_(aString))._scope_(self);
  33309. return self;
  33310. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  33311. },
  33312. args: ["aString"],
  33313. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  33314. referencedClasses: ["ArgVar"],
  33315. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  33316. }),
  33317. $globals.LexicalScope);
  33318. $core.addMethod(
  33319. $core.method({
  33320. selector: "addTemp:",
  33321. protocol: 'adding',
  33322. fn: function (aString){
  33323. var self=this;
  33324. return $core.withContext(function($ctx1) {
  33325. var $1;
  33326. $1=self._temps();
  33327. $ctx1.sendIdx["temps"]=1;
  33328. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  33329. $recv($recv(self._temps())._at_(aString))._scope_(self);
  33330. return self;
  33331. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  33332. },
  33333. args: ["aString"],
  33334. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  33335. referencedClasses: ["TempVar"],
  33336. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  33337. }),
  33338. $globals.LexicalScope);
  33339. $core.addMethod(
  33340. $core.method({
  33341. selector: "alias",
  33342. protocol: 'accessing',
  33343. fn: function (){
  33344. var self=this;
  33345. return $core.withContext(function($ctx1) {
  33346. return "$ctx".__comma($recv(self._scopeLevel())._asString());
  33347. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  33348. },
  33349. args: [],
  33350. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  33351. referencedClasses: [],
  33352. messageSends: [",", "asString", "scopeLevel"]
  33353. }),
  33354. $globals.LexicalScope);
  33355. $core.addMethod(
  33356. $core.method({
  33357. selector: "allVariableNames",
  33358. protocol: 'accessing',
  33359. fn: function (){
  33360. var self=this;
  33361. return $core.withContext(function($ctx1) {
  33362. var $1;
  33363. $1=$recv(self._args())._keys();
  33364. $ctx1.sendIdx["keys"]=1;
  33365. return $recv($1).__comma($recv(self._temps())._keys());
  33366. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  33367. },
  33368. args: [],
  33369. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  33370. referencedClasses: [],
  33371. messageSends: [",", "keys", "args", "temps"]
  33372. }),
  33373. $globals.LexicalScope);
  33374. $core.addMethod(
  33375. $core.method({
  33376. selector: "args",
  33377. protocol: 'accessing',
  33378. fn: function (){
  33379. var self=this;
  33380. return $core.withContext(function($ctx1) {
  33381. var $1,$receiver;
  33382. $1=self["@args"];
  33383. if(($receiver = $1) == null || $receiver.isNil){
  33384. self["@args"]=$recv($globals.Dictionary)._new();
  33385. return self["@args"];
  33386. } else {
  33387. return $1;
  33388. }
  33389. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  33390. },
  33391. args: [],
  33392. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  33393. referencedClasses: ["Dictionary"],
  33394. messageSends: ["ifNil:", "new"]
  33395. }),
  33396. $globals.LexicalScope);
  33397. $core.addMethod(
  33398. $core.method({
  33399. selector: "bindingFor:",
  33400. protocol: 'accessing',
  33401. fn: function (aStringOrNode){
  33402. var self=this;
  33403. return $core.withContext(function($ctx1) {
  33404. var $2,$3,$4,$5,$1;
  33405. $2=self._pseudoVars();
  33406. $3=$recv(aStringOrNode)._value();
  33407. $ctx1.sendIdx["value"]=1;
  33408. $1=$recv($2)._at_ifAbsent_($3,(function(){
  33409. return $core.withContext(function($ctx2) {
  33410. $4=self._args();
  33411. $5=$recv(aStringOrNode)._value();
  33412. $ctx2.sendIdx["value"]=2;
  33413. return $recv($4)._at_ifAbsent_($5,(function(){
  33414. return $core.withContext(function($ctx3) {
  33415. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  33416. return nil;
  33417. }));
  33418. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33419. }));
  33420. $ctx2.sendIdx["at:ifAbsent:"]=2;
  33421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33422. }));
  33423. $ctx1.sendIdx["at:ifAbsent:"]=1;
  33424. return $1;
  33425. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  33426. },
  33427. args: ["aStringOrNode"],
  33428. 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 ]]]",
  33429. referencedClasses: [],
  33430. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  33431. }),
  33432. $globals.LexicalScope);
  33433. $core.addMethod(
  33434. $core.method({
  33435. selector: "blockIndex",
  33436. protocol: 'accessing',
  33437. fn: function (){
  33438. var self=this;
  33439. return $core.withContext(function($ctx1) {
  33440. var $1,$receiver;
  33441. $1=self["@blockIndex"];
  33442. if(($receiver = $1) == null || $receiver.isNil){
  33443. return (0);
  33444. } else {
  33445. return $1;
  33446. }
  33447. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  33448. },
  33449. args: [],
  33450. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  33451. referencedClasses: [],
  33452. messageSends: ["ifNil:"]
  33453. }),
  33454. $globals.LexicalScope);
  33455. $core.addMethod(
  33456. $core.method({
  33457. selector: "blockIndex:",
  33458. protocol: 'accessing',
  33459. fn: function (anInteger){
  33460. var self=this;
  33461. self["@blockIndex"]=anInteger;
  33462. return self;
  33463. },
  33464. args: ["anInteger"],
  33465. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  33466. referencedClasses: [],
  33467. messageSends: []
  33468. }),
  33469. $globals.LexicalScope);
  33470. $core.addMethod(
  33471. $core.method({
  33472. selector: "canInlineNonLocalReturns",
  33473. protocol: 'testing',
  33474. fn: function (){
  33475. var self=this;
  33476. return $core.withContext(function($ctx1) {
  33477. return $recv(self._isInlined())._and_((function(){
  33478. return $core.withContext(function($ctx2) {
  33479. return $recv(self._outerScope())._canInlineNonLocalReturns();
  33480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33481. }));
  33482. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  33483. },
  33484. args: [],
  33485. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  33486. referencedClasses: [],
  33487. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  33488. }),
  33489. $globals.LexicalScope);
  33490. $core.addMethod(
  33491. $core.method({
  33492. selector: "instruction",
  33493. protocol: 'accessing',
  33494. fn: function (){
  33495. var self=this;
  33496. return self["@instruction"];
  33497. },
  33498. args: [],
  33499. source: "instruction\x0a\x09^ instruction",
  33500. referencedClasses: [],
  33501. messageSends: []
  33502. }),
  33503. $globals.LexicalScope);
  33504. $core.addMethod(
  33505. $core.method({
  33506. selector: "instruction:",
  33507. protocol: 'accessing',
  33508. fn: function (anIRInstruction){
  33509. var self=this;
  33510. self["@instruction"]=anIRInstruction;
  33511. return self;
  33512. },
  33513. args: ["anIRInstruction"],
  33514. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  33515. referencedClasses: [],
  33516. messageSends: []
  33517. }),
  33518. $globals.LexicalScope);
  33519. $core.addMethod(
  33520. $core.method({
  33521. selector: "isBlockScope",
  33522. protocol: 'testing',
  33523. fn: function (){
  33524. var self=this;
  33525. return $core.withContext(function($ctx1) {
  33526. return $recv(self._isMethodScope())._not();
  33527. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  33528. },
  33529. args: [],
  33530. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  33531. referencedClasses: [],
  33532. messageSends: ["not", "isMethodScope"]
  33533. }),
  33534. $globals.LexicalScope);
  33535. $core.addMethod(
  33536. $core.method({
  33537. selector: "isInlined",
  33538. protocol: 'testing',
  33539. fn: function (){
  33540. var self=this;
  33541. return $core.withContext(function($ctx1) {
  33542. var $2,$1;
  33543. $2=self._instruction();
  33544. $ctx1.sendIdx["instruction"]=1;
  33545. $1=$recv($2)._notNil();
  33546. return $recv($1)._and_((function(){
  33547. return $core.withContext(function($ctx2) {
  33548. return $recv(self._instruction())._isInlined();
  33549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33550. }));
  33551. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  33552. },
  33553. args: [],
  33554. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  33555. referencedClasses: [],
  33556. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  33557. }),
  33558. $globals.LexicalScope);
  33559. $core.addMethod(
  33560. $core.method({
  33561. selector: "isMethodScope",
  33562. protocol: 'testing',
  33563. fn: function (){
  33564. var self=this;
  33565. return false;
  33566. },
  33567. args: [],
  33568. source: "isMethodScope\x0a\x09^ false",
  33569. referencedClasses: [],
  33570. messageSends: []
  33571. }),
  33572. $globals.LexicalScope);
  33573. $core.addMethod(
  33574. $core.method({
  33575. selector: "lookupVariable:",
  33576. protocol: 'accessing',
  33577. fn: function (aNode){
  33578. var self=this;
  33579. var lookup;
  33580. return $core.withContext(function($ctx1) {
  33581. var $1,$2,$receiver;
  33582. lookup=self._bindingFor_(aNode);
  33583. $1=lookup;
  33584. if(($receiver = $1) == null || $receiver.isNil){
  33585. $2=self._outerScope();
  33586. $ctx1.sendIdx["outerScope"]=1;
  33587. if(($receiver = $2) == null || $receiver.isNil){
  33588. lookup=$2;
  33589. } else {
  33590. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  33591. }
  33592. lookup;
  33593. } else {
  33594. $1;
  33595. }
  33596. return lookup;
  33597. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  33598. },
  33599. args: ["aNode"],
  33600. 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",
  33601. referencedClasses: [],
  33602. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  33603. }),
  33604. $globals.LexicalScope);
  33605. $core.addMethod(
  33606. $core.method({
  33607. selector: "methodScope",
  33608. protocol: 'accessing',
  33609. fn: function (){
  33610. var self=this;
  33611. return $core.withContext(function($ctx1) {
  33612. var $1,$receiver;
  33613. $1=self._outerScope();
  33614. $ctx1.sendIdx["outerScope"]=1;
  33615. if(($receiver = $1) == null || $receiver.isNil){
  33616. return $1;
  33617. } else {
  33618. return $recv(self._outerScope())._methodScope();
  33619. }
  33620. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  33621. },
  33622. args: [],
  33623. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  33624. referencedClasses: [],
  33625. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  33626. }),
  33627. $globals.LexicalScope);
  33628. $core.addMethod(
  33629. $core.method({
  33630. selector: "node",
  33631. protocol: 'accessing',
  33632. fn: function (){
  33633. var self=this;
  33634. return self["@node"];
  33635. },
  33636. args: [],
  33637. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  33638. referencedClasses: [],
  33639. messageSends: []
  33640. }),
  33641. $globals.LexicalScope);
  33642. $core.addMethod(
  33643. $core.method({
  33644. selector: "node:",
  33645. protocol: 'accessing',
  33646. fn: function (aNode){
  33647. var self=this;
  33648. self["@node"]=aNode;
  33649. return self;
  33650. },
  33651. args: ["aNode"],
  33652. source: "node: aNode\x0a\x09node := aNode",
  33653. referencedClasses: [],
  33654. messageSends: []
  33655. }),
  33656. $globals.LexicalScope);
  33657. $core.addMethod(
  33658. $core.method({
  33659. selector: "outerScope",
  33660. protocol: 'accessing',
  33661. fn: function (){
  33662. var self=this;
  33663. return self["@outerScope"];
  33664. },
  33665. args: [],
  33666. source: "outerScope\x0a\x09^ outerScope",
  33667. referencedClasses: [],
  33668. messageSends: []
  33669. }),
  33670. $globals.LexicalScope);
  33671. $core.addMethod(
  33672. $core.method({
  33673. selector: "outerScope:",
  33674. protocol: 'accessing',
  33675. fn: function (aLexicalScope){
  33676. var self=this;
  33677. self["@outerScope"]=aLexicalScope;
  33678. return self;
  33679. },
  33680. args: ["aLexicalScope"],
  33681. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  33682. referencedClasses: [],
  33683. messageSends: []
  33684. }),
  33685. $globals.LexicalScope);
  33686. $core.addMethod(
  33687. $core.method({
  33688. selector: "pseudoVars",
  33689. protocol: 'accessing',
  33690. fn: function (){
  33691. var self=this;
  33692. return $core.withContext(function($ctx1) {
  33693. return $recv(self._methodScope())._pseudoVars();
  33694. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  33695. },
  33696. args: [],
  33697. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  33698. referencedClasses: [],
  33699. messageSends: ["pseudoVars", "methodScope"]
  33700. }),
  33701. $globals.LexicalScope);
  33702. $core.addMethod(
  33703. $core.method({
  33704. selector: "scopeLevel",
  33705. protocol: 'accessing',
  33706. fn: function (){
  33707. var self=this;
  33708. return $core.withContext(function($ctx1) {
  33709. var $1,$2,$4,$3,$receiver;
  33710. $1=self._outerScope();
  33711. $ctx1.sendIdx["outerScope"]=1;
  33712. if(($receiver = $1) == null || $receiver.isNil){
  33713. return (1);
  33714. } else {
  33715. $1;
  33716. }
  33717. $2=self._isInlined();
  33718. if($core.assert($2)){
  33719. $4=self._outerScope();
  33720. $ctx1.sendIdx["outerScope"]=2;
  33721. $3=$recv($4)._scopeLevel();
  33722. $ctx1.sendIdx["scopeLevel"]=1;
  33723. return $3;
  33724. }
  33725. return $recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  33726. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  33727. },
  33728. args: [],
  33729. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  33730. referencedClasses: [],
  33731. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  33732. }),
  33733. $globals.LexicalScope);
  33734. $core.addMethod(
  33735. $core.method({
  33736. selector: "temps",
  33737. protocol: 'accessing',
  33738. fn: function (){
  33739. var self=this;
  33740. return $core.withContext(function($ctx1) {
  33741. var $1,$receiver;
  33742. $1=self["@temps"];
  33743. if(($receiver = $1) == null || $receiver.isNil){
  33744. self["@temps"]=$recv($globals.Dictionary)._new();
  33745. return self["@temps"];
  33746. } else {
  33747. return $1;
  33748. }
  33749. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  33750. },
  33751. args: [],
  33752. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  33753. referencedClasses: ["Dictionary"],
  33754. messageSends: ["ifNil:", "new"]
  33755. }),
  33756. $globals.LexicalScope);
  33757. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  33758. $globals.MethodLexicalScope.comment="I represent a method scope.";
  33759. $core.addMethod(
  33760. $core.method({
  33761. selector: "addIVar:",
  33762. protocol: 'adding',
  33763. fn: function (aString){
  33764. var self=this;
  33765. return $core.withContext(function($ctx1) {
  33766. var $1;
  33767. $1=self._iVars();
  33768. $ctx1.sendIdx["iVars"]=1;
  33769. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  33770. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  33771. return self;
  33772. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  33773. },
  33774. args: ["aString"],
  33775. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  33776. referencedClasses: ["InstanceVar"],
  33777. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  33778. }),
  33779. $globals.MethodLexicalScope);
  33780. $core.addMethod(
  33781. $core.method({
  33782. selector: "addNonLocalReturn:",
  33783. protocol: 'adding',
  33784. fn: function (aScope){
  33785. var self=this;
  33786. return $core.withContext(function($ctx1) {
  33787. $recv(self._nonLocalReturns())._add_(aScope);
  33788. return self;
  33789. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  33790. },
  33791. args: ["aScope"],
  33792. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  33793. referencedClasses: [],
  33794. messageSends: ["add:", "nonLocalReturns"]
  33795. }),
  33796. $globals.MethodLexicalScope);
  33797. $core.addMethod(
  33798. $core.method({
  33799. selector: "allVariableNames",
  33800. protocol: 'accessing',
  33801. fn: function (){
  33802. var self=this;
  33803. return $core.withContext(function($ctx1) {
  33804. var $1;
  33805. $1=(
  33806. $ctx1.supercall = true,
  33807. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($recv(self), []));
  33808. $ctx1.supercall = false;
  33809. return $recv($1).__comma($recv(self._iVars())._keys());
  33810. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  33811. },
  33812. args: [],
  33813. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  33814. referencedClasses: [],
  33815. messageSends: [",", "allVariableNames", "keys", "iVars"]
  33816. }),
  33817. $globals.MethodLexicalScope);
  33818. $core.addMethod(
  33819. $core.method({
  33820. selector: "bindingFor:",
  33821. protocol: 'accessing',
  33822. fn: function (aNode){
  33823. var self=this;
  33824. return $core.withContext(function($ctx1) {
  33825. var $1,$receiver;
  33826. $1=(
  33827. $ctx1.supercall = true,
  33828. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  33829. $ctx1.supercall = false;
  33830. if(($receiver = $1) == null || $receiver.isNil){
  33831. return $recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  33832. return nil;
  33833. }));
  33834. } else {
  33835. return $1;
  33836. }
  33837. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  33838. },
  33839. args: ["aNode"],
  33840. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  33841. referencedClasses: [],
  33842. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  33843. }),
  33844. $globals.MethodLexicalScope);
  33845. $core.addMethod(
  33846. $core.method({
  33847. selector: "canInlineNonLocalReturns",
  33848. protocol: 'testing',
  33849. fn: function (){
  33850. var self=this;
  33851. return true;
  33852. },
  33853. args: [],
  33854. source: "canInlineNonLocalReturns\x0a\x09^ true",
  33855. referencedClasses: [],
  33856. messageSends: []
  33857. }),
  33858. $globals.MethodLexicalScope);
  33859. $core.addMethod(
  33860. $core.method({
  33861. selector: "hasLocalReturn",
  33862. protocol: 'testing',
  33863. fn: function (){
  33864. var self=this;
  33865. return $core.withContext(function($ctx1) {
  33866. return self._localReturn();
  33867. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  33868. },
  33869. args: [],
  33870. source: "hasLocalReturn\x0a\x09^ self localReturn",
  33871. referencedClasses: [],
  33872. messageSends: ["localReturn"]
  33873. }),
  33874. $globals.MethodLexicalScope);
  33875. $core.addMethod(
  33876. $core.method({
  33877. selector: "hasNonLocalReturn",
  33878. protocol: 'testing',
  33879. fn: function (){
  33880. var self=this;
  33881. return $core.withContext(function($ctx1) {
  33882. return $recv(self._nonLocalReturns())._notEmpty();
  33883. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  33884. },
  33885. args: [],
  33886. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  33887. referencedClasses: [],
  33888. messageSends: ["notEmpty", "nonLocalReturns"]
  33889. }),
  33890. $globals.MethodLexicalScope);
  33891. $core.addMethod(
  33892. $core.method({
  33893. selector: "iVars",
  33894. protocol: 'accessing',
  33895. fn: function (){
  33896. var self=this;
  33897. return $core.withContext(function($ctx1) {
  33898. var $1,$receiver;
  33899. $1=self["@iVars"];
  33900. if(($receiver = $1) == null || $receiver.isNil){
  33901. self["@iVars"]=$recv($globals.Dictionary)._new();
  33902. return self["@iVars"];
  33903. } else {
  33904. return $1;
  33905. }
  33906. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  33907. },
  33908. args: [],
  33909. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  33910. referencedClasses: ["Dictionary"],
  33911. messageSends: ["ifNil:", "new"]
  33912. }),
  33913. $globals.MethodLexicalScope);
  33914. $core.addMethod(
  33915. $core.method({
  33916. selector: "isMethodScope",
  33917. protocol: 'testing',
  33918. fn: function (){
  33919. var self=this;
  33920. return true;
  33921. },
  33922. args: [],
  33923. source: "isMethodScope\x0a\x09^ true",
  33924. referencedClasses: [],
  33925. messageSends: []
  33926. }),
  33927. $globals.MethodLexicalScope);
  33928. $core.addMethod(
  33929. $core.method({
  33930. selector: "localReturn",
  33931. protocol: 'accessing',
  33932. fn: function (){
  33933. var self=this;
  33934. return $core.withContext(function($ctx1) {
  33935. var $1,$receiver;
  33936. $1=self["@localReturn"];
  33937. if(($receiver = $1) == null || $receiver.isNil){
  33938. return false;
  33939. } else {
  33940. return $1;
  33941. }
  33942. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  33943. },
  33944. args: [],
  33945. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  33946. referencedClasses: [],
  33947. messageSends: ["ifNil:"]
  33948. }),
  33949. $globals.MethodLexicalScope);
  33950. $core.addMethod(
  33951. $core.method({
  33952. selector: "localReturn:",
  33953. protocol: 'accessing',
  33954. fn: function (aBoolean){
  33955. var self=this;
  33956. self["@localReturn"]=aBoolean;
  33957. return self;
  33958. },
  33959. args: ["aBoolean"],
  33960. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  33961. referencedClasses: [],
  33962. messageSends: []
  33963. }),
  33964. $globals.MethodLexicalScope);
  33965. $core.addMethod(
  33966. $core.method({
  33967. selector: "methodScope",
  33968. protocol: 'accessing',
  33969. fn: function (){
  33970. var self=this;
  33971. return self;
  33972. },
  33973. args: [],
  33974. source: "methodScope\x0a\x09^ self",
  33975. referencedClasses: [],
  33976. messageSends: []
  33977. }),
  33978. $globals.MethodLexicalScope);
  33979. $core.addMethod(
  33980. $core.method({
  33981. selector: "nonLocalReturns",
  33982. protocol: 'accessing',
  33983. fn: function (){
  33984. var self=this;
  33985. return $core.withContext(function($ctx1) {
  33986. var $1,$receiver;
  33987. $1=self["@nonLocalReturns"];
  33988. if(($receiver = $1) == null || $receiver.isNil){
  33989. self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  33990. return self["@nonLocalReturns"];
  33991. } else {
  33992. return $1;
  33993. }
  33994. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  33995. },
  33996. args: [],
  33997. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  33998. referencedClasses: ["OrderedCollection"],
  33999. messageSends: ["ifNil:", "new"]
  34000. }),
  34001. $globals.MethodLexicalScope);
  34002. $core.addMethod(
  34003. $core.method({
  34004. selector: "pseudoVars",
  34005. protocol: 'accessing',
  34006. fn: function (){
  34007. var self=this;
  34008. return $core.withContext(function($ctx1) {
  34009. var $1,$2,$4,$3,$receiver;
  34010. $1=self["@pseudoVars"];
  34011. if(($receiver = $1) == null || $receiver.isNil){
  34012. self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  34013. self["@pseudoVars"];
  34014. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  34015. return $core.withContext(function($ctx2) {
  34016. $2=self["@pseudoVars"];
  34017. $4=$recv($globals.PseudoVar)._on_(each);
  34018. $recv($4)._scope_(self._methodScope());
  34019. $3=$recv($4)._yourself();
  34020. return $recv($2)._at_put_(each,$3);
  34021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34022. }));
  34023. } else {
  34024. $1;
  34025. }
  34026. return self["@pseudoVars"];
  34027. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  34028. },
  34029. args: [],
  34030. 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",
  34031. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  34032. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  34033. }),
  34034. $globals.MethodLexicalScope);
  34035. $core.addMethod(
  34036. $core.method({
  34037. selector: "removeNonLocalReturn:",
  34038. protocol: 'adding',
  34039. fn: function (aScope){
  34040. var self=this;
  34041. return $core.withContext(function($ctx1) {
  34042. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  34043. }));
  34044. return self;
  34045. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34046. },
  34047. args: ["aScope"],
  34048. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  34049. referencedClasses: [],
  34050. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  34051. }),
  34052. $globals.MethodLexicalScope);
  34053. $core.addMethod(
  34054. $core.method({
  34055. selector: "unknownVariables",
  34056. protocol: 'accessing',
  34057. fn: function (){
  34058. var self=this;
  34059. return $core.withContext(function($ctx1) {
  34060. var $1,$receiver;
  34061. $1=self["@unknownVariables"];
  34062. if(($receiver = $1) == null || $receiver.isNil){
  34063. self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  34064. return self["@unknownVariables"];
  34065. } else {
  34066. return $1;
  34067. }
  34068. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  34069. },
  34070. args: [],
  34071. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  34072. referencedClasses: ["OrderedCollection"],
  34073. messageSends: ["ifNil:", "new"]
  34074. }),
  34075. $globals.MethodLexicalScope);
  34076. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  34077. $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.";
  34078. $core.addMethod(
  34079. $core.method({
  34080. selector: "alias",
  34081. protocol: 'accessing',
  34082. fn: function (){
  34083. var self=this;
  34084. return $core.withContext(function($ctx1) {
  34085. return $recv(self._name())._asVariableName();
  34086. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  34087. },
  34088. args: [],
  34089. source: "alias\x0a\x09^ self name asVariableName",
  34090. referencedClasses: [],
  34091. messageSends: ["asVariableName", "name"]
  34092. }),
  34093. $globals.ScopeVar);
  34094. $core.addMethod(
  34095. $core.method({
  34096. selector: "isArgVar",
  34097. protocol: 'testing',
  34098. fn: function (){
  34099. var self=this;
  34100. return false;
  34101. },
  34102. args: [],
  34103. source: "isArgVar\x0a\x09^ false",
  34104. referencedClasses: [],
  34105. messageSends: []
  34106. }),
  34107. $globals.ScopeVar);
  34108. $core.addMethod(
  34109. $core.method({
  34110. selector: "isClassRefVar",
  34111. protocol: 'testing',
  34112. fn: function (){
  34113. var self=this;
  34114. return false;
  34115. },
  34116. args: [],
  34117. source: "isClassRefVar\x0a\x09^ false",
  34118. referencedClasses: [],
  34119. messageSends: []
  34120. }),
  34121. $globals.ScopeVar);
  34122. $core.addMethod(
  34123. $core.method({
  34124. selector: "isImmutable",
  34125. protocol: 'testing',
  34126. fn: function (){
  34127. var self=this;
  34128. return false;
  34129. },
  34130. args: [],
  34131. source: "isImmutable\x0a\x09^ false",
  34132. referencedClasses: [],
  34133. messageSends: []
  34134. }),
  34135. $globals.ScopeVar);
  34136. $core.addMethod(
  34137. $core.method({
  34138. selector: "isInstanceVar",
  34139. protocol: 'testing',
  34140. fn: function (){
  34141. var self=this;
  34142. return false;
  34143. },
  34144. args: [],
  34145. source: "isInstanceVar\x0a\x09^ false",
  34146. referencedClasses: [],
  34147. messageSends: []
  34148. }),
  34149. $globals.ScopeVar);
  34150. $core.addMethod(
  34151. $core.method({
  34152. selector: "isPseudoVar",
  34153. protocol: 'testing',
  34154. fn: function (){
  34155. var self=this;
  34156. return false;
  34157. },
  34158. args: [],
  34159. source: "isPseudoVar\x0a\x09^ false",
  34160. referencedClasses: [],
  34161. messageSends: []
  34162. }),
  34163. $globals.ScopeVar);
  34164. $core.addMethod(
  34165. $core.method({
  34166. selector: "isTempVar",
  34167. protocol: 'testing',
  34168. fn: function (){
  34169. var self=this;
  34170. return false;
  34171. },
  34172. args: [],
  34173. source: "isTempVar\x0a\x09^ false",
  34174. referencedClasses: [],
  34175. messageSends: []
  34176. }),
  34177. $globals.ScopeVar);
  34178. $core.addMethod(
  34179. $core.method({
  34180. selector: "isUnknownVar",
  34181. protocol: 'testing',
  34182. fn: function (){
  34183. var self=this;
  34184. return false;
  34185. },
  34186. args: [],
  34187. source: "isUnknownVar\x0a\x09^ false",
  34188. referencedClasses: [],
  34189. messageSends: []
  34190. }),
  34191. $globals.ScopeVar);
  34192. $core.addMethod(
  34193. $core.method({
  34194. selector: "name",
  34195. protocol: 'accessing',
  34196. fn: function (){
  34197. var self=this;
  34198. return self["@name"];
  34199. },
  34200. args: [],
  34201. source: "name\x0a\x09^ name",
  34202. referencedClasses: [],
  34203. messageSends: []
  34204. }),
  34205. $globals.ScopeVar);
  34206. $core.addMethod(
  34207. $core.method({
  34208. selector: "name:",
  34209. protocol: 'accessing',
  34210. fn: function (aString){
  34211. var self=this;
  34212. self["@name"]=aString;
  34213. return self;
  34214. },
  34215. args: ["aString"],
  34216. source: "name: aString\x0a\x09name := aString",
  34217. referencedClasses: [],
  34218. messageSends: []
  34219. }),
  34220. $globals.ScopeVar);
  34221. $core.addMethod(
  34222. $core.method({
  34223. selector: "scope",
  34224. protocol: 'accessing',
  34225. fn: function (){
  34226. var self=this;
  34227. return self["@scope"];
  34228. },
  34229. args: [],
  34230. source: "scope\x0a\x09^ scope",
  34231. referencedClasses: [],
  34232. messageSends: []
  34233. }),
  34234. $globals.ScopeVar);
  34235. $core.addMethod(
  34236. $core.method({
  34237. selector: "scope:",
  34238. protocol: 'accessing',
  34239. fn: function (aScope){
  34240. var self=this;
  34241. self["@scope"]=aScope;
  34242. return self;
  34243. },
  34244. args: ["aScope"],
  34245. source: "scope: aScope\x0a\x09scope := aScope",
  34246. referencedClasses: [],
  34247. messageSends: []
  34248. }),
  34249. $globals.ScopeVar);
  34250. $core.addMethod(
  34251. $core.method({
  34252. selector: "validateAssignment",
  34253. protocol: 'testing',
  34254. fn: function (){
  34255. var self=this;
  34256. return $core.withContext(function($ctx1) {
  34257. var $1,$2;
  34258. $1=$recv(self._isArgVar())._or_((function(){
  34259. return $core.withContext(function($ctx2) {
  34260. return self._isPseudoVar();
  34261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34262. }));
  34263. if($core.assert($1)){
  34264. $2=$recv($globals.InvalidAssignmentError)._new();
  34265. $recv($2)._variableName_(self._name());
  34266. $recv($2)._signal();
  34267. }
  34268. return self;
  34269. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  34270. },
  34271. args: [],
  34272. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  34273. referencedClasses: ["InvalidAssignmentError"],
  34274. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  34275. }),
  34276. $globals.ScopeVar);
  34277. $core.addMethod(
  34278. $core.method({
  34279. selector: "on:",
  34280. protocol: 'instance creation',
  34281. fn: function (aString){
  34282. var self=this;
  34283. return $core.withContext(function($ctx1) {
  34284. var $1;
  34285. $1=self._new();
  34286. $recv($1)._name_(aString);
  34287. return $recv($1)._yourself();
  34288. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  34289. },
  34290. args: ["aString"],
  34291. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  34292. referencedClasses: [],
  34293. messageSends: ["name:", "new", "yourself"]
  34294. }),
  34295. $globals.ScopeVar.klass);
  34296. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  34297. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  34298. $core.addMethod(
  34299. $core.method({
  34300. selector: "isImmutable",
  34301. protocol: 'testing',
  34302. fn: function (){
  34303. var self=this;
  34304. return true;
  34305. },
  34306. args: [],
  34307. source: "isImmutable\x0a\x09^ true",
  34308. referencedClasses: [],
  34309. messageSends: []
  34310. }),
  34311. $globals.AliasVar);
  34312. $core.addMethod(
  34313. $core.method({
  34314. selector: "node",
  34315. protocol: 'accessing',
  34316. fn: function (){
  34317. var self=this;
  34318. return self["@node"];
  34319. },
  34320. args: [],
  34321. source: "node\x0a\x09^ node",
  34322. referencedClasses: [],
  34323. messageSends: []
  34324. }),
  34325. $globals.AliasVar);
  34326. $core.addMethod(
  34327. $core.method({
  34328. selector: "node:",
  34329. protocol: 'accessing',
  34330. fn: function (aNode){
  34331. var self=this;
  34332. self["@node"]=aNode;
  34333. return self;
  34334. },
  34335. args: ["aNode"],
  34336. source: "node: aNode\x0a\x09node := aNode",
  34337. referencedClasses: [],
  34338. messageSends: []
  34339. }),
  34340. $globals.AliasVar);
  34341. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34342. $globals.ArgVar.comment="I am an argument of a method or block.";
  34343. $core.addMethod(
  34344. $core.method({
  34345. selector: "isArgVar",
  34346. protocol: 'testing',
  34347. fn: function (){
  34348. var self=this;
  34349. return true;
  34350. },
  34351. args: [],
  34352. source: "isArgVar\x0a\x09^ true",
  34353. referencedClasses: [],
  34354. messageSends: []
  34355. }),
  34356. $globals.ArgVar);
  34357. $core.addMethod(
  34358. $core.method({
  34359. selector: "isImmutable",
  34360. protocol: 'testing',
  34361. fn: function (){
  34362. var self=this;
  34363. return true;
  34364. },
  34365. args: [],
  34366. source: "isImmutable\x0a\x09^ true",
  34367. referencedClasses: [],
  34368. messageSends: []
  34369. }),
  34370. $globals.ArgVar);
  34371. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34372. $globals.ClassRefVar.comment="I am an class reference variable";
  34373. $core.addMethod(
  34374. $core.method({
  34375. selector: "alias",
  34376. protocol: 'accessing',
  34377. fn: function (){
  34378. var self=this;
  34379. return $core.withContext(function($ctx1) {
  34380. return "$globals.".__comma(self._name());
  34381. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  34382. },
  34383. args: [],
  34384. 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",
  34385. referencedClasses: [],
  34386. messageSends: [",", "name"]
  34387. }),
  34388. $globals.ClassRefVar);
  34389. $core.addMethod(
  34390. $core.method({
  34391. selector: "isClassRefVar",
  34392. protocol: 'testing',
  34393. fn: function (){
  34394. var self=this;
  34395. return true;
  34396. },
  34397. args: [],
  34398. source: "isClassRefVar\x0a\x09^ true",
  34399. referencedClasses: [],
  34400. messageSends: []
  34401. }),
  34402. $globals.ClassRefVar);
  34403. $core.addMethod(
  34404. $core.method({
  34405. selector: "isImmutable",
  34406. protocol: 'testing',
  34407. fn: function (){
  34408. var self=this;
  34409. return true;
  34410. },
  34411. args: [],
  34412. source: "isImmutable\x0a\x09^ true",
  34413. referencedClasses: [],
  34414. messageSends: []
  34415. }),
  34416. $globals.ClassRefVar);
  34417. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34418. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  34419. $core.addMethod(
  34420. $core.method({
  34421. selector: "alias",
  34422. protocol: 'testing',
  34423. fn: function (){
  34424. var self=this;
  34425. return $core.withContext(function($ctx1) {
  34426. var $1;
  34427. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  34428. $ctx1.sendIdx[","]=1;
  34429. return $1;
  34430. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  34431. },
  34432. args: [],
  34433. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  34434. referencedClasses: [],
  34435. messageSends: [",", "name"]
  34436. }),
  34437. $globals.InstanceVar);
  34438. $core.addMethod(
  34439. $core.method({
  34440. selector: "isInstanceVar",
  34441. protocol: 'testing',
  34442. fn: function (){
  34443. var self=this;
  34444. return true;
  34445. },
  34446. args: [],
  34447. source: "isInstanceVar\x0a\x09^ true",
  34448. referencedClasses: [],
  34449. messageSends: []
  34450. }),
  34451. $globals.InstanceVar);
  34452. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34453. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  34454. $core.addMethod(
  34455. $core.method({
  34456. selector: "alias",
  34457. protocol: 'accessing',
  34458. fn: function (){
  34459. var self=this;
  34460. return $core.withContext(function($ctx1) {
  34461. return self._name();
  34462. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  34463. },
  34464. args: [],
  34465. source: "alias\x0a\x09^ self name",
  34466. referencedClasses: [],
  34467. messageSends: ["name"]
  34468. }),
  34469. $globals.PseudoVar);
  34470. $core.addMethod(
  34471. $core.method({
  34472. selector: "isImmutable",
  34473. protocol: 'testing',
  34474. fn: function (){
  34475. var self=this;
  34476. return true;
  34477. },
  34478. args: [],
  34479. source: "isImmutable\x0a\x09^ true",
  34480. referencedClasses: [],
  34481. messageSends: []
  34482. }),
  34483. $globals.PseudoVar);
  34484. $core.addMethod(
  34485. $core.method({
  34486. selector: "isPseudoVar",
  34487. protocol: 'testing',
  34488. fn: function (){
  34489. var self=this;
  34490. return true;
  34491. },
  34492. args: [],
  34493. source: "isPseudoVar\x0a\x09^ true",
  34494. referencedClasses: [],
  34495. messageSends: []
  34496. }),
  34497. $globals.PseudoVar);
  34498. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34499. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  34500. $core.addMethod(
  34501. $core.method({
  34502. selector: "isTempVar",
  34503. protocol: 'testing',
  34504. fn: function (){
  34505. var self=this;
  34506. return true;
  34507. },
  34508. args: [],
  34509. source: "isTempVar\x0a\x09^ true",
  34510. referencedClasses: [],
  34511. messageSends: []
  34512. }),
  34513. $globals.TempVar);
  34514. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34515. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  34516. $core.addMethod(
  34517. $core.method({
  34518. selector: "isUnknownVar",
  34519. protocol: 'testing',
  34520. fn: function (){
  34521. var self=this;
  34522. return true;
  34523. },
  34524. args: [],
  34525. source: "isUnknownVar\x0a\x09^ true",
  34526. referencedClasses: [],
  34527. messageSends: []
  34528. }),
  34529. $globals.UnknownVar);
  34530. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  34531. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  34532. $core.addMethod(
  34533. $core.method({
  34534. selector: "classReferences",
  34535. protocol: 'accessing',
  34536. fn: function (){
  34537. var self=this;
  34538. return $core.withContext(function($ctx1) {
  34539. var $1,$receiver;
  34540. $1=self["@classReferences"];
  34541. if(($receiver = $1) == null || $receiver.isNil){
  34542. self["@classReferences"]=$recv($globals.Set)._new();
  34543. return self["@classReferences"];
  34544. } else {
  34545. return $1;
  34546. }
  34547. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  34548. },
  34549. args: [],
  34550. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  34551. referencedClasses: ["Set"],
  34552. messageSends: ["ifNil:", "new"]
  34553. }),
  34554. $globals.SemanticAnalyzer);
  34555. $core.addMethod(
  34556. $core.method({
  34557. selector: "errorShadowingVariable:",
  34558. protocol: 'error handling',
  34559. fn: function (aString){
  34560. var self=this;
  34561. return $core.withContext(function($ctx1) {
  34562. var $1;
  34563. $1=$recv($globals.ShadowingVariableError)._new();
  34564. $recv($1)._variableName_(aString);
  34565. $recv($1)._signal();
  34566. return self;
  34567. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  34568. },
  34569. args: ["aString"],
  34570. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  34571. referencedClasses: ["ShadowingVariableError"],
  34572. messageSends: ["variableName:", "new", "signal"]
  34573. }),
  34574. $globals.SemanticAnalyzer);
  34575. $core.addMethod(
  34576. $core.method({
  34577. selector: "errorUnknownVariable:",
  34578. protocol: 'error handling',
  34579. fn: function (aNode){
  34580. var self=this;
  34581. var identifier;
  34582. return $core.withContext(function($ctx1) {
  34583. var $1,$2,$3;
  34584. identifier=$recv(aNode)._value();
  34585. $ctx1.sendIdx["value"]=1;
  34586. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  34587. return $core.withContext(function($ctx2) {
  34588. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  34589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34590. }));
  34591. if($core.assert($1)){
  34592. $2=$recv($globals.UnknownVariableError)._new();
  34593. $3=$recv(aNode)._value();
  34594. $ctx1.sendIdx["value"]=2;
  34595. $recv($2)._variableName_($3);
  34596. $recv($2)._signal();
  34597. } else {
  34598. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  34599. }
  34600. return self;
  34601. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  34602. },
  34603. args: ["aNode"],
  34604. 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 ]",
  34605. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  34606. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  34607. }),
  34608. $globals.SemanticAnalyzer);
  34609. $core.addMethod(
  34610. $core.method({
  34611. selector: "isVariableUndefined:inPackage:",
  34612. protocol: 'testing',
  34613. fn: function (aString,aPackage){
  34614. var self=this;
  34615. return $core.withContext(function($ctx1) {
  34616. var $1,$2,$3,$receiver;
  34617. if(($receiver = aPackage) == null || $receiver.isNil){
  34618. aPackage;
  34619. } else {
  34620. var packageKnownVars;
  34621. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  34622. packageKnownVars;
  34623. $1=$recv(packageKnownVars)._includes_(aString);
  34624. if($core.assert($1)){
  34625. return false;
  34626. }
  34627. }
  34628. $2=$recv($globals.Compiler)._new();
  34629. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  34630. $ctx1.sendIdx[","]=1;
  34631. return $recv($2)._eval_($3);
  34632. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  34633. },
  34634. args: ["aString", "aPackage"],
  34635. 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'",
  34636. referencedClasses: ["Compiler"],
  34637. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  34638. }),
  34639. $globals.SemanticAnalyzer);
  34640. $core.addMethod(
  34641. $core.method({
  34642. selector: "messageSends",
  34643. protocol: 'accessing',
  34644. fn: function (){
  34645. var self=this;
  34646. return $core.withContext(function($ctx1) {
  34647. var $1,$receiver;
  34648. $1=self["@messageSends"];
  34649. if(($receiver = $1) == null || $receiver.isNil){
  34650. self["@messageSends"]=$recv($globals.Dictionary)._new();
  34651. return self["@messageSends"];
  34652. } else {
  34653. return $1;
  34654. }
  34655. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  34656. },
  34657. args: [],
  34658. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  34659. referencedClasses: ["Dictionary"],
  34660. messageSends: ["ifNil:", "new"]
  34661. }),
  34662. $globals.SemanticAnalyzer);
  34663. $core.addMethod(
  34664. $core.method({
  34665. selector: "newBlockScope",
  34666. protocol: 'factory',
  34667. fn: function (){
  34668. var self=this;
  34669. return $core.withContext(function($ctx1) {
  34670. return self._newScopeOfClass_($globals.LexicalScope);
  34671. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  34672. },
  34673. args: [],
  34674. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  34675. referencedClasses: ["LexicalScope"],
  34676. messageSends: ["newScopeOfClass:"]
  34677. }),
  34678. $globals.SemanticAnalyzer);
  34679. $core.addMethod(
  34680. $core.method({
  34681. selector: "newMethodScope",
  34682. protocol: 'factory',
  34683. fn: function (){
  34684. var self=this;
  34685. return $core.withContext(function($ctx1) {
  34686. return self._newScopeOfClass_($globals.MethodLexicalScope);
  34687. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  34688. },
  34689. args: [],
  34690. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  34691. referencedClasses: ["MethodLexicalScope"],
  34692. messageSends: ["newScopeOfClass:"]
  34693. }),
  34694. $globals.SemanticAnalyzer);
  34695. $core.addMethod(
  34696. $core.method({
  34697. selector: "newScopeOfClass:",
  34698. protocol: 'factory',
  34699. fn: function (aLexicalScopeClass){
  34700. var self=this;
  34701. return $core.withContext(function($ctx1) {
  34702. var $1;
  34703. $1=$recv(aLexicalScopeClass)._new();
  34704. $recv($1)._outerScope_(self["@currentScope"]);
  34705. return $recv($1)._yourself();
  34706. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  34707. },
  34708. args: ["aLexicalScopeClass"],
  34709. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  34710. referencedClasses: [],
  34711. messageSends: ["outerScope:", "new", "yourself"]
  34712. }),
  34713. $globals.SemanticAnalyzer);
  34714. $core.addMethod(
  34715. $core.method({
  34716. selector: "nextBlockIndex",
  34717. protocol: 'private',
  34718. fn: function (){
  34719. var self=this;
  34720. return $core.withContext(function($ctx1) {
  34721. var $1,$receiver;
  34722. $1=self["@blockIndex"];
  34723. if(($receiver = $1) == null || $receiver.isNil){
  34724. self["@blockIndex"]=(0);
  34725. self["@blockIndex"];
  34726. } else {
  34727. $1;
  34728. }
  34729. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  34730. return self["@blockIndex"];
  34731. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  34732. },
  34733. args: [],
  34734. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  34735. referencedClasses: [],
  34736. messageSends: ["ifNil:", "+"]
  34737. }),
  34738. $globals.SemanticAnalyzer);
  34739. $core.addMethod(
  34740. $core.method({
  34741. selector: "popScope",
  34742. protocol: 'scope',
  34743. fn: function (){
  34744. var self=this;
  34745. return $core.withContext(function($ctx1) {
  34746. var $1,$receiver;
  34747. $1=self["@currentScope"];
  34748. if(($receiver = $1) == null || $receiver.isNil){
  34749. $1;
  34750. } else {
  34751. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  34752. self["@currentScope"];
  34753. }
  34754. return self;
  34755. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  34756. },
  34757. args: [],
  34758. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  34759. referencedClasses: [],
  34760. messageSends: ["ifNotNil:", "outerScope"]
  34761. }),
  34762. $globals.SemanticAnalyzer);
  34763. $core.addMethod(
  34764. $core.method({
  34765. selector: "pushScope:",
  34766. protocol: 'scope',
  34767. fn: function (aScope){
  34768. var self=this;
  34769. return $core.withContext(function($ctx1) {
  34770. $recv(aScope)._outerScope_(self["@currentScope"]);
  34771. self["@currentScope"]=aScope;
  34772. return self;
  34773. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  34774. },
  34775. args: ["aScope"],
  34776. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  34777. referencedClasses: [],
  34778. messageSends: ["outerScope:"]
  34779. }),
  34780. $globals.SemanticAnalyzer);
  34781. $core.addMethod(
  34782. $core.method({
  34783. selector: "theClass",
  34784. protocol: 'accessing',
  34785. fn: function (){
  34786. var self=this;
  34787. return self["@theClass"];
  34788. },
  34789. args: [],
  34790. source: "theClass\x0a\x09^ theClass",
  34791. referencedClasses: [],
  34792. messageSends: []
  34793. }),
  34794. $globals.SemanticAnalyzer);
  34795. $core.addMethod(
  34796. $core.method({
  34797. selector: "theClass:",
  34798. protocol: 'accessing',
  34799. fn: function (aClass){
  34800. var self=this;
  34801. self["@theClass"]=aClass;
  34802. return self;
  34803. },
  34804. args: ["aClass"],
  34805. source: "theClass: aClass\x0a\x09theClass := aClass",
  34806. referencedClasses: [],
  34807. messageSends: []
  34808. }),
  34809. $globals.SemanticAnalyzer);
  34810. $core.addMethod(
  34811. $core.method({
  34812. selector: "thePackage",
  34813. protocol: 'accessing',
  34814. fn: function (){
  34815. var self=this;
  34816. return self["@thePackage"];
  34817. },
  34818. args: [],
  34819. source: "thePackage\x0a\x09^ thePackage",
  34820. referencedClasses: [],
  34821. messageSends: []
  34822. }),
  34823. $globals.SemanticAnalyzer);
  34824. $core.addMethod(
  34825. $core.method({
  34826. selector: "thePackage:",
  34827. protocol: 'accessing',
  34828. fn: function (aPackage){
  34829. var self=this;
  34830. self["@thePackage"]=aPackage;
  34831. return self;
  34832. },
  34833. args: ["aPackage"],
  34834. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  34835. referencedClasses: [],
  34836. messageSends: []
  34837. }),
  34838. $globals.SemanticAnalyzer);
  34839. $core.addMethod(
  34840. $core.method({
  34841. selector: "validateVariableScope:",
  34842. protocol: 'scope',
  34843. fn: function (aString){
  34844. var self=this;
  34845. return $core.withContext(function($ctx1) {
  34846. var $1,$receiver;
  34847. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  34848. if(($receiver = $1) == null || $receiver.isNil){
  34849. $1;
  34850. } else {
  34851. self._errorShadowingVariable_(aString);
  34852. }
  34853. return self;
  34854. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  34855. },
  34856. args: ["aString"],
  34857. 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 ]",
  34858. referencedClasses: [],
  34859. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  34860. }),
  34861. $globals.SemanticAnalyzer);
  34862. $core.addMethod(
  34863. $core.method({
  34864. selector: "visitAssignmentNode:",
  34865. protocol: 'visiting',
  34866. fn: function (aNode){
  34867. var self=this;
  34868. return $core.withContext(function($ctx1) {
  34869. (
  34870. $ctx1.supercall = true,
  34871. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  34872. $ctx1.supercall = false;
  34873. $recv($recv(aNode)._left())._beAssigned();
  34874. return self;
  34875. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34876. },
  34877. args: ["aNode"],
  34878. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  34879. referencedClasses: [],
  34880. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  34881. }),
  34882. $globals.SemanticAnalyzer);
  34883. $core.addMethod(
  34884. $core.method({
  34885. selector: "visitBlockNode:",
  34886. protocol: 'visiting',
  34887. fn: function (aNode){
  34888. var self=this;
  34889. return $core.withContext(function($ctx1) {
  34890. self._pushScope_(self._newBlockScope());
  34891. $recv(aNode)._scope_(self["@currentScope"]);
  34892. $recv(self["@currentScope"])._node_(aNode);
  34893. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  34894. $recv($recv(aNode)._parameters())._do_((function(each){
  34895. return $core.withContext(function($ctx2) {
  34896. self._validateVariableScope_(each);
  34897. return $recv(self["@currentScope"])._addArg_(each);
  34898. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34899. }));
  34900. (
  34901. $ctx1.supercall = true,
  34902. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  34903. $ctx1.supercall = false;
  34904. self._popScope();
  34905. return self;
  34906. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34907. },
  34908. args: ["aNode"],
  34909. 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",
  34910. referencedClasses: [],
  34911. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  34912. }),
  34913. $globals.SemanticAnalyzer);
  34914. $core.addMethod(
  34915. $core.method({
  34916. selector: "visitCascadeNode:",
  34917. protocol: 'visiting',
  34918. fn: function (aNode){
  34919. var self=this;
  34920. return $core.withContext(function($ctx1) {
  34921. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  34922. (
  34923. $ctx1.supercall = true,
  34924. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  34925. $ctx1.supercall = false;
  34926. return self;
  34927. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34928. },
  34929. args: ["aNode"],
  34930. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  34931. referencedClasses: [],
  34932. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  34933. }),
  34934. $globals.SemanticAnalyzer);
  34935. $core.addMethod(
  34936. $core.method({
  34937. selector: "visitMethodNode:",
  34938. protocol: 'visiting',
  34939. fn: function (aNode){
  34940. var self=this;
  34941. return $core.withContext(function($ctx1) {
  34942. self._pushScope_(self._newMethodScope());
  34943. $recv(aNode)._scope_(self["@currentScope"]);
  34944. $recv(self["@currentScope"])._node_(aNode);
  34945. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  34946. return $core.withContext(function($ctx2) {
  34947. return $recv(self["@currentScope"])._addIVar_(each);
  34948. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34949. }));
  34950. $ctx1.sendIdx["do:"]=1;
  34951. $recv($recv(aNode)._arguments())._do_((function(each){
  34952. return $core.withContext(function($ctx2) {
  34953. self._validateVariableScope_(each);
  34954. return $recv(self["@currentScope"])._addArg_(each);
  34955. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34956. }));
  34957. (
  34958. $ctx1.supercall = true,
  34959. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  34960. $ctx1.supercall = false;
  34961. $recv(aNode)._classReferences_(self._classReferences());
  34962. $recv(aNode)._sendIndexes_(self._messageSends());
  34963. self._popScope();
  34964. return aNode;
  34965. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34966. },
  34967. args: ["aNode"],
  34968. 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",
  34969. referencedClasses: [],
  34970. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  34971. }),
  34972. $globals.SemanticAnalyzer);
  34973. $core.addMethod(
  34974. $core.method({
  34975. selector: "visitReturnNode:",
  34976. protocol: 'visiting',
  34977. fn: function (aNode){
  34978. var self=this;
  34979. return $core.withContext(function($ctx1) {
  34980. var $1;
  34981. $recv(aNode)._scope_(self["@currentScope"]);
  34982. $1=$recv(self["@currentScope"])._isMethodScope();
  34983. if($core.assert($1)){
  34984. $recv(self["@currentScope"])._localReturn_(true);
  34985. } else {
  34986. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  34987. }
  34988. (
  34989. $ctx1.supercall = true,
  34990. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  34991. $ctx1.supercall = false;
  34992. return self;
  34993. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34994. },
  34995. args: ["aNode"],
  34996. 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",
  34997. referencedClasses: [],
  34998. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  34999. }),
  35000. $globals.SemanticAnalyzer);
  35001. $core.addMethod(
  35002. $core.method({
  35003. selector: "visitSendNode:",
  35004. protocol: 'visiting',
  35005. fn: function (aNode){
  35006. var self=this;
  35007. var sends;
  35008. return $core.withContext(function($ctx1) {
  35009. sends=$recv(self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  35010. return $core.withContext(function($ctx2) {
  35011. return $recv($globals.OrderedCollection)._new();
  35012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35013. }));
  35014. $recv(sends)._add_(aNode);
  35015. $recv(aNode)._index_($recv(sends)._size());
  35016. (
  35017. $ctx1.supercall = true,
  35018. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  35019. $ctx1.supercall = false;
  35020. return self;
  35021. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  35022. },
  35023. args: ["aNode"],
  35024. 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",
  35025. referencedClasses: ["OrderedCollection"],
  35026. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  35027. }),
  35028. $globals.SemanticAnalyzer);
  35029. $core.addMethod(
  35030. $core.method({
  35031. selector: "visitSequenceNode:",
  35032. protocol: 'visiting',
  35033. fn: function (aNode){
  35034. var self=this;
  35035. return $core.withContext(function($ctx1) {
  35036. $recv($recv(aNode)._temps())._do_((function(each){
  35037. return $core.withContext(function($ctx2) {
  35038. self._validateVariableScope_(each);
  35039. return $recv(self["@currentScope"])._addTemp_(each);
  35040. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35041. }));
  35042. (
  35043. $ctx1.supercall = true,
  35044. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  35045. $ctx1.supercall = false;
  35046. return self;
  35047. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35048. },
  35049. args: ["aNode"],
  35050. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  35051. referencedClasses: [],
  35052. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  35053. }),
  35054. $globals.SemanticAnalyzer);
  35055. $core.addMethod(
  35056. $core.method({
  35057. selector: "visitVariableNode:",
  35058. protocol: 'visiting',
  35059. fn: function (aNode){
  35060. var self=this;
  35061. var binding;
  35062. return $core.withContext(function($ctx1) {
  35063. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  35064. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  35065. $1=binding;
  35066. if(($receiver = $1) == null || $receiver.isNil){
  35067. $3=$recv(aNode)._value();
  35068. $ctx1.sendIdx["value"]=1;
  35069. $2=$recv($3)._isCapitalized();
  35070. if($core.assert($2)){
  35071. $4=$recv($globals.ClassRefVar)._new();
  35072. $ctx1.sendIdx["new"]=1;
  35073. $5=$recv(aNode)._value();
  35074. $ctx1.sendIdx["value"]=2;
  35075. $recv($4)._name_($5);
  35076. $ctx1.sendIdx["name:"]=1;
  35077. $6=$recv($4)._yourself();
  35078. $ctx1.sendIdx["yourself"]=1;
  35079. binding=$6;
  35080. binding;
  35081. $7=self._classReferences();
  35082. $8=$recv(aNode)._value();
  35083. $ctx1.sendIdx["value"]=3;
  35084. $recv($7)._add_($8);
  35085. } else {
  35086. self._errorUnknownVariable_(aNode);
  35087. $9=$recv($globals.UnknownVar)._new();
  35088. $recv($9)._name_($recv(aNode)._value());
  35089. binding=$recv($9)._yourself();
  35090. binding;
  35091. }
  35092. } else {
  35093. $1;
  35094. }
  35095. $recv(aNode)._binding_(binding);
  35096. return self;
  35097. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  35098. },
  35099. args: ["aNode"],
  35100. 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.",
  35101. referencedClasses: ["ClassRefVar", "UnknownVar"],
  35102. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  35103. }),
  35104. $globals.SemanticAnalyzer);
  35105. $core.addMethod(
  35106. $core.method({
  35107. selector: "on:",
  35108. protocol: 'instance creation',
  35109. fn: function (aClass){
  35110. var self=this;
  35111. return $core.withContext(function($ctx1) {
  35112. var $1;
  35113. $1=self._new();
  35114. $recv($1)._theClass_(aClass);
  35115. return $recv($1)._yourself();
  35116. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  35117. },
  35118. args: ["aClass"],
  35119. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  35120. referencedClasses: [],
  35121. messageSends: ["theClass:", "new", "yourself"]
  35122. }),
  35123. $globals.SemanticAnalyzer.klass);
  35124. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Semantic');
  35125. $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";
  35126. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35127. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  35128. $core.addMethod(
  35129. $core.method({
  35130. selector: "messageText",
  35131. protocol: 'accessing',
  35132. fn: function (){
  35133. var self=this;
  35134. return $core.withContext(function($ctx1) {
  35135. return " Invalid assignment to variable: ".__comma(self._variableName());
  35136. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  35137. },
  35138. args: [],
  35139. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  35140. referencedClasses: [],
  35141. messageSends: [",", "variableName"]
  35142. }),
  35143. $globals.InvalidAssignmentError);
  35144. $core.addMethod(
  35145. $core.method({
  35146. selector: "variableName",
  35147. protocol: 'accessing',
  35148. fn: function (){
  35149. var self=this;
  35150. return self["@variableName"];
  35151. },
  35152. args: [],
  35153. source: "variableName\x0a\x09^ variableName",
  35154. referencedClasses: [],
  35155. messageSends: []
  35156. }),
  35157. $globals.InvalidAssignmentError);
  35158. $core.addMethod(
  35159. $core.method({
  35160. selector: "variableName:",
  35161. protocol: 'accessing',
  35162. fn: function (aString){
  35163. var self=this;
  35164. self["@variableName"]=aString;
  35165. return self;
  35166. },
  35167. args: ["aString"],
  35168. source: "variableName: aString\x0a\x09variableName := aString",
  35169. referencedClasses: [],
  35170. messageSends: []
  35171. }),
  35172. $globals.InvalidAssignmentError);
  35173. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35174. $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.";
  35175. $core.addMethod(
  35176. $core.method({
  35177. selector: "messageText",
  35178. protocol: 'accessing',
  35179. fn: function (){
  35180. var self=this;
  35181. return $core.withContext(function($ctx1) {
  35182. var $1;
  35183. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  35184. $ctx1.sendIdx[","]=1;
  35185. return $1;
  35186. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  35187. },
  35188. args: [],
  35189. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  35190. referencedClasses: [],
  35191. messageSends: [",", "variableName"]
  35192. }),
  35193. $globals.ShadowingVariableError);
  35194. $core.addMethod(
  35195. $core.method({
  35196. selector: "variableName",
  35197. protocol: 'accessing',
  35198. fn: function (){
  35199. var self=this;
  35200. return self["@variableName"];
  35201. },
  35202. args: [],
  35203. source: "variableName\x0a\x09^ variableName",
  35204. referencedClasses: [],
  35205. messageSends: []
  35206. }),
  35207. $globals.ShadowingVariableError);
  35208. $core.addMethod(
  35209. $core.method({
  35210. selector: "variableName:",
  35211. protocol: 'accessing',
  35212. fn: function (aString){
  35213. var self=this;
  35214. self["@variableName"]=aString;
  35215. return self;
  35216. },
  35217. args: ["aString"],
  35218. source: "variableName: aString\x0a\x09variableName := aString",
  35219. referencedClasses: [],
  35220. messageSends: []
  35221. }),
  35222. $globals.ShadowingVariableError);
  35223. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35224. $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.";
  35225. $core.addMethod(
  35226. $core.method({
  35227. selector: "messageText",
  35228. protocol: 'accessing',
  35229. fn: function (){
  35230. var self=this;
  35231. return $core.withContext(function($ctx1) {
  35232. var $1;
  35233. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  35234. $ctx1.sendIdx[","]=1;
  35235. return $1;
  35236. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  35237. },
  35238. args: [],
  35239. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  35240. referencedClasses: [],
  35241. messageSends: [",", "variableName"]
  35242. }),
  35243. $globals.UnknownVariableError);
  35244. $core.addMethod(
  35245. $core.method({
  35246. selector: "variableName",
  35247. protocol: 'accessing',
  35248. fn: function (){
  35249. var self=this;
  35250. return self["@variableName"];
  35251. },
  35252. args: [],
  35253. source: "variableName\x0a\x09^ variableName",
  35254. referencedClasses: [],
  35255. messageSends: []
  35256. }),
  35257. $globals.UnknownVariableError);
  35258. $core.addMethod(
  35259. $core.method({
  35260. selector: "variableName:",
  35261. protocol: 'accessing',
  35262. fn: function (aString){
  35263. var self=this;
  35264. self["@variableName"]=aString;
  35265. return self;
  35266. },
  35267. args: ["aString"],
  35268. source: "variableName: aString\x0a\x09variableName := aString",
  35269. referencedClasses: [],
  35270. messageSends: []
  35271. }),
  35272. $globals.UnknownVariableError);
  35273. });
  35274. 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";
  35275. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  35276. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35277. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  35278. $core.addPackage('Compiler-IR');
  35279. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  35280. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35281. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  35282. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  35283. $core.addMethod(
  35284. $core.method({
  35285. selector: "alias:",
  35286. protocol: 'visiting',
  35287. fn: function (aNode){
  35288. var self=this;
  35289. var variable;
  35290. return $core.withContext(function($ctx1) {
  35291. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  35292. $1=$recv(aNode)._isImmutable();
  35293. if($core.assert($1)){
  35294. $2=self._visit_(aNode);
  35295. $ctx1.sendIdx["visit:"]=1;
  35296. return $2;
  35297. }
  35298. $3=$recv($globals.IRVariable)._new();
  35299. $ctx1.sendIdx["new"]=1;
  35300. $5=$recv($globals.AliasVar)._new();
  35301. $ctx1.sendIdx["new"]=2;
  35302. $4=$recv($5)._name_("$".__comma(self._nextAlias()));
  35303. $recv($3)._variable_($4);
  35304. $6=$recv($3)._yourself();
  35305. $ctx1.sendIdx["yourself"]=1;
  35306. variable=$6;
  35307. $7=self._sequence();
  35308. $9=$recv($globals.IRAssignment)._new();
  35309. $recv($9)._add_(variable);
  35310. $ctx1.sendIdx["add:"]=2;
  35311. $recv($9)._add_(self._visit_(aNode));
  35312. $ctx1.sendIdx["add:"]=3;
  35313. $8=$recv($9)._yourself();
  35314. $recv($7)._add_($8);
  35315. $ctx1.sendIdx["add:"]=1;
  35316. $recv($recv(self._method())._internalVariables())._add_(variable);
  35317. return variable;
  35318. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  35319. },
  35320. args: ["aNode"],
  35321. 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",
  35322. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  35323. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  35324. }),
  35325. $globals.IRASTTranslator);
  35326. $core.addMethod(
  35327. $core.method({
  35328. selector: "aliasTemporally:",
  35329. protocol: 'visiting',
  35330. fn: function (aCollection){
  35331. var self=this;
  35332. var threshold,result;
  35333. return $core.withContext(function($ctx1) {
  35334. var $1,$2,$4,$3;
  35335. threshold=(0);
  35336. $recv(aCollection)._withIndexDo_((function(each,i){
  35337. return $core.withContext(function($ctx2) {
  35338. $1=$recv(each)._subtreeNeedsAliasing();
  35339. if($core.assert($1)){
  35340. threshold=i;
  35341. return threshold;
  35342. }
  35343. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  35344. }));
  35345. $ctx1.sendIdx["withIndexDo:"]=1;
  35346. result=$recv($globals.OrderedCollection)._new();
  35347. $recv(aCollection)._withIndexDo_((function(each,i){
  35348. return $core.withContext(function($ctx2) {
  35349. $2=result;
  35350. $4=$recv(i).__lt_eq(threshold);
  35351. if($core.assert($4)){
  35352. $3=self._alias_(each);
  35353. } else {
  35354. $3=self._visit_(each);
  35355. }
  35356. return $recv($2)._add_($3);
  35357. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  35358. }));
  35359. return result;
  35360. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  35361. },
  35362. args: ["aCollection"],
  35363. 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",
  35364. referencedClasses: ["OrderedCollection"],
  35365. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  35366. }),
  35367. $globals.IRASTTranslator);
  35368. $core.addMethod(
  35369. $core.method({
  35370. selector: "method",
  35371. protocol: 'accessing',
  35372. fn: function (){
  35373. var self=this;
  35374. return self["@method"];
  35375. },
  35376. args: [],
  35377. source: "method\x0a\x09^ method",
  35378. referencedClasses: [],
  35379. messageSends: []
  35380. }),
  35381. $globals.IRASTTranslator);
  35382. $core.addMethod(
  35383. $core.method({
  35384. selector: "method:",
  35385. protocol: 'accessing',
  35386. fn: function (anIRMethod){
  35387. var self=this;
  35388. self["@method"]=anIRMethod;
  35389. return self;
  35390. },
  35391. args: ["anIRMethod"],
  35392. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  35393. referencedClasses: [],
  35394. messageSends: []
  35395. }),
  35396. $globals.IRASTTranslator);
  35397. $core.addMethod(
  35398. $core.method({
  35399. selector: "nextAlias",
  35400. protocol: 'accessing',
  35401. fn: function (){
  35402. var self=this;
  35403. return $core.withContext(function($ctx1) {
  35404. var $1,$receiver;
  35405. $1=self["@nextAlias"];
  35406. if(($receiver = $1) == null || $receiver.isNil){
  35407. self["@nextAlias"]=(0);
  35408. self["@nextAlias"];
  35409. } else {
  35410. $1;
  35411. }
  35412. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  35413. return $recv(self["@nextAlias"])._asString();
  35414. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  35415. },
  35416. args: [],
  35417. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  35418. referencedClasses: [],
  35419. messageSends: ["ifNil:", "+", "asString"]
  35420. }),
  35421. $globals.IRASTTranslator);
  35422. $core.addMethod(
  35423. $core.method({
  35424. selector: "sequence",
  35425. protocol: 'accessing',
  35426. fn: function (){
  35427. var self=this;
  35428. return self["@sequence"];
  35429. },
  35430. args: [],
  35431. source: "sequence\x0a\x09^ sequence",
  35432. referencedClasses: [],
  35433. messageSends: []
  35434. }),
  35435. $globals.IRASTTranslator);
  35436. $core.addMethod(
  35437. $core.method({
  35438. selector: "sequence:",
  35439. protocol: 'accessing',
  35440. fn: function (anIRSequence){
  35441. var self=this;
  35442. self["@sequence"]=anIRSequence;
  35443. return self;
  35444. },
  35445. args: ["anIRSequence"],
  35446. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  35447. referencedClasses: [],
  35448. messageSends: []
  35449. }),
  35450. $globals.IRASTTranslator);
  35451. $core.addMethod(
  35452. $core.method({
  35453. selector: "source",
  35454. protocol: 'accessing',
  35455. fn: function (){
  35456. var self=this;
  35457. return self["@source"];
  35458. },
  35459. args: [],
  35460. source: "source\x0a\x09^ source",
  35461. referencedClasses: [],
  35462. messageSends: []
  35463. }),
  35464. $globals.IRASTTranslator);
  35465. $core.addMethod(
  35466. $core.method({
  35467. selector: "source:",
  35468. protocol: 'accessing',
  35469. fn: function (aString){
  35470. var self=this;
  35471. self["@source"]=aString;
  35472. return self;
  35473. },
  35474. args: ["aString"],
  35475. source: "source: aString\x0a\x09source := aString",
  35476. referencedClasses: [],
  35477. messageSends: []
  35478. }),
  35479. $globals.IRASTTranslator);
  35480. $core.addMethod(
  35481. $core.method({
  35482. selector: "theClass",
  35483. protocol: 'accessing',
  35484. fn: function (){
  35485. var self=this;
  35486. return self["@theClass"];
  35487. },
  35488. args: [],
  35489. source: "theClass\x0a\x09^ theClass",
  35490. referencedClasses: [],
  35491. messageSends: []
  35492. }),
  35493. $globals.IRASTTranslator);
  35494. $core.addMethod(
  35495. $core.method({
  35496. selector: "theClass:",
  35497. protocol: 'accessing',
  35498. fn: function (aClass){
  35499. var self=this;
  35500. self["@theClass"]=aClass;
  35501. return self;
  35502. },
  35503. args: ["aClass"],
  35504. source: "theClass: aClass\x0a\x09theClass := aClass",
  35505. referencedClasses: [],
  35506. messageSends: []
  35507. }),
  35508. $globals.IRASTTranslator);
  35509. $core.addMethod(
  35510. $core.method({
  35511. selector: "visitAssignmentNode:",
  35512. protocol: 'visiting',
  35513. fn: function (aNode){
  35514. var self=this;
  35515. var left,right,assignment;
  35516. return $core.withContext(function($ctx1) {
  35517. var $1,$3,$2;
  35518. right=self._visit_($recv(aNode)._right());
  35519. $ctx1.sendIdx["visit:"]=1;
  35520. left=self._visit_($recv(aNode)._left());
  35521. $1=self._sequence();
  35522. $3=$recv($globals.IRAssignment)._new();
  35523. $recv($3)._add_(left);
  35524. $ctx1.sendIdx["add:"]=2;
  35525. $recv($3)._add_(right);
  35526. $2=$recv($3)._yourself();
  35527. $recv($1)._add_($2);
  35528. $ctx1.sendIdx["add:"]=1;
  35529. return left;
  35530. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  35531. },
  35532. args: ["aNode"],
  35533. 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",
  35534. referencedClasses: ["IRAssignment"],
  35535. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  35536. }),
  35537. $globals.IRASTTranslator);
  35538. $core.addMethod(
  35539. $core.method({
  35540. selector: "visitBlockNode:",
  35541. protocol: 'visiting',
  35542. fn: function (aNode){
  35543. var self=this;
  35544. var closure;
  35545. return $core.withContext(function($ctx1) {
  35546. var $1,$2,$3,$5,$4,$6,$8,$7;
  35547. $1=$recv($globals.IRClosure)._new();
  35548. $ctx1.sendIdx["new"]=1;
  35549. $recv($1)._arguments_($recv(aNode)._parameters());
  35550. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35551. $2=$recv(aNode)._scope();
  35552. $ctx1.sendIdx["scope"]=1;
  35553. $recv($1)._scope_($2);
  35554. $ctx1.sendIdx["scope:"]=1;
  35555. $3=$recv($1)._yourself();
  35556. $ctx1.sendIdx["yourself"]=1;
  35557. closure=$3;
  35558. $5=$recv(aNode)._scope();
  35559. $ctx1.sendIdx["scope"]=2;
  35560. $4=$recv($5)._temps();
  35561. $recv($4)._do_((function(each){
  35562. return $core.withContext(function($ctx2) {
  35563. $6=closure;
  35564. $8=$recv($globals.IRTempDeclaration)._new();
  35565. $recv($8)._name_($recv(each)._name());
  35566. $recv($8)._scope_($recv(aNode)._scope());
  35567. $7=$recv($8)._yourself();
  35568. return $recv($6)._add_($7);
  35569. $ctx2.sendIdx["add:"]=1;
  35570. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35571. }));
  35572. $ctx1.sendIdx["do:"]=1;
  35573. $recv($recv(aNode)._dagChildren())._do_((function(each){
  35574. return $core.withContext(function($ctx2) {
  35575. return $recv(closure)._add_(self._visit_(each));
  35576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35577. }));
  35578. return closure;
  35579. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  35580. },
  35581. args: ["aNode"],
  35582. 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",
  35583. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  35584. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  35585. }),
  35586. $globals.IRASTTranslator);
  35587. $core.addMethod(
  35588. $core.method({
  35589. selector: "visitBlockSequenceNode:",
  35590. protocol: 'visiting',
  35591. fn: function (aNode){
  35592. var self=this;
  35593. return $core.withContext(function($ctx1) {
  35594. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  35595. $1=$recv($globals.IRBlockSequence)._new();
  35596. $ctx1.sendIdx["new"]=1;
  35597. return self._withSequence_do_($1,(function(){
  35598. return $core.withContext(function($ctx2) {
  35599. $2=$recv(aNode)._dagChildren();
  35600. $ctx2.sendIdx["dagChildren"]=1;
  35601. return $recv($2)._ifNotEmpty_((function(){
  35602. return $core.withContext(function($ctx3) {
  35603. $4=$recv(aNode)._dagChildren();
  35604. $ctx3.sendIdx["dagChildren"]=2;
  35605. $3=$recv($4)._allButLast();
  35606. $recv($3)._do_((function(each){
  35607. return $core.withContext(function($ctx4) {
  35608. $5=self._sequence();
  35609. $ctx4.sendIdx["sequence"]=1;
  35610. $6=self._visitOrAlias_(each);
  35611. $ctx4.sendIdx["visitOrAlias:"]=1;
  35612. return $recv($5)._add_($6);
  35613. $ctx4.sendIdx["add:"]=1;
  35614. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  35615. }));
  35616. $9=$recv(aNode)._dagChildren();
  35617. $ctx3.sendIdx["dagChildren"]=3;
  35618. $8=$recv($9)._last();
  35619. $ctx3.sendIdx["last"]=1;
  35620. $7=$recv($8)._isReturnNode();
  35621. if($core.assert($7)){
  35622. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  35623. } else {
  35624. $10=self._sequence();
  35625. $ctx3.sendIdx["sequence"]=2;
  35626. $12=$recv($globals.IRBlockReturn)._new();
  35627. $15=$recv(aNode)._dagChildren();
  35628. $ctx3.sendIdx["dagChildren"]=4;
  35629. $14=$recv($15)._last();
  35630. $ctx3.sendIdx["last"]=2;
  35631. $13=self._visitOrAlias_($14);
  35632. $ctx3.sendIdx["visitOrAlias:"]=2;
  35633. $recv($12)._add_($13);
  35634. $ctx3.sendIdx["add:"]=3;
  35635. $11=$recv($12)._yourself();
  35636. return $recv($10)._add_($11);
  35637. $ctx3.sendIdx["add:"]=2;
  35638. }
  35639. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35640. }));
  35641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35642. }));
  35643. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35644. },
  35645. args: ["aNode"],
  35646. 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) ] ]]",
  35647. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  35648. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  35649. }),
  35650. $globals.IRASTTranslator);
  35651. $core.addMethod(
  35652. $core.method({
  35653. selector: "visitCascadeNode:",
  35654. protocol: 'visiting',
  35655. fn: function (aNode){
  35656. var self=this;
  35657. var receiver;
  35658. return $core.withContext(function($ctx1) {
  35659. var $1,$2,$4,$3;
  35660. receiver=$recv(aNode)._receiver();
  35661. $1=$recv(receiver)._isImmutable();
  35662. if(!$core.assert($1)){
  35663. var alias;
  35664. alias=self._alias_(receiver);
  35665. alias;
  35666. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  35667. receiver;
  35668. }
  35669. $2=$recv(aNode)._dagChildren();
  35670. $ctx1.sendIdx["dagChildren"]=1;
  35671. $recv($2)._do_((function(each){
  35672. return $core.withContext(function($ctx2) {
  35673. return $recv(each)._receiver_(receiver);
  35674. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35675. }));
  35676. $ctx1.sendIdx["do:"]=1;
  35677. $4=$recv(aNode)._dagChildren();
  35678. $ctx1.sendIdx["dagChildren"]=2;
  35679. $3=$recv($4)._allButLast();
  35680. $recv($3)._do_((function(each){
  35681. return $core.withContext(function($ctx2) {
  35682. return $recv(self._sequence())._add_(self._visit_(each));
  35683. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35684. }));
  35685. return self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  35686. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  35687. },
  35688. args: ["aNode"],
  35689. 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",
  35690. referencedClasses: ["VariableNode"],
  35691. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  35692. }),
  35693. $globals.IRASTTranslator);
  35694. $core.addMethod(
  35695. $core.method({
  35696. selector: "visitDynamicArrayNode:",
  35697. protocol: 'visiting',
  35698. fn: function (aNode){
  35699. var self=this;
  35700. var array;
  35701. return $core.withContext(function($ctx1) {
  35702. array=$recv($globals.IRDynamicArray)._new();
  35703. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  35704. return $core.withContext(function($ctx2) {
  35705. return $recv(array)._add_(each);
  35706. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35707. }));
  35708. return array;
  35709. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  35710. },
  35711. args: ["aNode"],
  35712. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  35713. referencedClasses: ["IRDynamicArray"],
  35714. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  35715. }),
  35716. $globals.IRASTTranslator);
  35717. $core.addMethod(
  35718. $core.method({
  35719. selector: "visitDynamicDictionaryNode:",
  35720. protocol: 'visiting',
  35721. fn: function (aNode){
  35722. var self=this;
  35723. var dictionary;
  35724. return $core.withContext(function($ctx1) {
  35725. dictionary=$recv($globals.IRDynamicDictionary)._new();
  35726. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  35727. return $core.withContext(function($ctx2) {
  35728. return $recv(dictionary)._add_(each);
  35729. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35730. }));
  35731. return dictionary;
  35732. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  35733. },
  35734. args: ["aNode"],
  35735. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  35736. referencedClasses: ["IRDynamicDictionary"],
  35737. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  35738. }),
  35739. $globals.IRASTTranslator);
  35740. $core.addMethod(
  35741. $core.method({
  35742. selector: "visitJSStatementNode:",
  35743. protocol: 'visiting',
  35744. fn: function (aNode){
  35745. var self=this;
  35746. return $core.withContext(function($ctx1) {
  35747. var $1;
  35748. $1=$recv($globals.IRVerbatim)._new();
  35749. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  35750. return $recv($1)._yourself();
  35751. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35752. },
  35753. args: ["aNode"],
  35754. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  35755. referencedClasses: ["IRVerbatim"],
  35756. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  35757. }),
  35758. $globals.IRASTTranslator);
  35759. $core.addMethod(
  35760. $core.method({
  35761. selector: "visitMethodNode:",
  35762. protocol: 'visiting',
  35763. fn: function (aNode){
  35764. var self=this;
  35765. return $core.withContext(function($ctx1) {
  35766. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  35767. $2=$recv($globals.IRMethod)._new();
  35768. $ctx1.sendIdx["new"]=1;
  35769. $recv($2)._source_($recv(self._source())._crlfSanitized());
  35770. $ctx1.sendIdx["source:"]=1;
  35771. $recv($2)._theClass_(self._theClass());
  35772. $recv($2)._arguments_($recv(aNode)._arguments());
  35773. $recv($2)._selector_($recv(aNode)._selector());
  35774. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  35775. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35776. $recv($2)._classReferences_($recv(aNode)._classReferences());
  35777. $3=$recv(aNode)._scope();
  35778. $ctx1.sendIdx["scope"]=1;
  35779. $recv($2)._scope_($3);
  35780. $ctx1.sendIdx["scope:"]=1;
  35781. $4=$recv($2)._yourself();
  35782. $ctx1.sendIdx["yourself"]=1;
  35783. $1=$4;
  35784. self._method_($1);
  35785. $6=$recv(aNode)._scope();
  35786. $ctx1.sendIdx["scope"]=2;
  35787. $5=$recv($6)._temps();
  35788. $recv($5)._do_((function(each){
  35789. return $core.withContext(function($ctx2) {
  35790. $7=self._method();
  35791. $ctx2.sendIdx["method"]=1;
  35792. $9=$recv($globals.IRTempDeclaration)._new();
  35793. $ctx2.sendIdx["new"]=2;
  35794. $recv($9)._name_($recv(each)._name());
  35795. $10=$recv(aNode)._scope();
  35796. $ctx2.sendIdx["scope"]=3;
  35797. $recv($9)._scope_($10);
  35798. $11=$recv($9)._yourself();
  35799. $ctx2.sendIdx["yourself"]=2;
  35800. $8=$11;
  35801. return $recv($7)._add_($8);
  35802. $ctx2.sendIdx["add:"]=1;
  35803. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35804. }));
  35805. $ctx1.sendIdx["do:"]=1;
  35806. $recv($recv(aNode)._dagChildren())._do_((function(each){
  35807. return $core.withContext(function($ctx2) {
  35808. $12=self._method();
  35809. $ctx2.sendIdx["method"]=2;
  35810. return $recv($12)._add_(self._visit_(each));
  35811. $ctx2.sendIdx["add:"]=2;
  35812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35813. }));
  35814. $14=$recv(aNode)._scope();
  35815. $ctx1.sendIdx["scope"]=4;
  35816. $13=$recv($14)._hasLocalReturn();
  35817. if(!$core.assert($13)){
  35818. $15=self._method();
  35819. $ctx1.sendIdx["method"]=3;
  35820. $17=$recv($globals.IRReturn)._new();
  35821. $ctx1.sendIdx["new"]=3;
  35822. $19=$recv($globals.IRVariable)._new();
  35823. $ctx1.sendIdx["new"]=4;
  35824. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  35825. $20=$recv($19)._yourself();
  35826. $ctx1.sendIdx["yourself"]=3;
  35827. $18=$20;
  35828. $recv($17)._add_($18);
  35829. $ctx1.sendIdx["add:"]=4;
  35830. $21=$recv($17)._yourself();
  35831. $ctx1.sendIdx["yourself"]=4;
  35832. $16=$21;
  35833. $recv($15)._add_($16);
  35834. $ctx1.sendIdx["add:"]=3;
  35835. $23=$recv($globals.IRVerbatim)._new();
  35836. $recv($23)._source_("");
  35837. $22=$recv($23)._yourself();
  35838. $recv($15)._add_($22);
  35839. }
  35840. return self._method();
  35841. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35842. },
  35843. args: ["aNode"],
  35844. 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",
  35845. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  35846. 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"]
  35847. }),
  35848. $globals.IRASTTranslator);
  35849. $core.addMethod(
  35850. $core.method({
  35851. selector: "visitOrAlias:",
  35852. protocol: 'visiting',
  35853. fn: function (aNode){
  35854. var self=this;
  35855. return $core.withContext(function($ctx1) {
  35856. var $1;
  35857. $1=$recv(aNode)._shouldBeAliased();
  35858. if($core.assert($1)){
  35859. return self._alias_(aNode);
  35860. } else {
  35861. return self._visit_(aNode);
  35862. }
  35863. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  35864. },
  35865. args: ["aNode"],
  35866. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  35867. referencedClasses: [],
  35868. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  35869. }),
  35870. $globals.IRASTTranslator);
  35871. $core.addMethod(
  35872. $core.method({
  35873. selector: "visitReturnNode:",
  35874. protocol: 'visiting',
  35875. fn: function (aNode){
  35876. var self=this;
  35877. var return_;
  35878. return $core.withContext(function($ctx1) {
  35879. var $1;
  35880. $1=$recv(aNode)._nonLocalReturn();
  35881. if($core.assert($1)){
  35882. return_=$recv($globals.IRNonLocalReturn)._new();
  35883. $ctx1.sendIdx["new"]=1;
  35884. } else {
  35885. return_=$recv($globals.IRReturn)._new();
  35886. }
  35887. $recv(return_)._scope_($recv(aNode)._scope());
  35888. $recv($recv(aNode)._dagChildren())._do_((function(each){
  35889. return $core.withContext(function($ctx2) {
  35890. return $recv(return_)._add_(self._visitOrAlias_(each));
  35891. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35892. }));
  35893. return return_;
  35894. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  35895. },
  35896. args: ["aNode"],
  35897. 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",
  35898. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  35899. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  35900. }),
  35901. $globals.IRASTTranslator);
  35902. $core.addMethod(
  35903. $core.method({
  35904. selector: "visitSendNode:",
  35905. protocol: 'visiting',
  35906. fn: function (aNode){
  35907. var self=this;
  35908. var send;
  35909. return $core.withContext(function($ctx1) {
  35910. var $1;
  35911. send=$recv($globals.IRSend)._new();
  35912. $1=send;
  35913. $recv($1)._selector_($recv(aNode)._selector());
  35914. $recv($1)._index_($recv(aNode)._index());
  35915. $recv(self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  35916. return $core.withContext(function($ctx2) {
  35917. return $recv(send)._add_(each);
  35918. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35919. }));
  35920. return send;
  35921. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  35922. },
  35923. args: ["aNode"],
  35924. 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",
  35925. referencedClasses: ["IRSend"],
  35926. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  35927. }),
  35928. $globals.IRASTTranslator);
  35929. $core.addMethod(
  35930. $core.method({
  35931. selector: "visitSequenceNode:",
  35932. protocol: 'visiting',
  35933. fn: function (aNode){
  35934. var self=this;
  35935. return $core.withContext(function($ctx1) {
  35936. var $1;
  35937. return self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  35938. return $core.withContext(function($ctx2) {
  35939. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  35940. var instruction;
  35941. return $core.withContext(function($ctx3) {
  35942. instruction=self._visitOrAlias_(each);
  35943. instruction;
  35944. $1=$recv(instruction)._isVariable();
  35945. if(!$core.assert($1)){
  35946. return $recv(self._sequence())._add_(instruction);
  35947. }
  35948. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  35949. }));
  35950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35951. }));
  35952. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35953. },
  35954. args: ["aNode"],
  35955. 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 ] ]]",
  35956. referencedClasses: ["IRSequence"],
  35957. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  35958. }),
  35959. $globals.IRASTTranslator);
  35960. $core.addMethod(
  35961. $core.method({
  35962. selector: "visitValueNode:",
  35963. protocol: 'visiting',
  35964. fn: function (aNode){
  35965. var self=this;
  35966. return $core.withContext(function($ctx1) {
  35967. var $1;
  35968. $1=$recv($globals.IRValue)._new();
  35969. $recv($1)._value_($recv(aNode)._value());
  35970. return $recv($1)._yourself();
  35971. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35972. },
  35973. args: ["aNode"],
  35974. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  35975. referencedClasses: ["IRValue"],
  35976. messageSends: ["value:", "new", "value", "yourself"]
  35977. }),
  35978. $globals.IRASTTranslator);
  35979. $core.addMethod(
  35980. $core.method({
  35981. selector: "visitVariableNode:",
  35982. protocol: 'visiting',
  35983. fn: function (aNode){
  35984. var self=this;
  35985. return $core.withContext(function($ctx1) {
  35986. var $1;
  35987. $1=$recv($globals.IRVariable)._new();
  35988. $recv($1)._variable_($recv(aNode)._binding());
  35989. return $recv($1)._yourself();
  35990. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35991. },
  35992. args: ["aNode"],
  35993. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  35994. referencedClasses: ["IRVariable"],
  35995. messageSends: ["variable:", "new", "binding", "yourself"]
  35996. }),
  35997. $globals.IRASTTranslator);
  35998. $core.addMethod(
  35999. $core.method({
  36000. selector: "withSequence:do:",
  36001. protocol: 'accessing',
  36002. fn: function (aSequence,aBlock){
  36003. var self=this;
  36004. var outerSequence;
  36005. return $core.withContext(function($ctx1) {
  36006. outerSequence=self._sequence();
  36007. self._sequence_(aSequence);
  36008. $ctx1.sendIdx["sequence:"]=1;
  36009. $recv(aBlock)._value();
  36010. self._sequence_(outerSequence);
  36011. return aSequence;
  36012. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  36013. },
  36014. args: ["aSequence", "aBlock"],
  36015. 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",
  36016. referencedClasses: [],
  36017. messageSends: ["sequence", "sequence:", "value"]
  36018. }),
  36019. $globals.IRASTTranslator);
  36020. $core.addClass('IRInstruction', $globals.DagParentNode, ['parent'], 'Compiler-IR');
  36021. $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.";
  36022. $core.addMethod(
  36023. $core.method({
  36024. selector: "add:",
  36025. protocol: 'building',
  36026. fn: function (anObject){
  36027. var self=this;
  36028. return $core.withContext(function($ctx1) {
  36029. $recv(anObject)._parent_(self);
  36030. return $recv(self._dagChildren())._add_(anObject);
  36031. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  36032. },
  36033. args: ["anObject"],
  36034. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  36035. referencedClasses: [],
  36036. messageSends: ["parent:", "add:", "dagChildren"]
  36037. }),
  36038. $globals.IRInstruction);
  36039. $core.addMethod(
  36040. $core.method({
  36041. selector: "isClosure",
  36042. protocol: 'testing',
  36043. fn: function (){
  36044. var self=this;
  36045. return false;
  36046. },
  36047. args: [],
  36048. source: "isClosure\x0a\x09^ false",
  36049. referencedClasses: [],
  36050. messageSends: []
  36051. }),
  36052. $globals.IRInstruction);
  36053. $core.addMethod(
  36054. $core.method({
  36055. selector: "isInlined",
  36056. protocol: 'testing',
  36057. fn: function (){
  36058. var self=this;
  36059. return false;
  36060. },
  36061. args: [],
  36062. source: "isInlined\x0a\x09^ false",
  36063. referencedClasses: [],
  36064. messageSends: []
  36065. }),
  36066. $globals.IRInstruction);
  36067. $core.addMethod(
  36068. $core.method({
  36069. selector: "isMethod",
  36070. protocol: 'testing',
  36071. fn: function (){
  36072. var self=this;
  36073. return false;
  36074. },
  36075. args: [],
  36076. source: "isMethod\x0a\x09^ false",
  36077. referencedClasses: [],
  36078. messageSends: []
  36079. }),
  36080. $globals.IRInstruction);
  36081. $core.addMethod(
  36082. $core.method({
  36083. selector: "isSend",
  36084. protocol: 'testing',
  36085. fn: function (){
  36086. var self=this;
  36087. return false;
  36088. },
  36089. args: [],
  36090. source: "isSend\x0a\x09^ false",
  36091. referencedClasses: [],
  36092. messageSends: []
  36093. }),
  36094. $globals.IRInstruction);
  36095. $core.addMethod(
  36096. $core.method({
  36097. selector: "isSequence",
  36098. protocol: 'testing',
  36099. fn: function (){
  36100. var self=this;
  36101. return false;
  36102. },
  36103. args: [],
  36104. source: "isSequence\x0a\x09^ false",
  36105. referencedClasses: [],
  36106. messageSends: []
  36107. }),
  36108. $globals.IRInstruction);
  36109. $core.addMethod(
  36110. $core.method({
  36111. selector: "isTempDeclaration",
  36112. protocol: 'testing',
  36113. fn: function (){
  36114. var self=this;
  36115. return false;
  36116. },
  36117. args: [],
  36118. source: "isTempDeclaration\x0a\x09^ false",
  36119. referencedClasses: [],
  36120. messageSends: []
  36121. }),
  36122. $globals.IRInstruction);
  36123. $core.addMethod(
  36124. $core.method({
  36125. selector: "isVariable",
  36126. protocol: 'testing',
  36127. fn: function (){
  36128. var self=this;
  36129. return false;
  36130. },
  36131. args: [],
  36132. source: "isVariable\x0a\x09^ false",
  36133. referencedClasses: [],
  36134. messageSends: []
  36135. }),
  36136. $globals.IRInstruction);
  36137. $core.addMethod(
  36138. $core.method({
  36139. selector: "method",
  36140. protocol: 'accessing',
  36141. fn: function (){
  36142. var self=this;
  36143. return $core.withContext(function($ctx1) {
  36144. return $recv(self._parent())._method();
  36145. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  36146. },
  36147. args: [],
  36148. source: "method\x0a\x09^ self parent method",
  36149. referencedClasses: [],
  36150. messageSends: ["method", "parent"]
  36151. }),
  36152. $globals.IRInstruction);
  36153. $core.addMethod(
  36154. $core.method({
  36155. selector: "needsBoxingAsReceiver",
  36156. protocol: 'testing',
  36157. fn: function (){
  36158. var self=this;
  36159. return true;
  36160. },
  36161. args: [],
  36162. source: "needsBoxingAsReceiver\x0a\x09^ true",
  36163. referencedClasses: [],
  36164. messageSends: []
  36165. }),
  36166. $globals.IRInstruction);
  36167. $core.addMethod(
  36168. $core.method({
  36169. selector: "parent",
  36170. protocol: 'accessing',
  36171. fn: function (){
  36172. var self=this;
  36173. return self["@parent"];
  36174. },
  36175. args: [],
  36176. source: "parent\x0a\x09^ parent",
  36177. referencedClasses: [],
  36178. messageSends: []
  36179. }),
  36180. $globals.IRInstruction);
  36181. $core.addMethod(
  36182. $core.method({
  36183. selector: "parent:",
  36184. protocol: 'accessing',
  36185. fn: function (anIRInstruction){
  36186. var self=this;
  36187. self["@parent"]=anIRInstruction;
  36188. return self;
  36189. },
  36190. args: ["anIRInstruction"],
  36191. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  36192. referencedClasses: [],
  36193. messageSends: []
  36194. }),
  36195. $globals.IRInstruction);
  36196. $core.addMethod(
  36197. $core.method({
  36198. selector: "remove:",
  36199. protocol: 'building',
  36200. fn: function (anIRInstruction){
  36201. var self=this;
  36202. return $core.withContext(function($ctx1) {
  36203. $recv(self._dagChildren())._remove_(anIRInstruction);
  36204. return self;
  36205. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36206. },
  36207. args: ["anIRInstruction"],
  36208. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  36209. referencedClasses: [],
  36210. messageSends: ["remove:", "dagChildren"]
  36211. }),
  36212. $globals.IRInstruction);
  36213. $core.addMethod(
  36214. $core.method({
  36215. selector: "replace:with:",
  36216. protocol: 'building',
  36217. fn: function (anIRInstruction,anotherIRInstruction){
  36218. var self=this;
  36219. return $core.withContext(function($ctx1) {
  36220. var $1;
  36221. $recv(anotherIRInstruction)._parent_(self);
  36222. $1=self._dagChildren();
  36223. $ctx1.sendIdx["dagChildren"]=1;
  36224. $recv($1)._at_put_($recv(self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  36225. return self;
  36226. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  36227. },
  36228. args: ["anIRInstruction", "anotherIRInstruction"],
  36229. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  36230. referencedClasses: [],
  36231. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  36232. }),
  36233. $globals.IRInstruction);
  36234. $core.addMethod(
  36235. $core.method({
  36236. selector: "replaceWith:",
  36237. protocol: 'building',
  36238. fn: function (anIRInstruction){
  36239. var self=this;
  36240. return $core.withContext(function($ctx1) {
  36241. $recv(self._parent())._replace_with_(self,anIRInstruction);
  36242. return self;
  36243. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36244. },
  36245. args: ["anIRInstruction"],
  36246. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  36247. referencedClasses: [],
  36248. messageSends: ["replace:with:", "parent"]
  36249. }),
  36250. $globals.IRInstruction);
  36251. $core.addMethod(
  36252. $core.method({
  36253. selector: "scope",
  36254. protocol: 'accessing',
  36255. fn: function (){
  36256. var self=this;
  36257. return $core.withContext(function($ctx1) {
  36258. var $1,$receiver;
  36259. $1=self._parent();
  36260. if(($receiver = $1) == null || $receiver.isNil){
  36261. return $1;
  36262. } else {
  36263. var node;
  36264. node=$receiver;
  36265. return $recv(node)._scope();
  36266. }
  36267. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  36268. },
  36269. args: [],
  36270. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  36271. referencedClasses: [],
  36272. messageSends: ["ifNotNil:", "parent", "scope"]
  36273. }),
  36274. $globals.IRInstruction);
  36275. $core.addMethod(
  36276. $core.method({
  36277. selector: "yieldsValue",
  36278. protocol: 'testing',
  36279. fn: function (){
  36280. var self=this;
  36281. return true;
  36282. },
  36283. args: [],
  36284. source: "yieldsValue\x0a\x09^ true",
  36285. referencedClasses: [],
  36286. messageSends: []
  36287. }),
  36288. $globals.IRInstruction);
  36289. $core.addMethod(
  36290. $core.method({
  36291. selector: "on:",
  36292. protocol: 'instance creation',
  36293. fn: function (aBuilder){
  36294. var self=this;
  36295. return $core.withContext(function($ctx1) {
  36296. var $1;
  36297. $1=self._new();
  36298. $recv($1)._builder_(aBuilder);
  36299. return $recv($1)._yourself();
  36300. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  36301. },
  36302. args: ["aBuilder"],
  36303. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  36304. referencedClasses: [],
  36305. messageSends: ["builder:", "new", "yourself"]
  36306. }),
  36307. $globals.IRInstruction.klass);
  36308. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  36309. $core.addMethod(
  36310. $core.method({
  36311. selector: "acceptDagVisitor:",
  36312. protocol: 'visiting',
  36313. fn: function (aVisitor){
  36314. var self=this;
  36315. return $core.withContext(function($ctx1) {
  36316. return $recv(aVisitor)._visitIRAssignment_(self);
  36317. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  36318. },
  36319. args: ["aVisitor"],
  36320. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  36321. referencedClasses: [],
  36322. messageSends: ["visitIRAssignment:"]
  36323. }),
  36324. $globals.IRAssignment);
  36325. $core.addMethod(
  36326. $core.method({
  36327. selector: "left",
  36328. protocol: 'accessing',
  36329. fn: function (){
  36330. var self=this;
  36331. return $core.withContext(function($ctx1) {
  36332. return $recv(self._dagChildren())._first();
  36333. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  36334. },
  36335. args: [],
  36336. source: "left\x0a\x09^ self dagChildren first",
  36337. referencedClasses: [],
  36338. messageSends: ["first", "dagChildren"]
  36339. }),
  36340. $globals.IRAssignment);
  36341. $core.addMethod(
  36342. $core.method({
  36343. selector: "right",
  36344. protocol: 'accessing',
  36345. fn: function (){
  36346. var self=this;
  36347. return $core.withContext(function($ctx1) {
  36348. return $recv(self._dagChildren())._last();
  36349. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  36350. },
  36351. args: [],
  36352. source: "right\x0a\x09^ self dagChildren last",
  36353. referencedClasses: [],
  36354. messageSends: ["last", "dagChildren"]
  36355. }),
  36356. $globals.IRAssignment);
  36357. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  36358. $core.addMethod(
  36359. $core.method({
  36360. selector: "acceptDagVisitor:",
  36361. protocol: 'visiting',
  36362. fn: function (aVisitor){
  36363. var self=this;
  36364. return $core.withContext(function($ctx1) {
  36365. return $recv(aVisitor)._visitIRDynamicArray_(self);
  36366. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  36367. },
  36368. args: ["aVisitor"],
  36369. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  36370. referencedClasses: [],
  36371. messageSends: ["visitIRDynamicArray:"]
  36372. }),
  36373. $globals.IRDynamicArray);
  36374. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  36375. $core.addMethod(
  36376. $core.method({
  36377. selector: "acceptDagVisitor:",
  36378. protocol: 'visiting',
  36379. fn: function (aVisitor){
  36380. var self=this;
  36381. return $core.withContext(function($ctx1) {
  36382. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  36383. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  36384. },
  36385. args: ["aVisitor"],
  36386. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  36387. referencedClasses: [],
  36388. messageSends: ["visitIRDynamicDictionary:"]
  36389. }),
  36390. $globals.IRDynamicDictionary);
  36391. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  36392. $core.addMethod(
  36393. $core.method({
  36394. selector: "scope",
  36395. protocol: 'accessing',
  36396. fn: function (){
  36397. var self=this;
  36398. return self["@scope"];
  36399. },
  36400. args: [],
  36401. source: "scope\x0a\x09^ scope",
  36402. referencedClasses: [],
  36403. messageSends: []
  36404. }),
  36405. $globals.IRScopedInstruction);
  36406. $core.addMethod(
  36407. $core.method({
  36408. selector: "scope:",
  36409. protocol: 'accessing',
  36410. fn: function (aScope){
  36411. var self=this;
  36412. self["@scope"]=aScope;
  36413. return self;
  36414. },
  36415. args: ["aScope"],
  36416. source: "scope: aScope\x0a\x09scope := aScope",
  36417. referencedClasses: [],
  36418. messageSends: []
  36419. }),
  36420. $globals.IRScopedInstruction);
  36421. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  36422. $core.addMethod(
  36423. $core.method({
  36424. selector: "arguments",
  36425. protocol: 'accessing',
  36426. fn: function (){
  36427. var self=this;
  36428. return $core.withContext(function($ctx1) {
  36429. var $1,$receiver;
  36430. $1=self["@arguments"];
  36431. if(($receiver = $1) == null || $receiver.isNil){
  36432. return [];
  36433. } else {
  36434. return $1;
  36435. }
  36436. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  36437. },
  36438. args: [],
  36439. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36440. referencedClasses: [],
  36441. messageSends: ["ifNil:"]
  36442. }),
  36443. $globals.IRClosureInstruction);
  36444. $core.addMethod(
  36445. $core.method({
  36446. selector: "arguments:",
  36447. protocol: 'accessing',
  36448. fn: function (aCollection){
  36449. var self=this;
  36450. self["@arguments"]=aCollection;
  36451. return self;
  36452. },
  36453. args: ["aCollection"],
  36454. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  36455. referencedClasses: [],
  36456. messageSends: []
  36457. }),
  36458. $globals.IRClosureInstruction);
  36459. $core.addMethod(
  36460. $core.method({
  36461. selector: "locals",
  36462. protocol: 'accessing',
  36463. fn: function (){
  36464. var self=this;
  36465. return $core.withContext(function($ctx1) {
  36466. var $1;
  36467. $1=$recv(self._arguments())._copy();
  36468. $recv($1)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  36469. return $core.withContext(function($ctx2) {
  36470. return $recv(each)._name();
  36471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36472. })));
  36473. return $recv($1)._yourself();
  36474. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  36475. },
  36476. args: [],
  36477. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  36478. referencedClasses: [],
  36479. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  36480. }),
  36481. $globals.IRClosureInstruction);
  36482. $core.addMethod(
  36483. $core.method({
  36484. selector: "requiresSmalltalkContext",
  36485. protocol: 'accessing',
  36486. fn: function (){
  36487. var self=this;
  36488. return $core.withContext(function($ctx1) {
  36489. var $1,$receiver;
  36490. $1=self["@requiresSmalltalkContext"];
  36491. if(($receiver = $1) == null || $receiver.isNil){
  36492. return false;
  36493. } else {
  36494. return $1;
  36495. }
  36496. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  36497. },
  36498. args: [],
  36499. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  36500. referencedClasses: [],
  36501. messageSends: ["ifNil:"]
  36502. }),
  36503. $globals.IRClosureInstruction);
  36504. $core.addMethod(
  36505. $core.method({
  36506. selector: "requiresSmalltalkContext:",
  36507. protocol: 'accessing',
  36508. fn: function (anObject){
  36509. var self=this;
  36510. self["@requiresSmalltalkContext"]=anObject;
  36511. return self;
  36512. },
  36513. args: ["anObject"],
  36514. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  36515. referencedClasses: [],
  36516. messageSends: []
  36517. }),
  36518. $globals.IRClosureInstruction);
  36519. $core.addMethod(
  36520. $core.method({
  36521. selector: "scope:",
  36522. protocol: 'accessing',
  36523. fn: function (aScope){
  36524. var self=this;
  36525. return $core.withContext(function($ctx1) {
  36526. (
  36527. $ctx1.supercall = true,
  36528. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($recv(self), [aScope]));
  36529. $ctx1.supercall = false;
  36530. $recv(aScope)._instruction_(self);
  36531. return self;
  36532. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  36533. },
  36534. args: ["aScope"],
  36535. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  36536. referencedClasses: [],
  36537. messageSends: ["scope:", "instruction:"]
  36538. }),
  36539. $globals.IRClosureInstruction);
  36540. $core.addMethod(
  36541. $core.method({
  36542. selector: "tempDeclarations",
  36543. protocol: 'accessing',
  36544. fn: function (){
  36545. var self=this;
  36546. return $core.withContext(function($ctx1) {
  36547. return $recv(self._dagChildren())._select_((function(each){
  36548. return $core.withContext(function($ctx2) {
  36549. return $recv(each)._isTempDeclaration();
  36550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36551. }));
  36552. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  36553. },
  36554. args: [],
  36555. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  36556. referencedClasses: [],
  36557. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  36558. }),
  36559. $globals.IRClosureInstruction);
  36560. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  36561. $core.addMethod(
  36562. $core.method({
  36563. selector: "acceptDagVisitor:",
  36564. protocol: 'visiting',
  36565. fn: function (aVisitor){
  36566. var self=this;
  36567. return $core.withContext(function($ctx1) {
  36568. return $recv(aVisitor)._visitIRClosure_(self);
  36569. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  36570. },
  36571. args: ["aVisitor"],
  36572. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  36573. referencedClasses: [],
  36574. messageSends: ["visitIRClosure:"]
  36575. }),
  36576. $globals.IRClosure);
  36577. $core.addMethod(
  36578. $core.method({
  36579. selector: "isClosure",
  36580. protocol: 'testing',
  36581. fn: function (){
  36582. var self=this;
  36583. return true;
  36584. },
  36585. args: [],
  36586. source: "isClosure\x0a\x09^ true",
  36587. referencedClasses: [],
  36588. messageSends: []
  36589. }),
  36590. $globals.IRClosure);
  36591. $core.addMethod(
  36592. $core.method({
  36593. selector: "sequence",
  36594. protocol: 'accessing',
  36595. fn: function (){
  36596. var self=this;
  36597. return $core.withContext(function($ctx1) {
  36598. return $recv(self._dagChildren())._last();
  36599. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  36600. },
  36601. args: [],
  36602. source: "sequence\x0a\x09^ self dagChildren last",
  36603. referencedClasses: [],
  36604. messageSends: ["last", "dagChildren"]
  36605. }),
  36606. $globals.IRClosure);
  36607. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  36608. $globals.IRMethod.comment="I am a method instruction";
  36609. $core.addMethod(
  36610. $core.method({
  36611. selector: "acceptDagVisitor:",
  36612. protocol: 'visiting',
  36613. fn: function (aVisitor){
  36614. var self=this;
  36615. return $core.withContext(function($ctx1) {
  36616. return $recv(aVisitor)._visitIRMethod_(self);
  36617. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  36618. },
  36619. args: ["aVisitor"],
  36620. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  36621. referencedClasses: [],
  36622. messageSends: ["visitIRMethod:"]
  36623. }),
  36624. $globals.IRMethod);
  36625. $core.addMethod(
  36626. $core.method({
  36627. selector: "classReferences",
  36628. protocol: 'accessing',
  36629. fn: function (){
  36630. var self=this;
  36631. return self["@classReferences"];
  36632. },
  36633. args: [],
  36634. source: "classReferences\x0a\x09^ classReferences",
  36635. referencedClasses: [],
  36636. messageSends: []
  36637. }),
  36638. $globals.IRMethod);
  36639. $core.addMethod(
  36640. $core.method({
  36641. selector: "classReferences:",
  36642. protocol: 'accessing',
  36643. fn: function (aCollection){
  36644. var self=this;
  36645. self["@classReferences"]=aCollection;
  36646. return self;
  36647. },
  36648. args: ["aCollection"],
  36649. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  36650. referencedClasses: [],
  36651. messageSends: []
  36652. }),
  36653. $globals.IRMethod);
  36654. $core.addMethod(
  36655. $core.method({
  36656. selector: "internalVariables",
  36657. protocol: 'accessing',
  36658. fn: function (){
  36659. var self=this;
  36660. return $core.withContext(function($ctx1) {
  36661. var $1,$receiver;
  36662. $1=self["@internalVariables"];
  36663. if(($receiver = $1) == null || $receiver.isNil){
  36664. self["@internalVariables"]=$recv($globals.Set)._new();
  36665. return self["@internalVariables"];
  36666. } else {
  36667. return $1;
  36668. }
  36669. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  36670. },
  36671. args: [],
  36672. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  36673. referencedClasses: ["Set"],
  36674. messageSends: ["ifNil:", "new"]
  36675. }),
  36676. $globals.IRMethod);
  36677. $core.addMethod(
  36678. $core.method({
  36679. selector: "isMethod",
  36680. protocol: 'testing',
  36681. fn: function (){
  36682. var self=this;
  36683. return true;
  36684. },
  36685. args: [],
  36686. source: "isMethod\x0a\x09^ true",
  36687. referencedClasses: [],
  36688. messageSends: []
  36689. }),
  36690. $globals.IRMethod);
  36691. $core.addMethod(
  36692. $core.method({
  36693. selector: "messageSends",
  36694. protocol: 'accessing',
  36695. fn: function (){
  36696. var self=this;
  36697. return $core.withContext(function($ctx1) {
  36698. return $recv(self._sendIndexes())._keys();
  36699. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  36700. },
  36701. args: [],
  36702. source: "messageSends\x0a\x09^ self sendIndexes keys",
  36703. referencedClasses: [],
  36704. messageSends: ["keys", "sendIndexes"]
  36705. }),
  36706. $globals.IRMethod);
  36707. $core.addMethod(
  36708. $core.method({
  36709. selector: "method",
  36710. protocol: 'accessing',
  36711. fn: function (){
  36712. var self=this;
  36713. return self;
  36714. },
  36715. args: [],
  36716. source: "method\x0a\x09^ self",
  36717. referencedClasses: [],
  36718. messageSends: []
  36719. }),
  36720. $globals.IRMethod);
  36721. $core.addMethod(
  36722. $core.method({
  36723. selector: "selector",
  36724. protocol: 'accessing',
  36725. fn: function (){
  36726. var self=this;
  36727. return self["@selector"];
  36728. },
  36729. args: [],
  36730. source: "selector\x0a\x09^ selector",
  36731. referencedClasses: [],
  36732. messageSends: []
  36733. }),
  36734. $globals.IRMethod);
  36735. $core.addMethod(
  36736. $core.method({
  36737. selector: "selector:",
  36738. protocol: 'accessing',
  36739. fn: function (aString){
  36740. var self=this;
  36741. self["@selector"]=aString;
  36742. return self;
  36743. },
  36744. args: ["aString"],
  36745. source: "selector: aString\x0a\x09selector := aString",
  36746. referencedClasses: [],
  36747. messageSends: []
  36748. }),
  36749. $globals.IRMethod);
  36750. $core.addMethod(
  36751. $core.method({
  36752. selector: "sendIndexes",
  36753. protocol: 'accessing',
  36754. fn: function (){
  36755. var self=this;
  36756. return self["@sendIndexes"];
  36757. },
  36758. args: [],
  36759. source: "sendIndexes\x0a\x09^ sendIndexes",
  36760. referencedClasses: [],
  36761. messageSends: []
  36762. }),
  36763. $globals.IRMethod);
  36764. $core.addMethod(
  36765. $core.method({
  36766. selector: "sendIndexes:",
  36767. protocol: 'accessing',
  36768. fn: function (aDictionary){
  36769. var self=this;
  36770. self["@sendIndexes"]=aDictionary;
  36771. return self;
  36772. },
  36773. args: ["aDictionary"],
  36774. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  36775. referencedClasses: [],
  36776. messageSends: []
  36777. }),
  36778. $globals.IRMethod);
  36779. $core.addMethod(
  36780. $core.method({
  36781. selector: "source",
  36782. protocol: 'accessing',
  36783. fn: function (){
  36784. var self=this;
  36785. return self["@source"];
  36786. },
  36787. args: [],
  36788. source: "source\x0a\x09^ source",
  36789. referencedClasses: [],
  36790. messageSends: []
  36791. }),
  36792. $globals.IRMethod);
  36793. $core.addMethod(
  36794. $core.method({
  36795. selector: "source:",
  36796. protocol: 'accessing',
  36797. fn: function (aString){
  36798. var self=this;
  36799. self["@source"]=aString;
  36800. return self;
  36801. },
  36802. args: ["aString"],
  36803. source: "source: aString\x0a\x09source := aString",
  36804. referencedClasses: [],
  36805. messageSends: []
  36806. }),
  36807. $globals.IRMethod);
  36808. $core.addMethod(
  36809. $core.method({
  36810. selector: "theClass",
  36811. protocol: 'accessing',
  36812. fn: function (){
  36813. var self=this;
  36814. return self["@theClass"];
  36815. },
  36816. args: [],
  36817. source: "theClass\x0a\x09^ theClass",
  36818. referencedClasses: [],
  36819. messageSends: []
  36820. }),
  36821. $globals.IRMethod);
  36822. $core.addMethod(
  36823. $core.method({
  36824. selector: "theClass:",
  36825. protocol: 'accessing',
  36826. fn: function (aClass){
  36827. var self=this;
  36828. self["@theClass"]=aClass;
  36829. return self;
  36830. },
  36831. args: ["aClass"],
  36832. source: "theClass: aClass\x0a\x09theClass := aClass",
  36833. referencedClasses: [],
  36834. messageSends: []
  36835. }),
  36836. $globals.IRMethod);
  36837. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  36838. $globals.IRReturn.comment="I am a local return instruction.";
  36839. $core.addMethod(
  36840. $core.method({
  36841. selector: "acceptDagVisitor:",
  36842. protocol: 'visiting',
  36843. fn: function (aVisitor){
  36844. var self=this;
  36845. return $core.withContext(function($ctx1) {
  36846. return $recv(aVisitor)._visitIRReturn_(self);
  36847. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  36848. },
  36849. args: ["aVisitor"],
  36850. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  36851. referencedClasses: [],
  36852. messageSends: ["visitIRReturn:"]
  36853. }),
  36854. $globals.IRReturn);
  36855. $core.addMethod(
  36856. $core.method({
  36857. selector: "expression",
  36858. protocol: 'accessing',
  36859. fn: function (){
  36860. var self=this;
  36861. return $core.withContext(function($ctx1) {
  36862. return $recv(self._dagChildren())._single();
  36863. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  36864. },
  36865. args: [],
  36866. source: "expression\x0a\x09^ self dagChildren single",
  36867. referencedClasses: [],
  36868. messageSends: ["single", "dagChildren"]
  36869. }),
  36870. $globals.IRReturn);
  36871. $core.addMethod(
  36872. $core.method({
  36873. selector: "scope",
  36874. protocol: 'accessing',
  36875. fn: function (){
  36876. var self=this;
  36877. return $core.withContext(function($ctx1) {
  36878. var $1,$receiver;
  36879. $1=self["@scope"];
  36880. if(($receiver = $1) == null || $receiver.isNil){
  36881. return $recv(self._parent())._scope();
  36882. } else {
  36883. return $1;
  36884. }
  36885. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  36886. },
  36887. args: [],
  36888. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  36889. referencedClasses: [],
  36890. messageSends: ["ifNil:", "scope", "parent"]
  36891. }),
  36892. $globals.IRReturn);
  36893. $core.addMethod(
  36894. $core.method({
  36895. selector: "yieldsValue",
  36896. protocol: 'testing',
  36897. fn: function (){
  36898. var self=this;
  36899. return false;
  36900. },
  36901. args: [],
  36902. source: "yieldsValue\x0a\x09^ false",
  36903. referencedClasses: [],
  36904. messageSends: []
  36905. }),
  36906. $globals.IRReturn);
  36907. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  36908. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  36909. $core.addMethod(
  36910. $core.method({
  36911. selector: "acceptDagVisitor:",
  36912. protocol: 'visiting',
  36913. fn: function (aVisitor){
  36914. var self=this;
  36915. return $core.withContext(function($ctx1) {
  36916. return $recv(aVisitor)._visitIRBlockReturn_(self);
  36917. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  36918. },
  36919. args: ["aVisitor"],
  36920. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  36921. referencedClasses: [],
  36922. messageSends: ["visitIRBlockReturn:"]
  36923. }),
  36924. $globals.IRBlockReturn);
  36925. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  36926. $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.";
  36927. $core.addMethod(
  36928. $core.method({
  36929. selector: "acceptDagVisitor:",
  36930. protocol: 'visiting',
  36931. fn: function (aVisitor){
  36932. var self=this;
  36933. return $core.withContext(function($ctx1) {
  36934. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  36935. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  36936. },
  36937. args: ["aVisitor"],
  36938. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  36939. referencedClasses: [],
  36940. messageSends: ["visitIRNonLocalReturn:"]
  36941. }),
  36942. $globals.IRNonLocalReturn);
  36943. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  36944. $core.addMethod(
  36945. $core.method({
  36946. selector: "acceptDagVisitor:",
  36947. protocol: 'visiting',
  36948. fn: function (aVisitor){
  36949. var self=this;
  36950. return $core.withContext(function($ctx1) {
  36951. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  36952. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  36953. },
  36954. args: ["aVisitor"],
  36955. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  36956. referencedClasses: [],
  36957. messageSends: ["visitIRTempDeclaration:"]
  36958. }),
  36959. $globals.IRTempDeclaration);
  36960. $core.addMethod(
  36961. $core.method({
  36962. selector: "isTempDeclaration",
  36963. protocol: 'testing',
  36964. fn: function (){
  36965. var self=this;
  36966. return true;
  36967. },
  36968. args: [],
  36969. source: "isTempDeclaration\x0a\x09^ true",
  36970. referencedClasses: [],
  36971. messageSends: []
  36972. }),
  36973. $globals.IRTempDeclaration);
  36974. $core.addMethod(
  36975. $core.method({
  36976. selector: "name",
  36977. protocol: 'accessing',
  36978. fn: function (){
  36979. var self=this;
  36980. return self["@name"];
  36981. },
  36982. args: [],
  36983. source: "name\x0a\x09^ name",
  36984. referencedClasses: [],
  36985. messageSends: []
  36986. }),
  36987. $globals.IRTempDeclaration);
  36988. $core.addMethod(
  36989. $core.method({
  36990. selector: "name:",
  36991. protocol: 'accessing',
  36992. fn: function (aString){
  36993. var self=this;
  36994. self["@name"]=aString;
  36995. return self;
  36996. },
  36997. args: ["aString"],
  36998. source: "name: aString\x0a\x09name := aString",
  36999. referencedClasses: [],
  37000. messageSends: []
  37001. }),
  37002. $globals.IRTempDeclaration);
  37003. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'index'], 'Compiler-IR');
  37004. $globals.IRSend.comment="I am a message send instruction.";
  37005. $core.addMethod(
  37006. $core.method({
  37007. selector: "acceptDagVisitor:",
  37008. protocol: 'visiting',
  37009. fn: function (aVisitor){
  37010. var self=this;
  37011. return $core.withContext(function($ctx1) {
  37012. return $recv(aVisitor)._visitIRSend_(self);
  37013. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  37014. },
  37015. args: ["aVisitor"],
  37016. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  37017. referencedClasses: [],
  37018. messageSends: ["visitIRSend:"]
  37019. }),
  37020. $globals.IRSend);
  37021. $core.addMethod(
  37022. $core.method({
  37023. selector: "arguments",
  37024. protocol: 'accessing',
  37025. fn: function (){
  37026. var self=this;
  37027. return $core.withContext(function($ctx1) {
  37028. return $recv(self._dagChildren())._allButFirst();
  37029. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  37030. },
  37031. args: [],
  37032. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  37033. referencedClasses: [],
  37034. messageSends: ["allButFirst", "dagChildren"]
  37035. }),
  37036. $globals.IRSend);
  37037. $core.addMethod(
  37038. $core.method({
  37039. selector: "index",
  37040. protocol: 'accessing',
  37041. fn: function (){
  37042. var self=this;
  37043. return self["@index"];
  37044. },
  37045. args: [],
  37046. source: "index\x0a\x09^ index",
  37047. referencedClasses: [],
  37048. messageSends: []
  37049. }),
  37050. $globals.IRSend);
  37051. $core.addMethod(
  37052. $core.method({
  37053. selector: "index:",
  37054. protocol: 'accessing',
  37055. fn: function (anInteger){
  37056. var self=this;
  37057. self["@index"]=anInteger;
  37058. return self;
  37059. },
  37060. args: ["anInteger"],
  37061. source: "index: anInteger\x0a\x09index := anInteger",
  37062. referencedClasses: [],
  37063. messageSends: []
  37064. }),
  37065. $globals.IRSend);
  37066. $core.addMethod(
  37067. $core.method({
  37068. selector: "isSend",
  37069. protocol: 'testing',
  37070. fn: function (){
  37071. var self=this;
  37072. return true;
  37073. },
  37074. args: [],
  37075. source: "isSend\x0a\x09^ true",
  37076. referencedClasses: [],
  37077. messageSends: []
  37078. }),
  37079. $globals.IRSend);
  37080. $core.addMethod(
  37081. $core.method({
  37082. selector: "isSuperSend",
  37083. protocol: 'testing',
  37084. fn: function (){
  37085. var self=this;
  37086. var receiver;
  37087. return $core.withContext(function($ctx1) {
  37088. receiver=self._receiver();
  37089. return $recv($recv(receiver)._isVariable())._and_((function(){
  37090. return $core.withContext(function($ctx2) {
  37091. return $recv($recv($recv(receiver)._variable())._name()).__eq("super");
  37092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37093. }));
  37094. }, function($ctx1) {$ctx1.fill(self,"isSuperSend",{receiver:receiver},$globals.IRSend)});
  37095. },
  37096. args: [],
  37097. source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self receiver.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
  37098. referencedClasses: [],
  37099. messageSends: ["receiver", "and:", "isVariable", "=", "name", "variable"]
  37100. }),
  37101. $globals.IRSend);
  37102. $core.addMethod(
  37103. $core.method({
  37104. selector: "receiver",
  37105. protocol: 'accessing',
  37106. fn: function (){
  37107. var self=this;
  37108. return $core.withContext(function($ctx1) {
  37109. return $recv(self._dagChildren())._first();
  37110. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  37111. },
  37112. args: [],
  37113. source: "receiver\x0a\x09^ self dagChildren first",
  37114. referencedClasses: [],
  37115. messageSends: ["first", "dagChildren"]
  37116. }),
  37117. $globals.IRSend);
  37118. $core.addMethod(
  37119. $core.method({
  37120. selector: "selector",
  37121. protocol: 'accessing',
  37122. fn: function (){
  37123. var self=this;
  37124. return self["@selector"];
  37125. },
  37126. args: [],
  37127. source: "selector\x0a\x09^ selector",
  37128. referencedClasses: [],
  37129. messageSends: []
  37130. }),
  37131. $globals.IRSend);
  37132. $core.addMethod(
  37133. $core.method({
  37134. selector: "selector:",
  37135. protocol: 'accessing',
  37136. fn: function (aString){
  37137. var self=this;
  37138. self["@selector"]=aString;
  37139. return self;
  37140. },
  37141. args: ["aString"],
  37142. source: "selector: aString\x0a\x09selector := aString",
  37143. referencedClasses: [],
  37144. messageSends: []
  37145. }),
  37146. $globals.IRSend);
  37147. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  37148. $core.addMethod(
  37149. $core.method({
  37150. selector: "acceptDagVisitor:",
  37151. protocol: 'visiting',
  37152. fn: function (aVisitor){
  37153. var self=this;
  37154. return $core.withContext(function($ctx1) {
  37155. return $recv(aVisitor)._visitIRSequence_(self);
  37156. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  37157. },
  37158. args: ["aVisitor"],
  37159. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  37160. referencedClasses: [],
  37161. messageSends: ["visitIRSequence:"]
  37162. }),
  37163. $globals.IRSequence);
  37164. $core.addMethod(
  37165. $core.method({
  37166. selector: "isSequence",
  37167. protocol: 'testing',
  37168. fn: function (){
  37169. var self=this;
  37170. return true;
  37171. },
  37172. args: [],
  37173. source: "isSequence\x0a\x09^ true",
  37174. referencedClasses: [],
  37175. messageSends: []
  37176. }),
  37177. $globals.IRSequence);
  37178. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  37179. $core.addMethod(
  37180. $core.method({
  37181. selector: "acceptDagVisitor:",
  37182. protocol: 'visiting',
  37183. fn: function (aVisitor){
  37184. var self=this;
  37185. return $core.withContext(function($ctx1) {
  37186. return $recv(aVisitor)._visitIRBlockSequence_(self);
  37187. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  37188. },
  37189. args: ["aVisitor"],
  37190. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  37191. referencedClasses: [],
  37192. messageSends: ["visitIRBlockSequence:"]
  37193. }),
  37194. $globals.IRBlockSequence);
  37195. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  37196. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  37197. $core.addMethod(
  37198. $core.method({
  37199. selector: "acceptDagVisitor:",
  37200. protocol: 'visiting',
  37201. fn: function (aVisitor){
  37202. var self=this;
  37203. return $core.withContext(function($ctx1) {
  37204. return $recv(aVisitor)._visitIRValue_(self);
  37205. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  37206. },
  37207. args: ["aVisitor"],
  37208. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  37209. referencedClasses: [],
  37210. messageSends: ["visitIRValue:"]
  37211. }),
  37212. $globals.IRValue);
  37213. $core.addMethod(
  37214. $core.method({
  37215. selector: "needsBoxingAsReceiver",
  37216. protocol: 'testing',
  37217. fn: function (){
  37218. var self=this;
  37219. return false;
  37220. },
  37221. args: [],
  37222. source: "needsBoxingAsReceiver\x0a\x09^ false",
  37223. referencedClasses: [],
  37224. messageSends: []
  37225. }),
  37226. $globals.IRValue);
  37227. $core.addMethod(
  37228. $core.method({
  37229. selector: "value",
  37230. protocol: 'accessing',
  37231. fn: function (){
  37232. var self=this;
  37233. return self["@value"];
  37234. },
  37235. args: [],
  37236. source: "value\x0a\x09^ value",
  37237. referencedClasses: [],
  37238. messageSends: []
  37239. }),
  37240. $globals.IRValue);
  37241. $core.addMethod(
  37242. $core.method({
  37243. selector: "value:",
  37244. protocol: 'accessing',
  37245. fn: function (aString){
  37246. var self=this;
  37247. self["@value"]=aString;
  37248. return self;
  37249. },
  37250. args: ["aString"],
  37251. source: "value: aString\x0a\x09value := aString",
  37252. referencedClasses: [],
  37253. messageSends: []
  37254. }),
  37255. $globals.IRValue);
  37256. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  37257. $globals.IRVariable.comment="I am a variable instruction.";
  37258. $core.addMethod(
  37259. $core.method({
  37260. selector: "acceptDagVisitor:",
  37261. protocol: 'visiting',
  37262. fn: function (aVisitor){
  37263. var self=this;
  37264. return $core.withContext(function($ctx1) {
  37265. return $recv(aVisitor)._visitIRVariable_(self);
  37266. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  37267. },
  37268. args: ["aVisitor"],
  37269. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  37270. referencedClasses: [],
  37271. messageSends: ["visitIRVariable:"]
  37272. }),
  37273. $globals.IRVariable);
  37274. $core.addMethod(
  37275. $core.method({
  37276. selector: "isVariable",
  37277. protocol: 'testing',
  37278. fn: function (){
  37279. var self=this;
  37280. return true;
  37281. },
  37282. args: [],
  37283. source: "isVariable\x0a\x09^ true",
  37284. referencedClasses: [],
  37285. messageSends: []
  37286. }),
  37287. $globals.IRVariable);
  37288. $core.addMethod(
  37289. $core.method({
  37290. selector: "needsBoxingAsReceiver",
  37291. protocol: 'testing',
  37292. fn: function (){
  37293. var self=this;
  37294. return $core.withContext(function($ctx1) {
  37295. return $recv($recv(self._variable())._isPseudoVar())._not();
  37296. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  37297. },
  37298. args: [],
  37299. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  37300. referencedClasses: [],
  37301. messageSends: ["not", "isPseudoVar", "variable"]
  37302. }),
  37303. $globals.IRVariable);
  37304. $core.addMethod(
  37305. $core.method({
  37306. selector: "variable",
  37307. protocol: 'accessing',
  37308. fn: function (){
  37309. var self=this;
  37310. return self["@variable"];
  37311. },
  37312. args: [],
  37313. source: "variable\x0a\x09^ variable",
  37314. referencedClasses: [],
  37315. messageSends: []
  37316. }),
  37317. $globals.IRVariable);
  37318. $core.addMethod(
  37319. $core.method({
  37320. selector: "variable:",
  37321. protocol: 'accessing',
  37322. fn: function (aScopeVariable){
  37323. var self=this;
  37324. self["@variable"]=aScopeVariable;
  37325. return self;
  37326. },
  37327. args: ["aScopeVariable"],
  37328. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  37329. referencedClasses: [],
  37330. messageSends: []
  37331. }),
  37332. $globals.IRVariable);
  37333. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  37334. $core.addMethod(
  37335. $core.method({
  37336. selector: "acceptDagVisitor:",
  37337. protocol: 'visiting',
  37338. fn: function (aVisitor){
  37339. var self=this;
  37340. return $core.withContext(function($ctx1) {
  37341. return $recv(aVisitor)._visitIRVerbatim_(self);
  37342. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  37343. },
  37344. args: ["aVisitor"],
  37345. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  37346. referencedClasses: [],
  37347. messageSends: ["visitIRVerbatim:"]
  37348. }),
  37349. $globals.IRVerbatim);
  37350. $core.addMethod(
  37351. $core.method({
  37352. selector: "source",
  37353. protocol: 'accessing',
  37354. fn: function (){
  37355. var self=this;
  37356. return self["@source"];
  37357. },
  37358. args: [],
  37359. source: "source\x0a\x09^ source",
  37360. referencedClasses: [],
  37361. messageSends: []
  37362. }),
  37363. $globals.IRVerbatim);
  37364. $core.addMethod(
  37365. $core.method({
  37366. selector: "source:",
  37367. protocol: 'accessing',
  37368. fn: function (aString){
  37369. var self=this;
  37370. self["@source"]=aString;
  37371. return self;
  37372. },
  37373. args: ["aString"],
  37374. source: "source: aString\x0a\x09source := aString",
  37375. referencedClasses: [],
  37376. messageSends: []
  37377. }),
  37378. $globals.IRVerbatim);
  37379. $core.addClass('IRVisitor', $globals.ParentFakingPathDagVisitor, [], 'Compiler-IR');
  37380. $core.addMethod(
  37381. $core.method({
  37382. selector: "visitDagNode:",
  37383. protocol: 'visiting',
  37384. fn: function (aNode){
  37385. var self=this;
  37386. return $core.withContext(function($ctx1) {
  37387. return self._visitDagNodeVariantSimple_(aNode);
  37388. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  37389. },
  37390. args: ["aNode"],
  37391. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  37392. referencedClasses: [],
  37393. messageSends: ["visitDagNodeVariantSimple:"]
  37394. }),
  37395. $globals.IRVisitor);
  37396. $core.addMethod(
  37397. $core.method({
  37398. selector: "visitIRAssignment:",
  37399. protocol: 'visiting',
  37400. fn: function (anIRAssignment){
  37401. var self=this;
  37402. return $core.withContext(function($ctx1) {
  37403. return self._visitDagNode_(anIRAssignment);
  37404. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  37405. },
  37406. args: ["anIRAssignment"],
  37407. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  37408. referencedClasses: [],
  37409. messageSends: ["visitDagNode:"]
  37410. }),
  37411. $globals.IRVisitor);
  37412. $core.addMethod(
  37413. $core.method({
  37414. selector: "visitIRBlockReturn:",
  37415. protocol: 'visiting',
  37416. fn: function (anIRBlockReturn){
  37417. var self=this;
  37418. return $core.withContext(function($ctx1) {
  37419. return self._visitIRReturn_(anIRBlockReturn);
  37420. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  37421. },
  37422. args: ["anIRBlockReturn"],
  37423. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  37424. referencedClasses: [],
  37425. messageSends: ["visitIRReturn:"]
  37426. }),
  37427. $globals.IRVisitor);
  37428. $core.addMethod(
  37429. $core.method({
  37430. selector: "visitIRBlockSequence:",
  37431. protocol: 'visiting',
  37432. fn: function (anIRBlockSequence){
  37433. var self=this;
  37434. return $core.withContext(function($ctx1) {
  37435. return self._visitIRSequence_(anIRBlockSequence);
  37436. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  37437. },
  37438. args: ["anIRBlockSequence"],
  37439. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  37440. referencedClasses: [],
  37441. messageSends: ["visitIRSequence:"]
  37442. }),
  37443. $globals.IRVisitor);
  37444. $core.addMethod(
  37445. $core.method({
  37446. selector: "visitIRClosure:",
  37447. protocol: 'visiting',
  37448. fn: function (anIRClosure){
  37449. var self=this;
  37450. return $core.withContext(function($ctx1) {
  37451. return self._visitDagNode_(anIRClosure);
  37452. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  37453. },
  37454. args: ["anIRClosure"],
  37455. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  37456. referencedClasses: [],
  37457. messageSends: ["visitDagNode:"]
  37458. }),
  37459. $globals.IRVisitor);
  37460. $core.addMethod(
  37461. $core.method({
  37462. selector: "visitIRDynamicArray:",
  37463. protocol: 'visiting',
  37464. fn: function (anIRDynamicArray){
  37465. var self=this;
  37466. return $core.withContext(function($ctx1) {
  37467. return self._visitDagNode_(anIRDynamicArray);
  37468. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  37469. },
  37470. args: ["anIRDynamicArray"],
  37471. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  37472. referencedClasses: [],
  37473. messageSends: ["visitDagNode:"]
  37474. }),
  37475. $globals.IRVisitor);
  37476. $core.addMethod(
  37477. $core.method({
  37478. selector: "visitIRDynamicDictionary:",
  37479. protocol: 'visiting',
  37480. fn: function (anIRDynamicDictionary){
  37481. var self=this;
  37482. return $core.withContext(function($ctx1) {
  37483. return self._visitDagNode_(anIRDynamicDictionary);
  37484. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  37485. },
  37486. args: ["anIRDynamicDictionary"],
  37487. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  37488. referencedClasses: [],
  37489. messageSends: ["visitDagNode:"]
  37490. }),
  37491. $globals.IRVisitor);
  37492. $core.addMethod(
  37493. $core.method({
  37494. selector: "visitIRInlinedClosure:",
  37495. protocol: 'visiting',
  37496. fn: function (anIRInlinedClosure){
  37497. var self=this;
  37498. return $core.withContext(function($ctx1) {
  37499. return self._visitIRClosure_(anIRInlinedClosure);
  37500. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  37501. },
  37502. args: ["anIRInlinedClosure"],
  37503. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  37504. referencedClasses: [],
  37505. messageSends: ["visitIRClosure:"]
  37506. }),
  37507. $globals.IRVisitor);
  37508. $core.addMethod(
  37509. $core.method({
  37510. selector: "visitIRInlinedSequence:",
  37511. protocol: 'visiting',
  37512. fn: function (anIRInlinedSequence){
  37513. var self=this;
  37514. return $core.withContext(function($ctx1) {
  37515. return self._visitIRSequence_(anIRInlinedSequence);
  37516. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  37517. },
  37518. args: ["anIRInlinedSequence"],
  37519. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  37520. referencedClasses: [],
  37521. messageSends: ["visitIRSequence:"]
  37522. }),
  37523. $globals.IRVisitor);
  37524. $core.addMethod(
  37525. $core.method({
  37526. selector: "visitIRMethod:",
  37527. protocol: 'visiting',
  37528. fn: function (anIRMethod){
  37529. var self=this;
  37530. return $core.withContext(function($ctx1) {
  37531. return self._visitDagNode_(anIRMethod);
  37532. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  37533. },
  37534. args: ["anIRMethod"],
  37535. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  37536. referencedClasses: [],
  37537. messageSends: ["visitDagNode:"]
  37538. }),
  37539. $globals.IRVisitor);
  37540. $core.addMethod(
  37541. $core.method({
  37542. selector: "visitIRNonLocalReturn:",
  37543. protocol: 'visiting',
  37544. fn: function (anIRNonLocalReturn){
  37545. var self=this;
  37546. return $core.withContext(function($ctx1) {
  37547. return self._visitDagNode_(anIRNonLocalReturn);
  37548. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  37549. },
  37550. args: ["anIRNonLocalReturn"],
  37551. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  37552. referencedClasses: [],
  37553. messageSends: ["visitDagNode:"]
  37554. }),
  37555. $globals.IRVisitor);
  37556. $core.addMethod(
  37557. $core.method({
  37558. selector: "visitIRNonLocalReturnHandling:",
  37559. protocol: 'visiting',
  37560. fn: function (anIRNonLocalReturnHandling){
  37561. var self=this;
  37562. return $core.withContext(function($ctx1) {
  37563. return self._visitDagNode_(anIRNonLocalReturnHandling);
  37564. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  37565. },
  37566. args: ["anIRNonLocalReturnHandling"],
  37567. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  37568. referencedClasses: [],
  37569. messageSends: ["visitDagNode:"]
  37570. }),
  37571. $globals.IRVisitor);
  37572. $core.addMethod(
  37573. $core.method({
  37574. selector: "visitIRReturn:",
  37575. protocol: 'visiting',
  37576. fn: function (anIRReturn){
  37577. var self=this;
  37578. return $core.withContext(function($ctx1) {
  37579. return self._visitDagNode_(anIRReturn);
  37580. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  37581. },
  37582. args: ["anIRReturn"],
  37583. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  37584. referencedClasses: [],
  37585. messageSends: ["visitDagNode:"]
  37586. }),
  37587. $globals.IRVisitor);
  37588. $core.addMethod(
  37589. $core.method({
  37590. selector: "visitIRSend:",
  37591. protocol: 'visiting',
  37592. fn: function (anIRSend){
  37593. var self=this;
  37594. return $core.withContext(function($ctx1) {
  37595. return self._visitDagNode_(anIRSend);
  37596. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  37597. },
  37598. args: ["anIRSend"],
  37599. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  37600. referencedClasses: [],
  37601. messageSends: ["visitDagNode:"]
  37602. }),
  37603. $globals.IRVisitor);
  37604. $core.addMethod(
  37605. $core.method({
  37606. selector: "visitIRSequence:",
  37607. protocol: 'visiting',
  37608. fn: function (anIRSequence){
  37609. var self=this;
  37610. return $core.withContext(function($ctx1) {
  37611. return self._visitDagNode_(anIRSequence);
  37612. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  37613. },
  37614. args: ["anIRSequence"],
  37615. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  37616. referencedClasses: [],
  37617. messageSends: ["visitDagNode:"]
  37618. }),
  37619. $globals.IRVisitor);
  37620. $core.addMethod(
  37621. $core.method({
  37622. selector: "visitIRTempDeclaration:",
  37623. protocol: 'visiting',
  37624. fn: function (anIRTempDeclaration){
  37625. var self=this;
  37626. return $core.withContext(function($ctx1) {
  37627. return self._visitDagNode_(anIRTempDeclaration);
  37628. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  37629. },
  37630. args: ["anIRTempDeclaration"],
  37631. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  37632. referencedClasses: [],
  37633. messageSends: ["visitDagNode:"]
  37634. }),
  37635. $globals.IRVisitor);
  37636. $core.addMethod(
  37637. $core.method({
  37638. selector: "visitIRValue:",
  37639. protocol: 'visiting',
  37640. fn: function (anIRValue){
  37641. var self=this;
  37642. return $core.withContext(function($ctx1) {
  37643. return self._visitDagNode_(anIRValue);
  37644. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  37645. },
  37646. args: ["anIRValue"],
  37647. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  37648. referencedClasses: [],
  37649. messageSends: ["visitDagNode:"]
  37650. }),
  37651. $globals.IRVisitor);
  37652. $core.addMethod(
  37653. $core.method({
  37654. selector: "visitIRVariable:",
  37655. protocol: 'visiting',
  37656. fn: function (anIRVariable){
  37657. var self=this;
  37658. return $core.withContext(function($ctx1) {
  37659. return self._visitDagNode_(anIRVariable);
  37660. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  37661. },
  37662. args: ["anIRVariable"],
  37663. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  37664. referencedClasses: [],
  37665. messageSends: ["visitDagNode:"]
  37666. }),
  37667. $globals.IRVisitor);
  37668. $core.addMethod(
  37669. $core.method({
  37670. selector: "visitIRVerbatim:",
  37671. protocol: 'visiting',
  37672. fn: function (anIRVerbatim){
  37673. var self=this;
  37674. return $core.withContext(function($ctx1) {
  37675. return self._visitDagNode_(anIRVerbatim);
  37676. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  37677. },
  37678. args: ["anIRVerbatim"],
  37679. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  37680. referencedClasses: [],
  37681. messageSends: ["visitDagNode:"]
  37682. }),
  37683. $globals.IRVisitor);
  37684. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  37685. $core.addMethod(
  37686. $core.method({
  37687. selector: "contents",
  37688. protocol: 'accessing',
  37689. fn: function (){
  37690. var self=this;
  37691. return $core.withContext(function($ctx1) {
  37692. return $recv(self._stream())._contents();
  37693. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  37694. },
  37695. args: [],
  37696. source: "contents\x0a\x09^ self stream contents",
  37697. referencedClasses: [],
  37698. messageSends: ["contents", "stream"]
  37699. }),
  37700. $globals.IRJSTranslator);
  37701. $core.addMethod(
  37702. $core.method({
  37703. selector: "currentClass",
  37704. protocol: 'accessing',
  37705. fn: function (){
  37706. var self=this;
  37707. return self["@currentClass"];
  37708. },
  37709. args: [],
  37710. source: "currentClass\x0a\x09^ currentClass",
  37711. referencedClasses: [],
  37712. messageSends: []
  37713. }),
  37714. $globals.IRJSTranslator);
  37715. $core.addMethod(
  37716. $core.method({
  37717. selector: "currentClass:",
  37718. protocol: 'accessing',
  37719. fn: function (aClass){
  37720. var self=this;
  37721. self["@currentClass"]=aClass;
  37722. return self;
  37723. },
  37724. args: ["aClass"],
  37725. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  37726. referencedClasses: [],
  37727. messageSends: []
  37728. }),
  37729. $globals.IRJSTranslator);
  37730. $core.addMethod(
  37731. $core.method({
  37732. selector: "initialize",
  37733. protocol: 'initialization',
  37734. fn: function (){
  37735. var self=this;
  37736. return $core.withContext(function($ctx1) {
  37737. (
  37738. $ctx1.supercall = true,
  37739. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  37740. $ctx1.supercall = false;
  37741. self["@stream"]=$recv($globals.JSStream)._new();
  37742. return self;
  37743. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  37744. },
  37745. args: [],
  37746. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  37747. referencedClasses: ["JSStream"],
  37748. messageSends: ["initialize", "new"]
  37749. }),
  37750. $globals.IRJSTranslator);
  37751. $core.addMethod(
  37752. $core.method({
  37753. selector: "stream",
  37754. protocol: 'accessing',
  37755. fn: function (){
  37756. var self=this;
  37757. return self["@stream"];
  37758. },
  37759. args: [],
  37760. source: "stream\x0a\x09^ stream",
  37761. referencedClasses: [],
  37762. messageSends: []
  37763. }),
  37764. $globals.IRJSTranslator);
  37765. $core.addMethod(
  37766. $core.method({
  37767. selector: "stream:",
  37768. protocol: 'accessing',
  37769. fn: function (aStream){
  37770. var self=this;
  37771. self["@stream"]=aStream;
  37772. return self;
  37773. },
  37774. args: ["aStream"],
  37775. source: "stream: aStream\x0a\x09stream := aStream",
  37776. referencedClasses: [],
  37777. messageSends: []
  37778. }),
  37779. $globals.IRJSTranslator);
  37780. $core.addMethod(
  37781. $core.method({
  37782. selector: "visitIRAssignment:",
  37783. protocol: 'visiting',
  37784. fn: function (anIRAssignment){
  37785. var self=this;
  37786. return $core.withContext(function($ctx1) {
  37787. $recv(self._stream())._nextPutAssignLhs_rhs_((function(){
  37788. return $core.withContext(function($ctx2) {
  37789. return self._visit_($recv(anIRAssignment)._left());
  37790. $ctx2.sendIdx["visit:"]=1;
  37791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37792. }),(function(){
  37793. return $core.withContext(function($ctx2) {
  37794. return self._visit_($recv(anIRAssignment)._right());
  37795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  37796. }));
  37797. return self;
  37798. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  37799. },
  37800. args: ["anIRAssignment"],
  37801. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  37802. referencedClasses: [],
  37803. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  37804. }),
  37805. $globals.IRJSTranslator);
  37806. $core.addMethod(
  37807. $core.method({
  37808. selector: "visitIRClosure:",
  37809. protocol: 'visiting',
  37810. fn: function (anIRClosure){
  37811. var self=this;
  37812. return $core.withContext(function($ctx1) {
  37813. var $1,$2;
  37814. $1=self._stream();
  37815. $ctx1.sendIdx["stream"]=1;
  37816. $recv($1)._nextPutClosureWith_arguments_((function(){
  37817. return $core.withContext(function($ctx2) {
  37818. $2=self._stream();
  37819. $ctx2.sendIdx["stream"]=2;
  37820. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  37821. return $core.withContext(function($ctx3) {
  37822. return $recv($recv(each)._name())._asVariableName();
  37823. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  37824. })));
  37825. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  37826. return $core.withContext(function($ctx3) {
  37827. return (
  37828. $ctx3.supercall = true,
  37829. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  37830. $ctx3.supercall = false;
  37831. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  37832. }));
  37833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37834. }),$recv(anIRClosure)._arguments());
  37835. return self;
  37836. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  37837. },
  37838. args: ["anIRClosure"],
  37839. 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",
  37840. referencedClasses: [],
  37841. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  37842. }),
  37843. $globals.IRJSTranslator);
  37844. $core.addMethod(
  37845. $core.method({
  37846. selector: "visitIRDynamicArray:",
  37847. protocol: 'visiting',
  37848. fn: function (anIRDynamicArray){
  37849. var self=this;
  37850. return $core.withContext(function($ctx1) {
  37851. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  37852. return self;
  37853. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  37854. },
  37855. args: ["anIRDynamicArray"],
  37856. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  37857. referencedClasses: [],
  37858. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  37859. }),
  37860. $globals.IRJSTranslator);
  37861. $core.addMethod(
  37862. $core.method({
  37863. selector: "visitIRDynamicDictionary:",
  37864. protocol: 'visiting',
  37865. fn: function (anIRDynamicDictionary){
  37866. var self=this;
  37867. return $core.withContext(function($ctx1) {
  37868. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  37869. return self;
  37870. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  37871. },
  37872. args: ["anIRDynamicDictionary"],
  37873. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  37874. referencedClasses: [],
  37875. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  37876. }),
  37877. $globals.IRJSTranslator);
  37878. $core.addMethod(
  37879. $core.method({
  37880. selector: "visitIRMethod:",
  37881. protocol: 'visiting',
  37882. fn: function (anIRMethod){
  37883. var self=this;
  37884. return $core.withContext(function($ctx1) {
  37885. var $1,$2,$3,$4,$5,$6,$7;
  37886. $1=self._stream();
  37887. $ctx1.sendIdx["stream"]=1;
  37888. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  37889. return $core.withContext(function($ctx2) {
  37890. $2=self._stream();
  37891. $ctx2.sendIdx["stream"]=2;
  37892. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  37893. return $core.withContext(function($ctx3) {
  37894. $3=self._stream();
  37895. $ctx3.sendIdx["stream"]=3;
  37896. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  37897. return $core.withContext(function($ctx4) {
  37898. return $recv($recv(each)._name())._asVariableName();
  37899. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  37900. }));
  37901. $ctx3.sendIdx["collect:"]=1;
  37902. $recv($3)._nextPutVars_($4);
  37903. $ctx3.sendIdx["nextPutVars:"]=1;
  37904. $5=self._stream();
  37905. $ctx3.sendIdx["stream"]=4;
  37906. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  37907. return $core.withContext(function($ctx4) {
  37908. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  37909. return $core.withContext(function($ctx5) {
  37910. $6=self._stream();
  37911. $ctx5.sendIdx["stream"]=5;
  37912. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  37913. return $core.withContext(function($ctx6) {
  37914. return $recv($recv(each)._variable())._alias();
  37915. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  37916. })));
  37917. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  37918. }));
  37919. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  37920. if($core.assert($7)){
  37921. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  37922. return $core.withContext(function($ctx5) {
  37923. return (
  37924. $ctx5.supercall = true,
  37925. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  37926. $ctx5.supercall = false;
  37927. $ctx5.sendIdx["visitIRMethod:"]=1;
  37928. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  37929. }));
  37930. } else {
  37931. return (
  37932. $ctx4.supercall = true,
  37933. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  37934. $ctx4.supercall = false;
  37935. }
  37936. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  37937. }));
  37938. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  37939. }),$recv(anIRMethod)._arguments());
  37940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37941. }));
  37942. return self._contents();
  37943. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  37944. },
  37945. args: ["anIRMethod"],
  37946. 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",
  37947. referencedClasses: [],
  37948. 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"]
  37949. }),
  37950. $globals.IRJSTranslator);
  37951. $core.addMethod(
  37952. $core.method({
  37953. selector: "visitIRNonLocalReturn:",
  37954. protocol: 'visiting',
  37955. fn: function (anIRNonLocalReturn){
  37956. var self=this;
  37957. return $core.withContext(function($ctx1) {
  37958. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  37959. return $core.withContext(function($ctx2) {
  37960. return (
  37961. $ctx2.supercall = true,
  37962. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  37963. $ctx2.supercall = false;
  37964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37965. }));
  37966. return self;
  37967. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  37968. },
  37969. args: ["anIRNonLocalReturn"],
  37970. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  37971. referencedClasses: [],
  37972. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  37973. }),
  37974. $globals.IRJSTranslator);
  37975. $core.addMethod(
  37976. $core.method({
  37977. selector: "visitIRReturn:",
  37978. protocol: 'visiting',
  37979. fn: function (anIRReturn){
  37980. var self=this;
  37981. return $core.withContext(function($ctx1) {
  37982. $recv(self._stream())._nextPutReturnWith_((function(){
  37983. return $core.withContext(function($ctx2) {
  37984. return (
  37985. $ctx2.supercall = true,
  37986. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  37987. $ctx2.supercall = false;
  37988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37989. }));
  37990. return self;
  37991. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  37992. },
  37993. args: ["anIRReturn"],
  37994. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  37995. referencedClasses: [],
  37996. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  37997. }),
  37998. $globals.IRJSTranslator);
  37999. $core.addMethod(
  38000. $core.method({
  38001. selector: "visitIRSend:",
  38002. protocol: 'visiting',
  38003. fn: function (anIRSend){
  38004. var self=this;
  38005. var sends,superclass;
  38006. return $core.withContext(function($ctx1) {
  38007. var $1,$2;
  38008. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  38009. $1=$recv(anIRSend)._isSuperSend();
  38010. if($core.assert($1)){
  38011. self._visitSuperSend_(anIRSend);
  38012. } else {
  38013. self._visitSend_(anIRSend);
  38014. }
  38015. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  38016. if($core.assert($2)){
  38017. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  38018. }
  38019. return self;
  38020. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  38021. },
  38022. args: ["anIRSend"],
  38023. 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 ]",
  38024. referencedClasses: [],
  38025. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuperSend", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  38026. }),
  38027. $globals.IRJSTranslator);
  38028. $core.addMethod(
  38029. $core.method({
  38030. selector: "visitIRSequence:",
  38031. protocol: 'visiting',
  38032. fn: function (anIRSequence){
  38033. var self=this;
  38034. return $core.withContext(function($ctx1) {
  38035. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  38036. return $core.withContext(function($ctx2) {
  38037. return $recv(self._stream())._nextPutStatementWith_((function(){
  38038. return $core.withContext(function($ctx3) {
  38039. return self._visit_(each);
  38040. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38041. }));
  38042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38043. }));
  38044. return self;
  38045. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  38046. },
  38047. args: ["anIRSequence"],
  38048. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  38049. referencedClasses: [],
  38050. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  38051. }),
  38052. $globals.IRJSTranslator);
  38053. $core.addMethod(
  38054. $core.method({
  38055. selector: "visitIRTempDeclaration:",
  38056. protocol: 'visiting',
  38057. fn: function (anIRTempDeclaration){
  38058. var self=this;
  38059. return self;
  38060. },
  38061. args: ["anIRTempDeclaration"],
  38062. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  38063. referencedClasses: [],
  38064. messageSends: []
  38065. }),
  38066. $globals.IRJSTranslator);
  38067. $core.addMethod(
  38068. $core.method({
  38069. selector: "visitIRValue:",
  38070. protocol: 'visiting',
  38071. fn: function (anIRValue){
  38072. var self=this;
  38073. return $core.withContext(function($ctx1) {
  38074. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  38075. return self;
  38076. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  38077. },
  38078. args: ["anIRValue"],
  38079. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  38080. referencedClasses: [],
  38081. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  38082. }),
  38083. $globals.IRJSTranslator);
  38084. $core.addMethod(
  38085. $core.method({
  38086. selector: "visitIRVariable:",
  38087. protocol: 'visiting',
  38088. fn: function (anIRVariable){
  38089. var self=this;
  38090. return $core.withContext(function($ctx1) {
  38091. var $3,$2,$1,$4;
  38092. $3=$recv(anIRVariable)._variable();
  38093. $ctx1.sendIdx["variable"]=1;
  38094. $2=$recv($3)._name();
  38095. $1=$recv($2).__eq("thisContext");
  38096. if($core.assert($1)){
  38097. $4=self._stream();
  38098. $ctx1.sendIdx["stream"]=1;
  38099. $recv($4)._nextPutAll_("$core.getThisContext()");
  38100. $ctx1.sendIdx["nextPutAll:"]=1;
  38101. } else {
  38102. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  38103. }
  38104. return self;
  38105. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  38106. },
  38107. args: ["anIRVariable"],
  38108. 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 ]",
  38109. referencedClasses: [],
  38110. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  38111. }),
  38112. $globals.IRJSTranslator);
  38113. $core.addMethod(
  38114. $core.method({
  38115. selector: "visitIRVerbatim:",
  38116. protocol: 'visiting',
  38117. fn: function (anIRVerbatim){
  38118. var self=this;
  38119. return $core.withContext(function($ctx1) {
  38120. var $1;
  38121. $1=self._stream();
  38122. $ctx1.sendIdx["stream"]=1;
  38123. $recv($1)._nextPutStatementWith_((function(){
  38124. return $core.withContext(function($ctx2) {
  38125. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  38126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38127. }));
  38128. return self;
  38129. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  38130. },
  38131. args: ["anIRVerbatim"],
  38132. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  38133. referencedClasses: [],
  38134. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  38135. }),
  38136. $globals.IRJSTranslator);
  38137. $core.addMethod(
  38138. $core.method({
  38139. selector: "visitInstructionList:enclosedBetween:and:",
  38140. protocol: 'visiting',
  38141. fn: function (anArray,aString,anotherString){
  38142. var self=this;
  38143. return $core.withContext(function($ctx1) {
  38144. var $1;
  38145. $1=self._stream();
  38146. $ctx1.sendIdx["stream"]=1;
  38147. $recv($1)._nextPutAll_(aString);
  38148. $ctx1.sendIdx["nextPutAll:"]=1;
  38149. $recv(anArray)._do_separatedBy_((function(each){
  38150. return $core.withContext(function($ctx2) {
  38151. return self._visit_(each);
  38152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38153. }),(function(){
  38154. return $core.withContext(function($ctx2) {
  38155. return $recv(self._stream())._nextPutAll_(",");
  38156. $ctx2.sendIdx["nextPutAll:"]=2;
  38157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38158. }));
  38159. $recv(self["@stream"])._nextPutAll_(anotherString);
  38160. return self;
  38161. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  38162. },
  38163. args: ["anArray", "aString", "anotherString"],
  38164. 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",
  38165. referencedClasses: [],
  38166. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  38167. }),
  38168. $globals.IRJSTranslator);
  38169. $core.addMethod(
  38170. $core.method({
  38171. selector: "visitReceiver:",
  38172. protocol: 'visiting',
  38173. fn: function (anIRInstruction){
  38174. var self=this;
  38175. return $core.withContext(function($ctx1) {
  38176. var $1,$2,$3;
  38177. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  38178. if(!$core.assert($1)){
  38179. $2=self._visit_(anIRInstruction);
  38180. $ctx1.sendIdx["visit:"]=1;
  38181. return $2;
  38182. }
  38183. $3=self._stream();
  38184. $ctx1.sendIdx["stream"]=1;
  38185. $recv($3)._nextPutAll_("$recv(");
  38186. $ctx1.sendIdx["nextPutAll:"]=1;
  38187. self._visit_(anIRInstruction);
  38188. $recv(self._stream())._nextPutAll_(")");
  38189. return self;
  38190. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  38191. },
  38192. args: ["anIRInstruction"],
  38193. 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: ')'",
  38194. referencedClasses: [],
  38195. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  38196. }),
  38197. $globals.IRJSTranslator);
  38198. $core.addMethod(
  38199. $core.method({
  38200. selector: "visitSend:",
  38201. protocol: 'visiting',
  38202. fn: function (anIRSend){
  38203. var self=this;
  38204. return $core.withContext(function($ctx1) {
  38205. self._visitReceiver_($recv(anIRSend)._receiver());
  38206. $recv(self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  38207. self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  38208. return self;
  38209. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38210. },
  38211. args: ["anIRSend"],
  38212. 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: ')'",
  38213. referencedClasses: [],
  38214. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  38215. }),
  38216. $globals.IRJSTranslator);
  38217. $core.addMethod(
  38218. $core.method({
  38219. selector: "visitSuperSend:",
  38220. protocol: 'visiting',
  38221. fn: function (anIRSend){
  38222. var self=this;
  38223. return $core.withContext(function($ctx1) {
  38224. var $1,$4,$3,$2,$5,$6,$7,$8;
  38225. $1=self._stream();
  38226. $ctx1.sendIdx["stream"]=1;
  38227. $recv($1)._nextPutAll_("(");
  38228. $ctx1.sendIdx["nextPutAll:"]=1;
  38229. $recv($1)._lf();
  38230. $ctx1.sendIdx["lf"]=1;
  38231. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38232. $ctx1.sendIdx["nextPutAll:"]=2;
  38233. $recv($1)._lf();
  38234. $ctx1.sendIdx["lf"]=2;
  38235. $4=$recv(anIRSend)._scope();
  38236. $ctx1.sendIdx["scope"]=1;
  38237. $3=$recv($4)._alias();
  38238. $ctx1.sendIdx["alias"]=1;
  38239. $2=$recv($3).__comma(".supercall = true,");
  38240. $ctx1.sendIdx[","]=1;
  38241. $recv($1)._nextPutAll_($2);
  38242. $ctx1.sendIdx["nextPutAll:"]=3;
  38243. $recv($1)._lf();
  38244. $ctx1.sendIdx["lf"]=3;
  38245. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38246. $ctx1.sendIdx["nextPutAll:"]=4;
  38247. $recv($1)._lf();
  38248. $ctx1.sendIdx["lf"]=4;
  38249. $5="(".__comma($recv(self._currentClass())._asJavascript());
  38250. $ctx1.sendIdx[","]=2;
  38251. $recv($1)._nextPutAll_($5);
  38252. $ctx1.sendIdx["nextPutAll:"]=5;
  38253. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  38254. $ctx1.sendIdx["nextPutAll:"]=6;
  38255. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  38256. $ctx1.sendIdx[","]=3;
  38257. $recv($1)._nextPutAll_($6);
  38258. $ctx1.sendIdx["nextPutAll:"]=7;
  38259. $7=$recv($1)._nextPutAll_("$recv(self), ");
  38260. $ctx1.sendIdx["nextPutAll:"]=8;
  38261. self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  38262. $8=self._stream();
  38263. $recv($8)._nextPutAll_("));");
  38264. $ctx1.sendIdx["nextPutAll:"]=9;
  38265. $recv($8)._lf();
  38266. $ctx1.sendIdx["lf"]=5;
  38267. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38268. $ctx1.sendIdx["nextPutAll:"]=10;
  38269. $recv($8)._lf();
  38270. $ctx1.sendIdx["lf"]=6;
  38271. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  38272. $ctx1.sendIdx["nextPutAll:"]=11;
  38273. $recv($8)._lf();
  38274. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38275. return self;
  38276. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38277. },
  38278. args: ["anIRSend"],
  38279. 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 asJavascript;\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);'",
  38280. referencedClasses: [],
  38281. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  38282. }),
  38283. $globals.IRJSTranslator);
  38284. $core.addClass('JSStream', $globals.Object, ['stream', 'omitSemicolon'], 'Compiler-IR');
  38285. $core.addMethod(
  38286. $core.method({
  38287. selector: "contents",
  38288. protocol: 'accessing',
  38289. fn: function (){
  38290. var self=this;
  38291. return $core.withContext(function($ctx1) {
  38292. return $recv(self["@stream"])._contents();
  38293. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  38294. },
  38295. args: [],
  38296. source: "contents\x0a\x09^ stream contents",
  38297. referencedClasses: [],
  38298. messageSends: ["contents"]
  38299. }),
  38300. $globals.JSStream);
  38301. $core.addMethod(
  38302. $core.method({
  38303. selector: "initialize",
  38304. protocol: 'initialization',
  38305. fn: function (){
  38306. var self=this;
  38307. return $core.withContext(function($ctx1) {
  38308. (
  38309. $ctx1.supercall = true,
  38310. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  38311. $ctx1.supercall = false;
  38312. self["@stream"]=""._writeStream();
  38313. return self;
  38314. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  38315. },
  38316. args: [],
  38317. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  38318. referencedClasses: [],
  38319. messageSends: ["initialize", "writeStream"]
  38320. }),
  38321. $globals.JSStream);
  38322. $core.addMethod(
  38323. $core.method({
  38324. selector: "lf",
  38325. protocol: 'streaming',
  38326. fn: function (){
  38327. var self=this;
  38328. return $core.withContext(function($ctx1) {
  38329. $recv(self["@stream"])._lf();
  38330. return self;
  38331. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  38332. },
  38333. args: [],
  38334. source: "lf\x0a\x09stream lf",
  38335. referencedClasses: [],
  38336. messageSends: ["lf"]
  38337. }),
  38338. $globals.JSStream);
  38339. $core.addMethod(
  38340. $core.method({
  38341. selector: "nextPut:",
  38342. protocol: 'streaming',
  38343. fn: function (aString){
  38344. var self=this;
  38345. return $core.withContext(function($ctx1) {
  38346. $recv(self["@stream"])._nextPut_(aString);
  38347. return self;
  38348. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  38349. },
  38350. args: ["aString"],
  38351. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  38352. referencedClasses: [],
  38353. messageSends: ["nextPut:"]
  38354. }),
  38355. $globals.JSStream);
  38356. $core.addMethod(
  38357. $core.method({
  38358. selector: "nextPutAll:",
  38359. protocol: 'streaming',
  38360. fn: function (aString){
  38361. var self=this;
  38362. return $core.withContext(function($ctx1) {
  38363. $recv(self["@stream"])._nextPutAll_(aString);
  38364. return self;
  38365. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  38366. },
  38367. args: ["aString"],
  38368. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  38369. referencedClasses: [],
  38370. messageSends: ["nextPutAll:"]
  38371. }),
  38372. $globals.JSStream);
  38373. $core.addMethod(
  38374. $core.method({
  38375. selector: "nextPutAssignLhs:rhs:",
  38376. protocol: 'streaming',
  38377. fn: function (aBlock,anotherBlock){
  38378. var self=this;
  38379. return $core.withContext(function($ctx1) {
  38380. $recv(aBlock)._value();
  38381. $ctx1.sendIdx["value"]=1;
  38382. $recv(self["@stream"])._nextPutAll_("=");
  38383. $recv(anotherBlock)._value();
  38384. return self;
  38385. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38386. },
  38387. args: ["aBlock", "anotherBlock"],
  38388. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  38389. referencedClasses: [],
  38390. messageSends: ["value", "nextPutAll:"]
  38391. }),
  38392. $globals.JSStream);
  38393. $core.addMethod(
  38394. $core.method({
  38395. selector: "nextPutBlockContextFor:during:",
  38396. protocol: 'streaming',
  38397. fn: function (anIRClosure,aBlock){
  38398. var self=this;
  38399. return $core.withContext(function($ctx1) {
  38400. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  38401. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  38402. if(!$core.assert($1)){
  38403. $2=$recv(aBlock)._value();
  38404. $ctx1.sendIdx["value"]=1;
  38405. return $2;
  38406. }
  38407. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38408. $ctx1.sendIdx["nextPutAll:"]=1;
  38409. self._lf();
  38410. $ctx1.sendIdx["lf"]=1;
  38411. $6=$recv(anIRClosure)._scope();
  38412. $ctx1.sendIdx["scope"]=1;
  38413. $5=$recv($6)._alias();
  38414. $ctx1.sendIdx["alias"]=1;
  38415. $4="return $core.withContext(function(".__comma($5);
  38416. $ctx1.sendIdx[","]=2;
  38417. $3=$recv($4).__comma(") {");
  38418. $ctx1.sendIdx[","]=1;
  38419. self._nextPutAll_($3);
  38420. $ctx1.sendIdx["nextPutAll:"]=2;
  38421. self._lf();
  38422. $ctx1.sendIdx["lf"]=2;
  38423. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38424. $ctx1.sendIdx["nextPutAll:"]=3;
  38425. $7=self._lf();
  38426. $ctx1.sendIdx["lf"]=3;
  38427. $recv(aBlock)._value();
  38428. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38429. $ctx1.sendIdx["nextPutAll:"]=4;
  38430. self._lf();
  38431. $ctx1.sendIdx["lf"]=4;
  38432. $11=$recv(anIRClosure)._scope();
  38433. $ctx1.sendIdx["scope"]=2;
  38434. $10=$recv($11)._alias();
  38435. $ctx1.sendIdx["alias"]=2;
  38436. $9="}, function(".__comma($10);
  38437. $ctx1.sendIdx[","]=4;
  38438. $8=$recv($9).__comma(") {");
  38439. $ctx1.sendIdx[","]=3;
  38440. self._nextPutAll_($8);
  38441. $ctx1.sendIdx["nextPutAll:"]=5;
  38442. $15=$recv(anIRClosure)._scope();
  38443. $ctx1.sendIdx["scope"]=3;
  38444. $14=$recv($15)._alias();
  38445. $ctx1.sendIdx["alias"]=3;
  38446. $13=$recv($14).__comma(".fillBlock({");
  38447. $ctx1.sendIdx[","]=5;
  38448. $12=self._nextPutAll_($13);
  38449. $ctx1.sendIdx["nextPutAll:"]=6;
  38450. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  38451. return $core.withContext(function($ctx2) {
  38452. $16=$recv(each)._asVariableName();
  38453. $ctx2.sendIdx["asVariableName"]=1;
  38454. self._nextPutAll_($16);
  38455. $ctx2.sendIdx["nextPutAll:"]=7;
  38456. self._nextPutAll_(":");
  38457. $ctx2.sendIdx["nextPutAll:"]=8;
  38458. $17=self._nextPutAll_($recv(each)._asVariableName());
  38459. $ctx2.sendIdx["nextPutAll:"]=9;
  38460. return $17;
  38461. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38462. }),(function(){
  38463. return $core.withContext(function($ctx2) {
  38464. return self._nextPutAll_(",");
  38465. $ctx2.sendIdx["nextPutAll:"]=10;
  38466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38467. }));
  38468. self._nextPutAll_("},");
  38469. $ctx1.sendIdx["nextPutAll:"]=11;
  38470. $23=$recv(anIRClosure)._scope();
  38471. $ctx1.sendIdx["scope"]=4;
  38472. $22=$recv($23)._outerScope();
  38473. $21=$recv($22)._alias();
  38474. $20=$recv($21).__comma(",");
  38475. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  38476. $ctx1.sendIdx[","]=7;
  38477. $18=$recv($19).__comma(")});");
  38478. $ctx1.sendIdx[","]=6;
  38479. self._nextPutAll_($18);
  38480. $ctx1.sendIdx["nextPutAll:"]=12;
  38481. self._lf();
  38482. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38483. return self;
  38484. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  38485. },
  38486. args: ["anIRClosure", "aBlock"],
  38487. 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);'",
  38488. referencedClasses: [],
  38489. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  38490. }),
  38491. $globals.JSStream);
  38492. $core.addMethod(
  38493. $core.method({
  38494. selector: "nextPutClosureWith:arguments:",
  38495. protocol: 'streaming',
  38496. fn: function (aBlock,anArray){
  38497. var self=this;
  38498. return $core.withContext(function($ctx1) {
  38499. var $1,$2,$3;
  38500. $recv(self["@stream"])._nextPutAll_("(function(");
  38501. $ctx1.sendIdx["nextPutAll:"]=1;
  38502. $recv(anArray)._do_separatedBy_((function(each){
  38503. return $core.withContext(function($ctx2) {
  38504. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38505. $ctx2.sendIdx["nextPutAll:"]=2;
  38506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38507. }),(function(){
  38508. return $core.withContext(function($ctx2) {
  38509. return $recv(self["@stream"])._nextPut_(",");
  38510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38511. }));
  38512. $1=self["@stream"];
  38513. $recv($1)._nextPutAll_("){");
  38514. $ctx1.sendIdx["nextPutAll:"]=3;
  38515. $2=$recv($1)._lf();
  38516. $ctx1.sendIdx["lf"]=1;
  38517. $recv(aBlock)._value();
  38518. $3=self["@stream"];
  38519. $recv($3)._lf();
  38520. $recv($3)._nextPutAll_("})");
  38521. return self;
  38522. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38523. },
  38524. args: ["aBlock", "anArray"],
  38525. 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: '})'",
  38526. referencedClasses: [],
  38527. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38528. }),
  38529. $globals.JSStream);
  38530. $core.addMethod(
  38531. $core.method({
  38532. selector: "nextPutContextFor:during:",
  38533. protocol: 'streaming',
  38534. fn: function (aMethod,aBlock){
  38535. var self=this;
  38536. return $core.withContext(function($ctx1) {
  38537. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  38538. $1=$recv(aMethod)._requiresSmalltalkContext();
  38539. if(!$core.assert($1)){
  38540. $2=$recv(aBlock)._value();
  38541. $ctx1.sendIdx["value"]=1;
  38542. return $2;
  38543. }
  38544. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38545. $ctx1.sendIdx["nextPutAll:"]=1;
  38546. self._lf();
  38547. $ctx1.sendIdx["lf"]=1;
  38548. $6=$recv(aMethod)._scope();
  38549. $ctx1.sendIdx["scope"]=1;
  38550. $5=$recv($6)._alias();
  38551. $ctx1.sendIdx["alias"]=1;
  38552. $4="return $core.withContext(function(".__comma($5);
  38553. $ctx1.sendIdx[","]=2;
  38554. $3=$recv($4).__comma(") {");
  38555. $ctx1.sendIdx[","]=1;
  38556. self._nextPutAll_($3);
  38557. $ctx1.sendIdx["nextPutAll:"]=2;
  38558. self._lf();
  38559. $ctx1.sendIdx["lf"]=2;
  38560. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38561. $ctx1.sendIdx["nextPutAll:"]=3;
  38562. $7=self._lf();
  38563. $ctx1.sendIdx["lf"]=3;
  38564. $recv(aBlock)._value();
  38565. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38566. $ctx1.sendIdx["nextPutAll:"]=4;
  38567. self._lf();
  38568. $ctx1.sendIdx["lf"]=4;
  38569. $12=$recv(aMethod)._scope();
  38570. $ctx1.sendIdx["scope"]=2;
  38571. $11=$recv($12)._alias();
  38572. $ctx1.sendIdx["alias"]=2;
  38573. $10="}, function(".__comma($11);
  38574. $ctx1.sendIdx[","]=5;
  38575. $9=$recv($10).__comma(") {");
  38576. $ctx1.sendIdx[","]=4;
  38577. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  38578. $ctx1.sendIdx[","]=3;
  38579. self._nextPutAll_($8);
  38580. $ctx1.sendIdx["nextPutAll:"]=5;
  38581. $16=$recv($recv(aMethod)._selector())._asJavascript();
  38582. $ctx1.sendIdx["asJavascript"]=1;
  38583. $15=".fill(self,".__comma($16);
  38584. $14=$recv($15).__comma(",{");
  38585. $ctx1.sendIdx[","]=6;
  38586. $13=self._nextPutAll_($14);
  38587. $ctx1.sendIdx["nextPutAll:"]=6;
  38588. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  38589. return $core.withContext(function($ctx2) {
  38590. $17=$recv(each)._asVariableName();
  38591. $ctx2.sendIdx["asVariableName"]=1;
  38592. self._nextPutAll_($17);
  38593. $ctx2.sendIdx["nextPutAll:"]=7;
  38594. self._nextPutAll_(":");
  38595. $ctx2.sendIdx["nextPutAll:"]=8;
  38596. $18=self._nextPutAll_($recv(each)._asVariableName());
  38597. $ctx2.sendIdx["nextPutAll:"]=9;
  38598. return $18;
  38599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38600. }),(function(){
  38601. return $core.withContext(function($ctx2) {
  38602. return self._nextPutAll_(",");
  38603. $ctx2.sendIdx["nextPutAll:"]=10;
  38604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38605. }));
  38606. self._nextPutAll_("},");
  38607. $ctx1.sendIdx["nextPutAll:"]=11;
  38608. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  38609. $ctx1.sendIdx["nextPutAll:"]=12;
  38610. self._nextPutAll_(")});");
  38611. $ctx1.sendIdx["nextPutAll:"]=13;
  38612. self._lf();
  38613. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38614. return self;
  38615. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38616. },
  38617. args: ["aMethod", "aBlock"],
  38618. 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 asJavascript, ',{'.\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 asJavascript;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  38619. referencedClasses: [],
  38620. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  38621. }),
  38622. $globals.JSStream);
  38623. $core.addMethod(
  38624. $core.method({
  38625. selector: "nextPutFunctionWith:arguments:",
  38626. protocol: 'streaming',
  38627. fn: function (aBlock,anArray){
  38628. var self=this;
  38629. return $core.withContext(function($ctx1) {
  38630. var $1,$2,$3,$4,$5;
  38631. $recv(self["@stream"])._nextPutAll_("fn: function(");
  38632. $ctx1.sendIdx["nextPutAll:"]=1;
  38633. $recv(anArray)._do_separatedBy_((function(each){
  38634. return $core.withContext(function($ctx2) {
  38635. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38636. $ctx2.sendIdx["nextPutAll:"]=2;
  38637. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38638. }),(function(){
  38639. return $core.withContext(function($ctx2) {
  38640. return $recv(self["@stream"])._nextPut_(",");
  38641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38642. }));
  38643. $1=self["@stream"];
  38644. $recv($1)._nextPutAll_("){");
  38645. $ctx1.sendIdx["nextPutAll:"]=3;
  38646. $2=$recv($1)._lf();
  38647. $ctx1.sendIdx["lf"]=1;
  38648. $3=self["@stream"];
  38649. $recv($3)._nextPutAll_("var self=this;");
  38650. $ctx1.sendIdx["nextPutAll:"]=4;
  38651. $4=$recv($3)._lf();
  38652. $ctx1.sendIdx["lf"]=2;
  38653. $recv(aBlock)._value();
  38654. $5=self["@stream"];
  38655. $recv($5)._lf();
  38656. $recv($5)._nextPutAll_("}");
  38657. return self;
  38658. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38659. },
  38660. args: ["aBlock", "anArray"],
  38661. 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: '}'",
  38662. referencedClasses: [],
  38663. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38664. }),
  38665. $globals.JSStream);
  38666. $core.addMethod(
  38667. $core.method({
  38668. selector: "nextPutIf:then:",
  38669. protocol: 'streaming',
  38670. fn: function (aBlock,anotherBlock){
  38671. var self=this;
  38672. return $core.withContext(function($ctx1) {
  38673. var $1;
  38674. $recv(self["@stream"])._nextPutAll_("if(");
  38675. $ctx1.sendIdx["nextPutAll:"]=1;
  38676. $recv(aBlock)._value();
  38677. $ctx1.sendIdx["value"]=1;
  38678. $1=self["@stream"];
  38679. $recv($1)._nextPutAll_("){");
  38680. $ctx1.sendIdx["nextPutAll:"]=2;
  38681. $recv($1)._lf();
  38682. $recv(anotherBlock)._value();
  38683. $recv(self["@stream"])._nextPutAll_("}");
  38684. self._omitSemicolon_(true);
  38685. return self;
  38686. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38687. },
  38688. args: ["aBlock", "anotherBlock"],
  38689. 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",
  38690. referencedClasses: [],
  38691. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  38692. }),
  38693. $globals.JSStream);
  38694. $core.addMethod(
  38695. $core.method({
  38696. selector: "nextPutIf:then:else:",
  38697. protocol: 'streaming',
  38698. fn: function (aBlock,ifBlock,elseBlock){
  38699. var self=this;
  38700. return $core.withContext(function($ctx1) {
  38701. var $1,$2,$3;
  38702. $recv(self["@stream"])._nextPutAll_("if(");
  38703. $ctx1.sendIdx["nextPutAll:"]=1;
  38704. $recv(aBlock)._value();
  38705. $ctx1.sendIdx["value"]=1;
  38706. $1=self["@stream"];
  38707. $recv($1)._nextPutAll_("){");
  38708. $ctx1.sendIdx["nextPutAll:"]=2;
  38709. $2=$recv($1)._lf();
  38710. $ctx1.sendIdx["lf"]=1;
  38711. $recv(ifBlock)._value();
  38712. $ctx1.sendIdx["value"]=2;
  38713. $3=self["@stream"];
  38714. $recv($3)._nextPutAll_("} else {");
  38715. $ctx1.sendIdx["nextPutAll:"]=3;
  38716. $recv($3)._lf();
  38717. $recv(elseBlock)._value();
  38718. $recv(self["@stream"])._nextPutAll_("}");
  38719. self._omitSemicolon_(true);
  38720. return self;
  38721. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  38722. },
  38723. args: ["aBlock", "ifBlock", "elseBlock"],
  38724. 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",
  38725. referencedClasses: [],
  38726. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  38727. }),
  38728. $globals.JSStream);
  38729. $core.addMethod(
  38730. $core.method({
  38731. selector: "nextPutMethodDeclaration:with:",
  38732. protocol: 'streaming',
  38733. fn: function (aMethod,aBlock){
  38734. var self=this;
  38735. return $core.withContext(function($ctx1) {
  38736. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  38737. $1=self["@stream"];
  38738. $recv($1)._nextPutAll_("$core.method({");
  38739. $ctx1.sendIdx["nextPutAll:"]=1;
  38740. $recv($1)._lf();
  38741. $ctx1.sendIdx["lf"]=1;
  38742. $4=$recv($recv(aMethod)._selector())._asJavascript();
  38743. $ctx1.sendIdx["asJavascript"]=1;
  38744. $3="selector: ".__comma($4);
  38745. $ctx1.sendIdx[","]=2;
  38746. $2=$recv($3).__comma(",");
  38747. $ctx1.sendIdx[","]=1;
  38748. $recv($1)._nextPutAll_($2);
  38749. $ctx1.sendIdx["nextPutAll:"]=2;
  38750. $recv($1)._lf();
  38751. $ctx1.sendIdx["lf"]=2;
  38752. $7=$recv($recv(aMethod)._source())._asJavascript();
  38753. $ctx1.sendIdx["asJavascript"]=2;
  38754. $6="source: ".__comma($7);
  38755. $ctx1.sendIdx[","]=4;
  38756. $5=$recv($6).__comma(",");
  38757. $ctx1.sendIdx[","]=3;
  38758. $recv($1)._nextPutAll_($5);
  38759. $ctx1.sendIdx["nextPutAll:"]=3;
  38760. $8=$recv($1)._lf();
  38761. $ctx1.sendIdx["lf"]=3;
  38762. $recv(aBlock)._value();
  38763. $ctx1.sendIdx["value"]=1;
  38764. $9=self["@stream"];
  38765. $12=$recv($globals.String)._lf();
  38766. $ctx1.sendIdx["lf"]=4;
  38767. $11=",".__comma($12);
  38768. $ctx1.sendIdx[","]=6;
  38769. $10=$recv($11).__comma("messageSends: ");
  38770. $ctx1.sendIdx[","]=5;
  38771. $recv($9)._nextPutAll_($10);
  38772. $ctx1.sendIdx["nextPutAll:"]=4;
  38773. $15=$recv($recv(aMethod)._messageSends())._asArray();
  38774. $ctx1.sendIdx["asArray"]=1;
  38775. $14=$recv($15)._asJavascript();
  38776. $ctx1.sendIdx["asJavascript"]=3;
  38777. $13=$recv($14).__comma(",");
  38778. $ctx1.sendIdx[","]=7;
  38779. $recv($9)._nextPutAll_($13);
  38780. $ctx1.sendIdx["nextPutAll:"]=5;
  38781. $recv($9)._lf();
  38782. $ctx1.sendIdx["lf"]=5;
  38783. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  38784. return $core.withContext(function($ctx2) {
  38785. return $recv(each)._value();
  38786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38787. })))._asArray())._asJavascript();
  38788. $ctx1.sendIdx["asJavascript"]=4;
  38789. $17="args: ".__comma($18);
  38790. $16=$recv($17).__comma(",");
  38791. $ctx1.sendIdx[","]=8;
  38792. $recv($9)._nextPutAll_($16);
  38793. $ctx1.sendIdx["nextPutAll:"]=6;
  38794. $recv($9)._lf();
  38795. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  38796. $ctx1.sendIdx["nextPutAll:"]=7;
  38797. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  38798. return $core.withContext(function($ctx2) {
  38799. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  38800. $ctx2.sendIdx["nextPutAll:"]=8;
  38801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38802. }),(function(){
  38803. return $core.withContext(function($ctx2) {
  38804. return $recv(self["@stream"])._nextPutAll_(",");
  38805. $ctx2.sendIdx["nextPutAll:"]=9;
  38806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38807. }));
  38808. $20=self["@stream"];
  38809. $recv($20)._nextPutAll_("]");
  38810. $ctx1.sendIdx["nextPutAll:"]=10;
  38811. $recv($20)._nextPutAll_("})");
  38812. return self;
  38813. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38814. },
  38815. args: ["aMethod", "aBlock"],
  38816. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: '$core.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavascript ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  38817. referencedClasses: ["String"],
  38818. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  38819. }),
  38820. $globals.JSStream);
  38821. $core.addMethod(
  38822. $core.method({
  38823. selector: "nextPutNonLocalReturnHandlingWith:",
  38824. protocol: 'streaming',
  38825. fn: function (aBlock){
  38826. var self=this;
  38827. return $core.withContext(function($ctx1) {
  38828. var $1,$2,$3;
  38829. $1=self["@stream"];
  38830. $recv($1)._nextPutAll_("var $early={};");
  38831. $ctx1.sendIdx["nextPutAll:"]=1;
  38832. $recv($1)._lf();
  38833. $ctx1.sendIdx["lf"]=1;
  38834. $recv($1)._nextPutAll_("try {");
  38835. $ctx1.sendIdx["nextPutAll:"]=2;
  38836. $2=$recv($1)._lf();
  38837. $ctx1.sendIdx["lf"]=2;
  38838. $recv(aBlock)._value();
  38839. $3=self["@stream"];
  38840. $recv($3)._nextPutAll_("}");
  38841. $ctx1.sendIdx["nextPutAll:"]=3;
  38842. $recv($3)._lf();
  38843. $ctx1.sendIdx["lf"]=3;
  38844. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  38845. $recv($3)._lf();
  38846. return self;
  38847. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  38848. },
  38849. args: ["aBlock"],
  38850. 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",
  38851. referencedClasses: [],
  38852. messageSends: ["nextPutAll:", "lf", "value"]
  38853. }),
  38854. $globals.JSStream);
  38855. $core.addMethod(
  38856. $core.method({
  38857. selector: "nextPutNonLocalReturnWith:",
  38858. protocol: 'streaming',
  38859. fn: function (aBlock){
  38860. var self=this;
  38861. return $core.withContext(function($ctx1) {
  38862. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  38863. $ctx1.sendIdx["nextPutAll:"]=1;
  38864. $recv(aBlock)._value();
  38865. $recv(self["@stream"])._nextPutAll_("]");
  38866. return self;
  38867. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  38868. },
  38869. args: ["aBlock"],
  38870. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  38871. referencedClasses: [],
  38872. messageSends: ["nextPutAll:", "value"]
  38873. }),
  38874. $globals.JSStream);
  38875. $core.addMethod(
  38876. $core.method({
  38877. selector: "nextPutReturnWith:",
  38878. protocol: 'streaming',
  38879. fn: function (aBlock){
  38880. var self=this;
  38881. return $core.withContext(function($ctx1) {
  38882. $recv(self["@stream"])._nextPutAll_("return ");
  38883. $recv(aBlock)._value();
  38884. return self;
  38885. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  38886. },
  38887. args: ["aBlock"],
  38888. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  38889. referencedClasses: [],
  38890. messageSends: ["nextPutAll:", "value"]
  38891. }),
  38892. $globals.JSStream);
  38893. $core.addMethod(
  38894. $core.method({
  38895. selector: "nextPutSendIndexFor:",
  38896. protocol: 'streaming',
  38897. fn: function (anIRSend){
  38898. var self=this;
  38899. return $core.withContext(function($ctx1) {
  38900. self._nextPutAll_(";");
  38901. $ctx1.sendIdx["nextPutAll:"]=1;
  38902. self._lf();
  38903. $ctx1.sendIdx["lf"]=1;
  38904. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38905. $ctx1.sendIdx["nextPutAll:"]=2;
  38906. self._lf();
  38907. $ctx1.sendIdx["lf"]=2;
  38908. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  38909. $ctx1.sendIdx["nextPutAll:"]=3;
  38910. self._nextPutAll_(".sendIdx[");
  38911. $ctx1.sendIdx["nextPutAll:"]=4;
  38912. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  38913. $ctx1.sendIdx["nextPutAll:"]=5;
  38914. self._nextPutAll_("]=");
  38915. $ctx1.sendIdx["nextPutAll:"]=6;
  38916. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  38917. $ctx1.sendIdx["nextPutAll:"]=7;
  38918. self._nextPutAll_(";");
  38919. $ctx1.sendIdx["nextPutAll:"]=8;
  38920. self._lf();
  38921. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  38922. return self;
  38923. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  38924. },
  38925. args: ["anIRSend"],
  38926. 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 asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'",
  38927. referencedClasses: [],
  38928. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  38929. }),
  38930. $globals.JSStream);
  38931. $core.addMethod(
  38932. $core.method({
  38933. selector: "nextPutStatementWith:",
  38934. protocol: 'streaming',
  38935. fn: function (aBlock){
  38936. var self=this;
  38937. return $core.withContext(function($ctx1) {
  38938. var $1;
  38939. self._omitSemicolon_(false);
  38940. $ctx1.sendIdx["omitSemicolon:"]=1;
  38941. $recv(aBlock)._value();
  38942. $1=self._omitSemicolon();
  38943. if(!$core.assert($1)){
  38944. $recv(self["@stream"])._nextPutAll_(";");
  38945. }
  38946. self._omitSemicolon_(false);
  38947. $recv(self["@stream"])._lf();
  38948. return self;
  38949. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  38950. },
  38951. args: ["aBlock"],
  38952. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  38953. referencedClasses: [],
  38954. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  38955. }),
  38956. $globals.JSStream);
  38957. $core.addMethod(
  38958. $core.method({
  38959. selector: "nextPutVars:",
  38960. protocol: 'streaming',
  38961. fn: function (aCollection){
  38962. var self=this;
  38963. return $core.withContext(function($ctx1) {
  38964. var $1;
  38965. $recv(aCollection)._ifNotEmpty_((function(){
  38966. return $core.withContext(function($ctx2) {
  38967. $recv(self["@stream"])._nextPutAll_("var ");
  38968. $ctx2.sendIdx["nextPutAll:"]=1;
  38969. $recv(aCollection)._do_separatedBy_((function(each){
  38970. return $core.withContext(function($ctx3) {
  38971. return $recv(self["@stream"])._nextPutAll_(each);
  38972. $ctx3.sendIdx["nextPutAll:"]=2;
  38973. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38974. }),(function(){
  38975. return $core.withContext(function($ctx3) {
  38976. return $recv(self["@stream"])._nextPutAll_(",");
  38977. $ctx3.sendIdx["nextPutAll:"]=3;
  38978. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38979. }));
  38980. $1=self["@stream"];
  38981. $recv($1)._nextPutAll_(";");
  38982. return $recv($1)._lf();
  38983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38984. }));
  38985. return self;
  38986. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  38987. },
  38988. args: ["aCollection"],
  38989. 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 ]",
  38990. referencedClasses: [],
  38991. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  38992. }),
  38993. $globals.JSStream);
  38994. $core.addMethod(
  38995. $core.method({
  38996. selector: "omitSemicolon",
  38997. protocol: 'accessing',
  38998. fn: function (){
  38999. var self=this;
  39000. return self["@omitSemicolon"];
  39001. },
  39002. args: [],
  39003. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  39004. referencedClasses: [],
  39005. messageSends: []
  39006. }),
  39007. $globals.JSStream);
  39008. $core.addMethod(
  39009. $core.method({
  39010. selector: "omitSemicolon:",
  39011. protocol: 'accessing',
  39012. fn: function (aBoolean){
  39013. var self=this;
  39014. self["@omitSemicolon"]=aBoolean;
  39015. return self;
  39016. },
  39017. args: ["aBoolean"],
  39018. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  39019. referencedClasses: [],
  39020. messageSends: []
  39021. }),
  39022. $globals.JSStream);
  39023. $core.addMethod(
  39024. $core.method({
  39025. selector: "isReferenced",
  39026. protocol: '*Compiler-IR',
  39027. fn: function (){
  39028. var self=this;
  39029. return $core.withContext(function($ctx1) {
  39030. var $3,$2,$1;
  39031. $3=self._parent();
  39032. $ctx1.sendIdx["parent"]=1;
  39033. $2=$recv($3)._isSequenceNode();
  39034. $1=$recv($2)._or_((function(){
  39035. return $core.withContext(function($ctx2) {
  39036. return $recv(self._parent())._isAssignmentNode();
  39037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39038. }));
  39039. return $recv($1)._not();
  39040. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  39041. },
  39042. args: [],
  39043. 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",
  39044. referencedClasses: [],
  39045. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  39046. }),
  39047. $globals.ASTNode);
  39048. $core.addMethod(
  39049. $core.method({
  39050. selector: "subtreeNeedsAliasing",
  39051. protocol: '*Compiler-IR',
  39052. fn: function (){
  39053. var self=this;
  39054. return $core.withContext(function($ctx1) {
  39055. return $recv(self._shouldBeAliased())._or_((function(){
  39056. return $core.withContext(function($ctx2) {
  39057. return $recv(self._dagChildren())._anySatisfy_((function(each){
  39058. return $core.withContext(function($ctx3) {
  39059. return $recv(each)._subtreeNeedsAliasing();
  39060. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39061. }));
  39062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39063. }));
  39064. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  39065. },
  39066. args: [],
  39067. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  39068. referencedClasses: [],
  39069. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  39070. }),
  39071. $globals.ASTNode);
  39072. $core.addMethod(
  39073. $core.method({
  39074. selector: "shouldBeAliased",
  39075. protocol: '*Compiler-IR',
  39076. fn: function (){
  39077. var self=this;
  39078. return $core.withContext(function($ctx1) {
  39079. var $1;
  39080. $1=(
  39081. $ctx1.supercall = true,
  39082. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  39083. $ctx1.supercall = false;
  39084. return $recv($1)._or_((function(){
  39085. return $core.withContext(function($ctx2) {
  39086. return self._isReferenced();
  39087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39088. }));
  39089. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  39090. },
  39091. args: [],
  39092. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  39093. referencedClasses: [],
  39094. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  39095. }),
  39096. $globals.AssignmentNode);
  39097. $core.addMethod(
  39098. $core.method({
  39099. selector: "appendToInstruction:",
  39100. protocol: '*Compiler-IR',
  39101. fn: function (anIRInstruction){
  39102. var self=this;
  39103. return $core.withContext(function($ctx1) {
  39104. $recv(anIRInstruction)._appendBlock_(self);
  39105. return self;
  39106. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  39107. },
  39108. args: ["anIRInstruction"],
  39109. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  39110. referencedClasses: [],
  39111. messageSends: ["appendBlock:"]
  39112. }),
  39113. $globals.BlockClosure);
  39114. $core.addMethod(
  39115. $core.method({
  39116. selector: "subtreeNeedsAliasing",
  39117. protocol: '*Compiler-IR',
  39118. fn: function (){
  39119. var self=this;
  39120. return $core.withContext(function($ctx1) {
  39121. return self._shouldBeAliased();
  39122. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  39123. },
  39124. args: [],
  39125. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  39126. referencedClasses: [],
  39127. messageSends: ["shouldBeAliased"]
  39128. }),
  39129. $globals.BlockNode);
  39130. $core.addMethod(
  39131. $core.method({
  39132. selector: "subtreeNeedsAliasing",
  39133. protocol: '*Compiler-IR',
  39134. fn: function (){
  39135. var self=this;
  39136. return $core.withContext(function($ctx1) {
  39137. return $recv($recv(self._parent())._isSequenceNode())._not();
  39138. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  39139. },
  39140. args: [],
  39141. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  39142. referencedClasses: [],
  39143. messageSends: ["not", "isSequenceNode", "parent"]
  39144. }),
  39145. $globals.CascadeNode);
  39146. $core.addMethod(
  39147. $core.method({
  39148. selector: "shouldBeAliased",
  39149. protocol: '*Compiler-IR',
  39150. fn: function (){
  39151. var self=this;
  39152. var sends;
  39153. return $core.withContext(function($ctx1) {
  39154. var $2,$1;
  39155. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  39156. $2=(
  39157. $ctx1.supercall = true,
  39158. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  39159. $ctx1.supercall = false;
  39160. $1=$recv($2)._or_((function(){
  39161. return $core.withContext(function($ctx2) {
  39162. return $recv(self._isReferenced())._and_((function(){
  39163. return $core.withContext(function($ctx3) {
  39164. return $recv($recv(self._index()).__lt(sends))._or_((function(){
  39165. return $core.withContext(function($ctx4) {
  39166. return self._superSend();
  39167. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  39168. }));
  39169. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39170. }));
  39171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39172. }));
  39173. $ctx1.sendIdx["or:"]=1;
  39174. return $1;
  39175. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  39176. },
  39177. args: [],
  39178. 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 ] ] ])",
  39179. referencedClasses: [],
  39180. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  39181. }),
  39182. $globals.SendNode);
  39183. $core.addMethod(
  39184. $core.method({
  39185. selector: "subtreeNeedsAliasing",
  39186. protocol: '*Compiler-IR',
  39187. fn: function (){
  39188. var self=this;
  39189. return $core.withContext(function($ctx1) {
  39190. return $recv(self._shouldBeInlined())._or_((function(){
  39191. return $core.withContext(function($ctx2) {
  39192. return (
  39193. $ctx2.supercall = true,
  39194. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($recv(self), []));
  39195. $ctx2.supercall = false;
  39196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39197. }));
  39198. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  39199. },
  39200. args: [],
  39201. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  39202. referencedClasses: [],
  39203. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  39204. }),
  39205. $globals.SendNode);
  39206. });
  39207. 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";
  39208. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  39209. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  39210. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  39211. $core.addPackage('Compiler-Inlining');
  39212. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  39213. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  39214. $core.addClass('ASTPreInliner', $globals.NodeVisitor, [], 'Compiler-Inlining');
  39215. $core.addMethod(
  39216. $core.method({
  39217. selector: "visitSendNode:",
  39218. protocol: 'visiting',
  39219. fn: function (aNode){
  39220. var self=this;
  39221. return $core.withContext(function($ctx1) {
  39222. var $1,$2,$3,$4,$receiver;
  39223. $1=$recv(aNode)._superSend();
  39224. if(!$core.assert($1)){
  39225. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  39226. if($core.assert($2)){
  39227. $recv(aNode)._shouldBeInlined_(true);
  39228. $3=$recv(aNode)._receiver();
  39229. if(($receiver = $3) == null || $receiver.isNil){
  39230. $3;
  39231. } else {
  39232. var receiver;
  39233. receiver=$receiver;
  39234. $recv(receiver)._shouldBeAliased_(true);
  39235. }
  39236. }
  39237. }
  39238. $4=(
  39239. $ctx1.supercall = true,
  39240. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  39241. $ctx1.supercall = false;
  39242. return $4;
  39243. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  39244. },
  39245. args: ["aNode"],
  39246. 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",
  39247. referencedClasses: ["IRSendInliner"],
  39248. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  39249. }),
  39250. $globals.ASTPreInliner);
  39251. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  39252. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  39253. $core.addMethod(
  39254. $core.method({
  39255. selector: "acceptDagVisitor:",
  39256. protocol: 'visiting',
  39257. fn: function (aVisitor){
  39258. var self=this;
  39259. return $core.withContext(function($ctx1) {
  39260. $recv(aVisitor)._visitIRInlinedClosure_(self);
  39261. return self;
  39262. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  39263. },
  39264. args: ["aVisitor"],
  39265. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  39266. referencedClasses: [],
  39267. messageSends: ["visitIRInlinedClosure:"]
  39268. }),
  39269. $globals.IRInlinedClosure);
  39270. $core.addMethod(
  39271. $core.method({
  39272. selector: "isInlined",
  39273. protocol: 'testing',
  39274. fn: function (){
  39275. var self=this;
  39276. return true;
  39277. },
  39278. args: [],
  39279. source: "isInlined\x0a\x09^ true",
  39280. referencedClasses: [],
  39281. messageSends: []
  39282. }),
  39283. $globals.IRInlinedClosure);
  39284. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  39285. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  39286. $core.addMethod(
  39287. $core.method({
  39288. selector: "acceptDagVisitor:",
  39289. protocol: 'visiting',
  39290. fn: function (aVisitor){
  39291. var self=this;
  39292. return $core.withContext(function($ctx1) {
  39293. $recv(aVisitor)._visitInlinedSend_(self);
  39294. return self;
  39295. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  39296. },
  39297. args: ["aVisitor"],
  39298. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  39299. referencedClasses: [],
  39300. messageSends: ["visitInlinedSend:"]
  39301. }),
  39302. $globals.IRInlinedSend);
  39303. $core.addMethod(
  39304. $core.method({
  39305. selector: "internalVariables",
  39306. protocol: 'accessing',
  39307. fn: function (){
  39308. var self=this;
  39309. return [];
  39310. },
  39311. args: [],
  39312. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  39313. referencedClasses: [],
  39314. messageSends: []
  39315. }),
  39316. $globals.IRInlinedSend);
  39317. $core.addMethod(
  39318. $core.method({
  39319. selector: "isInlined",
  39320. protocol: 'testing',
  39321. fn: function (){
  39322. var self=this;
  39323. return true;
  39324. },
  39325. args: [],
  39326. source: "isInlined\x0a\x09^ true",
  39327. referencedClasses: [],
  39328. messageSends: []
  39329. }),
  39330. $globals.IRInlinedSend);
  39331. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39332. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  39333. $core.addMethod(
  39334. $core.method({
  39335. selector: "acceptDagVisitor:",
  39336. protocol: 'visiting',
  39337. fn: function (aVisitor){
  39338. var self=this;
  39339. return $core.withContext(function($ctx1) {
  39340. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  39341. return self;
  39342. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  39343. },
  39344. args: ["aVisitor"],
  39345. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  39346. referencedClasses: [],
  39347. messageSends: ["visitIRInlinedIfFalse:"]
  39348. }),
  39349. $globals.IRInlinedIfFalse);
  39350. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39351. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  39352. $core.addMethod(
  39353. $core.method({
  39354. selector: "acceptDagVisitor:",
  39355. protocol: 'visiting',
  39356. fn: function (aVisitor){
  39357. var self=this;
  39358. return $core.withContext(function($ctx1) {
  39359. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  39360. return self;
  39361. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  39362. },
  39363. args: ["aVisitor"],
  39364. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  39365. referencedClasses: [],
  39366. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  39367. }),
  39368. $globals.IRInlinedIfNilIfNotNil);
  39369. $core.addMethod(
  39370. $core.method({
  39371. selector: "internalVariables",
  39372. protocol: 'accessing',
  39373. fn: function (){
  39374. var self=this;
  39375. return $core.withContext(function($ctx1) {
  39376. return $recv($globals.Array)._with_(self._receiverInternalVariable());
  39377. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  39378. },
  39379. args: [],
  39380. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  39381. referencedClasses: ["Array"],
  39382. messageSends: ["with:", "receiverInternalVariable"]
  39383. }),
  39384. $globals.IRInlinedIfNilIfNotNil);
  39385. $core.addMethod(
  39386. $core.method({
  39387. selector: "receiverInternalVariable",
  39388. protocol: 'accessing',
  39389. fn: function (){
  39390. var self=this;
  39391. return $core.withContext(function($ctx1) {
  39392. var $1;
  39393. $1=$recv($globals.IRVariable)._new();
  39394. $ctx1.sendIdx["new"]=1;
  39395. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_(self._receiverInternalVariableName()));
  39396. return $recv($1)._yourself();
  39397. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  39398. },
  39399. args: [],
  39400. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  39401. referencedClasses: ["IRVariable", "AliasVar"],
  39402. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  39403. }),
  39404. $globals.IRInlinedIfNilIfNotNil);
  39405. $core.addMethod(
  39406. $core.method({
  39407. selector: "receiverInternalVariableName",
  39408. protocol: 'accessing',
  39409. fn: function (){
  39410. var self=this;
  39411. return "$receiver";
  39412. },
  39413. args: [],
  39414. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  39415. referencedClasses: [],
  39416. messageSends: []
  39417. }),
  39418. $globals.IRInlinedIfNilIfNotNil);
  39419. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39420. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  39421. $core.addMethod(
  39422. $core.method({
  39423. selector: "acceptDagVisitor:",
  39424. protocol: 'visiting',
  39425. fn: function (aVisitor){
  39426. var self=this;
  39427. return $core.withContext(function($ctx1) {
  39428. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  39429. return self;
  39430. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  39431. },
  39432. args: ["aVisitor"],
  39433. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  39434. referencedClasses: [],
  39435. messageSends: ["visitIRInlinedIfTrue:"]
  39436. }),
  39437. $globals.IRInlinedIfTrue);
  39438. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39439. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  39440. $core.addMethod(
  39441. $core.method({
  39442. selector: "acceptDagVisitor:",
  39443. protocol: 'visiting',
  39444. fn: function (aVisitor){
  39445. var self=this;
  39446. return $core.withContext(function($ctx1) {
  39447. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  39448. return self;
  39449. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  39450. },
  39451. args: ["aVisitor"],
  39452. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  39453. referencedClasses: [],
  39454. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  39455. }),
  39456. $globals.IRInlinedIfTrueIfFalse);
  39457. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  39458. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  39459. $core.addMethod(
  39460. $core.method({
  39461. selector: "acceptDagVisitor:",
  39462. protocol: 'visiting',
  39463. fn: function (aVisitor){
  39464. var self=this;
  39465. return $core.withContext(function($ctx1) {
  39466. $recv(aVisitor)._visitIRInlinedSequence_(self);
  39467. return self;
  39468. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  39469. },
  39470. args: ["aVisitor"],
  39471. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  39472. referencedClasses: [],
  39473. messageSends: ["visitIRInlinedSequence:"]
  39474. }),
  39475. $globals.IRInlinedSequence);
  39476. $core.addMethod(
  39477. $core.method({
  39478. selector: "isInlined",
  39479. protocol: 'testing',
  39480. fn: function (){
  39481. var self=this;
  39482. return true;
  39483. },
  39484. args: [],
  39485. source: "isInlined\x0a\x09^ true",
  39486. referencedClasses: [],
  39487. messageSends: []
  39488. }),
  39489. $globals.IRInlinedSequence);
  39490. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  39491. $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`";
  39492. $core.addMethod(
  39493. $core.method({
  39494. selector: "assignmentInliner",
  39495. protocol: 'factory',
  39496. fn: function (){
  39497. var self=this;
  39498. return $core.withContext(function($ctx1) {
  39499. var $1;
  39500. $1=$recv($globals.IRAssignmentInliner)._new();
  39501. $recv($1)._translator_(self);
  39502. return $recv($1)._yourself();
  39503. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  39504. },
  39505. args: [],
  39506. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39507. referencedClasses: ["IRAssignmentInliner"],
  39508. messageSends: ["translator:", "new", "yourself"]
  39509. }),
  39510. $globals.IRInliner);
  39511. $core.addMethod(
  39512. $core.method({
  39513. selector: "returnInliner",
  39514. protocol: 'factory',
  39515. fn: function (){
  39516. var self=this;
  39517. return $core.withContext(function($ctx1) {
  39518. var $1;
  39519. $1=$recv($globals.IRReturnInliner)._new();
  39520. $recv($1)._translator_(self);
  39521. return $recv($1)._yourself();
  39522. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  39523. },
  39524. args: [],
  39525. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39526. referencedClasses: ["IRReturnInliner"],
  39527. messageSends: ["translator:", "new", "yourself"]
  39528. }),
  39529. $globals.IRInliner);
  39530. $core.addMethod(
  39531. $core.method({
  39532. selector: "sendInliner",
  39533. protocol: 'factory',
  39534. fn: function (){
  39535. var self=this;
  39536. return $core.withContext(function($ctx1) {
  39537. var $1;
  39538. $1=$recv($globals.IRSendInliner)._new();
  39539. $recv($1)._translator_(self);
  39540. return $recv($1)._yourself();
  39541. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  39542. },
  39543. args: [],
  39544. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39545. referencedClasses: ["IRSendInliner"],
  39546. messageSends: ["translator:", "new", "yourself"]
  39547. }),
  39548. $globals.IRInliner);
  39549. $core.addMethod(
  39550. $core.method({
  39551. selector: "shouldInlineAssignment:",
  39552. protocol: 'testing',
  39553. fn: function (anIRAssignment){
  39554. var self=this;
  39555. return $core.withContext(function($ctx1) {
  39556. var $3,$2,$1;
  39557. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  39558. return $core.withContext(function($ctx2) {
  39559. $3=$recv(anIRAssignment)._right();
  39560. $ctx2.sendIdx["right"]=1;
  39561. $2=$recv($3)._isSend();
  39562. return $recv($2)._and_((function(){
  39563. return $core.withContext(function($ctx3) {
  39564. return self._shouldInlineSend_($recv(anIRAssignment)._right());
  39565. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39566. }));
  39567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39568. }));
  39569. $ctx1.sendIdx["and:"]=1;
  39570. return $1;
  39571. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39572. },
  39573. args: ["anIRAssignment"],
  39574. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  39575. referencedClasses: [],
  39576. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  39577. }),
  39578. $globals.IRInliner);
  39579. $core.addMethod(
  39580. $core.method({
  39581. selector: "shouldInlineReturn:",
  39582. protocol: 'testing',
  39583. fn: function (anIRReturn){
  39584. var self=this;
  39585. return $core.withContext(function($ctx1) {
  39586. var $3,$2,$1;
  39587. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  39588. return $core.withContext(function($ctx2) {
  39589. $3=$recv(anIRReturn)._expression();
  39590. $ctx2.sendIdx["expression"]=1;
  39591. $2=$recv($3)._isSend();
  39592. return $recv($2)._and_((function(){
  39593. return $core.withContext(function($ctx3) {
  39594. return self._shouldInlineSend_($recv(anIRReturn)._expression());
  39595. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39596. }));
  39597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39598. }));
  39599. $ctx1.sendIdx["and:"]=1;
  39600. return $1;
  39601. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39602. },
  39603. args: ["anIRReturn"],
  39604. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  39605. referencedClasses: [],
  39606. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  39607. }),
  39608. $globals.IRInliner);
  39609. $core.addMethod(
  39610. $core.method({
  39611. selector: "shouldInlineSend:",
  39612. protocol: 'testing',
  39613. fn: function (anIRSend){
  39614. var self=this;
  39615. return $core.withContext(function($ctx1) {
  39616. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  39617. return $core.withContext(function($ctx2) {
  39618. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  39619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39620. }));
  39621. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39622. },
  39623. args: ["anIRSend"],
  39624. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  39625. referencedClasses: ["IRSendInliner"],
  39626. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  39627. }),
  39628. $globals.IRInliner);
  39629. $core.addMethod(
  39630. $core.method({
  39631. selector: "visitIRAssignment:",
  39632. protocol: 'visiting',
  39633. fn: function (anIRAssignment){
  39634. var self=this;
  39635. return $core.withContext(function($ctx1) {
  39636. var $1;
  39637. $1=self._shouldInlineAssignment_(anIRAssignment);
  39638. if($core.assert($1)){
  39639. return $recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  39640. } else {
  39641. return (
  39642. $ctx1.supercall = true,
  39643. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  39644. $ctx1.supercall = false;
  39645. }
  39646. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39647. },
  39648. args: ["anIRAssignment"],
  39649. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  39650. referencedClasses: [],
  39651. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  39652. }),
  39653. $globals.IRInliner);
  39654. $core.addMethod(
  39655. $core.method({
  39656. selector: "visitIRNonLocalReturn:",
  39657. protocol: 'visiting',
  39658. fn: function (anIRNonLocalReturn){
  39659. var self=this;
  39660. var localReturn;
  39661. return $core.withContext(function($ctx1) {
  39662. var $2,$1,$4,$3,$5,$6,$7;
  39663. $2=$recv(anIRNonLocalReturn)._scope();
  39664. $ctx1.sendIdx["scope"]=1;
  39665. $1=$recv($2)._canInlineNonLocalReturns();
  39666. if($core.assert($1)){
  39667. $4=$recv(anIRNonLocalReturn)._scope();
  39668. $ctx1.sendIdx["scope"]=2;
  39669. $3=$recv($4)._methodScope();
  39670. $5=$recv(anIRNonLocalReturn)._scope();
  39671. $ctx1.sendIdx["scope"]=3;
  39672. $recv($3)._removeNonLocalReturn_($5);
  39673. $6=$recv($globals.IRReturn)._new();
  39674. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  39675. localReturn=$recv($6)._yourself();
  39676. localReturn;
  39677. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  39678. return $core.withContext(function($ctx2) {
  39679. return $recv(localReturn)._add_(each);
  39680. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39681. }));
  39682. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  39683. return self._visitIRReturn_(localReturn);
  39684. }
  39685. $7=(
  39686. $ctx1.supercall = true,
  39687. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39688. $ctx1.supercall = false;
  39689. return $7;
  39690. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  39691. },
  39692. args: ["anIRNonLocalReturn"],
  39693. 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",
  39694. referencedClasses: ["IRReturn"],
  39695. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  39696. }),
  39697. $globals.IRInliner);
  39698. $core.addMethod(
  39699. $core.method({
  39700. selector: "visitIRReturn:",
  39701. protocol: 'visiting',
  39702. fn: function (anIRReturn){
  39703. var self=this;
  39704. return $core.withContext(function($ctx1) {
  39705. var $1;
  39706. $1=self._shouldInlineReturn_(anIRReturn);
  39707. if($core.assert($1)){
  39708. return $recv(self._returnInliner())._inlineReturn_(anIRReturn);
  39709. } else {
  39710. return (
  39711. $ctx1.supercall = true,
  39712. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39713. $ctx1.supercall = false;
  39714. }
  39715. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39716. },
  39717. args: ["anIRReturn"],
  39718. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  39719. referencedClasses: [],
  39720. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  39721. }),
  39722. $globals.IRInliner);
  39723. $core.addMethod(
  39724. $core.method({
  39725. selector: "visitIRSend:",
  39726. protocol: 'visiting',
  39727. fn: function (anIRSend){
  39728. var self=this;
  39729. return $core.withContext(function($ctx1) {
  39730. var $1;
  39731. $1=self._shouldInlineSend_(anIRSend);
  39732. if($core.assert($1)){
  39733. return $recv(self._sendInliner())._inlineSend_(anIRSend);
  39734. } else {
  39735. return (
  39736. $ctx1.supercall = true,
  39737. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  39738. $ctx1.supercall = false;
  39739. }
  39740. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39741. },
  39742. args: ["anIRSend"],
  39743. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  39744. referencedClasses: [],
  39745. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  39746. }),
  39747. $globals.IRInliner);
  39748. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  39749. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  39750. $core.addMethod(
  39751. $core.method({
  39752. selector: "visitIRInlinedClosure:",
  39753. protocol: 'visiting',
  39754. fn: function (anIRInlinedClosure){
  39755. var self=this;
  39756. return $core.withContext(function($ctx1) {
  39757. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  39758. return $core.withContext(function($ctx2) {
  39759. return $recv($recv(each)._name())._asVariableName();
  39760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39761. })));
  39762. self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  39763. return self;
  39764. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  39765. },
  39766. args: ["anIRInlinedClosure"],
  39767. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  39768. referencedClasses: [],
  39769. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  39770. }),
  39771. $globals.IRInliningJSTranslator);
  39772. $core.addMethod(
  39773. $core.method({
  39774. selector: "visitIRInlinedIfFalse:",
  39775. protocol: 'visiting',
  39776. fn: function (anIRInlinedIfFalse){
  39777. var self=this;
  39778. return $core.withContext(function($ctx1) {
  39779. var $1,$2,$4,$3;
  39780. $1=self._stream();
  39781. $ctx1.sendIdx["stream"]=1;
  39782. $recv($1)._nextPutIf_then_((function(){
  39783. return $core.withContext(function($ctx2) {
  39784. $2=self._stream();
  39785. $ctx2.sendIdx["stream"]=2;
  39786. $recv($2)._nextPutAll_("!$core.assert(");
  39787. $ctx2.sendIdx["nextPutAll:"]=1;
  39788. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  39789. $ctx2.sendIdx["dagChildren"]=1;
  39790. $3=$recv($4)._first();
  39791. self._visit_($3);
  39792. $ctx2.sendIdx["visit:"]=1;
  39793. return $recv(self._stream())._nextPutAll_(")");
  39794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39795. }),(function(){
  39796. return $core.withContext(function($ctx2) {
  39797. return self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  39798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39799. }));
  39800. return self;
  39801. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  39802. },
  39803. args: ["anIRInlinedIfFalse"],
  39804. 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 ]",
  39805. referencedClasses: [],
  39806. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  39807. }),
  39808. $globals.IRInliningJSTranslator);
  39809. $core.addMethod(
  39810. $core.method({
  39811. selector: "visitIRInlinedIfNilIfNotNil:",
  39812. protocol: 'visiting',
  39813. fn: function (anIRInlinedIfNilIfNotNil){
  39814. var self=this;
  39815. return $core.withContext(function($ctx1) {
  39816. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  39817. $1=self._stream();
  39818. $ctx1.sendIdx["stream"]=1;
  39819. $recv($1)._nextPutIf_then_else_((function(){
  39820. var recvVarName;
  39821. return $core.withContext(function($ctx2) {
  39822. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  39823. recvVarName;
  39824. $2=self._stream();
  39825. $ctx2.sendIdx["stream"]=2;
  39826. $4="(".__comma(recvVarName);
  39827. $ctx2.sendIdx[","]=2;
  39828. $3=$recv($4).__comma(" = ");
  39829. $ctx2.sendIdx[","]=1;
  39830. $recv($2)._nextPutAll_($3);
  39831. $ctx2.sendIdx["nextPutAll:"]=1;
  39832. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  39833. $ctx2.sendIdx["dagChildren"]=1;
  39834. $5=$recv($6)._first();
  39835. self._visit_($5);
  39836. $ctx2.sendIdx["visit:"]=1;
  39837. $7=self._stream();
  39838. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".isNil");
  39839. $ctx2.sendIdx[","]=3;
  39840. return $recv($7)._nextPutAll_($8);
  39841. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  39842. }),(function(){
  39843. return $core.withContext(function($ctx2) {
  39844. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  39845. $ctx2.sendIdx["dagChildren"]=2;
  39846. $9=$recv($10)._second();
  39847. return self._visit_($9);
  39848. $ctx2.sendIdx["visit:"]=2;
  39849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39850. }),(function(){
  39851. return $core.withContext(function($ctx2) {
  39852. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  39853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39854. }));
  39855. return self;
  39856. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  39857. },
  39858. args: ["anIRInlinedIfNilIfNotNil"],
  39859. 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 ]",
  39860. referencedClasses: [],
  39861. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  39862. }),
  39863. $globals.IRInliningJSTranslator);
  39864. $core.addMethod(
  39865. $core.method({
  39866. selector: "visitIRInlinedIfTrue:",
  39867. protocol: 'visiting',
  39868. fn: function (anIRInlinedIfTrue){
  39869. var self=this;
  39870. return $core.withContext(function($ctx1) {
  39871. var $1,$2,$4,$3;
  39872. $1=self._stream();
  39873. $ctx1.sendIdx["stream"]=1;
  39874. $recv($1)._nextPutIf_then_((function(){
  39875. return $core.withContext(function($ctx2) {
  39876. $2=self._stream();
  39877. $ctx2.sendIdx["stream"]=2;
  39878. $recv($2)._nextPutAll_("$core.assert(");
  39879. $ctx2.sendIdx["nextPutAll:"]=1;
  39880. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  39881. $ctx2.sendIdx["dagChildren"]=1;
  39882. $3=$recv($4)._first();
  39883. self._visit_($3);
  39884. $ctx2.sendIdx["visit:"]=1;
  39885. return $recv(self._stream())._nextPutAll_(")");
  39886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39887. }),(function(){
  39888. return $core.withContext(function($ctx2) {
  39889. return self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  39890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39891. }));
  39892. return self;
  39893. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  39894. },
  39895. args: ["anIRInlinedIfTrue"],
  39896. 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 ]",
  39897. referencedClasses: [],
  39898. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  39899. }),
  39900. $globals.IRInliningJSTranslator);
  39901. $core.addMethod(
  39902. $core.method({
  39903. selector: "visitIRInlinedIfTrueIfFalse:",
  39904. protocol: 'visiting',
  39905. fn: function (anIRInlinedIfTrueIfFalse){
  39906. var self=this;
  39907. return $core.withContext(function($ctx1) {
  39908. var $1,$2,$4,$3,$6,$5;
  39909. $1=self._stream();
  39910. $ctx1.sendIdx["stream"]=1;
  39911. $recv($1)._nextPutIf_then_else_((function(){
  39912. return $core.withContext(function($ctx2) {
  39913. $2=self._stream();
  39914. $ctx2.sendIdx["stream"]=2;
  39915. $recv($2)._nextPutAll_("$core.assert(");
  39916. $ctx2.sendIdx["nextPutAll:"]=1;
  39917. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  39918. $ctx2.sendIdx["dagChildren"]=1;
  39919. $3=$recv($4)._first();
  39920. self._visit_($3);
  39921. $ctx2.sendIdx["visit:"]=1;
  39922. return $recv(self._stream())._nextPutAll_(")");
  39923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39924. }),(function(){
  39925. return $core.withContext(function($ctx2) {
  39926. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  39927. $ctx2.sendIdx["dagChildren"]=2;
  39928. $5=$recv($6)._second();
  39929. return self._visit_($5);
  39930. $ctx2.sendIdx["visit:"]=2;
  39931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39932. }),(function(){
  39933. return $core.withContext(function($ctx2) {
  39934. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  39935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39936. }));
  39937. return self;
  39938. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  39939. },
  39940. args: ["anIRInlinedIfTrueIfFalse"],
  39941. 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 ]",
  39942. referencedClasses: [],
  39943. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  39944. }),
  39945. $globals.IRInliningJSTranslator);
  39946. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  39947. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  39948. $core.addMethod(
  39949. $core.method({
  39950. selector: "ifFalse:",
  39951. protocol: 'inlining',
  39952. fn: function (anIRInstruction){
  39953. var self=this;
  39954. return $core.withContext(function($ctx1) {
  39955. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  39956. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  39957. },
  39958. args: ["anIRInstruction"],
  39959. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  39960. referencedClasses: ["IRInlinedIfFalse"],
  39961. messageSends: ["inlinedSend:withBlock:", "new"]
  39962. }),
  39963. $globals.IRSendInliner);
  39964. $core.addMethod(
  39965. $core.method({
  39966. selector: "ifFalse:ifTrue:",
  39967. protocol: 'inlining',
  39968. fn: function (anIRInstruction,anotherIRInstruction){
  39969. var self=this;
  39970. return $core.withContext(function($ctx1) {
  39971. return self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  39972. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  39973. },
  39974. args: ["anIRInstruction", "anotherIRInstruction"],
  39975. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  39976. referencedClasses: [],
  39977. messageSends: ["perform:withArguments:"]
  39978. }),
  39979. $globals.IRSendInliner);
  39980. $core.addMethod(
  39981. $core.method({
  39982. selector: "ifNil:",
  39983. protocol: 'inlining',
  39984. fn: function (anIRInstruction){
  39985. var self=this;
  39986. return $core.withContext(function($ctx1) {
  39987. var $1,$3,$5,$6,$4,$2;
  39988. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  39989. $ctx1.sendIdx["new"]=1;
  39990. $3=$recv($globals.IRClosure)._new();
  39991. $ctx1.sendIdx["new"]=2;
  39992. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  39993. $5=$recv($globals.IRBlockSequence)._new();
  39994. $recv($5)._add_($recv(self._send())._receiver());
  39995. $6=$recv($5)._yourself();
  39996. $ctx1.sendIdx["yourself"]=1;
  39997. $4=$6;
  39998. $recv($3)._add_($4);
  39999. $ctx1.sendIdx["add:"]=1;
  40000. $2=$recv($3)._yourself();
  40001. return self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  40002. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40003. },
  40004. args: ["anIRInstruction"],
  40005. 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)",
  40006. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  40007. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  40008. }),
  40009. $globals.IRSendInliner);
  40010. $core.addMethod(
  40011. $core.method({
  40012. selector: "ifNil:ifNotNil:",
  40013. protocol: 'inlining',
  40014. fn: function (anIRInstruction,anotherIRInstruction){
  40015. var self=this;
  40016. return $core.withContext(function($ctx1) {
  40017. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  40018. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40019. },
  40020. args: ["anIRInstruction", "anotherIRInstruction"],
  40021. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40022. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40023. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40024. }),
  40025. $globals.IRSendInliner);
  40026. $core.addMethod(
  40027. $core.method({
  40028. selector: "ifNotNil:",
  40029. protocol: 'inlining',
  40030. fn: function (anIRInstruction){
  40031. var self=this;
  40032. return $core.withContext(function($ctx1) {
  40033. var $1,$3,$5,$6,$4,$2;
  40034. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  40035. $ctx1.sendIdx["new"]=1;
  40036. $3=$recv($globals.IRClosure)._new();
  40037. $ctx1.sendIdx["new"]=2;
  40038. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  40039. $5=$recv($globals.IRBlockSequence)._new();
  40040. $recv($5)._add_($recv(self._send())._receiver());
  40041. $6=$recv($5)._yourself();
  40042. $ctx1.sendIdx["yourself"]=1;
  40043. $4=$6;
  40044. $recv($3)._add_($4);
  40045. $ctx1.sendIdx["add:"]=1;
  40046. $2=$recv($3)._yourself();
  40047. return self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  40048. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40049. },
  40050. args: ["anIRInstruction"],
  40051. 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",
  40052. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  40053. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  40054. }),
  40055. $globals.IRSendInliner);
  40056. $core.addMethod(
  40057. $core.method({
  40058. selector: "ifNotNil:ifNil:",
  40059. protocol: 'inlining',
  40060. fn: function (anIRInstruction,anotherIRInstruction){
  40061. var self=this;
  40062. return $core.withContext(function($ctx1) {
  40063. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  40064. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40065. },
  40066. args: ["anIRInstruction", "anotherIRInstruction"],
  40067. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  40068. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40069. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40070. }),
  40071. $globals.IRSendInliner);
  40072. $core.addMethod(
  40073. $core.method({
  40074. selector: "ifTrue:",
  40075. protocol: 'inlining',
  40076. fn: function (anIRInstruction){
  40077. var self=this;
  40078. return $core.withContext(function($ctx1) {
  40079. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  40080. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40081. },
  40082. args: ["anIRInstruction"],
  40083. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  40084. referencedClasses: ["IRInlinedIfTrue"],
  40085. messageSends: ["inlinedSend:withBlock:", "new"]
  40086. }),
  40087. $globals.IRSendInliner);
  40088. $core.addMethod(
  40089. $core.method({
  40090. selector: "ifTrue:ifFalse:",
  40091. protocol: 'inlining',
  40092. fn: function (anIRInstruction,anotherIRInstruction){
  40093. var self=this;
  40094. return $core.withContext(function($ctx1) {
  40095. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  40096. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40097. },
  40098. args: ["anIRInstruction", "anotherIRInstruction"],
  40099. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40100. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  40101. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40102. }),
  40103. $globals.IRSendInliner);
  40104. $core.addMethod(
  40105. $core.method({
  40106. selector: "inlineClosure:",
  40107. protocol: 'inlining',
  40108. fn: function (anIRClosure){
  40109. var self=this;
  40110. var inlinedClosure,sequence,statements;
  40111. return $core.withContext(function($ctx1) {
  40112. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  40113. inlinedClosure=self._inlinedClosure();
  40114. $1=inlinedClosure;
  40115. $2=$recv(anIRClosure)._scope();
  40116. $ctx1.sendIdx["scope"]=1;
  40117. $recv($1)._scope_($2);
  40118. $ctx1.sendIdx["scope:"]=1;
  40119. $recv($1)._parent_($recv(anIRClosure)._parent());
  40120. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  40121. return $core.withContext(function($ctx2) {
  40122. return $recv(inlinedClosure)._add_(each);
  40123. $ctx2.sendIdx["add:"]=1;
  40124. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40125. }));
  40126. $ctx1.sendIdx["do:"]=1;
  40127. sequence=self._inlinedSequence();
  40128. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  40129. return $core.withContext(function($ctx2) {
  40130. $3=inlinedClosure;
  40131. $5=$recv($globals.IRTempDeclaration)._new();
  40132. $ctx2.sendIdx["new"]=1;
  40133. $recv($5)._name_(each);
  40134. $ctx2.sendIdx["name:"]=1;
  40135. $6=$recv($5)._yourself();
  40136. $ctx2.sendIdx["yourself"]=1;
  40137. $4=$6;
  40138. $recv($3)._add_($4);
  40139. $ctx2.sendIdx["add:"]=2;
  40140. $7=sequence;
  40141. $9=$recv($globals.IRAssignment)._new();
  40142. $ctx2.sendIdx["new"]=2;
  40143. $11=$recv($globals.IRVariable)._new();
  40144. $ctx2.sendIdx["new"]=3;
  40145. $13=$recv($globals.AliasVar)._new();
  40146. $ctx2.sendIdx["new"]=4;
  40147. $14=$recv(inlinedClosure)._scope();
  40148. $ctx2.sendIdx["scope"]=2;
  40149. $recv($13)._scope_($14);
  40150. $ctx2.sendIdx["scope:"]=2;
  40151. $recv($13)._name_(each);
  40152. $ctx2.sendIdx["name:"]=2;
  40153. $15=$recv($13)._yourself();
  40154. $ctx2.sendIdx["yourself"]=2;
  40155. $12=$15;
  40156. $10=$recv($11)._variable_($12);
  40157. $ctx2.sendIdx["variable:"]=1;
  40158. $recv($9)._add_($10);
  40159. $ctx2.sendIdx["add:"]=4;
  40160. $17=$recv($globals.IRVariable)._new();
  40161. $ctx2.sendIdx["new"]=5;
  40162. $19=$recv($globals.AliasVar)._new();
  40163. $recv($19)._scope_($recv(inlinedClosure)._scope());
  40164. $recv($19)._name_("$receiver");
  40165. $20=$recv($19)._yourself();
  40166. $ctx2.sendIdx["yourself"]=3;
  40167. $18=$20;
  40168. $16=$recv($17)._variable_($18);
  40169. $recv($9)._add_($16);
  40170. $ctx2.sendIdx["add:"]=5;
  40171. $8=$recv($9)._yourself();
  40172. return $recv($7)._add_($8);
  40173. $ctx2.sendIdx["add:"]=3;
  40174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40175. }));
  40176. $ctx1.sendIdx["do:"]=2;
  40177. $recv(inlinedClosure)._add_(sequence);
  40178. $ctx1.sendIdx["add:"]=6;
  40179. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  40180. $recv(statements)._ifNotEmpty_((function(){
  40181. return $core.withContext(function($ctx2) {
  40182. $recv($recv(statements)._allButLast())._do_((function(each){
  40183. return $core.withContext(function($ctx3) {
  40184. return $recv(sequence)._add_(each);
  40185. $ctx3.sendIdx["add:"]=7;
  40186. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  40187. }));
  40188. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  40189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40190. }));
  40191. return inlinedClosure;
  40192. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  40193. },
  40194. args: ["anIRClosure"],
  40195. 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",
  40196. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  40197. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  40198. }),
  40199. $globals.IRSendInliner);
  40200. $core.addMethod(
  40201. $core.method({
  40202. selector: "inlineSend:",
  40203. protocol: 'inlining',
  40204. fn: function (anIRSend){
  40205. var self=this;
  40206. return $core.withContext(function($ctx1) {
  40207. var $2,$1;
  40208. self._send_(anIRSend);
  40209. $2=self._send();
  40210. $ctx1.sendIdx["send"]=1;
  40211. $1=$recv($2)._selector();
  40212. return self._perform_withArguments_($1,$recv(self._send())._arguments());
  40213. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  40214. },
  40215. args: ["anIRSend"],
  40216. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  40217. referencedClasses: [],
  40218. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  40219. }),
  40220. $globals.IRSendInliner);
  40221. $core.addMethod(
  40222. $core.method({
  40223. selector: "inlineSend:andReplace:",
  40224. protocol: 'private',
  40225. fn: function (anIRSend,anIRInstruction){
  40226. var self=this;
  40227. return $core.withContext(function($ctx1) {
  40228. $recv(anIRInstruction)._replaceWith_(anIRSend);
  40229. return self._inlineSend_(anIRSend);
  40230. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40231. },
  40232. args: ["anIRSend", "anIRInstruction"],
  40233. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  40234. referencedClasses: [],
  40235. messageSends: ["replaceWith:", "inlineSend:"]
  40236. }),
  40237. $globals.IRSendInliner);
  40238. $core.addMethod(
  40239. $core.method({
  40240. selector: "inlinedClosure",
  40241. protocol: 'factory',
  40242. fn: function (){
  40243. var self=this;
  40244. return $core.withContext(function($ctx1) {
  40245. return $recv($globals.IRInlinedClosure)._new();
  40246. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  40247. },
  40248. args: [],
  40249. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  40250. referencedClasses: ["IRInlinedClosure"],
  40251. messageSends: ["new"]
  40252. }),
  40253. $globals.IRSendInliner);
  40254. $core.addMethod(
  40255. $core.method({
  40256. selector: "inlinedSend:withBlock:",
  40257. protocol: 'private',
  40258. fn: function (inlinedSend,anIRInstruction){
  40259. var self=this;
  40260. var inlinedClosure;
  40261. return $core.withContext(function($ctx1) {
  40262. var $1,$2,$4,$3,$5;
  40263. $1=$recv(anIRInstruction)._isClosure();
  40264. if(!$core.assert($1)){
  40265. self._inliningError_("Message argument should be a block");
  40266. $ctx1.sendIdx["inliningError:"]=1;
  40267. }
  40268. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  40269. if(!$core.assert($2)){
  40270. self._inliningError_("Inlined block should have zero argument");
  40271. }
  40272. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  40273. $4=self._send();
  40274. $ctx1.sendIdx["send"]=1;
  40275. $3=$recv($4)._receiver();
  40276. $recv(inlinedSend)._add_($3);
  40277. $ctx1.sendIdx["add:"]=1;
  40278. $recv(inlinedSend)._add_(inlinedClosure);
  40279. $recv(self._send())._replaceWith_(inlinedSend);
  40280. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  40281. $ctx1.sendIdx["internalVariables"]=1;
  40282. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  40283. return inlinedSend;
  40284. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  40285. },
  40286. args: ["inlinedSend", "anIRInstruction"],
  40287. 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",
  40288. referencedClasses: [],
  40289. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40290. }),
  40291. $globals.IRSendInliner);
  40292. $core.addMethod(
  40293. $core.method({
  40294. selector: "inlinedSend:withBlock:withBlock:",
  40295. protocol: 'private',
  40296. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  40297. var self=this;
  40298. var inlinedClosure1,inlinedClosure2;
  40299. return $core.withContext(function($ctx1) {
  40300. var $1,$2,$3,$4,$6,$5,$7;
  40301. $1=$recv(anIRInstruction)._isClosure();
  40302. $ctx1.sendIdx["isClosure"]=1;
  40303. if(!$core.assert($1)){
  40304. self._inliningError_("Message argument should be a block");
  40305. $ctx1.sendIdx["inliningError:"]=1;
  40306. }
  40307. $2=$recv(anotherIRInstruction)._isClosure();
  40308. if(!$core.assert($2)){
  40309. self._inliningError_("Message argument should be a block");
  40310. }
  40311. $3=self._translator();
  40312. $ctx1.sendIdx["translator"]=1;
  40313. $4=self._inlineClosure_(anIRInstruction);
  40314. $ctx1.sendIdx["inlineClosure:"]=1;
  40315. inlinedClosure1=$recv($3)._visit_($4);
  40316. $ctx1.sendIdx["visit:"]=1;
  40317. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  40318. $6=self._send();
  40319. $ctx1.sendIdx["send"]=1;
  40320. $5=$recv($6)._receiver();
  40321. $recv(inlinedSend)._add_($5);
  40322. $ctx1.sendIdx["add:"]=1;
  40323. $recv(inlinedSend)._add_(inlinedClosure1);
  40324. $ctx1.sendIdx["add:"]=2;
  40325. $recv(inlinedSend)._add_(inlinedClosure2);
  40326. $recv(self._send())._replaceWith_(inlinedSend);
  40327. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  40328. $ctx1.sendIdx["internalVariables"]=1;
  40329. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  40330. return inlinedSend;
  40331. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  40332. },
  40333. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  40334. 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",
  40335. referencedClasses: [],
  40336. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40337. }),
  40338. $globals.IRSendInliner);
  40339. $core.addMethod(
  40340. $core.method({
  40341. selector: "inlinedSequence",
  40342. protocol: 'factory',
  40343. fn: function (){
  40344. var self=this;
  40345. return $core.withContext(function($ctx1) {
  40346. return $recv($globals.IRInlinedSequence)._new();
  40347. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  40348. },
  40349. args: [],
  40350. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  40351. referencedClasses: ["IRInlinedSequence"],
  40352. messageSends: ["new"]
  40353. }),
  40354. $globals.IRSendInliner);
  40355. $core.addMethod(
  40356. $core.method({
  40357. selector: "inliningError:",
  40358. protocol: 'error handling',
  40359. fn: function (aString){
  40360. var self=this;
  40361. return $core.withContext(function($ctx1) {
  40362. $recv($globals.InliningError)._signal_(aString);
  40363. return self;
  40364. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  40365. },
  40366. args: ["aString"],
  40367. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  40368. referencedClasses: ["InliningError"],
  40369. messageSends: ["signal:"]
  40370. }),
  40371. $globals.IRSendInliner);
  40372. $core.addMethod(
  40373. $core.method({
  40374. selector: "send",
  40375. protocol: 'accessing',
  40376. fn: function (){
  40377. var self=this;
  40378. return self["@send"];
  40379. },
  40380. args: [],
  40381. source: "send\x0a\x09^ send",
  40382. referencedClasses: [],
  40383. messageSends: []
  40384. }),
  40385. $globals.IRSendInliner);
  40386. $core.addMethod(
  40387. $core.method({
  40388. selector: "send:",
  40389. protocol: 'accessing',
  40390. fn: function (anIRSend){
  40391. var self=this;
  40392. self["@send"]=anIRSend;
  40393. return self;
  40394. },
  40395. args: ["anIRSend"],
  40396. source: "send: anIRSend\x0a\x09send := anIRSend",
  40397. referencedClasses: [],
  40398. messageSends: []
  40399. }),
  40400. $globals.IRSendInliner);
  40401. $core.addMethod(
  40402. $core.method({
  40403. selector: "translator",
  40404. protocol: 'accessing',
  40405. fn: function (){
  40406. var self=this;
  40407. return self["@translator"];
  40408. },
  40409. args: [],
  40410. source: "translator\x0a\x09^ translator",
  40411. referencedClasses: [],
  40412. messageSends: []
  40413. }),
  40414. $globals.IRSendInliner);
  40415. $core.addMethod(
  40416. $core.method({
  40417. selector: "translator:",
  40418. protocol: 'accessing',
  40419. fn: function (anASTTranslator){
  40420. var self=this;
  40421. self["@translator"]=anASTTranslator;
  40422. return self;
  40423. },
  40424. args: ["anASTTranslator"],
  40425. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  40426. referencedClasses: [],
  40427. messageSends: []
  40428. }),
  40429. $globals.IRSendInliner);
  40430. $core.addMethod(
  40431. $core.method({
  40432. selector: "inlinedSelectors",
  40433. protocol: 'accessing',
  40434. fn: function (){
  40435. var self=this;
  40436. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  40437. },
  40438. args: [],
  40439. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  40440. referencedClasses: [],
  40441. messageSends: []
  40442. }),
  40443. $globals.IRSendInliner.klass);
  40444. $core.addMethod(
  40445. $core.method({
  40446. selector: "shouldInline:",
  40447. protocol: 'accessing',
  40448. fn: function (anIRSend){
  40449. var self=this;
  40450. return $core.withContext(function($ctx1) {
  40451. var $1;
  40452. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  40453. if(!$core.assert($1)){
  40454. return false;
  40455. }
  40456. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  40457. return $core.withContext(function($ctx2) {
  40458. return $recv(each)._isClosure();
  40459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40460. }));
  40461. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.klass)});
  40462. },
  40463. args: ["anIRSend"],
  40464. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  40465. referencedClasses: [],
  40466. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  40467. }),
  40468. $globals.IRSendInliner.klass);
  40469. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['target'], 'Compiler-Inlining');
  40470. $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};";
  40471. $core.addMethod(
  40472. $core.method({
  40473. selector: "inlineAssignment:",
  40474. protocol: 'inlining',
  40475. fn: function (anIRAssignment){
  40476. var self=this;
  40477. return $core.withContext(function($ctx1) {
  40478. self._target_($recv(anIRAssignment)._left());
  40479. return self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  40480. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  40481. },
  40482. args: ["anIRAssignment"],
  40483. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  40484. referencedClasses: [],
  40485. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  40486. }),
  40487. $globals.IRAssignmentInliner);
  40488. $core.addMethod(
  40489. $core.method({
  40490. selector: "inlineClosure:",
  40491. protocol: 'inlining',
  40492. fn: function (anIRClosure){
  40493. var self=this;
  40494. var closure,sequence,statements;
  40495. return $core.withContext(function($ctx1) {
  40496. var $1,$2,$3,$5,$4;
  40497. closure=(
  40498. $ctx1.supercall = true,
  40499. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40500. $ctx1.supercall = false;
  40501. sequence=$recv(closure)._sequence();
  40502. statements=$recv(sequence)._dagChildren();
  40503. $recv(statements)._ifNotEmpty_((function(){
  40504. var final;
  40505. return $core.withContext(function($ctx2) {
  40506. final=$recv(statements)._last();
  40507. final;
  40508. $1=$recv(final)._yieldsValue();
  40509. if($core.assert($1)){
  40510. $2=sequence;
  40511. $3=final;
  40512. $5=$recv($globals.IRAssignment)._new();
  40513. $recv($5)._add_(self._target());
  40514. $ctx2.sendIdx["add:"]=1;
  40515. $recv($5)._add_($recv(final)._copy());
  40516. $4=$recv($5)._yourself();
  40517. return $recv($2)._replace_with_($3,$4);
  40518. }
  40519. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  40520. }));
  40521. return closure;
  40522. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  40523. },
  40524. args: ["anIRClosure"],
  40525. 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",
  40526. referencedClasses: ["IRAssignment"],
  40527. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  40528. }),
  40529. $globals.IRAssignmentInliner);
  40530. $core.addMethod(
  40531. $core.method({
  40532. selector: "target",
  40533. protocol: 'accessing',
  40534. fn: function (){
  40535. var self=this;
  40536. return self["@target"];
  40537. },
  40538. args: [],
  40539. source: "target\x0a\x09^ target",
  40540. referencedClasses: [],
  40541. messageSends: []
  40542. }),
  40543. $globals.IRAssignmentInliner);
  40544. $core.addMethod(
  40545. $core.method({
  40546. selector: "target:",
  40547. protocol: 'accessing',
  40548. fn: function (anObject){
  40549. var self=this;
  40550. self["@target"]=anObject;
  40551. return self;
  40552. },
  40553. args: ["anObject"],
  40554. source: "target: anObject\x0a\x09target := anObject",
  40555. referencedClasses: [],
  40556. messageSends: []
  40557. }),
  40558. $globals.IRAssignmentInliner);
  40559. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  40560. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  40561. $core.addMethod(
  40562. $core.method({
  40563. selector: "inlineClosure:",
  40564. protocol: 'inlining',
  40565. fn: function (anIRClosure){
  40566. var self=this;
  40567. var closure,sequence,statements;
  40568. return $core.withContext(function($ctx1) {
  40569. var $1,$2,$3,$5,$4;
  40570. closure=(
  40571. $ctx1.supercall = true,
  40572. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40573. $ctx1.supercall = false;
  40574. sequence=$recv(closure)._sequence();
  40575. statements=$recv(sequence)._dagChildren();
  40576. $recv(statements)._ifNotEmpty_((function(){
  40577. var final;
  40578. return $core.withContext(function($ctx2) {
  40579. final=$recv(statements)._last();
  40580. final;
  40581. $1=$recv(final)._yieldsValue();
  40582. if($core.assert($1)){
  40583. $2=sequence;
  40584. $3=final;
  40585. $5=$recv($globals.IRReturn)._new();
  40586. $recv($5)._add_($recv(final)._copy());
  40587. $4=$recv($5)._yourself();
  40588. return $recv($2)._replace_with_($3,$4);
  40589. }
  40590. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  40591. }));
  40592. return closure;
  40593. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  40594. },
  40595. args: ["anIRClosure"],
  40596. 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",
  40597. referencedClasses: ["IRReturn"],
  40598. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  40599. }),
  40600. $globals.IRReturnInliner);
  40601. $core.addMethod(
  40602. $core.method({
  40603. selector: "inlineReturn:",
  40604. protocol: 'inlining',
  40605. fn: function (anIRReturn){
  40606. var self=this;
  40607. return $core.withContext(function($ctx1) {
  40608. return self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  40609. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  40610. },
  40611. args: ["anIRReturn"],
  40612. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  40613. referencedClasses: [],
  40614. messageSends: ["inlineSend:andReplace:", "expression"]
  40615. }),
  40616. $globals.IRReturnInliner);
  40617. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  40618. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  40619. $core.addMethod(
  40620. $core.method({
  40621. selector: "inliner",
  40622. protocol: 'compiling',
  40623. fn: function (){
  40624. var self=this;
  40625. return $core.withContext(function($ctx1) {
  40626. return $recv($globals.IRInliner)._new();
  40627. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  40628. },
  40629. args: [],
  40630. source: "inliner\x0a\x09^ IRInliner new",
  40631. referencedClasses: ["IRInliner"],
  40632. messageSends: ["new"]
  40633. }),
  40634. $globals.InliningCodeGenerator);
  40635. $core.addMethod(
  40636. $core.method({
  40637. selector: "irTranslatorClass",
  40638. protocol: 'compiling',
  40639. fn: function (){
  40640. var self=this;
  40641. return $globals.IRInliningJSTranslator;
  40642. },
  40643. args: [],
  40644. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  40645. referencedClasses: ["IRInliningJSTranslator"],
  40646. messageSends: []
  40647. }),
  40648. $globals.InliningCodeGenerator);
  40649. $core.addMethod(
  40650. $core.method({
  40651. selector: "preInliner",
  40652. protocol: 'compiling',
  40653. fn: function (){
  40654. var self=this;
  40655. return $core.withContext(function($ctx1) {
  40656. return $recv($globals.ASTPreInliner)._new();
  40657. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  40658. },
  40659. args: [],
  40660. source: "preInliner\x0a\x09^ ASTPreInliner new",
  40661. referencedClasses: ["ASTPreInliner"],
  40662. messageSends: ["new"]
  40663. }),
  40664. $globals.InliningCodeGenerator);
  40665. $core.addMethod(
  40666. $core.method({
  40667. selector: "transformersDictionary",
  40668. protocol: 'compiling',
  40669. fn: function (){
  40670. var self=this;
  40671. return $core.withContext(function($ctx1) {
  40672. var $1;
  40673. $1=(
  40674. $ctx1.supercall = true,
  40675. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($recv(self), []));
  40676. $ctx1.supercall = false;
  40677. $recv($1)._at_put_("3000-inlinerTagging",self._preInliner());
  40678. $ctx1.sendIdx["at:put:"]=1;
  40679. $recv($1)._at_put_("6000-inliner",self._inliner());
  40680. $ctx1.sendIdx["at:put:"]=2;
  40681. $recv($1)._at_put_("8000-irToJs",self._irTranslator());
  40682. return $recv($1)._yourself();
  40683. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  40684. },
  40685. args: [],
  40686. source: "transformersDictionary\x0a\x09^ super transformersDictionary\x0a\x09\x09at: '3000-inlinerTagging' put: self preInliner;\x0a\x09\x09at: '6000-inliner' put: self inliner;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself",
  40687. referencedClasses: [],
  40688. messageSends: ["at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  40689. }),
  40690. $globals.InliningCodeGenerator);
  40691. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Inlining');
  40692. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  40693. $core.addClass('InliningSemanticAnalyzer', $globals.SemanticAnalyzer, [], 'Compiler-Inlining');
  40694. $core.addMethod(
  40695. $core.method({
  40696. selector: "visitSendNode:",
  40697. protocol: 'visiting',
  40698. fn: function (aNode){
  40699. var self=this;
  40700. return $core.withContext(function($ctx1) {
  40701. var $1,$2,$3,$receiver;
  40702. $1=$recv(aNode)._superSend();
  40703. if(!$core.assert($1)){
  40704. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  40705. if($core.assert($2)){
  40706. $recv(aNode)._shouldBeInlined_(true);
  40707. $3=$recv(aNode)._receiver();
  40708. if(($receiver = $3) == null || $receiver.isNil){
  40709. $3;
  40710. } else {
  40711. var receiver;
  40712. receiver=$receiver;
  40713. $recv(receiver)._shouldBeAliased_(true);
  40714. }
  40715. }
  40716. }
  40717. (
  40718. $ctx1.supercall = true,
  40719. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  40720. $ctx1.supercall = false;
  40721. return self;
  40722. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  40723. },
  40724. args: ["aNode"],
  40725. 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",
  40726. referencedClasses: ["IRSendInliner"],
  40727. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  40728. }),
  40729. $globals.InliningSemanticAnalyzer);
  40730. $core.addMethod(
  40731. $core.method({
  40732. selector: "asInlinedBlockResult",
  40733. protocol: '*Compiler-Inlining',
  40734. fn: function (){
  40735. var self=this;
  40736. return $core.withContext(function($ctx1) {
  40737. return self._expression();
  40738. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  40739. },
  40740. args: [],
  40741. source: "asInlinedBlockResult\x0a\x09^ self expression",
  40742. referencedClasses: [],
  40743. messageSends: ["expression"]
  40744. }),
  40745. $globals.IRBlockReturn);
  40746. $core.addMethod(
  40747. $core.method({
  40748. selector: "asInlinedBlockResult",
  40749. protocol: '*Compiler-Inlining',
  40750. fn: function (){
  40751. var self=this;
  40752. return self;
  40753. },
  40754. args: [],
  40755. source: "asInlinedBlockResult\x0a\x09^ self",
  40756. referencedClasses: [],
  40757. messageSends: []
  40758. }),
  40759. $globals.IRInstruction);
  40760. });
  40761. 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";
  40762. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  40763. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  40764. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  40765. $core.addPackage('Compiler-Interpreter');
  40766. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  40767. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40768. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  40769. $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`).";
  40770. $core.addMethod(
  40771. $core.method({
  40772. selector: "applyTo:arguments:",
  40773. protocol: 'evaluating',
  40774. fn: function (anObject,aCollection){
  40775. var self=this;
  40776. return $core.withContext(function($ctx1) {
  40777. self._interpreterError();
  40778. return self;
  40779. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  40780. },
  40781. args: ["anObject", "aCollection"],
  40782. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  40783. referencedClasses: [],
  40784. messageSends: ["interpreterError"]
  40785. }),
  40786. $globals.AIBlockClosure);
  40787. $core.addMethod(
  40788. $core.method({
  40789. selector: "compiledSource",
  40790. protocol: 'accessing',
  40791. fn: function (){
  40792. var self=this;
  40793. return "[ AST Block closure ]";
  40794. },
  40795. args: [],
  40796. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  40797. referencedClasses: [],
  40798. messageSends: []
  40799. }),
  40800. $globals.AIBlockClosure);
  40801. $core.addMethod(
  40802. $core.method({
  40803. selector: "currySelf",
  40804. protocol: 'converting',
  40805. fn: function (){
  40806. var self=this;
  40807. return $core.withContext(function($ctx1) {
  40808. self._interpreterError();
  40809. return self;
  40810. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  40811. },
  40812. args: [],
  40813. source: "currySelf\x0a\x09self interpreterError",
  40814. referencedClasses: [],
  40815. messageSends: ["interpreterError"]
  40816. }),
  40817. $globals.AIBlockClosure);
  40818. $core.addMethod(
  40819. $core.method({
  40820. selector: "initializeWithContext:node:",
  40821. protocol: 'initialization',
  40822. fn: function (aContext,aNode){
  40823. var self=this;
  40824. self["@node"]=aNode;
  40825. self["@outerContext"]=aContext;
  40826. return self;
  40827. },
  40828. args: ["aContext", "aNode"],
  40829. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  40830. referencedClasses: [],
  40831. messageSends: []
  40832. }),
  40833. $globals.AIBlockClosure);
  40834. $core.addMethod(
  40835. $core.method({
  40836. selector: "interpreterError",
  40837. protocol: 'error handling',
  40838. fn: function (){
  40839. var self=this;
  40840. return $core.withContext(function($ctx1) {
  40841. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  40842. return self;
  40843. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  40844. },
  40845. args: [],
  40846. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  40847. referencedClasses: ["ASTInterpreterError"],
  40848. messageSends: ["signal:"]
  40849. }),
  40850. $globals.AIBlockClosure);
  40851. $core.addMethod(
  40852. $core.method({
  40853. selector: "numArgs",
  40854. protocol: 'accessing',
  40855. fn: function (){
  40856. var self=this;
  40857. return $core.withContext(function($ctx1) {
  40858. return $recv($recv(self["@node"])._temps())._size();
  40859. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  40860. },
  40861. args: [],
  40862. source: "numArgs\x0a\x09^ node temps size",
  40863. referencedClasses: [],
  40864. messageSends: ["size", "temps"]
  40865. }),
  40866. $globals.AIBlockClosure);
  40867. $core.addMethod(
  40868. $core.method({
  40869. selector: "value",
  40870. protocol: 'evaluating',
  40871. fn: function (){
  40872. var self=this;
  40873. return $core.withContext(function($ctx1) {
  40874. return self._valueWithPossibleArguments_([]);
  40875. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  40876. },
  40877. args: [],
  40878. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  40879. referencedClasses: [],
  40880. messageSends: ["valueWithPossibleArguments:"]
  40881. }),
  40882. $globals.AIBlockClosure);
  40883. $core.addMethod(
  40884. $core.method({
  40885. selector: "value:",
  40886. protocol: 'evaluating',
  40887. fn: function (anArgument){
  40888. var self=this;
  40889. return $core.withContext(function($ctx1) {
  40890. return self._valueWithPossibleArguments_([anArgument]);
  40891. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  40892. },
  40893. args: ["anArgument"],
  40894. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  40895. referencedClasses: [],
  40896. messageSends: ["valueWithPossibleArguments:"]
  40897. }),
  40898. $globals.AIBlockClosure);
  40899. $core.addMethod(
  40900. $core.method({
  40901. selector: "value:value:",
  40902. protocol: 'evaluating',
  40903. fn: function (firstArgument,secondArgument){
  40904. var self=this;
  40905. return $core.withContext(function($ctx1) {
  40906. return self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  40907. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  40908. },
  40909. args: ["firstArgument", "secondArgument"],
  40910. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  40911. referencedClasses: [],
  40912. messageSends: ["valueWithPossibleArguments:"]
  40913. }),
  40914. $globals.AIBlockClosure);
  40915. $core.addMethod(
  40916. $core.method({
  40917. selector: "value:value:value:",
  40918. protocol: 'evaluating',
  40919. fn: function (firstArgument,secondArgument,thirdArgument){
  40920. var self=this;
  40921. return $core.withContext(function($ctx1) {
  40922. return self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  40923. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  40924. },
  40925. args: ["firstArgument", "secondArgument", "thirdArgument"],
  40926. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  40927. referencedClasses: [],
  40928. messageSends: ["valueWithPossibleArguments:"]
  40929. }),
  40930. $globals.AIBlockClosure);
  40931. $core.addMethod(
  40932. $core.method({
  40933. selector: "valueWithPossibleArguments:",
  40934. protocol: 'evaluating',
  40935. fn: function (aCollection){
  40936. var self=this;
  40937. var context,sequenceNode;
  40938. return $core.withContext(function($ctx1) {
  40939. var $1,$2,$3;
  40940. context=$recv(self["@outerContext"])._newInnerContext();
  40941. $1=$recv($recv($recv(self["@node"])._dagChildren())._first())._copy();
  40942. $recv($1)._parent_(nil);
  40943. sequenceNode=$recv($1)._yourself();
  40944. $recv($recv(sequenceNode)._temps())._do_((function(each){
  40945. return $core.withContext(function($ctx2) {
  40946. return $recv(context)._defineLocal_(each);
  40947. $ctx2.sendIdx["defineLocal:"]=1;
  40948. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40949. }));
  40950. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  40951. return $core.withContext(function($ctx2) {
  40952. $recv(context)._defineLocal_(each);
  40953. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  40954. return nil;
  40955. })));
  40956. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  40957. }));
  40958. $2=$recv(context)._interpreter();
  40959. $ctx1.sendIdx["interpreter"]=1;
  40960. $recv($2)._node_(sequenceNode);
  40961. $recv($2)._enterNode();
  40962. $recv($2)._proceed();
  40963. $3=$recv(self["@outerContext"])._interpreter();
  40964. $ctx1.sendIdx["interpreter"]=2;
  40965. $recv($3)._setNonLocalReturnFromContext_(context);
  40966. return $recv($recv(context)._interpreter())._pop();
  40967. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  40968. },
  40969. args: ["aCollection"],
  40970. 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",
  40971. referencedClasses: [],
  40972. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  40973. }),
  40974. $globals.AIBlockClosure);
  40975. $core.addMethod(
  40976. $core.method({
  40977. selector: "forContext:node:",
  40978. protocol: 'instance creation',
  40979. fn: function (aContext,aNode){
  40980. var self=this;
  40981. return $core.withContext(function($ctx1) {
  40982. var $1;
  40983. $1=self._new();
  40984. $recv($1)._initializeWithContext_node_(aContext,aNode);
  40985. return $recv($1)._yourself();
  40986. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  40987. },
  40988. args: ["aContext", "aNode"],
  40989. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  40990. referencedClasses: [],
  40991. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  40992. }),
  40993. $globals.AIBlockClosure.klass);
  40994. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  40995. $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)";
  40996. $core.addMethod(
  40997. $core.method({
  40998. selector: "arguments",
  40999. protocol: 'interpreting',
  41000. fn: function (){
  41001. var self=this;
  41002. return $core.withContext(function($ctx1) {
  41003. return $recv($recv(self._ast())._arguments())._collect_((function(each){
  41004. return $core.withContext(function($ctx2) {
  41005. return self._localAt_ifAbsent_(each,(function(){
  41006. return $core.withContext(function($ctx3) {
  41007. return self._error_("Argument not in context");
  41008. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41009. }));
  41010. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41011. }));
  41012. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  41013. },
  41014. args: [],
  41015. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  41016. referencedClasses: [],
  41017. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  41018. }),
  41019. $globals.AIContext);
  41020. $core.addMethod(
  41021. $core.method({
  41022. selector: "ast",
  41023. protocol: 'interpreting',
  41024. fn: function (){
  41025. var self=this;
  41026. return $core.withContext(function($ctx1) {
  41027. var $1,$2,$3,$receiver;
  41028. $1=self._isBlockContext();
  41029. if($core.assert($1)){
  41030. $2=self._outerContext();
  41031. if(($receiver = $2) == null || $receiver.isNil){
  41032. return $2;
  41033. } else {
  41034. var context;
  41035. context=$receiver;
  41036. return $recv(context)._ast();
  41037. }
  41038. }
  41039. $3=self["@ast"];
  41040. if(($receiver = $3) == null || $receiver.isNil){
  41041. self._initializeAST();
  41042. } else {
  41043. $3;
  41044. }
  41045. return self["@ast"];
  41046. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  41047. },
  41048. args: [],
  41049. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  41050. referencedClasses: [],
  41051. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  41052. }),
  41053. $globals.AIContext);
  41054. $core.addMethod(
  41055. $core.method({
  41056. selector: "basicLocalAt:",
  41057. protocol: 'private',
  41058. fn: function (aString){
  41059. var self=this;
  41060. return $core.withContext(function($ctx1) {
  41061. return $recv(self._locals())._at_(aString);
  41062. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  41063. },
  41064. args: ["aString"],
  41065. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  41066. referencedClasses: [],
  41067. messageSends: ["at:", "locals"]
  41068. }),
  41069. $globals.AIContext);
  41070. $core.addMethod(
  41071. $core.method({
  41072. selector: "basicLocalAt:put:",
  41073. protocol: 'private',
  41074. fn: function (aString,anObject){
  41075. var self=this;
  41076. return $core.withContext(function($ctx1) {
  41077. $recv(self._locals())._at_put_(aString,anObject);
  41078. return self;
  41079. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  41080. },
  41081. args: ["aString", "anObject"],
  41082. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  41083. referencedClasses: [],
  41084. messageSends: ["at:put:", "locals"]
  41085. }),
  41086. $globals.AIContext);
  41087. $core.addMethod(
  41088. $core.method({
  41089. selector: "basicReceiver",
  41090. protocol: 'interpreting',
  41091. fn: function (){
  41092. var self=this;
  41093. return $core.withContext(function($ctx1) {
  41094. return self._localAt_("self");
  41095. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  41096. },
  41097. args: [],
  41098. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  41099. referencedClasses: [],
  41100. messageSends: ["localAt:"]
  41101. }),
  41102. $globals.AIContext);
  41103. $core.addMethod(
  41104. $core.method({
  41105. selector: "defineLocal:",
  41106. protocol: 'accessing',
  41107. fn: function (aString){
  41108. var self=this;
  41109. return $core.withContext(function($ctx1) {
  41110. $recv(self._locals())._at_put_(aString,nil);
  41111. return self;
  41112. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  41113. },
  41114. args: ["aString"],
  41115. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  41116. referencedClasses: [],
  41117. messageSends: ["at:put:", "locals"]
  41118. }),
  41119. $globals.AIContext);
  41120. $core.addMethod(
  41121. $core.method({
  41122. selector: "evaluate:on:",
  41123. protocol: 'evaluating',
  41124. fn: function (aString,anEvaluator){
  41125. var self=this;
  41126. return $core.withContext(function($ctx1) {
  41127. return $recv(anEvaluator)._evaluate_context_(aString,self);
  41128. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  41129. },
  41130. args: ["aString", "anEvaluator"],
  41131. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  41132. referencedClasses: [],
  41133. messageSends: ["evaluate:context:"]
  41134. }),
  41135. $globals.AIContext);
  41136. $core.addMethod(
  41137. $core.method({
  41138. selector: "evaluateNode:",
  41139. protocol: 'evaluating',
  41140. fn: function (aNode){
  41141. var self=this;
  41142. return $core.withContext(function($ctx1) {
  41143. var $1;
  41144. $1=$recv($globals.ASTInterpreter)._new();
  41145. $recv($1)._context_(self);
  41146. $recv($1)._node_(aNode);
  41147. $recv($1)._enterNode();
  41148. $recv($1)._proceed();
  41149. return $recv($1)._result();
  41150. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  41151. },
  41152. args: ["aNode"],
  41153. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  41154. referencedClasses: ["ASTInterpreter"],
  41155. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  41156. }),
  41157. $globals.AIContext);
  41158. $core.addMethod(
  41159. $core.method({
  41160. selector: "evaluatedSelector",
  41161. protocol: 'accessing',
  41162. fn: function (){
  41163. var self=this;
  41164. return self["@evaluatedSelector"];
  41165. },
  41166. args: [],
  41167. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  41168. referencedClasses: [],
  41169. messageSends: []
  41170. }),
  41171. $globals.AIContext);
  41172. $core.addMethod(
  41173. $core.method({
  41174. selector: "evaluatedSelector:",
  41175. protocol: 'accessing',
  41176. fn: function (aString){
  41177. var self=this;
  41178. self["@evaluatedSelector"]=aString;
  41179. return self;
  41180. },
  41181. args: ["aString"],
  41182. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  41183. referencedClasses: [],
  41184. messageSends: []
  41185. }),
  41186. $globals.AIContext);
  41187. $core.addMethod(
  41188. $core.method({
  41189. selector: "index",
  41190. protocol: 'accessing',
  41191. fn: function (){
  41192. var self=this;
  41193. return $core.withContext(function($ctx1) {
  41194. var $1,$receiver;
  41195. $1=self["@index"];
  41196. if(($receiver = $1) == null || $receiver.isNil){
  41197. return (0);
  41198. } else {
  41199. return $1;
  41200. }
  41201. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  41202. },
  41203. args: [],
  41204. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  41205. referencedClasses: [],
  41206. messageSends: ["ifNil:"]
  41207. }),
  41208. $globals.AIContext);
  41209. $core.addMethod(
  41210. $core.method({
  41211. selector: "index:",
  41212. protocol: 'accessing',
  41213. fn: function (anInteger){
  41214. var self=this;
  41215. self["@index"]=anInteger;
  41216. return self;
  41217. },
  41218. args: ["anInteger"],
  41219. source: "index: anInteger\x0a\x09index := anInteger",
  41220. referencedClasses: [],
  41221. messageSends: []
  41222. }),
  41223. $globals.AIContext);
  41224. $core.addMethod(
  41225. $core.method({
  41226. selector: "initializeAST",
  41227. protocol: 'initialization',
  41228. fn: function (){
  41229. var self=this;
  41230. return $core.withContext(function($ctx1) {
  41231. var $1;
  41232. $1=self._method();
  41233. $ctx1.sendIdx["method"]=1;
  41234. self["@ast"]=$recv($1)._ast();
  41235. $recv($recv($globals.SemanticAnalyzer)._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  41236. return self;
  41237. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  41238. },
  41239. args: [],
  41240. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  41241. referencedClasses: ["SemanticAnalyzer"],
  41242. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  41243. }),
  41244. $globals.AIContext);
  41245. $core.addMethod(
  41246. $core.method({
  41247. selector: "initializeFromMethodContext:",
  41248. protocol: 'initialization',
  41249. fn: function (aMethodContext){
  41250. var self=this;
  41251. return $core.withContext(function($ctx1) {
  41252. var $1,$2,$3,$receiver;
  41253. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  41254. self._index_($recv(aMethodContext)._index());
  41255. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  41256. self._receiver_($recv(aMethodContext)._receiver());
  41257. self._supercall_($recv(aMethodContext)._supercall());
  41258. self._selector_($recv(aMethodContext)._selector());
  41259. $1=$recv(aMethodContext)._outerContext();
  41260. $ctx1.sendIdx["outerContext"]=1;
  41261. if(($receiver = $1) == null || $receiver.isNil){
  41262. $1;
  41263. } else {
  41264. var outer;
  41265. outer=$receiver;
  41266. $2=$recv(outer)._methodContext();
  41267. if(($receiver = $2) == null || $receiver.isNil){
  41268. $2;
  41269. } else {
  41270. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  41271. }
  41272. $3=$recv(aMethodContext)._locals();
  41273. $ctx1.sendIdx["locals"]=1;
  41274. $recv($3)._keysAndValuesDo_((function(key,value){
  41275. return $core.withContext(function($ctx2) {
  41276. return $recv(self._locals())._at_put_(key,value);
  41277. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  41278. }));
  41279. }
  41280. return self;
  41281. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  41282. },
  41283. args: ["aMethodContext"],
  41284. 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 ] ]",
  41285. referencedClasses: [],
  41286. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  41287. }),
  41288. $globals.AIContext);
  41289. $core.addMethod(
  41290. $core.method({
  41291. selector: "initializeInterpreter",
  41292. protocol: 'initialization',
  41293. fn: function (){
  41294. var self=this;
  41295. return $core.withContext(function($ctx1) {
  41296. var $1,$2,$receiver;
  41297. $1=$recv($globals.ASTInterpreter)._new();
  41298. $recv($1)._context_(self);
  41299. self["@interpreter"]=$recv($1)._yourself();
  41300. $2=self._innerContext();
  41301. if(($receiver = $2) == null || $receiver.isNil){
  41302. $2;
  41303. } else {
  41304. self._setupInterpreter_(self["@interpreter"]);
  41305. }
  41306. return self;
  41307. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  41308. },
  41309. args: [],
  41310. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  41311. referencedClasses: ["ASTInterpreter"],
  41312. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  41313. }),
  41314. $globals.AIContext);
  41315. $core.addMethod(
  41316. $core.method({
  41317. selector: "initializeLocals",
  41318. protocol: 'initialization',
  41319. fn: function (){
  41320. var self=this;
  41321. return $core.withContext(function($ctx1) {
  41322. self["@locals"]=$recv($globals.Dictionary)._new();
  41323. $recv(self["@locals"])._at_put_("thisContext",self);
  41324. return self;
  41325. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  41326. },
  41327. args: [],
  41328. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  41329. referencedClasses: ["Dictionary"],
  41330. messageSends: ["new", "at:put:"]
  41331. }),
  41332. $globals.AIContext);
  41333. $core.addMethod(
  41334. $core.method({
  41335. selector: "innerContext",
  41336. protocol: 'accessing',
  41337. fn: function (){
  41338. var self=this;
  41339. return self["@innerContext"];
  41340. },
  41341. args: [],
  41342. source: "innerContext\x0a\x09^ innerContext",
  41343. referencedClasses: [],
  41344. messageSends: []
  41345. }),
  41346. $globals.AIContext);
  41347. $core.addMethod(
  41348. $core.method({
  41349. selector: "innerContext:",
  41350. protocol: 'accessing',
  41351. fn: function (anAIContext){
  41352. var self=this;
  41353. self["@innerContext"]=anAIContext;
  41354. return self;
  41355. },
  41356. args: ["anAIContext"],
  41357. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  41358. referencedClasses: [],
  41359. messageSends: []
  41360. }),
  41361. $globals.AIContext);
  41362. $core.addMethod(
  41363. $core.method({
  41364. selector: "interpreter",
  41365. protocol: 'interpreting',
  41366. fn: function (){
  41367. var self=this;
  41368. return $core.withContext(function($ctx1) {
  41369. var $1,$receiver;
  41370. $1=self["@interpreter"];
  41371. if(($receiver = $1) == null || $receiver.isNil){
  41372. self._initializeInterpreter();
  41373. } else {
  41374. $1;
  41375. }
  41376. return self["@interpreter"];
  41377. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  41378. },
  41379. args: [],
  41380. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  41381. referencedClasses: [],
  41382. messageSends: ["ifNil:", "initializeInterpreter"]
  41383. }),
  41384. $globals.AIContext);
  41385. $core.addMethod(
  41386. $core.method({
  41387. selector: "interpreter:",
  41388. protocol: 'interpreting',
  41389. fn: function (anInterpreter){
  41390. var self=this;
  41391. self["@interpreter"]=anInterpreter;
  41392. return self;
  41393. },
  41394. args: ["anInterpreter"],
  41395. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  41396. referencedClasses: [],
  41397. messageSends: []
  41398. }),
  41399. $globals.AIContext);
  41400. $core.addMethod(
  41401. $core.method({
  41402. selector: "isTopContext",
  41403. protocol: 'testing',
  41404. fn: function (){
  41405. var self=this;
  41406. return $core.withContext(function($ctx1) {
  41407. return $recv(self._innerContext())._isNil();
  41408. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  41409. },
  41410. args: [],
  41411. source: "isTopContext\x0a\x09^ self innerContext isNil",
  41412. referencedClasses: [],
  41413. messageSends: ["isNil", "innerContext"]
  41414. }),
  41415. $globals.AIContext);
  41416. $core.addMethod(
  41417. $core.method({
  41418. selector: "localAt:",
  41419. protocol: 'accessing',
  41420. fn: function (aString){
  41421. var self=this;
  41422. var context;
  41423. return $core.withContext(function($ctx1) {
  41424. context=self._lookupContextForLocal_(aString);
  41425. return $recv(context)._basicLocalAt_(aString);
  41426. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  41427. },
  41428. args: ["aString"],
  41429. 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",
  41430. referencedClasses: [],
  41431. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  41432. }),
  41433. $globals.AIContext);
  41434. $core.addMethod(
  41435. $core.method({
  41436. selector: "localAt:ifAbsent:",
  41437. protocol: 'accessing',
  41438. fn: function (aString,aBlock){
  41439. var self=this;
  41440. var context;
  41441. return $core.withContext(function($ctx1) {
  41442. var $early={};
  41443. try {
  41444. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  41445. return $core.withContext(function($ctx2) {
  41446. throw $early=[$recv(aBlock)._value()];
  41447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41448. }));
  41449. return $recv(context)._basicLocalAt_(aString);
  41450. }
  41451. catch(e) {if(e===$early)return e[0]; throw e}
  41452. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  41453. },
  41454. args: ["aString", "aBlock"],
  41455. 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",
  41456. referencedClasses: [],
  41457. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  41458. }),
  41459. $globals.AIContext);
  41460. $core.addMethod(
  41461. $core.method({
  41462. selector: "localAt:put:",
  41463. protocol: 'accessing',
  41464. fn: function (aString,anObject){
  41465. var self=this;
  41466. var context;
  41467. return $core.withContext(function($ctx1) {
  41468. context=self._lookupContextForLocal_(aString);
  41469. $recv(context)._basicLocalAt_put_(aString,anObject);
  41470. return self;
  41471. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  41472. },
  41473. args: ["aString", "anObject"],
  41474. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  41475. referencedClasses: [],
  41476. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  41477. }),
  41478. $globals.AIContext);
  41479. $core.addMethod(
  41480. $core.method({
  41481. selector: "locals",
  41482. protocol: 'accessing',
  41483. fn: function (){
  41484. var self=this;
  41485. return $core.withContext(function($ctx1) {
  41486. var $1,$receiver;
  41487. $1=self["@locals"];
  41488. if(($receiver = $1) == null || $receiver.isNil){
  41489. self._initializeLocals();
  41490. } else {
  41491. $1;
  41492. }
  41493. return self["@locals"];
  41494. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  41495. },
  41496. args: [],
  41497. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  41498. referencedClasses: [],
  41499. messageSends: ["ifNil:", "initializeLocals"]
  41500. }),
  41501. $globals.AIContext);
  41502. $core.addMethod(
  41503. $core.method({
  41504. selector: "lookupContextForLocal:",
  41505. protocol: 'private',
  41506. fn: function (aString){
  41507. var self=this;
  41508. return $core.withContext(function($ctx1) {
  41509. return self._lookupContextForLocal_ifNone_(aString,(function(){
  41510. return $core.withContext(function($ctx2) {
  41511. return self._variableNotFound();
  41512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41513. }));
  41514. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  41515. },
  41516. args: ["aString"],
  41517. 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 ]",
  41518. referencedClasses: [],
  41519. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  41520. }),
  41521. $globals.AIContext);
  41522. $core.addMethod(
  41523. $core.method({
  41524. selector: "lookupContextForLocal:ifNone:",
  41525. protocol: 'private',
  41526. fn: function (aString,aBlock){
  41527. var self=this;
  41528. return $core.withContext(function($ctx1) {
  41529. var $1;
  41530. return $recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  41531. return self;
  41532. }),(function(){
  41533. return $core.withContext(function($ctx2) {
  41534. $1=self._outerContext();
  41535. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  41536. return $core.withContext(function($ctx3) {
  41537. return $recv(context)._lookupContextForLocal_(aString);
  41538. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  41539. }));
  41540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41541. }));
  41542. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  41543. },
  41544. args: ["aString", "aBlock"],
  41545. 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 ] ]",
  41546. referencedClasses: [],
  41547. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  41548. }),
  41549. $globals.AIContext);
  41550. $core.addMethod(
  41551. $core.method({
  41552. selector: "newInnerContext",
  41553. protocol: 'factory',
  41554. fn: function (){
  41555. var self=this;
  41556. return $core.withContext(function($ctx1) {
  41557. var $1;
  41558. $1=$recv(self._class())._new();
  41559. $recv($1)._outerContext_(self);
  41560. return $recv($1)._yourself();
  41561. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  41562. },
  41563. args: [],
  41564. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  41565. referencedClasses: [],
  41566. messageSends: ["outerContext:", "new", "class", "yourself"]
  41567. }),
  41568. $globals.AIContext);
  41569. $core.addMethod(
  41570. $core.method({
  41571. selector: "outerContext",
  41572. protocol: 'accessing',
  41573. fn: function (){
  41574. var self=this;
  41575. return self["@outerContext"];
  41576. },
  41577. args: [],
  41578. source: "outerContext\x0a\x09^ outerContext",
  41579. referencedClasses: [],
  41580. messageSends: []
  41581. }),
  41582. $globals.AIContext);
  41583. $core.addMethod(
  41584. $core.method({
  41585. selector: "outerContext:",
  41586. protocol: 'accessing',
  41587. fn: function (anAIContext){
  41588. var self=this;
  41589. return $core.withContext(function($ctx1) {
  41590. var $1,$receiver;
  41591. self["@outerContext"]=anAIContext;
  41592. $1=self["@outerContext"];
  41593. if(($receiver = $1) == null || $receiver.isNil){
  41594. $1;
  41595. } else {
  41596. var context;
  41597. context=$receiver;
  41598. $recv(context)._innerContext_(self);
  41599. }
  41600. return self;
  41601. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  41602. },
  41603. args: ["anAIContext"],
  41604. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  41605. referencedClasses: [],
  41606. messageSends: ["ifNotNil:", "innerContext:"]
  41607. }),
  41608. $globals.AIContext);
  41609. $core.addMethod(
  41610. $core.method({
  41611. selector: "receiver:",
  41612. protocol: 'interpreting',
  41613. fn: function (anObject){
  41614. var self=this;
  41615. return $core.withContext(function($ctx1) {
  41616. $recv(self._locals())._at_put_("self",anObject);
  41617. return self;
  41618. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  41619. },
  41620. args: ["anObject"],
  41621. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  41622. referencedClasses: [],
  41623. messageSends: ["at:put:", "locals"]
  41624. }),
  41625. $globals.AIContext);
  41626. $core.addMethod(
  41627. $core.method({
  41628. selector: "selector",
  41629. protocol: 'accessing',
  41630. fn: function (){
  41631. var self=this;
  41632. return self["@selector"];
  41633. },
  41634. args: [],
  41635. source: "selector\x0a\x09^ selector",
  41636. referencedClasses: [],
  41637. messageSends: []
  41638. }),
  41639. $globals.AIContext);
  41640. $core.addMethod(
  41641. $core.method({
  41642. selector: "selector:",
  41643. protocol: 'accessing',
  41644. fn: function (aString){
  41645. var self=this;
  41646. self["@selector"]=aString;
  41647. return self;
  41648. },
  41649. args: ["aString"],
  41650. source: "selector: aString\x0a\x09selector := aString",
  41651. referencedClasses: [],
  41652. messageSends: []
  41653. }),
  41654. $globals.AIContext);
  41655. $core.addMethod(
  41656. $core.method({
  41657. selector: "sendIndexAt:",
  41658. protocol: 'accessing',
  41659. fn: function (aString){
  41660. var self=this;
  41661. return $core.withContext(function($ctx1) {
  41662. return $recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  41663. return (0);
  41664. }));
  41665. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  41666. },
  41667. args: ["aString"],
  41668. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  41669. referencedClasses: [],
  41670. messageSends: ["at:ifAbsent:", "sendIndexes"]
  41671. }),
  41672. $globals.AIContext);
  41673. $core.addMethod(
  41674. $core.method({
  41675. selector: "sendIndexes",
  41676. protocol: 'accessing',
  41677. fn: function (){
  41678. var self=this;
  41679. return $core.withContext(function($ctx1) {
  41680. var $1,$receiver;
  41681. $1=self["@sendIndexes"];
  41682. if(($receiver = $1) == null || $receiver.isNil){
  41683. return $recv($globals.Dictionary)._new();
  41684. } else {
  41685. return $1;
  41686. }
  41687. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  41688. },
  41689. args: [],
  41690. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  41691. referencedClasses: ["Dictionary"],
  41692. messageSends: ["ifNil:", "new"]
  41693. }),
  41694. $globals.AIContext);
  41695. $core.addMethod(
  41696. $core.method({
  41697. selector: "sendIndexes:",
  41698. protocol: 'accessing',
  41699. fn: function (aDictionary){
  41700. var self=this;
  41701. self["@sendIndexes"]=aDictionary;
  41702. return self;
  41703. },
  41704. args: ["aDictionary"],
  41705. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  41706. referencedClasses: [],
  41707. messageSends: []
  41708. }),
  41709. $globals.AIContext);
  41710. $core.addMethod(
  41711. $core.method({
  41712. selector: "setupInterpreter:",
  41713. protocol: 'interpreting',
  41714. fn: function (anInterpreter){
  41715. var self=this;
  41716. var currentNode;
  41717. return $core.withContext(function($ctx1) {
  41718. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  41719. $1=$recv($globals.ASTPCNodeVisitor)._new();
  41720. $2=self._evaluatedSelector();
  41721. $ctx1.sendIdx["evaluatedSelector"]=1;
  41722. $recv($1)._selector_($2);
  41723. $recv($1)._index_(self._sendIndexAt_(self._evaluatedSelector()));
  41724. $3=self._ast();
  41725. $ctx1.sendIdx["ast"]=1;
  41726. $recv($1)._visit_($3);
  41727. currentNode=$recv($1)._currentNode();
  41728. $4=$recv(self._ast())._sequenceNode();
  41729. if(($receiver = $4) == null || $receiver.isNil){
  41730. $4;
  41731. } else {
  41732. var sequence;
  41733. sequence=$receiver;
  41734. $recv($recv(sequence)._temps())._do_((function(each){
  41735. return $core.withContext(function($ctx2) {
  41736. return self._defineLocal_(each);
  41737. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41738. }));
  41739. $ctx1.sendIdx["do:"]=1;
  41740. }
  41741. $recv(anInterpreter)._node_(currentNode);
  41742. $7=self._innerContext();
  41743. $ctx1.sendIdx["innerContext"]=1;
  41744. $6=$recv($7)._arguments();
  41745. $5=$recv($6)._reversed();
  41746. $recv($5)._do_((function(each){
  41747. return $core.withContext(function($ctx2) {
  41748. return $recv(anInterpreter)._push_(each);
  41749. $ctx2.sendIdx["push:"]=1;
  41750. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41751. }));
  41752. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  41753. return self;
  41754. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  41755. },
  41756. args: ["anInterpreter"],
  41757. 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)",
  41758. referencedClasses: ["ASTPCNodeVisitor"],
  41759. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  41760. }),
  41761. $globals.AIContext);
  41762. $core.addMethod(
  41763. $core.method({
  41764. selector: "supercall",
  41765. protocol: 'interpreting',
  41766. fn: function (){
  41767. var self=this;
  41768. return $core.withContext(function($ctx1) {
  41769. var $1,$receiver;
  41770. $1=self["@supercall"];
  41771. if(($receiver = $1) == null || $receiver.isNil){
  41772. return false;
  41773. } else {
  41774. return $1;
  41775. }
  41776. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  41777. },
  41778. args: [],
  41779. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  41780. referencedClasses: [],
  41781. messageSends: ["ifNil:"]
  41782. }),
  41783. $globals.AIContext);
  41784. $core.addMethod(
  41785. $core.method({
  41786. selector: "supercall:",
  41787. protocol: 'interpreting',
  41788. fn: function (aBoolean){
  41789. var self=this;
  41790. self["@supercall"]=aBoolean;
  41791. return self;
  41792. },
  41793. args: ["aBoolean"],
  41794. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  41795. referencedClasses: [],
  41796. messageSends: []
  41797. }),
  41798. $globals.AIContext);
  41799. $core.addMethod(
  41800. $core.method({
  41801. selector: "variableNotFound",
  41802. protocol: 'error handling',
  41803. fn: function (){
  41804. var self=this;
  41805. return $core.withContext(function($ctx1) {
  41806. self._error_("Variable missing");
  41807. return self;
  41808. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  41809. },
  41810. args: [],
  41811. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  41812. referencedClasses: [],
  41813. messageSends: ["error:"]
  41814. }),
  41815. $globals.AIContext);
  41816. $core.addMethod(
  41817. $core.method({
  41818. selector: "fromMethodContext:",
  41819. protocol: 'instance creation',
  41820. fn: function (aMethodContext){
  41821. var self=this;
  41822. return $core.withContext(function($ctx1) {
  41823. var $1;
  41824. $1=self._new();
  41825. $recv($1)._initializeFromMethodContext_(aMethodContext);
  41826. return $recv($1)._yourself();
  41827. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  41828. },
  41829. args: ["aMethodContext"],
  41830. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  41831. referencedClasses: [],
  41832. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  41833. }),
  41834. $globals.AIContext.klass);
  41835. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  41836. $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.";
  41837. $core.addMethod(
  41838. $core.method({
  41839. selector: "context",
  41840. protocol: 'accessing',
  41841. fn: function (){
  41842. var self=this;
  41843. return self["@context"];
  41844. },
  41845. args: [],
  41846. source: "context\x0a\x09^ context",
  41847. referencedClasses: [],
  41848. messageSends: []
  41849. }),
  41850. $globals.AISemanticAnalyzer);
  41851. $core.addMethod(
  41852. $core.method({
  41853. selector: "context:",
  41854. protocol: 'accessing',
  41855. fn: function (anAIContext){
  41856. var self=this;
  41857. self["@context"]=anAIContext;
  41858. return self;
  41859. },
  41860. args: ["anAIContext"],
  41861. source: "context: anAIContext\x0a\x09context := anAIContext",
  41862. referencedClasses: [],
  41863. messageSends: []
  41864. }),
  41865. $globals.AISemanticAnalyzer);
  41866. $core.addMethod(
  41867. $core.method({
  41868. selector: "visitVariableNode:",
  41869. protocol: 'visiting',
  41870. fn: function (aNode){
  41871. var self=this;
  41872. return $core.withContext(function($ctx1) {
  41873. var $1;
  41874. var $early={};
  41875. try {
  41876. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  41877. return $core.withContext(function($ctx2) {
  41878. $1=(
  41879. $ctx2.supercall = true,
  41880. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  41881. $ctx2.supercall = false;
  41882. throw $early=[$1];
  41883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41884. }));
  41885. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  41886. return self;
  41887. }
  41888. catch(e) {if(e===$early)return e[0]; throw e}
  41889. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  41890. },
  41891. args: ["aNode"],
  41892. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  41893. referencedClasses: ["ASTContextVar"],
  41894. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  41895. }),
  41896. $globals.AISemanticAnalyzer);
  41897. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  41898. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  41899. $core.addMethod(
  41900. $core.method({
  41901. selector: "context",
  41902. protocol: 'accessing',
  41903. fn: function (){
  41904. var self=this;
  41905. return self["@context"];
  41906. },
  41907. args: [],
  41908. source: "context\x0a\x09^ context",
  41909. referencedClasses: [],
  41910. messageSends: []
  41911. }),
  41912. $globals.ASTContextVar);
  41913. $core.addMethod(
  41914. $core.method({
  41915. selector: "context:",
  41916. protocol: 'accessing',
  41917. fn: function (anObject){
  41918. var self=this;
  41919. self["@context"]=anObject;
  41920. return self;
  41921. },
  41922. args: ["anObject"],
  41923. source: "context: anObject\x0a\x09context := anObject",
  41924. referencedClasses: [],
  41925. messageSends: []
  41926. }),
  41927. $globals.ASTContextVar);
  41928. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  41929. $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.";
  41930. $core.addMethod(
  41931. $core.method({
  41932. selector: "atEnd",
  41933. protocol: 'testing',
  41934. fn: function (){
  41935. var self=this;
  41936. return $core.withContext(function($ctx1) {
  41937. var $1,$receiver;
  41938. $1=self._context();
  41939. $ctx1.sendIdx["context"]=1;
  41940. if(($receiver = $1) == null || $receiver.isNil){
  41941. return true;
  41942. } else {
  41943. $1;
  41944. }
  41945. return $recv($recv(self._interpreter())._atEnd())._and_((function(){
  41946. return $core.withContext(function($ctx2) {
  41947. return $recv(self._context())._isTopContext();
  41948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41949. }));
  41950. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  41951. },
  41952. args: [],
  41953. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  41954. referencedClasses: [],
  41955. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  41956. }),
  41957. $globals.ASTDebugger);
  41958. $core.addMethod(
  41959. $core.method({
  41960. selector: "context",
  41961. protocol: 'accessing',
  41962. fn: function (){
  41963. var self=this;
  41964. return self["@context"];
  41965. },
  41966. args: [],
  41967. source: "context\x0a\x09^ context",
  41968. referencedClasses: [],
  41969. messageSends: []
  41970. }),
  41971. $globals.ASTDebugger);
  41972. $core.addMethod(
  41973. $core.method({
  41974. selector: "context:",
  41975. protocol: 'accessing',
  41976. fn: function (aContext){
  41977. var self=this;
  41978. self["@context"]=aContext;
  41979. return self;
  41980. },
  41981. args: ["aContext"],
  41982. source: "context: aContext\x0a\x09context := aContext",
  41983. referencedClasses: [],
  41984. messageSends: []
  41985. }),
  41986. $globals.ASTDebugger);
  41987. $core.addMethod(
  41988. $core.method({
  41989. selector: "flushInnerContexts",
  41990. protocol: 'actions',
  41991. fn: function (){
  41992. var self=this;
  41993. return $core.withContext(function($ctx1) {
  41994. var $1,$receiver;
  41995. $1=self._context();
  41996. if(($receiver = $1) == null || $receiver.isNil){
  41997. $1;
  41998. } else {
  41999. var cxt;
  42000. cxt=$receiver;
  42001. $recv(cxt)._innerContext_(nil);
  42002. }
  42003. return self;
  42004. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  42005. },
  42006. args: [],
  42007. 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 ]",
  42008. referencedClasses: [],
  42009. messageSends: ["ifNotNil:", "context", "innerContext:"]
  42010. }),
  42011. $globals.ASTDebugger);
  42012. $core.addMethod(
  42013. $core.method({
  42014. selector: "interpreter",
  42015. protocol: 'accessing',
  42016. fn: function (){
  42017. var self=this;
  42018. return $core.withContext(function($ctx1) {
  42019. var $1,$receiver;
  42020. $1=self._context();
  42021. if(($receiver = $1) == null || $receiver.isNil){
  42022. return $1;
  42023. } else {
  42024. var ctx;
  42025. ctx=$receiver;
  42026. return $recv(ctx)._interpreter();
  42027. }
  42028. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  42029. },
  42030. args: [],
  42031. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  42032. referencedClasses: [],
  42033. messageSends: ["ifNotNil:", "context", "interpreter"]
  42034. }),
  42035. $globals.ASTDebugger);
  42036. $core.addMethod(
  42037. $core.method({
  42038. selector: "method",
  42039. protocol: 'accessing',
  42040. fn: function (){
  42041. var self=this;
  42042. return $core.withContext(function($ctx1) {
  42043. return $recv(self._context())._method();
  42044. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  42045. },
  42046. args: [],
  42047. source: "method\x0a\x09^ self context method",
  42048. referencedClasses: [],
  42049. messageSends: ["method", "context"]
  42050. }),
  42051. $globals.ASTDebugger);
  42052. $core.addMethod(
  42053. $core.method({
  42054. selector: "node",
  42055. protocol: 'accessing',
  42056. fn: function (){
  42057. var self=this;
  42058. return $core.withContext(function($ctx1) {
  42059. var $1,$receiver;
  42060. $1=self._interpreter();
  42061. $ctx1.sendIdx["interpreter"]=1;
  42062. if(($receiver = $1) == null || $receiver.isNil){
  42063. return $1;
  42064. } else {
  42065. return $recv(self._interpreter())._node();
  42066. }
  42067. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  42068. },
  42069. args: [],
  42070. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  42071. referencedClasses: [],
  42072. messageSends: ["ifNotNil:", "interpreter", "node"]
  42073. }),
  42074. $globals.ASTDebugger);
  42075. $core.addMethod(
  42076. $core.method({
  42077. selector: "onStep",
  42078. protocol: 'private',
  42079. fn: function (){
  42080. var self=this;
  42081. return $core.withContext(function($ctx1) {
  42082. var $1,$3,$2,$4,$6,$5,$receiver;
  42083. $1=self._interpreter();
  42084. $ctx1.sendIdx["interpreter"]=1;
  42085. self["@result"]=$recv($1)._result();
  42086. $3=self._interpreter();
  42087. $ctx1.sendIdx["interpreter"]=2;
  42088. $2=$recv($3)._atEnd();
  42089. $ctx1.sendIdx["atEnd"]=1;
  42090. if($core.assert($2)){
  42091. $4=$recv(self._context())._outerContext();
  42092. if(($receiver = $4) == null || $receiver.isNil){
  42093. $4;
  42094. } else {
  42095. var outerContext;
  42096. outerContext=$receiver;
  42097. self._context_(outerContext);
  42098. }
  42099. $6=self._interpreter();
  42100. $ctx1.sendIdx["interpreter"]=3;
  42101. $5=$recv($6)._atEnd();
  42102. if(!$core.assert($5)){
  42103. $recv(self._interpreter())._skip();
  42104. }
  42105. }
  42106. self._flushInnerContexts();
  42107. return self;
  42108. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  42109. },
  42110. args: [],
  42111. 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",
  42112. referencedClasses: [],
  42113. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  42114. }),
  42115. $globals.ASTDebugger);
  42116. $core.addMethod(
  42117. $core.method({
  42118. selector: "proceed",
  42119. protocol: 'stepping',
  42120. fn: function (){
  42121. var self=this;
  42122. return $core.withContext(function($ctx1) {
  42123. $recv((function(){
  42124. return $core.withContext(function($ctx2) {
  42125. return self._atEnd();
  42126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42127. }))._whileFalse_((function(){
  42128. return $core.withContext(function($ctx2) {
  42129. return self._stepOver();
  42130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42131. }));
  42132. return self;
  42133. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  42134. },
  42135. args: [],
  42136. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  42137. referencedClasses: [],
  42138. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  42139. }),
  42140. $globals.ASTDebugger);
  42141. $core.addMethod(
  42142. $core.method({
  42143. selector: "restart",
  42144. protocol: 'stepping',
  42145. fn: function (){
  42146. var self=this;
  42147. return $core.withContext(function($ctx1) {
  42148. $recv(self._interpreter())._restart();
  42149. self._flushInnerContexts();
  42150. return self;
  42151. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  42152. },
  42153. args: [],
  42154. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  42155. referencedClasses: [],
  42156. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  42157. }),
  42158. $globals.ASTDebugger);
  42159. $core.addMethod(
  42160. $core.method({
  42161. selector: "result",
  42162. protocol: 'accessing',
  42163. fn: function (){
  42164. var self=this;
  42165. return self["@result"];
  42166. },
  42167. args: [],
  42168. source: "result\x0a\x09^ result",
  42169. referencedClasses: [],
  42170. messageSends: []
  42171. }),
  42172. $globals.ASTDebugger);
  42173. $core.addMethod(
  42174. $core.method({
  42175. selector: "stepInto",
  42176. protocol: 'stepping',
  42177. fn: function (){
  42178. var self=this;
  42179. return $core.withContext(function($ctx1) {
  42180. self._shouldBeImplemented();
  42181. return self;
  42182. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  42183. },
  42184. args: [],
  42185. source: "stepInto\x0a\x09self shouldBeImplemented",
  42186. referencedClasses: [],
  42187. messageSends: ["shouldBeImplemented"]
  42188. }),
  42189. $globals.ASTDebugger);
  42190. $core.addMethod(
  42191. $core.method({
  42192. selector: "stepOver",
  42193. protocol: 'stepping',
  42194. fn: function (){
  42195. var self=this;
  42196. return $core.withContext(function($ctx1) {
  42197. var $1,$2;
  42198. $1=$recv(self._context())._isTopContext();
  42199. if($core.assert($1)){
  42200. $recv(self._interpreter())._stepOver();
  42201. } else {
  42202. $2=self._interpreter();
  42203. $ctx1.sendIdx["interpreter"]=1;
  42204. $recv($2)._skip();
  42205. }
  42206. self._onStep();
  42207. return self;
  42208. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  42209. },
  42210. args: [],
  42211. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  42212. referencedClasses: [],
  42213. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  42214. }),
  42215. $globals.ASTDebugger);
  42216. $core.addMethod(
  42217. $core.method({
  42218. selector: "context:",
  42219. protocol: 'instance creation',
  42220. fn: function (aContext){
  42221. var self=this;
  42222. return $core.withContext(function($ctx1) {
  42223. var $1;
  42224. $1=self._new();
  42225. $recv($1)._context_(aContext);
  42226. return $recv($1)._yourself();
  42227. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  42228. },
  42229. args: ["aContext"],
  42230. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  42231. referencedClasses: [],
  42232. messageSends: ["context:", "new", "yourself"]
  42233. }),
  42234. $globals.ASTDebugger.klass);
  42235. $core.addClass('ASTEnterNode', $globals.NodeVisitor, ['interpreter'], 'Compiler-Interpreter');
  42236. $core.addMethod(
  42237. $core.method({
  42238. selector: "interpreter",
  42239. protocol: 'accessing',
  42240. fn: function (){
  42241. var self=this;
  42242. return self["@interpreter"];
  42243. },
  42244. args: [],
  42245. source: "interpreter\x0a\x09^ interpreter",
  42246. referencedClasses: [],
  42247. messageSends: []
  42248. }),
  42249. $globals.ASTEnterNode);
  42250. $core.addMethod(
  42251. $core.method({
  42252. selector: "interpreter:",
  42253. protocol: 'accessing',
  42254. fn: function (anObject){
  42255. var self=this;
  42256. self["@interpreter"]=anObject;
  42257. return self;
  42258. },
  42259. args: ["anObject"],
  42260. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  42261. referencedClasses: [],
  42262. messageSends: []
  42263. }),
  42264. $globals.ASTEnterNode);
  42265. $core.addMethod(
  42266. $core.method({
  42267. selector: "visitBlockNode:",
  42268. protocol: 'visiting',
  42269. fn: function (aNode){
  42270. var self=this;
  42271. return aNode;
  42272. },
  42273. args: ["aNode"],
  42274. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  42275. referencedClasses: [],
  42276. messageSends: []
  42277. }),
  42278. $globals.ASTEnterNode);
  42279. $core.addMethod(
  42280. $core.method({
  42281. selector: "visitDagNode:",
  42282. protocol: 'visiting',
  42283. fn: function (aNode){
  42284. var self=this;
  42285. return $core.withContext(function($ctx1) {
  42286. var $early={};
  42287. try {
  42288. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  42289. throw $early=[aNode];
  42290. }),(function(nodes){
  42291. return $core.withContext(function($ctx2) {
  42292. throw $early=[self._visit_($recv(nodes)._first())];
  42293. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  42294. }));
  42295. return self;
  42296. }
  42297. catch(e) {if(e===$early)return e[0]; throw e}
  42298. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42299. },
  42300. args: ["aNode"],
  42301. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  42302. referencedClasses: [],
  42303. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  42304. }),
  42305. $globals.ASTEnterNode);
  42306. $core.addMethod(
  42307. $core.method({
  42308. selector: "visitSequenceNode:",
  42309. protocol: 'visiting',
  42310. fn: function (aNode){
  42311. var self=this;
  42312. return $core.withContext(function($ctx1) {
  42313. var $1;
  42314. $recv($recv(aNode)._temps())._do_((function(each){
  42315. return $core.withContext(function($ctx2) {
  42316. return $recv($recv(self._interpreter())._context())._defineLocal_(each);
  42317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42318. }));
  42319. $1=(
  42320. $ctx1.supercall = true,
  42321. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  42322. $ctx1.supercall = false;
  42323. return $1;
  42324. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42325. },
  42326. args: ["aNode"],
  42327. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  42328. referencedClasses: [],
  42329. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  42330. }),
  42331. $globals.ASTEnterNode);
  42332. $core.addMethod(
  42333. $core.method({
  42334. selector: "on:",
  42335. protocol: 'instance creation',
  42336. fn: function (anInterpreter){
  42337. var self=this;
  42338. return $core.withContext(function($ctx1) {
  42339. var $1;
  42340. $1=self._new();
  42341. $recv($1)._interpreter_(anInterpreter);
  42342. return $recv($1)._yourself();
  42343. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.klass)});
  42344. },
  42345. args: ["anInterpreter"],
  42346. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  42347. referencedClasses: [],
  42348. messageSends: ["interpreter:", "new", "yourself"]
  42349. }),
  42350. $globals.ASTEnterNode.klass);
  42351. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  42352. $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";
  42353. $core.addMethod(
  42354. $core.method({
  42355. selector: "assign:to:",
  42356. protocol: 'private',
  42357. fn: function (aNode,anObject){
  42358. var self=this;
  42359. return $core.withContext(function($ctx1) {
  42360. var $1,$3,$2,$4;
  42361. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  42362. if($core.assert($1)){
  42363. $3=self._context();
  42364. $ctx1.sendIdx["context"]=1;
  42365. $2=$recv($3)._receiver();
  42366. $4=$recv(aNode)._value();
  42367. $ctx1.sendIdx["value"]=1;
  42368. $recv($2)._instVarAt_put_($4,anObject);
  42369. } else {
  42370. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  42371. }
  42372. return self;
  42373. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  42374. },
  42375. args: ["aNode", "anObject"],
  42376. 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 ]",
  42377. referencedClasses: [],
  42378. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  42379. }),
  42380. $globals.ASTInterpreter);
  42381. $core.addMethod(
  42382. $core.method({
  42383. selector: "atEnd",
  42384. protocol: 'testing',
  42385. fn: function (){
  42386. var self=this;
  42387. return $core.withContext(function($ctx1) {
  42388. var $1;
  42389. $1=self["@forceAtEnd"];
  42390. if($core.assert($1)){
  42391. return true;
  42392. }
  42393. return $recv(self._hasReturned())._or_((function(){
  42394. return $core.withContext(function($ctx2) {
  42395. return $recv(self._node())._isNil();
  42396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42397. }));
  42398. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  42399. },
  42400. args: [],
  42401. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  42402. referencedClasses: [],
  42403. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  42404. }),
  42405. $globals.ASTInterpreter);
  42406. $core.addMethod(
  42407. $core.method({
  42408. selector: "context",
  42409. protocol: 'accessing',
  42410. fn: function (){
  42411. var self=this;
  42412. return self["@context"];
  42413. },
  42414. args: [],
  42415. source: "context\x0a\x09^ context",
  42416. referencedClasses: [],
  42417. messageSends: []
  42418. }),
  42419. $globals.ASTInterpreter);
  42420. $core.addMethod(
  42421. $core.method({
  42422. selector: "context:",
  42423. protocol: 'accessing',
  42424. fn: function (aContext){
  42425. var self=this;
  42426. self["@context"]=aContext;
  42427. return self;
  42428. },
  42429. args: ["aContext"],
  42430. source: "context: aContext\x0a\x09context := aContext",
  42431. referencedClasses: [],
  42432. messageSends: []
  42433. }),
  42434. $globals.ASTInterpreter);
  42435. $core.addMethod(
  42436. $core.method({
  42437. selector: "enterNode",
  42438. protocol: 'interpreting',
  42439. fn: function (){
  42440. var self=this;
  42441. return $core.withContext(function($ctx1) {
  42442. self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_(self._node()));
  42443. return self;
  42444. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  42445. },
  42446. args: [],
  42447. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  42448. referencedClasses: ["ASTEnterNode"],
  42449. messageSends: ["node:", "visit:", "on:", "node"]
  42450. }),
  42451. $globals.ASTInterpreter);
  42452. $core.addMethod(
  42453. $core.method({
  42454. selector: "eval:",
  42455. protocol: 'private',
  42456. fn: function (aString){
  42457. var self=this;
  42458. var source,function_;
  42459. return $core.withContext(function($ctx1) {
  42460. var $3,$2,$1;
  42461. source=$recv($globals.String)._streamContents_((function(str){
  42462. return $core.withContext(function($ctx2) {
  42463. $recv(str)._nextPutAll_("0,(function(");
  42464. $ctx2.sendIdx["nextPutAll:"]=1;
  42465. $3=self._context();
  42466. $ctx2.sendIdx["context"]=1;
  42467. $2=$recv($3)._locals();
  42468. $ctx2.sendIdx["locals"]=1;
  42469. $1=$recv($2)._keys();
  42470. $recv($1)._do_separatedBy_((function(each){
  42471. return $core.withContext(function($ctx3) {
  42472. return $recv(str)._nextPutAll_(each);
  42473. $ctx3.sendIdx["nextPutAll:"]=2;
  42474. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42475. }),(function(){
  42476. return $core.withContext(function($ctx3) {
  42477. return $recv(str)._nextPutAll_(",");
  42478. $ctx3.sendIdx["nextPutAll:"]=3;
  42479. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42480. }));
  42481. $recv(str)._nextPutAll_("){ return (function() {");
  42482. $ctx2.sendIdx["nextPutAll:"]=4;
  42483. $recv(str)._nextPutAll_(aString);
  42484. $ctx2.sendIdx["nextPutAll:"]=5;
  42485. return $recv(str)._nextPutAll_("})()})");
  42486. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  42487. }));
  42488. function_=$recv($recv($globals.Compiler)._new())._eval_(source);
  42489. return $recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  42490. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  42491. },
  42492. args: ["aString"],
  42493. 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",
  42494. referencedClasses: ["String", "Compiler"],
  42495. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  42496. }),
  42497. $globals.ASTInterpreter);
  42498. $core.addMethod(
  42499. $core.method({
  42500. selector: "hasReturned",
  42501. protocol: 'testing',
  42502. fn: function (){
  42503. var self=this;
  42504. return $core.withContext(function($ctx1) {
  42505. var $1,$receiver;
  42506. $1=self["@returned"];
  42507. if(($receiver = $1) == null || $receiver.isNil){
  42508. return false;
  42509. } else {
  42510. return $1;
  42511. }
  42512. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  42513. },
  42514. args: [],
  42515. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  42516. referencedClasses: [],
  42517. messageSends: ["ifNil:"]
  42518. }),
  42519. $globals.ASTInterpreter);
  42520. $core.addMethod(
  42521. $core.method({
  42522. selector: "initialize",
  42523. protocol: 'initialization',
  42524. fn: function (){
  42525. var self=this;
  42526. return $core.withContext(function($ctx1) {
  42527. (
  42528. $ctx1.supercall = true,
  42529. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  42530. $ctx1.supercall = false;
  42531. self["@forceAtEnd"]=false;
  42532. return self;
  42533. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  42534. },
  42535. args: [],
  42536. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  42537. referencedClasses: [],
  42538. messageSends: ["initialize"]
  42539. }),
  42540. $globals.ASTInterpreter);
  42541. $core.addMethod(
  42542. $core.method({
  42543. selector: "interpret",
  42544. protocol: 'interpreting',
  42545. fn: function (){
  42546. var self=this;
  42547. return $core.withContext(function($ctx1) {
  42548. self._visit_(self._node());
  42549. return self;
  42550. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  42551. },
  42552. args: [],
  42553. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  42554. referencedClasses: [],
  42555. messageSends: ["visit:", "node"]
  42556. }),
  42557. $globals.ASTInterpreter);
  42558. $core.addMethod(
  42559. $core.method({
  42560. selector: "messageFromSendNode:arguments:",
  42561. protocol: 'private',
  42562. fn: function (aSendNode,aCollection){
  42563. var self=this;
  42564. return $core.withContext(function($ctx1) {
  42565. var $1;
  42566. $1=$recv($globals.Message)._new();
  42567. $recv($1)._selector_($recv(aSendNode)._selector());
  42568. $recv($1)._arguments_(aCollection);
  42569. return $recv($1)._yourself();
  42570. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  42571. },
  42572. args: ["aSendNode", "aCollection"],
  42573. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  42574. referencedClasses: ["Message"],
  42575. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  42576. }),
  42577. $globals.ASTInterpreter);
  42578. $core.addMethod(
  42579. $core.method({
  42580. selector: "messageNotUnderstood:receiver:",
  42581. protocol: 'private',
  42582. fn: function (aMessage,anObject){
  42583. var self=this;
  42584. return $core.withContext(function($ctx1) {
  42585. var $1;
  42586. $1=$recv($globals.MessageNotUnderstood)._new();
  42587. $recv($1)._message_(aMessage);
  42588. $recv($1)._receiver_(anObject);
  42589. $recv($1)._signal();
  42590. return self;
  42591. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  42592. },
  42593. args: ["aMessage", "anObject"],
  42594. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  42595. referencedClasses: ["MessageNotUnderstood"],
  42596. messageSends: ["message:", "new", "receiver:", "signal"]
  42597. }),
  42598. $globals.ASTInterpreter);
  42599. $core.addMethod(
  42600. $core.method({
  42601. selector: "next",
  42602. protocol: 'interpreting',
  42603. fn: function (){
  42604. var self=this;
  42605. var nd,nextNode;
  42606. return $core.withContext(function($ctx1) {
  42607. var $1,$2,$receiver;
  42608. nd=self._node();
  42609. $1=$recv(nd)._parent();
  42610. if(($receiver = $1) == null || $receiver.isNil){
  42611. nextNode=$1;
  42612. } else {
  42613. var parent;
  42614. parent=$receiver;
  42615. $2=$recv(parent)._nextSiblingNode_(nd);
  42616. if(($receiver = $2) == null || $receiver.isNil){
  42617. nextNode=parent;
  42618. } else {
  42619. var sibling;
  42620. sibling=$receiver;
  42621. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  42622. }
  42623. }
  42624. self._node_(nextNode);
  42625. return self;
  42626. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  42627. },
  42628. args: [],
  42629. 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",
  42630. referencedClasses: ["ASTEnterNode"],
  42631. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  42632. }),
  42633. $globals.ASTInterpreter);
  42634. $core.addMethod(
  42635. $core.method({
  42636. selector: "node",
  42637. protocol: 'accessing',
  42638. fn: function (){
  42639. var self=this;
  42640. return self["@node"];
  42641. },
  42642. args: [],
  42643. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  42644. referencedClasses: [],
  42645. messageSends: []
  42646. }),
  42647. $globals.ASTInterpreter);
  42648. $core.addMethod(
  42649. $core.method({
  42650. selector: "node:",
  42651. protocol: 'accessing',
  42652. fn: function (aNode){
  42653. var self=this;
  42654. self["@node"]=aNode;
  42655. return self;
  42656. },
  42657. args: ["aNode"],
  42658. source: "node: aNode\x0a\x09node := aNode",
  42659. referencedClasses: [],
  42660. messageSends: []
  42661. }),
  42662. $globals.ASTInterpreter);
  42663. $core.addMethod(
  42664. $core.method({
  42665. selector: "peek",
  42666. protocol: 'stack',
  42667. fn: function (){
  42668. var self=this;
  42669. return $core.withContext(function($ctx1) {
  42670. var $1;
  42671. var $early={};
  42672. try {
  42673. $1=self._stack();
  42674. $ctx1.sendIdx["stack"]=1;
  42675. $recv($1)._ifEmpty_((function(){
  42676. throw $early=[nil];
  42677. }));
  42678. return $recv(self._stack())._last();
  42679. }
  42680. catch(e) {if(e===$early)return e[0]; throw e}
  42681. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  42682. },
  42683. args: [],
  42684. 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",
  42685. referencedClasses: [],
  42686. messageSends: ["ifEmpty:", "stack", "last"]
  42687. }),
  42688. $globals.ASTInterpreter);
  42689. $core.addMethod(
  42690. $core.method({
  42691. selector: "pop",
  42692. protocol: 'stack',
  42693. fn: function (){
  42694. var self=this;
  42695. var peekedValue;
  42696. return $core.withContext(function($ctx1) {
  42697. peekedValue=self._peek();
  42698. $recv(self._stack())._removeLast();
  42699. return peekedValue;
  42700. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  42701. },
  42702. args: [],
  42703. 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",
  42704. referencedClasses: [],
  42705. messageSends: ["peek", "removeLast", "stack"]
  42706. }),
  42707. $globals.ASTInterpreter);
  42708. $core.addMethod(
  42709. $core.method({
  42710. selector: "proceed",
  42711. protocol: 'interpreting',
  42712. fn: function (){
  42713. var self=this;
  42714. return $core.withContext(function($ctx1) {
  42715. $recv((function(){
  42716. return $core.withContext(function($ctx2) {
  42717. return self._atEnd();
  42718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42719. }))._whileFalse_((function(){
  42720. return $core.withContext(function($ctx2) {
  42721. return self._step();
  42722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42723. }));
  42724. return self;
  42725. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  42726. },
  42727. args: [],
  42728. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  42729. referencedClasses: [],
  42730. messageSends: ["whileFalse:", "atEnd", "step"]
  42731. }),
  42732. $globals.ASTInterpreter);
  42733. $core.addMethod(
  42734. $core.method({
  42735. selector: "push:",
  42736. protocol: 'stack',
  42737. fn: function (anObject){
  42738. var self=this;
  42739. return $core.withContext(function($ctx1) {
  42740. return $recv(self._stack())._add_(anObject);
  42741. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  42742. },
  42743. args: ["anObject"],
  42744. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  42745. referencedClasses: [],
  42746. messageSends: ["add:", "stack"]
  42747. }),
  42748. $globals.ASTInterpreter);
  42749. $core.addMethod(
  42750. $core.method({
  42751. selector: "restart",
  42752. protocol: 'interpreting',
  42753. fn: function (){
  42754. var self=this;
  42755. return $core.withContext(function($ctx1) {
  42756. self._node_($recv(self._context())._ast());
  42757. self._enterNode();
  42758. return self;
  42759. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  42760. },
  42761. args: [],
  42762. source: "restart\x0a\x09self node: self context ast; enterNode",
  42763. referencedClasses: [],
  42764. messageSends: ["node:", "ast", "context", "enterNode"]
  42765. }),
  42766. $globals.ASTInterpreter);
  42767. $core.addMethod(
  42768. $core.method({
  42769. selector: "result",
  42770. protocol: 'accessing',
  42771. fn: function (){
  42772. var self=this;
  42773. return $core.withContext(function($ctx1) {
  42774. var $1;
  42775. $1=self._hasReturned();
  42776. if($core.assert($1)){
  42777. return self._returnValue();
  42778. } else {
  42779. return $recv(self._context())._receiver();
  42780. }
  42781. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  42782. },
  42783. args: [],
  42784. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  42785. referencedClasses: [],
  42786. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  42787. }),
  42788. $globals.ASTInterpreter);
  42789. $core.addMethod(
  42790. $core.method({
  42791. selector: "returnValue",
  42792. protocol: 'accessing',
  42793. fn: function (){
  42794. var self=this;
  42795. return self["@returnValue"];
  42796. },
  42797. args: [],
  42798. source: "returnValue\x0a\x09^ returnValue",
  42799. referencedClasses: [],
  42800. messageSends: []
  42801. }),
  42802. $globals.ASTInterpreter);
  42803. $core.addMethod(
  42804. $core.method({
  42805. selector: "returnValue:",
  42806. protocol: 'accessing',
  42807. fn: function (anObject){
  42808. var self=this;
  42809. self["@returnValue"]=anObject;
  42810. return self;
  42811. },
  42812. args: ["anObject"],
  42813. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  42814. referencedClasses: [],
  42815. messageSends: []
  42816. }),
  42817. $globals.ASTInterpreter);
  42818. $core.addMethod(
  42819. $core.method({
  42820. selector: "sendMessage:to:superSend:",
  42821. protocol: 'private',
  42822. fn: function (aMessage,anObject,aBoolean){
  42823. var self=this;
  42824. var method;
  42825. return $core.withContext(function($ctx1) {
  42826. var $2,$1,$3,$receiver;
  42827. var $early={};
  42828. try {
  42829. if(!$core.assert(aBoolean)){
  42830. return $recv(aMessage)._sendTo_(anObject);
  42831. }
  42832. $2=$recv(anObject)._class();
  42833. $ctx1.sendIdx["class"]=1;
  42834. $1=$recv($2)._superclass();
  42835. $ctx1.sendIdx["superclass"]=1;
  42836. if(($receiver = $1) == null || $receiver.isNil){
  42837. $3=self._messageNotUnderstood_receiver_(aMessage,anObject);
  42838. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  42839. return $3;
  42840. } else {
  42841. $1;
  42842. }
  42843. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  42844. return $core.withContext(function($ctx2) {
  42845. throw $early=[self._messageNotUnderstood_receiver_(aMessage,anObject)];
  42846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42847. }));
  42848. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  42849. }
  42850. catch(e) {if(e===$early)return e[0]; throw e}
  42851. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  42852. },
  42853. args: ["aMessage", "anObject", "aBoolean"],
  42854. 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",
  42855. referencedClasses: [],
  42856. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  42857. }),
  42858. $globals.ASTInterpreter);
  42859. $core.addMethod(
  42860. $core.method({
  42861. selector: "setNonLocalReturnFromContext:",
  42862. protocol: 'interpreting',
  42863. fn: function (aContext){
  42864. var self=this;
  42865. return $core.withContext(function($ctx1) {
  42866. var $2,$1;
  42867. $2=$recv(aContext)._interpreter();
  42868. $ctx1.sendIdx["interpreter"]=1;
  42869. $1=$recv($2)._hasReturned();
  42870. if($core.assert($1)){
  42871. self["@returned"]=true;
  42872. self["@returned"];
  42873. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  42874. }
  42875. return self;
  42876. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  42877. },
  42878. args: ["aContext"],
  42879. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  42880. referencedClasses: [],
  42881. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  42882. }),
  42883. $globals.ASTInterpreter);
  42884. $core.addMethod(
  42885. $core.method({
  42886. selector: "skip",
  42887. protocol: 'interpreting',
  42888. fn: function (){
  42889. var self=this;
  42890. return $core.withContext(function($ctx1) {
  42891. self._next();
  42892. return self;
  42893. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  42894. },
  42895. args: [],
  42896. source: "skip\x0a\x09self next",
  42897. referencedClasses: [],
  42898. messageSends: ["next"]
  42899. }),
  42900. $globals.ASTInterpreter);
  42901. $core.addMethod(
  42902. $core.method({
  42903. selector: "stack",
  42904. protocol: 'accessing',
  42905. fn: function (){
  42906. var self=this;
  42907. return $core.withContext(function($ctx1) {
  42908. var $1,$receiver;
  42909. $1=self["@stack"];
  42910. if(($receiver = $1) == null || $receiver.isNil){
  42911. self["@stack"]=$recv($globals.OrderedCollection)._new();
  42912. return self["@stack"];
  42913. } else {
  42914. return $1;
  42915. }
  42916. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  42917. },
  42918. args: [],
  42919. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  42920. referencedClasses: ["OrderedCollection"],
  42921. messageSends: ["ifNil:", "new"]
  42922. }),
  42923. $globals.ASTInterpreter);
  42924. $core.addMethod(
  42925. $core.method({
  42926. selector: "step",
  42927. protocol: 'interpreting',
  42928. fn: function (){
  42929. var self=this;
  42930. return $core.withContext(function($ctx1) {
  42931. self._interpret();
  42932. self._next();
  42933. return self;
  42934. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  42935. },
  42936. args: [],
  42937. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  42938. referencedClasses: [],
  42939. messageSends: ["interpret", "next"]
  42940. }),
  42941. $globals.ASTInterpreter);
  42942. $core.addMethod(
  42943. $core.method({
  42944. selector: "stepOver",
  42945. protocol: 'interpreting',
  42946. fn: function (){
  42947. var self=this;
  42948. return $core.withContext(function($ctx1) {
  42949. var $2,$1;
  42950. self._step();
  42951. $ctx1.sendIdx["step"]=1;
  42952. $recv((function(){
  42953. return $core.withContext(function($ctx2) {
  42954. $2=self._node();
  42955. $ctx2.sendIdx["node"]=1;
  42956. $1=$recv($2)._isNil();
  42957. return $recv($1)._or_((function(){
  42958. return $core.withContext(function($ctx3) {
  42959. return $recv(self._node())._isSteppingNode();
  42960. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42961. }));
  42962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42963. }))._whileFalse_((function(){
  42964. return $core.withContext(function($ctx2) {
  42965. return self._step();
  42966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42967. }));
  42968. return self;
  42969. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  42970. },
  42971. args: [],
  42972. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  42973. referencedClasses: [],
  42974. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  42975. }),
  42976. $globals.ASTInterpreter);
  42977. $core.addMethod(
  42978. $core.method({
  42979. selector: "visit:",
  42980. protocol: 'visiting',
  42981. fn: function (aNode){
  42982. var self=this;
  42983. return $core.withContext(function($ctx1) {
  42984. var $1;
  42985. $1=self._hasReturned();
  42986. if(!$core.assert($1)){
  42987. (
  42988. $ctx1.supercall = true,
  42989. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  42990. $ctx1.supercall = false;
  42991. }
  42992. return self;
  42993. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  42994. },
  42995. args: ["aNode"],
  42996. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  42997. referencedClasses: [],
  42998. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  42999. }),
  43000. $globals.ASTInterpreter);
  43001. $core.addMethod(
  43002. $core.method({
  43003. selector: "visitAssignmentNode:",
  43004. protocol: 'visiting',
  43005. fn: function (aNode){
  43006. var self=this;
  43007. var poppedValue;
  43008. return $core.withContext(function($ctx1) {
  43009. poppedValue=self._pop();
  43010. $ctx1.sendIdx["pop"]=1;
  43011. self._pop();
  43012. self._push_(poppedValue);
  43013. self._assign_to_($recv(aNode)._left(),poppedValue);
  43014. return self;
  43015. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  43016. },
  43017. args: ["aNode"],
  43018. 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",
  43019. referencedClasses: [],
  43020. messageSends: ["pop", "push:", "assign:to:", "left"]
  43021. }),
  43022. $globals.ASTInterpreter);
  43023. $core.addMethod(
  43024. $core.method({
  43025. selector: "visitBlockNode:",
  43026. protocol: 'visiting',
  43027. fn: function (aNode){
  43028. var self=this;
  43029. var block;
  43030. return $core.withContext(function($ctx1) {
  43031. block=$recv($globals.AIBlockClosure)._forContext_node_(self._context(),aNode);
  43032. self._push_(block);
  43033. return self;
  43034. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  43035. },
  43036. args: ["aNode"],
  43037. 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",
  43038. referencedClasses: ["AIBlockClosure"],
  43039. messageSends: ["forContext:node:", "context", "push:"]
  43040. }),
  43041. $globals.ASTInterpreter);
  43042. $core.addMethod(
  43043. $core.method({
  43044. selector: "visitBlockSequenceNode:",
  43045. protocol: 'visiting',
  43046. fn: function (aNode){
  43047. var self=this;
  43048. return $core.withContext(function($ctx1) {
  43049. (
  43050. $ctx1.supercall = true,
  43051. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  43052. $ctx1.supercall = false;
  43053. self["@forceAtEnd"]=true;
  43054. return self;
  43055. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43056. },
  43057. args: ["aNode"],
  43058. 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",
  43059. referencedClasses: [],
  43060. messageSends: ["visitBlockSequenceNode:"]
  43061. }),
  43062. $globals.ASTInterpreter);
  43063. $core.addMethod(
  43064. $core.method({
  43065. selector: "visitDagNode:",
  43066. protocol: 'visiting',
  43067. fn: function (aNode){
  43068. var self=this;
  43069. return self;
  43070. },
  43071. args: ["aNode"],
  43072. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  43073. referencedClasses: [],
  43074. messageSends: []
  43075. }),
  43076. $globals.ASTInterpreter);
  43077. $core.addMethod(
  43078. $core.method({
  43079. selector: "visitDynamicArrayNode:",
  43080. protocol: 'visiting',
  43081. fn: function (aNode){
  43082. var self=this;
  43083. var array;
  43084. return $core.withContext(function($ctx1) {
  43085. array=[];
  43086. $recv($recv(aNode)._dagChildren())._do_((function(each){
  43087. return $core.withContext(function($ctx2) {
  43088. return $recv(array)._addFirst_(self._pop());
  43089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43090. }));
  43091. self._push_(array);
  43092. return self;
  43093. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  43094. },
  43095. args: ["aNode"],
  43096. 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",
  43097. referencedClasses: [],
  43098. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  43099. }),
  43100. $globals.ASTInterpreter);
  43101. $core.addMethod(
  43102. $core.method({
  43103. selector: "visitDynamicDictionaryNode:",
  43104. protocol: 'visiting',
  43105. fn: function (aNode){
  43106. var self=this;
  43107. var keyValueList;
  43108. return $core.withContext(function($ctx1) {
  43109. keyValueList=$recv($globals.OrderedCollection)._new();
  43110. $recv($recv(aNode)._dagChildren())._do_((function(each){
  43111. return $core.withContext(function($ctx2) {
  43112. return $recv(keyValueList)._add_(self._pop());
  43113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43114. }));
  43115. self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  43116. return self;
  43117. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  43118. },
  43119. args: ["aNode"],
  43120. 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)",
  43121. referencedClasses: ["OrderedCollection", "HashedCollection"],
  43122. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  43123. }),
  43124. $globals.ASTInterpreter);
  43125. $core.addMethod(
  43126. $core.method({
  43127. selector: "visitJSStatementNode:",
  43128. protocol: 'visiting',
  43129. fn: function (aNode){
  43130. var self=this;
  43131. return $core.withContext(function($ctx1) {
  43132. self["@returned"]=true;
  43133. self._returnValue_(self._eval_($recv(aNode)._source()));
  43134. return self;
  43135. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43136. },
  43137. args: ["aNode"],
  43138. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  43139. referencedClasses: [],
  43140. messageSends: ["returnValue:", "eval:", "source"]
  43141. }),
  43142. $globals.ASTInterpreter);
  43143. $core.addMethod(
  43144. $core.method({
  43145. selector: "visitReturnNode:",
  43146. protocol: 'visiting',
  43147. fn: function (aNode){
  43148. var self=this;
  43149. return $core.withContext(function($ctx1) {
  43150. self["@returned"]=true;
  43151. self._returnValue_(self._pop());
  43152. return self;
  43153. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43154. },
  43155. args: ["aNode"],
  43156. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  43157. referencedClasses: [],
  43158. messageSends: ["returnValue:", "pop"]
  43159. }),
  43160. $globals.ASTInterpreter);
  43161. $core.addMethod(
  43162. $core.method({
  43163. selector: "visitSendNode:",
  43164. protocol: 'visiting',
  43165. fn: function (aNode){
  43166. var self=this;
  43167. var receiver,args,message,result;
  43168. return $core.withContext(function($ctx1) {
  43169. var $1;
  43170. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  43171. return $core.withContext(function($ctx2) {
  43172. return self._pop();
  43173. $ctx2.sendIdx["pop"]=1;
  43174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43175. }));
  43176. receiver=self._peek();
  43177. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  43178. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  43179. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  43180. return $core.withContext(function($ctx2) {
  43181. return $recv($recv(aNode)._isLastChild())._not();
  43182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43183. }));
  43184. if(!$core.assert($1)){
  43185. self._pop();
  43186. self._push_(result);
  43187. }
  43188. return self;
  43189. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  43190. },
  43191. args: ["aNode"],
  43192. 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 ]",
  43193. referencedClasses: [],
  43194. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  43195. }),
  43196. $globals.ASTInterpreter);
  43197. $core.addMethod(
  43198. $core.method({
  43199. selector: "visitValueNode:",
  43200. protocol: 'visiting',
  43201. fn: function (aNode){
  43202. var self=this;
  43203. return $core.withContext(function($ctx1) {
  43204. self._push_($recv(aNode)._value());
  43205. return self;
  43206. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43207. },
  43208. args: ["aNode"],
  43209. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  43210. referencedClasses: [],
  43211. messageSends: ["push:", "value"]
  43212. }),
  43213. $globals.ASTInterpreter);
  43214. $core.addMethod(
  43215. $core.method({
  43216. selector: "visitVariableNode:",
  43217. protocol: 'visiting',
  43218. fn: function (aNode){
  43219. var self=this;
  43220. return $core.withContext(function($ctx1) {
  43221. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  43222. $2=$recv(aNode)._binding();
  43223. $ctx1.sendIdx["binding"]=1;
  43224. $1=$recv($2)._isUnknownVar();
  43225. if($core.assert($1)){
  43226. $5=$recv($globals.Platform)._globals();
  43227. $ctx1.sendIdx["globals"]=1;
  43228. $6=$recv(aNode)._value();
  43229. $ctx1.sendIdx["value"]=1;
  43230. $4=$recv($5)._at_ifAbsent_($6,(function(){
  43231. return $core.withContext(function($ctx2) {
  43232. return self._error_("Unknown variable");
  43233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43234. }));
  43235. $ctx1.sendIdx["at:ifAbsent:"]=1;
  43236. $3=self._push_($4);
  43237. $ctx1.sendIdx["push:"]=1;
  43238. return $3;
  43239. }
  43240. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  43241. if($core.assert($8)){
  43242. $10=self._context();
  43243. $ctx1.sendIdx["context"]=1;
  43244. $9=$recv($10)._receiver();
  43245. $11=$recv(aNode)._value();
  43246. $ctx1.sendIdx["value"]=2;
  43247. $7=$recv($9)._instVarAt_($11);
  43248. } else {
  43249. $12=self._context();
  43250. $13=$recv(aNode)._value();
  43251. $ctx1.sendIdx["value"]=3;
  43252. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  43253. return $core.withContext(function($ctx2) {
  43254. $15=$recv(aNode)._value();
  43255. $ctx2.sendIdx["value"]=4;
  43256. $14=$recv($15)._isCapitalized();
  43257. if($core.assert($14)){
  43258. $16=$recv($globals.Smalltalk)._globals();
  43259. $ctx2.sendIdx["globals"]=2;
  43260. $17=$recv(aNode)._value();
  43261. $ctx2.sendIdx["value"]=5;
  43262. return $recv($16)._at_ifAbsent_($17,(function(){
  43263. return $core.withContext(function($ctx3) {
  43264. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  43265. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  43266. }));
  43267. }
  43268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  43269. }));
  43270. }
  43271. self._push_($7);
  43272. return self;
  43273. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43274. },
  43275. args: ["aNode"],
  43276. 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 ] ] ] ])",
  43277. referencedClasses: ["Platform", "Smalltalk"],
  43278. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  43279. }),
  43280. $globals.ASTInterpreter);
  43281. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  43282. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  43283. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['index', 'trackedIndex', 'selector', 'currentNode'], 'Compiler-Interpreter');
  43284. $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`";
  43285. $core.addMethod(
  43286. $core.method({
  43287. selector: "currentNode",
  43288. protocol: 'accessing',
  43289. fn: function (){
  43290. var self=this;
  43291. return self["@currentNode"];
  43292. },
  43293. args: [],
  43294. source: "currentNode\x0a\x09^ currentNode",
  43295. referencedClasses: [],
  43296. messageSends: []
  43297. }),
  43298. $globals.ASTPCNodeVisitor);
  43299. $core.addMethod(
  43300. $core.method({
  43301. selector: "increaseTrackedIndex",
  43302. protocol: 'accessing',
  43303. fn: function (){
  43304. var self=this;
  43305. return $core.withContext(function($ctx1) {
  43306. self["@trackedIndex"]=$recv(self._trackedIndex()).__plus((1));
  43307. return self;
  43308. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  43309. },
  43310. args: [],
  43311. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  43312. referencedClasses: [],
  43313. messageSends: ["+", "trackedIndex"]
  43314. }),
  43315. $globals.ASTPCNodeVisitor);
  43316. $core.addMethod(
  43317. $core.method({
  43318. selector: "index",
  43319. protocol: 'accessing',
  43320. fn: function (){
  43321. var self=this;
  43322. return self["@index"];
  43323. },
  43324. args: [],
  43325. source: "index\x0a\x09^ index",
  43326. referencedClasses: [],
  43327. messageSends: []
  43328. }),
  43329. $globals.ASTPCNodeVisitor);
  43330. $core.addMethod(
  43331. $core.method({
  43332. selector: "index:",
  43333. protocol: 'accessing',
  43334. fn: function (aNumber){
  43335. var self=this;
  43336. self["@index"]=aNumber;
  43337. return self;
  43338. },
  43339. args: ["aNumber"],
  43340. source: "index: aNumber\x0a\x09index := aNumber",
  43341. referencedClasses: [],
  43342. messageSends: []
  43343. }),
  43344. $globals.ASTPCNodeVisitor);
  43345. $core.addMethod(
  43346. $core.method({
  43347. selector: "selector",
  43348. protocol: 'accessing',
  43349. fn: function (){
  43350. var self=this;
  43351. return self["@selector"];
  43352. },
  43353. args: [],
  43354. source: "selector\x0a\x09^ selector",
  43355. referencedClasses: [],
  43356. messageSends: []
  43357. }),
  43358. $globals.ASTPCNodeVisitor);
  43359. $core.addMethod(
  43360. $core.method({
  43361. selector: "selector:",
  43362. protocol: 'accessing',
  43363. fn: function (aString){
  43364. var self=this;
  43365. self["@selector"]=aString;
  43366. return self;
  43367. },
  43368. args: ["aString"],
  43369. source: "selector: aString\x0a\x09selector := aString",
  43370. referencedClasses: [],
  43371. messageSends: []
  43372. }),
  43373. $globals.ASTPCNodeVisitor);
  43374. $core.addMethod(
  43375. $core.method({
  43376. selector: "trackedIndex",
  43377. protocol: 'accessing',
  43378. fn: function (){
  43379. var self=this;
  43380. return $core.withContext(function($ctx1) {
  43381. var $1,$receiver;
  43382. $1=self["@trackedIndex"];
  43383. if(($receiver = $1) == null || $receiver.isNil){
  43384. self["@trackedIndex"]=(0);
  43385. return self["@trackedIndex"];
  43386. } else {
  43387. return $1;
  43388. }
  43389. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  43390. },
  43391. args: [],
  43392. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  43393. referencedClasses: [],
  43394. messageSends: ["ifNil:"]
  43395. }),
  43396. $globals.ASTPCNodeVisitor);
  43397. $core.addMethod(
  43398. $core.method({
  43399. selector: "visitJSStatementNode:",
  43400. protocol: 'visiting',
  43401. fn: function (aNode){
  43402. var self=this;
  43403. self["@currentNode"]=aNode;
  43404. return self;
  43405. },
  43406. args: ["aNode"],
  43407. 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",
  43408. referencedClasses: [],
  43409. messageSends: []
  43410. }),
  43411. $globals.ASTPCNodeVisitor);
  43412. $core.addMethod(
  43413. $core.method({
  43414. selector: "visitSendNode:",
  43415. protocol: 'visiting',
  43416. fn: function (aNode){
  43417. var self=this;
  43418. return $core.withContext(function($ctx1) {
  43419. var $2,$1,$3;
  43420. (
  43421. $ctx1.supercall = true,
  43422. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  43423. $ctx1.supercall = false;
  43424. $2=self._selector();
  43425. $ctx1.sendIdx["selector"]=1;
  43426. $1=$recv($2).__eq($recv(aNode)._selector());
  43427. $ctx1.sendIdx["="]=1;
  43428. if($core.assert($1)){
  43429. $3=$recv(self._trackedIndex()).__eq(self._index());
  43430. if($core.assert($3)){
  43431. self["@currentNode"]=aNode;
  43432. self["@currentNode"];
  43433. }
  43434. self._increaseTrackedIndex();
  43435. }
  43436. return self;
  43437. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  43438. },
  43439. args: ["aNode"],
  43440. 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 ]",
  43441. referencedClasses: [],
  43442. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  43443. }),
  43444. $globals.ASTPCNodeVisitor);
  43445. $core.addMethod(
  43446. $core.method({
  43447. selector: "isLastChild",
  43448. protocol: '*Compiler-Interpreter',
  43449. fn: function (){
  43450. var self=this;
  43451. return $core.withContext(function($ctx1) {
  43452. return $recv($recv($recv(self._parent())._dagChildren())._last()).__eq(self);
  43453. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  43454. },
  43455. args: [],
  43456. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  43457. referencedClasses: [],
  43458. messageSends: ["=", "last", "dagChildren", "parent"]
  43459. }),
  43460. $globals.ASTNode);
  43461. $core.addMethod(
  43462. $core.method({
  43463. selector: "isSteppingNode",
  43464. protocol: '*Compiler-Interpreter',
  43465. fn: function (){
  43466. var self=this;
  43467. return false;
  43468. },
  43469. args: [],
  43470. source: "isSteppingNode\x0a\x09^ false",
  43471. referencedClasses: [],
  43472. messageSends: []
  43473. }),
  43474. $globals.ASTNode);
  43475. $core.addMethod(
  43476. $core.method({
  43477. selector: "nextSiblingNode:",
  43478. protocol: '*Compiler-Interpreter',
  43479. fn: function (aNode){
  43480. var self=this;
  43481. return $core.withContext(function($ctx1) {
  43482. var $1;
  43483. var $early={};
  43484. try {
  43485. $1=self._dagChildren();
  43486. $ctx1.sendIdx["dagChildren"]=1;
  43487. return $recv($1)._at_ifAbsent_($recv($recv(self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  43488. throw $early=[nil];
  43489. }));
  43490. }
  43491. catch(e) {if(e===$early)return e[0]; throw e}
  43492. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  43493. },
  43494. args: ["aNode"],
  43495. 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 ]",
  43496. referencedClasses: [],
  43497. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  43498. }),
  43499. $globals.ASTNode);
  43500. $core.addMethod(
  43501. $core.method({
  43502. selector: "isSteppingNode",
  43503. protocol: '*Compiler-Interpreter',
  43504. fn: function (){
  43505. var self=this;
  43506. return true;
  43507. },
  43508. args: [],
  43509. source: "isSteppingNode\x0a\x09^ true",
  43510. referencedClasses: [],
  43511. messageSends: []
  43512. }),
  43513. $globals.AssignmentNode);
  43514. $core.addMethod(
  43515. $core.method({
  43516. selector: "isSteppingNode",
  43517. protocol: '*Compiler-Interpreter',
  43518. fn: function (){
  43519. var self=this;
  43520. return true;
  43521. },
  43522. args: [],
  43523. source: "isSteppingNode\x0a\x09^ true",
  43524. referencedClasses: [],
  43525. messageSends: []
  43526. }),
  43527. $globals.BlockNode);
  43528. $core.addMethod(
  43529. $core.method({
  43530. selector: "nextSiblingNode:",
  43531. protocol: '*Compiler-Interpreter',
  43532. fn: function (aNode){
  43533. var self=this;
  43534. return nil;
  43535. },
  43536. args: ["aNode"],
  43537. 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",
  43538. referencedClasses: [],
  43539. messageSends: []
  43540. }),
  43541. $globals.BlockNode);
  43542. $core.addMethod(
  43543. $core.method({
  43544. selector: "isSteppingNode",
  43545. protocol: '*Compiler-Interpreter',
  43546. fn: function (){
  43547. var self=this;
  43548. return true;
  43549. },
  43550. args: [],
  43551. source: "isSteppingNode\x0a\x09^ true",
  43552. referencedClasses: [],
  43553. messageSends: []
  43554. }),
  43555. $globals.DynamicArrayNode);
  43556. $core.addMethod(
  43557. $core.method({
  43558. selector: "isSteppingNode",
  43559. protocol: '*Compiler-Interpreter',
  43560. fn: function (){
  43561. var self=this;
  43562. return true;
  43563. },
  43564. args: [],
  43565. source: "isSteppingNode\x0a\x09^ true",
  43566. referencedClasses: [],
  43567. messageSends: []
  43568. }),
  43569. $globals.DynamicDictionaryNode);
  43570. $core.addMethod(
  43571. $core.method({
  43572. selector: "isSteppingNode",
  43573. protocol: '*Compiler-Interpreter',
  43574. fn: function (){
  43575. var self=this;
  43576. return true;
  43577. },
  43578. args: [],
  43579. source: "isSteppingNode\x0a\x09^ true",
  43580. referencedClasses: [],
  43581. messageSends: []
  43582. }),
  43583. $globals.JSStatementNode);
  43584. $core.addMethod(
  43585. $core.method({
  43586. selector: "isCascadeSendNode",
  43587. protocol: '*Compiler-Interpreter',
  43588. fn: function (){
  43589. var self=this;
  43590. return $core.withContext(function($ctx1) {
  43591. return $recv(self._parent())._isCascadeNode();
  43592. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  43593. },
  43594. args: [],
  43595. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  43596. referencedClasses: [],
  43597. messageSends: ["isCascadeNode", "parent"]
  43598. }),
  43599. $globals.SendNode);
  43600. $core.addMethod(
  43601. $core.method({
  43602. selector: "isSteppingNode",
  43603. protocol: '*Compiler-Interpreter',
  43604. fn: function (){
  43605. var self=this;
  43606. return true;
  43607. },
  43608. args: [],
  43609. source: "isSteppingNode\x0a\x09^ true",
  43610. referencedClasses: [],
  43611. messageSends: []
  43612. }),
  43613. $globals.SendNode);
  43614. });
  43615. define('amber/lang',[
  43616. './deploy',
  43617. './compatibility', // pre-fetch, dep of ./boot
  43618. './boot', // pre-fetch, dep of ./helpers
  43619. './helpers', // pre-fetch, dep of ./deploy
  43620. './parser',
  43621. // --- packages for the Amber reflection begin here ---
  43622. 'amber_core/Platform-ImportExport',
  43623. 'amber_core/Compiler-Core',
  43624. 'amber_core/Compiler-AST',
  43625. 'amber_core/Compiler-Semantic',
  43626. 'amber_core/Compiler-IR',
  43627. 'amber_core/Compiler-Inlining',
  43628. 'amber_core/Compiler-Interpreter'
  43629. // --- packages for the Amber reflection end here ---
  43630. ], function (amber) { return amber; });
  43631. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  43632. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  43633. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  43634. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  43635. $core.addPackage('Platform-DOM');
  43636. $core.packages["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  43637. $core.packages["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43638. $core.addClass('PlatformDom', $globals.Object, [], 'Platform-DOM');
  43639. $core.addMethod(
  43640. $core.method({
  43641. selector: "isDomNode:",
  43642. protocol: 'testing',
  43643. fn: function (anObject){
  43644. var self=this;
  43645. return $core.withContext(function($ctx1) {
  43646. return anObject.nodeType > 0 &&
  43647. Object.prototype.toString.call(anObject) !== "[object Object]";
  43648. return self;
  43649. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.klass)});
  43650. },
  43651. args: ["anObject"],
  43652. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  43653. referencedClasses: [],
  43654. messageSends: []
  43655. }),
  43656. $globals.PlatformDom.klass);
  43657. $core.addMethod(
  43658. $core.method({
  43659. selector: "isFeasible",
  43660. protocol: 'testing',
  43661. fn: function (){
  43662. var self=this;
  43663. return $core.withContext(function($ctx1) {
  43664. if (typeof document === "undefined") return false;
  43665. try {
  43666. var d = document.createElement("div"),
  43667. f = document.createDocumentFragment(),
  43668. t = document.createTextNode("Hello, Amber!");
  43669. f.appendChild(t);
  43670. d.insertBefore(f, null);
  43671. return d.innerHTML === "Hello, Amber!";
  43672. } catch (e) {
  43673. return false;
  43674. };
  43675. return self;
  43676. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.klass)});
  43677. },
  43678. args: [],
  43679. 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'>",
  43680. referencedClasses: [],
  43681. messageSends: []
  43682. }),
  43683. $globals.PlatformDom.klass);
  43684. $core.addMethod(
  43685. $core.method({
  43686. selector: "newCustomEvent:detail:",
  43687. protocol: 'creation',
  43688. fn: function (aString,anObject){
  43689. var self=this;
  43690. return $core.withContext(function($ctx1) {
  43691. return new CustomEvent(aString, {detail: anObject});
  43692. return self;
  43693. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.klass)});
  43694. },
  43695. args: ["aString", "anObject"],
  43696. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  43697. referencedClasses: [],
  43698. messageSends: []
  43699. }),
  43700. $globals.PlatformDom.klass);
  43701. $core.addMethod(
  43702. $core.method({
  43703. selector: "toArray:",
  43704. protocol: 'converting',
  43705. fn: function (aDomList){
  43706. var self=this;
  43707. return $core.withContext(function($ctx1) {
  43708. return Array.prototype.slice.call(aDomList);
  43709. return self;
  43710. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.klass)});
  43711. },
  43712. args: ["aDomList"],
  43713. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  43714. referencedClasses: [],
  43715. messageSends: []
  43716. }),
  43717. $globals.PlatformDom.klass);
  43718. $core.addMethod(
  43719. $core.method({
  43720. selector: "asDomNode",
  43721. protocol: '*Platform-DOM',
  43722. fn: function (){
  43723. var self=this;
  43724. return $core.withContext(function($ctx1) {
  43725. return $recv(document)._createTextNode_(self._asString());
  43726. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  43727. },
  43728. args: [],
  43729. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  43730. referencedClasses: [],
  43731. messageSends: ["createTextNode:", "asString"]
  43732. }),
  43733. $globals.CharacterArray);
  43734. $core.addMethod(
  43735. $core.method({
  43736. selector: "asDomNode",
  43737. protocol: '*Platform-DOM',
  43738. fn: function (){
  43739. var self=this;
  43740. var fragment;
  43741. return $core.withContext(function($ctx1) {
  43742. fragment=$recv(document)._createDocumentFragment();
  43743. self._do_((function(each){
  43744. return $core.withContext(function($ctx2) {
  43745. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  43746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43747. }));
  43748. return fragment;
  43749. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  43750. },
  43751. args: [],
  43752. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  43753. referencedClasses: [],
  43754. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  43755. }),
  43756. $globals.Collection);
  43757. $core.addMethod(
  43758. $core.method({
  43759. selector: "asDomNode",
  43760. protocol: '*Platform-DOM',
  43761. fn: function (){
  43762. var self=this;
  43763. return $core.withContext(function($ctx1) {
  43764. var $1,$2;
  43765. $1=$recv($globals.PlatformDom)._isDomNode_(self["@jsObject"]);
  43766. if($core.assert($1)){
  43767. return self["@jsObject"];
  43768. } else {
  43769. $2=(
  43770. $ctx1.supercall = true,
  43771. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($recv(self), []));
  43772. $ctx1.supercall = false;
  43773. return $2;
  43774. }
  43775. return self;
  43776. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  43777. },
  43778. args: [],
  43779. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  43780. referencedClasses: ["PlatformDom"],
  43781. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  43782. }),
  43783. $globals.JSObjectProxy);
  43784. $core.addMethod(
  43785. $core.method({
  43786. selector: "htmlTextContent",
  43787. protocol: '*Platform-DOM',
  43788. fn: function (){
  43789. var self=this;
  43790. return $core.withContext(function($ctx1) {
  43791. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  43792. return self;
  43793. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  43794. },
  43795. args: [],
  43796. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  43797. referencedClasses: [],
  43798. messageSends: []
  43799. }),
  43800. $globals.String);
  43801. });
  43802. 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";
  43803. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  43804. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  43805. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  43806. $core.addPackage('SUnit');
  43807. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  43808. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43809. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  43810. $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.";
  43811. $core.addMethod(
  43812. $core.method({
  43813. selector: "result",
  43814. protocol: 'accessing',
  43815. fn: function (){
  43816. var self=this;
  43817. return self["@result"];
  43818. },
  43819. args: [],
  43820. source: "result\x0a\x09^ result",
  43821. referencedClasses: [],
  43822. messageSends: []
  43823. }),
  43824. $globals.ResultAnnouncement);
  43825. $core.addMethod(
  43826. $core.method({
  43827. selector: "result:",
  43828. protocol: 'accessing',
  43829. fn: function (aTestResult){
  43830. var self=this;
  43831. self["@result"]=aTestResult;
  43832. return self;
  43833. },
  43834. args: ["aTestResult"],
  43835. source: "result: aTestResult\x0a\x09result := aTestResult",
  43836. referencedClasses: [],
  43837. messageSends: []
  43838. }),
  43839. $globals.ResultAnnouncement);
  43840. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  43841. $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.";
  43842. $core.addMethod(
  43843. $core.method({
  43844. selector: "assert:",
  43845. protocol: 'testing',
  43846. fn: function (aBoolean){
  43847. var self=this;
  43848. return $core.withContext(function($ctx1) {
  43849. self._assert_description_(aBoolean,"Assertion failed");
  43850. return self;
  43851. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  43852. },
  43853. args: ["aBoolean"],
  43854. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  43855. referencedClasses: [],
  43856. messageSends: ["assert:description:"]
  43857. }),
  43858. $globals.TestCase);
  43859. $core.addMethod(
  43860. $core.method({
  43861. selector: "assert:description:",
  43862. protocol: 'testing',
  43863. fn: function (aBoolean,aString){
  43864. var self=this;
  43865. return $core.withContext(function($ctx1) {
  43866. if(!$core.assert(aBoolean)){
  43867. self._signalFailure_(aString);
  43868. }
  43869. return self;
  43870. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  43871. },
  43872. args: ["aBoolean", "aString"],
  43873. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  43874. referencedClasses: [],
  43875. messageSends: ["ifFalse:", "signalFailure:"]
  43876. }),
  43877. $globals.TestCase);
  43878. $core.addMethod(
  43879. $core.method({
  43880. selector: "assert:equals:",
  43881. protocol: 'testing',
  43882. fn: function (actual,expected){
  43883. var self=this;
  43884. return $core.withContext(function($ctx1) {
  43885. var $1,$5,$4,$3,$2;
  43886. $1=$recv(actual).__eq(expected);
  43887. $5=$recv(expected)._printString();
  43888. $ctx1.sendIdx["printString"]=1;
  43889. $4="Expected: ".__comma($5);
  43890. $3=$recv($4).__comma(" but was: ");
  43891. $ctx1.sendIdx[","]=2;
  43892. $2=$recv($3).__comma($recv(actual)._printString());
  43893. $ctx1.sendIdx[","]=1;
  43894. return self._assert_description_($1,$2);
  43895. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  43896. },
  43897. args: ["actual", "expected"],
  43898. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  43899. referencedClasses: [],
  43900. messageSends: ["assert:description:", "=", ",", "printString"]
  43901. }),
  43902. $globals.TestCase);
  43903. $core.addMethod(
  43904. $core.method({
  43905. selector: "async:",
  43906. protocol: 'async',
  43907. fn: function (aBlock){
  43908. var self=this;
  43909. var c;
  43910. return $core.withContext(function($ctx1) {
  43911. var $1;
  43912. self._errorIfNotAsync_("#async");
  43913. c=self["@context"];
  43914. return (function(){
  43915. return $core.withContext(function($ctx2) {
  43916. $1=self._isAsync();
  43917. if($core.assert($1)){
  43918. return $recv(c)._execute_(aBlock);
  43919. }
  43920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43921. });
  43922. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  43923. },
  43924. args: ["aBlock"],
  43925. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  43926. referencedClasses: [],
  43927. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  43928. }),
  43929. $globals.TestCase);
  43930. $core.addMethod(
  43931. $core.method({
  43932. selector: "context:",
  43933. protocol: 'accessing',
  43934. fn: function (aRunningTestContext){
  43935. var self=this;
  43936. self["@context"]=aRunningTestContext;
  43937. return self;
  43938. },
  43939. args: ["aRunningTestContext"],
  43940. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  43941. referencedClasses: [],
  43942. messageSends: []
  43943. }),
  43944. $globals.TestCase);
  43945. $core.addMethod(
  43946. $core.method({
  43947. selector: "deny:",
  43948. protocol: 'testing',
  43949. fn: function (aBoolean){
  43950. var self=this;
  43951. return $core.withContext(function($ctx1) {
  43952. self._assert_($recv(aBoolean)._not());
  43953. return self;
  43954. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  43955. },
  43956. args: ["aBoolean"],
  43957. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  43958. referencedClasses: [],
  43959. messageSends: ["assert:", "not"]
  43960. }),
  43961. $globals.TestCase);
  43962. $core.addMethod(
  43963. $core.method({
  43964. selector: "errorIfNotAsync:",
  43965. protocol: 'error handling',
  43966. fn: function (aString){
  43967. var self=this;
  43968. return $core.withContext(function($ctx1) {
  43969. var $1;
  43970. $1=self._isAsync();
  43971. if(!$core.assert($1)){
  43972. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  43973. }
  43974. return self;
  43975. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  43976. },
  43977. args: ["aString"],
  43978. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  43979. referencedClasses: [],
  43980. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  43981. }),
  43982. $globals.TestCase);
  43983. $core.addMethod(
  43984. $core.method({
  43985. selector: "finished",
  43986. protocol: 'async',
  43987. fn: function (){
  43988. var self=this;
  43989. return $core.withContext(function($ctx1) {
  43990. self._errorIfNotAsync_("#finished");
  43991. self["@asyncTimeout"]=nil;
  43992. return self;
  43993. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  43994. },
  43995. args: [],
  43996. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  43997. referencedClasses: [],
  43998. messageSends: ["errorIfNotAsync:"]
  43999. }),
  44000. $globals.TestCase);
  44001. $core.addMethod(
  44002. $core.method({
  44003. selector: "isAsync",
  44004. protocol: 'testing',
  44005. fn: function (){
  44006. var self=this;
  44007. return $core.withContext(function($ctx1) {
  44008. return $recv(self["@asyncTimeout"])._notNil();
  44009. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  44010. },
  44011. args: [],
  44012. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  44013. referencedClasses: [],
  44014. messageSends: ["notNil"]
  44015. }),
  44016. $globals.TestCase);
  44017. $core.addMethod(
  44018. $core.method({
  44019. selector: "performTest",
  44020. protocol: 'running',
  44021. fn: function (){
  44022. var self=this;
  44023. return $core.withContext(function($ctx1) {
  44024. self["@asyncTimeout"]=nil;
  44025. self._perform_(self._selector());
  44026. return self;
  44027. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  44028. },
  44029. args: [],
  44030. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  44031. referencedClasses: [],
  44032. messageSends: ["perform:", "selector"]
  44033. }),
  44034. $globals.TestCase);
  44035. $core.addMethod(
  44036. $core.method({
  44037. selector: "runCase",
  44038. protocol: 'running',
  44039. fn: function (){
  44040. var self=this;
  44041. return $core.withContext(function($ctx1) {
  44042. $recv($recv($globals.TestContext)._testCase_(self))._start();
  44043. return self;
  44044. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  44045. },
  44046. args: [],
  44047. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  44048. referencedClasses: ["TestContext"],
  44049. messageSends: ["start", "testCase:"]
  44050. }),
  44051. $globals.TestCase);
  44052. $core.addMethod(
  44053. $core.method({
  44054. selector: "selector",
  44055. protocol: 'accessing',
  44056. fn: function (){
  44057. var self=this;
  44058. return self["@testSelector"];
  44059. },
  44060. args: [],
  44061. source: "selector\x0a\x09^ testSelector",
  44062. referencedClasses: [],
  44063. messageSends: []
  44064. }),
  44065. $globals.TestCase);
  44066. $core.addMethod(
  44067. $core.method({
  44068. selector: "setTestSelector:",
  44069. protocol: 'accessing',
  44070. fn: function (aSelector){
  44071. var self=this;
  44072. self["@testSelector"]=aSelector;
  44073. return self;
  44074. },
  44075. args: ["aSelector"],
  44076. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  44077. referencedClasses: [],
  44078. messageSends: []
  44079. }),
  44080. $globals.TestCase);
  44081. $core.addMethod(
  44082. $core.method({
  44083. selector: "setUp",
  44084. protocol: 'running',
  44085. fn: function (){
  44086. var self=this;
  44087. return self;
  44088. },
  44089. args: [],
  44090. source: "setUp",
  44091. referencedClasses: [],
  44092. messageSends: []
  44093. }),
  44094. $globals.TestCase);
  44095. $core.addMethod(
  44096. $core.method({
  44097. selector: "should:",
  44098. protocol: 'testing',
  44099. fn: function (aBlock){
  44100. var self=this;
  44101. return $core.withContext(function($ctx1) {
  44102. self._assert_($recv(aBlock)._value());
  44103. return self;
  44104. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  44105. },
  44106. args: ["aBlock"],
  44107. source: "should: aBlock\x0a\x09self assert: aBlock value",
  44108. referencedClasses: [],
  44109. messageSends: ["assert:", "value"]
  44110. }),
  44111. $globals.TestCase);
  44112. $core.addMethod(
  44113. $core.method({
  44114. selector: "should:raise:",
  44115. protocol: 'testing',
  44116. fn: function (aBlock,anExceptionClass){
  44117. var self=this;
  44118. return $core.withContext(function($ctx1) {
  44119. self._assert_($recv((function(){
  44120. return $core.withContext(function($ctx2) {
  44121. $recv(aBlock)._value();
  44122. return false;
  44123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44124. }))._on_do_(anExceptionClass,(function(ex){
  44125. return true;
  44126. })));
  44127. return self;
  44128. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  44129. },
  44130. args: ["aBlock", "anExceptionClass"],
  44131. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  44132. referencedClasses: [],
  44133. messageSends: ["assert:", "on:do:", "value"]
  44134. }),
  44135. $globals.TestCase);
  44136. $core.addMethod(
  44137. $core.method({
  44138. selector: "shouldnt:raise:",
  44139. protocol: 'testing',
  44140. fn: function (aBlock,anExceptionClass){
  44141. var self=this;
  44142. return $core.withContext(function($ctx1) {
  44143. self._assert_($recv((function(){
  44144. return $core.withContext(function($ctx2) {
  44145. $recv(aBlock)._value();
  44146. return true;
  44147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44148. }))._on_do_(anExceptionClass,(function(ex){
  44149. return false;
  44150. })));
  44151. return self;
  44152. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  44153. },
  44154. args: ["aBlock", "anExceptionClass"],
  44155. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  44156. referencedClasses: [],
  44157. messageSends: ["assert:", "on:do:", "value"]
  44158. }),
  44159. $globals.TestCase);
  44160. $core.addMethod(
  44161. $core.method({
  44162. selector: "signalFailure:",
  44163. protocol: 'private',
  44164. fn: function (aString){
  44165. var self=this;
  44166. return $core.withContext(function($ctx1) {
  44167. var $1;
  44168. $1=$recv($globals.TestFailure)._new();
  44169. $recv($1)._messageText_(aString);
  44170. $recv($1)._signal();
  44171. return self;
  44172. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  44173. },
  44174. args: ["aString"],
  44175. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  44176. referencedClasses: ["TestFailure"],
  44177. messageSends: ["messageText:", "new", "signal"]
  44178. }),
  44179. $globals.TestCase);
  44180. $core.addMethod(
  44181. $core.method({
  44182. selector: "tearDown",
  44183. protocol: 'running',
  44184. fn: function (){
  44185. var self=this;
  44186. return self;
  44187. },
  44188. args: [],
  44189. source: "tearDown",
  44190. referencedClasses: [],
  44191. messageSends: []
  44192. }),
  44193. $globals.TestCase);
  44194. $core.addMethod(
  44195. $core.method({
  44196. selector: "timeout:",
  44197. protocol: 'async',
  44198. fn: function (aNumber){
  44199. var self=this;
  44200. return $core.withContext(function($ctx1) {
  44201. var $1,$receiver;
  44202. $1=self["@asyncTimeout"];
  44203. if(($receiver = $1) == null || $receiver.isNil){
  44204. $1;
  44205. } else {
  44206. $recv(self["@asyncTimeout"])._clearTimeout();
  44207. }
  44208. self["@asyncTimeout"]=(0);
  44209. self["@asyncTimeout"]=$recv(self._async_((function(){
  44210. return $core.withContext(function($ctx2) {
  44211. return self._assert_description_(false,"SUnit grace time exhausted");
  44212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44213. })))._valueWithTimeout_(aNumber);
  44214. return self;
  44215. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  44216. },
  44217. args: ["aNumber"],
  44218. 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",
  44219. referencedClasses: [],
  44220. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  44221. }),
  44222. $globals.TestCase);
  44223. $core.addMethod(
  44224. $core.method({
  44225. selector: "allTestSelectors",
  44226. protocol: 'accessing',
  44227. fn: function (){
  44228. var self=this;
  44229. var selectors;
  44230. return $core.withContext(function($ctx1) {
  44231. var $1;
  44232. selectors=self._testSelectors();
  44233. $1=self._shouldInheritSelectors();
  44234. if($core.assert($1)){
  44235. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  44236. }
  44237. return selectors;
  44238. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  44239. },
  44240. args: [],
  44241. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  44242. referencedClasses: [],
  44243. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  44244. }),
  44245. $globals.TestCase.klass);
  44246. $core.addMethod(
  44247. $core.method({
  44248. selector: "buildSuite",
  44249. protocol: 'accessing',
  44250. fn: function (){
  44251. var self=this;
  44252. return $core.withContext(function($ctx1) {
  44253. return $recv(self._allTestSelectors())._collect_((function(each){
  44254. return $core.withContext(function($ctx2) {
  44255. return self._selector_(each);
  44256. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44257. }));
  44258. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  44259. },
  44260. args: [],
  44261. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  44262. referencedClasses: [],
  44263. messageSends: ["collect:", "allTestSelectors", "selector:"]
  44264. }),
  44265. $globals.TestCase.klass);
  44266. $core.addMethod(
  44267. $core.method({
  44268. selector: "classTag",
  44269. protocol: 'accessing',
  44270. fn: function (){
  44271. var self=this;
  44272. return "test";
  44273. },
  44274. args: [],
  44275. 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'",
  44276. referencedClasses: [],
  44277. messageSends: []
  44278. }),
  44279. $globals.TestCase.klass);
  44280. $core.addMethod(
  44281. $core.method({
  44282. selector: "isAbstract",
  44283. protocol: 'testing',
  44284. fn: function (){
  44285. var self=this;
  44286. return $core.withContext(function($ctx1) {
  44287. return $recv(self._name()).__eq("TestCase");
  44288. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  44289. },
  44290. args: [],
  44291. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  44292. referencedClasses: [],
  44293. messageSends: ["=", "name"]
  44294. }),
  44295. $globals.TestCase.klass);
  44296. $core.addMethod(
  44297. $core.method({
  44298. selector: "lookupHierarchyRoot",
  44299. protocol: 'accessing',
  44300. fn: function (){
  44301. var self=this;
  44302. return $globals.TestCase;
  44303. },
  44304. args: [],
  44305. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  44306. referencedClasses: ["TestCase"],
  44307. messageSends: []
  44308. }),
  44309. $globals.TestCase.klass);
  44310. $core.addMethod(
  44311. $core.method({
  44312. selector: "selector:",
  44313. protocol: 'accessing',
  44314. fn: function (aSelector){
  44315. var self=this;
  44316. return $core.withContext(function($ctx1) {
  44317. var $1;
  44318. $1=self._new();
  44319. $recv($1)._setTestSelector_(aSelector);
  44320. return $recv($1)._yourself();
  44321. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  44322. },
  44323. args: ["aSelector"],
  44324. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  44325. referencedClasses: [],
  44326. messageSends: ["setTestSelector:", "new", "yourself"]
  44327. }),
  44328. $globals.TestCase.klass);
  44329. $core.addMethod(
  44330. $core.method({
  44331. selector: "shouldInheritSelectors",
  44332. protocol: 'testing',
  44333. fn: function (){
  44334. var self=this;
  44335. return $core.withContext(function($ctx1) {
  44336. return self.__tild_eq(self._lookupHierarchyRoot());
  44337. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  44338. },
  44339. args: [],
  44340. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  44341. referencedClasses: [],
  44342. messageSends: ["~=", "lookupHierarchyRoot"]
  44343. }),
  44344. $globals.TestCase.klass);
  44345. $core.addMethod(
  44346. $core.method({
  44347. selector: "testSelectors",
  44348. protocol: 'accessing',
  44349. fn: function (){
  44350. var self=this;
  44351. return $core.withContext(function($ctx1) {
  44352. return $recv($recv(self._methodDictionary())._keys())._select_((function(each){
  44353. return $core.withContext(function($ctx2) {
  44354. return $recv(each)._match_("^test");
  44355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44356. }));
  44357. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  44358. },
  44359. args: [],
  44360. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  44361. referencedClasses: [],
  44362. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  44363. }),
  44364. $globals.TestCase.klass);
  44365. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  44366. $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).";
  44367. $core.addMethod(
  44368. $core.method({
  44369. selector: "execute:",
  44370. protocol: 'running',
  44371. fn: function (aBlock){
  44372. var self=this;
  44373. var failed;
  44374. return $core.withContext(function($ctx1) {
  44375. var $1,$2;
  44376. $recv(self["@testCase"])._context_(self);
  44377. $ctx1.sendIdx["context:"]=1;
  44378. $recv((function(){
  44379. return $core.withContext(function($ctx2) {
  44380. failed=true;
  44381. failed;
  44382. $recv(aBlock)._value();
  44383. failed=false;
  44384. return failed;
  44385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44386. }))._ensure_((function(){
  44387. return $core.withContext(function($ctx2) {
  44388. $recv(self["@testCase"])._context_(nil);
  44389. $1=$recv(failed)._and_((function(){
  44390. return $core.withContext(function($ctx3) {
  44391. return $recv(self["@testCase"])._isAsync();
  44392. $ctx3.sendIdx["isAsync"]=1;
  44393. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44394. }));
  44395. if($core.assert($1)){
  44396. $recv(self["@testCase"])._finished();
  44397. }
  44398. $2=$recv(self["@testCase"])._isAsync();
  44399. if(!$core.assert($2)){
  44400. return $recv(self["@testCase"])._tearDown();
  44401. }
  44402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44403. }));
  44404. return self;
  44405. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  44406. },
  44407. args: ["aBlock"],
  44408. 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 ] ]",
  44409. referencedClasses: [],
  44410. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  44411. }),
  44412. $globals.TestContext);
  44413. $core.addMethod(
  44414. $core.method({
  44415. selector: "start",
  44416. protocol: 'running',
  44417. fn: function (){
  44418. var self=this;
  44419. return $core.withContext(function($ctx1) {
  44420. self._execute_((function(){
  44421. return $core.withContext(function($ctx2) {
  44422. $recv(self["@testCase"])._setUp();
  44423. return $recv(self["@testCase"])._performTest();
  44424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44425. }));
  44426. return self;
  44427. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  44428. },
  44429. args: [],
  44430. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  44431. referencedClasses: [],
  44432. messageSends: ["execute:", "setUp", "performTest"]
  44433. }),
  44434. $globals.TestContext);
  44435. $core.addMethod(
  44436. $core.method({
  44437. selector: "testCase:",
  44438. protocol: 'accessing',
  44439. fn: function (aTestCase){
  44440. var self=this;
  44441. self["@testCase"]=aTestCase;
  44442. return self;
  44443. },
  44444. args: ["aTestCase"],
  44445. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  44446. referencedClasses: [],
  44447. messageSends: []
  44448. }),
  44449. $globals.TestContext);
  44450. $core.addMethod(
  44451. $core.method({
  44452. selector: "testCase:",
  44453. protocol: 'instance creation',
  44454. fn: function (aTestCase){
  44455. var self=this;
  44456. return $core.withContext(function($ctx1) {
  44457. var $1;
  44458. $1=self._new();
  44459. $recv($1)._testCase_(aTestCase);
  44460. return $recv($1)._yourself();
  44461. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  44462. },
  44463. args: ["aTestCase"],
  44464. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  44465. referencedClasses: [],
  44466. messageSends: ["testCase:", "new", "yourself"]
  44467. }),
  44468. $globals.TestContext.klass);
  44469. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  44470. $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`.";
  44471. $core.addMethod(
  44472. $core.method({
  44473. selector: "execute:",
  44474. protocol: 'running',
  44475. fn: function (aBlock){
  44476. var self=this;
  44477. return $core.withContext(function($ctx1) {
  44478. var $1;
  44479. $recv((function(){
  44480. return $core.withContext(function($ctx2) {
  44481. return self._withErrorReporting_((function(){
  44482. return $core.withContext(function($ctx3) {
  44483. return (
  44484. $ctx3.supercall = true,
  44485. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($recv(self), [aBlock]));
  44486. $ctx3.supercall = false;
  44487. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44488. }));
  44489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44490. }))._ensure_((function(){
  44491. return $core.withContext(function($ctx2) {
  44492. $1=$recv(self["@testCase"])._isAsync();
  44493. if(!$core.assert($1)){
  44494. $recv(self["@result"])._increaseRuns();
  44495. return $recv(self["@finished"])._value();
  44496. }
  44497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44498. }));
  44499. return self;
  44500. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44501. },
  44502. args: ["aBlock"],
  44503. 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 ] ]",
  44504. referencedClasses: [],
  44505. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  44506. }),
  44507. $globals.ReportingTestContext);
  44508. $core.addMethod(
  44509. $core.method({
  44510. selector: "finished:",
  44511. protocol: 'accessing',
  44512. fn: function (aBlock){
  44513. var self=this;
  44514. self["@finished"]=aBlock;
  44515. return self;
  44516. },
  44517. args: ["aBlock"],
  44518. source: "finished: aBlock\x0a\x09finished := aBlock",
  44519. referencedClasses: [],
  44520. messageSends: []
  44521. }),
  44522. $globals.ReportingTestContext);
  44523. $core.addMethod(
  44524. $core.method({
  44525. selector: "result:",
  44526. protocol: 'accessing',
  44527. fn: function (aTestResult){
  44528. var self=this;
  44529. self["@result"]=aTestResult;
  44530. return self;
  44531. },
  44532. args: ["aTestResult"],
  44533. source: "result: aTestResult\x0a\x09result := aTestResult",
  44534. referencedClasses: [],
  44535. messageSends: []
  44536. }),
  44537. $globals.ReportingTestContext);
  44538. $core.addMethod(
  44539. $core.method({
  44540. selector: "withErrorReporting:",
  44541. protocol: 'private',
  44542. fn: function (aBlock){
  44543. var self=this;
  44544. return $core.withContext(function($ctx1) {
  44545. $recv((function(){
  44546. return $core.withContext(function($ctx2) {
  44547. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  44548. return $core.withContext(function($ctx3) {
  44549. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  44550. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  44551. }));
  44552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44553. }))._on_do_($globals.Error,(function(ex){
  44554. return $core.withContext(function($ctx2) {
  44555. return $recv(self["@result"])._addError_(self["@testCase"]);
  44556. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  44557. }));
  44558. $ctx1.sendIdx["on:do:"]=1;
  44559. return self;
  44560. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44561. },
  44562. args: ["aBlock"],
  44563. 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 ]",
  44564. referencedClasses: ["TestFailure", "Error"],
  44565. messageSends: ["on:do:", "addFailure:", "addError:"]
  44566. }),
  44567. $globals.ReportingTestContext);
  44568. $core.addMethod(
  44569. $core.method({
  44570. selector: "testCase:result:finished:",
  44571. protocol: 'instance creation',
  44572. fn: function (aTestCase,aTestResult,aBlock){
  44573. var self=this;
  44574. return $core.withContext(function($ctx1) {
  44575. var $1;
  44576. $1=(
  44577. $ctx1.supercall = true,
  44578. ($globals.ReportingTestContext.klass.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  44579. $ctx1.supercall = false;
  44580. $recv($1)._result_(aTestResult);
  44581. $recv($1)._finished_(aBlock);
  44582. return $recv($1)._yourself();
  44583. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  44584. },
  44585. args: ["aTestCase", "aTestResult", "aBlock"],
  44586. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  44587. referencedClasses: [],
  44588. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  44589. }),
  44590. $globals.ReportingTestContext.klass);
  44591. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  44592. $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.";
  44593. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  44594. $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";
  44595. $core.addMethod(
  44596. $core.method({
  44597. selector: "addError:",
  44598. protocol: 'accessing',
  44599. fn: function (anError){
  44600. var self=this;
  44601. return $core.withContext(function($ctx1) {
  44602. $recv(self._errors())._add_(anError);
  44603. return self;
  44604. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  44605. },
  44606. args: ["anError"],
  44607. source: "addError: anError\x0a\x09self errors add: anError",
  44608. referencedClasses: [],
  44609. messageSends: ["add:", "errors"]
  44610. }),
  44611. $globals.TestResult);
  44612. $core.addMethod(
  44613. $core.method({
  44614. selector: "addFailure:",
  44615. protocol: 'accessing',
  44616. fn: function (aFailure){
  44617. var self=this;
  44618. return $core.withContext(function($ctx1) {
  44619. $recv(self._failures())._add_(aFailure);
  44620. return self;
  44621. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  44622. },
  44623. args: ["aFailure"],
  44624. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  44625. referencedClasses: [],
  44626. messageSends: ["add:", "failures"]
  44627. }),
  44628. $globals.TestResult);
  44629. $core.addMethod(
  44630. $core.method({
  44631. selector: "errors",
  44632. protocol: 'accessing',
  44633. fn: function (){
  44634. var self=this;
  44635. return self["@errors"];
  44636. },
  44637. args: [],
  44638. source: "errors\x0a\x09^ errors",
  44639. referencedClasses: [],
  44640. messageSends: []
  44641. }),
  44642. $globals.TestResult);
  44643. $core.addMethod(
  44644. $core.method({
  44645. selector: "failures",
  44646. protocol: 'accessing',
  44647. fn: function (){
  44648. var self=this;
  44649. return self["@failures"];
  44650. },
  44651. args: [],
  44652. source: "failures\x0a\x09^ failures",
  44653. referencedClasses: [],
  44654. messageSends: []
  44655. }),
  44656. $globals.TestResult);
  44657. $core.addMethod(
  44658. $core.method({
  44659. selector: "increaseRuns",
  44660. protocol: 'accessing',
  44661. fn: function (){
  44662. var self=this;
  44663. return $core.withContext(function($ctx1) {
  44664. self["@runs"]=$recv(self["@runs"]).__plus((1));
  44665. return self;
  44666. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  44667. },
  44668. args: [],
  44669. source: "increaseRuns\x0a\x09runs := runs + 1",
  44670. referencedClasses: [],
  44671. messageSends: ["+"]
  44672. }),
  44673. $globals.TestResult);
  44674. $core.addMethod(
  44675. $core.method({
  44676. selector: "initialize",
  44677. protocol: 'initialization',
  44678. fn: function (){
  44679. var self=this;
  44680. return $core.withContext(function($ctx1) {
  44681. (
  44682. $ctx1.supercall = true,
  44683. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  44684. $ctx1.supercall = false;
  44685. self["@timestamp"]=$recv($globals.Date)._now();
  44686. self["@runs"]=(0);
  44687. self["@errors"]=$recv($globals.Array)._new();
  44688. $ctx1.sendIdx["new"]=1;
  44689. self["@failures"]=$recv($globals.Array)._new();
  44690. self["@total"]=(0);
  44691. return self;
  44692. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  44693. },
  44694. args: [],
  44695. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  44696. referencedClasses: ["Date", "Array"],
  44697. messageSends: ["initialize", "now", "new"]
  44698. }),
  44699. $globals.TestResult);
  44700. $core.addMethod(
  44701. $core.method({
  44702. selector: "nextRunDo:",
  44703. protocol: 'running',
  44704. fn: function (aBlock){
  44705. var self=this;
  44706. return $core.withContext(function($ctx1) {
  44707. var $2,$1;
  44708. $2=self._runs();
  44709. $ctx1.sendIdx["runs"]=1;
  44710. $1=$recv($2).__eq_eq(self._total());
  44711. if(!$core.assert($1)){
  44712. return $recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  44713. }
  44714. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  44715. },
  44716. args: ["aBlock"],
  44717. 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 ]",
  44718. referencedClasses: [],
  44719. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  44720. }),
  44721. $globals.TestResult);
  44722. $core.addMethod(
  44723. $core.method({
  44724. selector: "runCase:",
  44725. protocol: 'running',
  44726. fn: function (aTestCase){
  44727. var self=this;
  44728. return $core.withContext(function($ctx1) {
  44729. $recv((function(){
  44730. return $core.withContext(function($ctx2) {
  44731. return $recv((function(){
  44732. return $core.withContext(function($ctx3) {
  44733. self._increaseRuns();
  44734. return $recv(aTestCase)._runCase();
  44735. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44736. }))._on_do_($globals.TestFailure,(function(ex){
  44737. return $core.withContext(function($ctx3) {
  44738. return self._addFailure_(aTestCase);
  44739. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  44740. }));
  44741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44742. }))._on_do_($globals.Error,(function(ex){
  44743. return $core.withContext(function($ctx2) {
  44744. return self._addError_(aTestCase);
  44745. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  44746. }));
  44747. $ctx1.sendIdx["on:do:"]=1;
  44748. return self;
  44749. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  44750. },
  44751. args: ["aTestCase"],
  44752. 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 ]",
  44753. referencedClasses: ["TestFailure", "Error"],
  44754. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  44755. }),
  44756. $globals.TestResult);
  44757. $core.addMethod(
  44758. $core.method({
  44759. selector: "runs",
  44760. protocol: 'accessing',
  44761. fn: function (){
  44762. var self=this;
  44763. return self["@runs"];
  44764. },
  44765. args: [],
  44766. source: "runs\x0a\x09^ runs",
  44767. referencedClasses: [],
  44768. messageSends: []
  44769. }),
  44770. $globals.TestResult);
  44771. $core.addMethod(
  44772. $core.method({
  44773. selector: "status",
  44774. protocol: 'accessing',
  44775. fn: function (){
  44776. var self=this;
  44777. return $core.withContext(function($ctx1) {
  44778. var $1;
  44779. $1=$recv(self._errors())._ifNotEmpty_ifEmpty_((function(){
  44780. return "error";
  44781. }),(function(){
  44782. return $core.withContext(function($ctx2) {
  44783. return $recv(self._failures())._ifNotEmpty_ifEmpty_((function(){
  44784. return "failure";
  44785. }),(function(){
  44786. return "success";
  44787. }));
  44788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44789. }));
  44790. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  44791. return $1;
  44792. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  44793. },
  44794. args: [],
  44795. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  44796. referencedClasses: [],
  44797. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  44798. }),
  44799. $globals.TestResult);
  44800. $core.addMethod(
  44801. $core.method({
  44802. selector: "timestamp",
  44803. protocol: 'accessing',
  44804. fn: function (){
  44805. var self=this;
  44806. return self["@timestamp"];
  44807. },
  44808. args: [],
  44809. source: "timestamp\x0a\x09^ timestamp",
  44810. referencedClasses: [],
  44811. messageSends: []
  44812. }),
  44813. $globals.TestResult);
  44814. $core.addMethod(
  44815. $core.method({
  44816. selector: "total",
  44817. protocol: 'accessing',
  44818. fn: function (){
  44819. var self=this;
  44820. return self["@total"];
  44821. },
  44822. args: [],
  44823. source: "total\x0a\x09^ total",
  44824. referencedClasses: [],
  44825. messageSends: []
  44826. }),
  44827. $globals.TestResult);
  44828. $core.addMethod(
  44829. $core.method({
  44830. selector: "total:",
  44831. protocol: 'accessing',
  44832. fn: function (aNumber){
  44833. var self=this;
  44834. self["@total"]=aNumber;
  44835. return self;
  44836. },
  44837. args: ["aNumber"],
  44838. source: "total: aNumber\x0a\x09total := aNumber",
  44839. referencedClasses: [],
  44840. messageSends: []
  44841. }),
  44842. $globals.TestResult);
  44843. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  44844. $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`.";
  44845. $core.addMethod(
  44846. $core.method({
  44847. selector: "announcer",
  44848. protocol: 'accessing',
  44849. fn: function (){
  44850. var self=this;
  44851. return self["@announcer"];
  44852. },
  44853. args: [],
  44854. source: "announcer\x0a\x09^ announcer",
  44855. referencedClasses: [],
  44856. messageSends: []
  44857. }),
  44858. $globals.TestSuiteRunner);
  44859. $core.addMethod(
  44860. $core.method({
  44861. selector: "contextOf:",
  44862. protocol: 'private',
  44863. fn: function (anInteger){
  44864. var self=this;
  44865. return $core.withContext(function($ctx1) {
  44866. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  44867. return $core.withContext(function($ctx2) {
  44868. return self._resume();
  44869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44870. }));
  44871. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  44872. },
  44873. args: ["anInteger"],
  44874. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  44875. referencedClasses: ["ReportingTestContext"],
  44876. messageSends: ["testCase:result:finished:", "at:", "resume"]
  44877. }),
  44878. $globals.TestSuiteRunner);
  44879. $core.addMethod(
  44880. $core.method({
  44881. selector: "initialize",
  44882. protocol: 'initialization',
  44883. fn: function (){
  44884. var self=this;
  44885. return $core.withContext(function($ctx1) {
  44886. var $1;
  44887. (
  44888. $ctx1.supercall = true,
  44889. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  44890. $ctx1.supercall = false;
  44891. self["@announcer"]=$recv($globals.Announcer)._new();
  44892. $ctx1.sendIdx["new"]=1;
  44893. self["@result"]=$recv($globals.TestResult)._new();
  44894. self["@runNextTest"]=(function(){
  44895. var runs;
  44896. return $core.withContext(function($ctx2) {
  44897. runs=$recv(self["@result"])._runs();
  44898. runs;
  44899. $1=$recv(runs).__lt($recv(self["@result"])._total());
  44900. if($core.assert($1)){
  44901. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  44902. }
  44903. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  44904. });
  44905. return self;
  44906. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  44907. },
  44908. args: [],
  44909. 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 ] ].",
  44910. referencedClasses: ["Announcer", "TestResult"],
  44911. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  44912. }),
  44913. $globals.TestSuiteRunner);
  44914. $core.addMethod(
  44915. $core.method({
  44916. selector: "result",
  44917. protocol: 'accessing',
  44918. fn: function (){
  44919. var self=this;
  44920. return self["@result"];
  44921. },
  44922. args: [],
  44923. source: "result\x0a\x09^ result",
  44924. referencedClasses: [],
  44925. messageSends: []
  44926. }),
  44927. $globals.TestSuiteRunner);
  44928. $core.addMethod(
  44929. $core.method({
  44930. selector: "resume",
  44931. protocol: 'actions',
  44932. fn: function (){
  44933. var self=this;
  44934. return $core.withContext(function($ctx1) {
  44935. $recv(self["@runNextTest"])._fork();
  44936. $recv(self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_(self["@result"]));
  44937. return self;
  44938. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  44939. },
  44940. args: [],
  44941. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  44942. referencedClasses: ["ResultAnnouncement"],
  44943. messageSends: ["fork", "announce:", "result:", "new"]
  44944. }),
  44945. $globals.TestSuiteRunner);
  44946. $core.addMethod(
  44947. $core.method({
  44948. selector: "run",
  44949. protocol: 'actions',
  44950. fn: function (){
  44951. var self=this;
  44952. return $core.withContext(function($ctx1) {
  44953. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  44954. self._resume();
  44955. return self;
  44956. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  44957. },
  44958. args: [],
  44959. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  44960. referencedClasses: [],
  44961. messageSends: ["total:", "size", "resume"]
  44962. }),
  44963. $globals.TestSuiteRunner);
  44964. $core.addMethod(
  44965. $core.method({
  44966. selector: "suite:",
  44967. protocol: 'accessing',
  44968. fn: function (aCollection){
  44969. var self=this;
  44970. self["@suite"]=aCollection;
  44971. return self;
  44972. },
  44973. args: ["aCollection"],
  44974. source: "suite: aCollection\x0a\x09suite := aCollection",
  44975. referencedClasses: [],
  44976. messageSends: []
  44977. }),
  44978. $globals.TestSuiteRunner);
  44979. $core.addMethod(
  44980. $core.method({
  44981. selector: "new",
  44982. protocol: 'instance creation',
  44983. fn: function (){
  44984. var self=this;
  44985. return $core.withContext(function($ctx1) {
  44986. self._shouldNotImplement();
  44987. return self;
  44988. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  44989. },
  44990. args: [],
  44991. source: "new\x0a\x09self shouldNotImplement",
  44992. referencedClasses: [],
  44993. messageSends: ["shouldNotImplement"]
  44994. }),
  44995. $globals.TestSuiteRunner.klass);
  44996. $core.addMethod(
  44997. $core.method({
  44998. selector: "on:",
  44999. protocol: 'instance creation',
  45000. fn: function (aCollection){
  45001. var self=this;
  45002. return $core.withContext(function($ctx1) {
  45003. var $1;
  45004. $1=(
  45005. $ctx1.supercall = true,
  45006. ($globals.TestSuiteRunner.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  45007. $ctx1.supercall = false;
  45008. return $recv($1)._suite_(aCollection);
  45009. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  45010. },
  45011. args: ["aCollection"],
  45012. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  45013. referencedClasses: [],
  45014. messageSends: ["suite:", "new"]
  45015. }),
  45016. $globals.TestSuiteRunner.klass);
  45017. $core.addMethod(
  45018. $core.method({
  45019. selector: "isTestClass",
  45020. protocol: '*SUnit',
  45021. fn: function (){
  45022. var self=this;
  45023. return $core.withContext(function($ctx1) {
  45024. return $recv(self._includesBehavior_($globals.TestCase))._and_((function(){
  45025. return $core.withContext(function($ctx2) {
  45026. return $recv(self._isAbstract())._not();
  45027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45028. }));
  45029. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  45030. },
  45031. args: [],
  45032. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  45033. referencedClasses: ["TestCase"],
  45034. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  45035. }),
  45036. $globals.Behavior);
  45037. $core.addMethod(
  45038. $core.method({
  45039. selector: "isTestPackage",
  45040. protocol: '*SUnit',
  45041. fn: function (){
  45042. var self=this;
  45043. return $core.withContext(function($ctx1) {
  45044. return $recv(self._classes())._anySatisfy_((function(each){
  45045. return $core.withContext(function($ctx2) {
  45046. return $recv(each)._isTestClass();
  45047. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45048. }));
  45049. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  45050. },
  45051. args: [],
  45052. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  45053. referencedClasses: [],
  45054. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  45055. }),
  45056. $globals.Package);
  45057. });
  45058. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  45059. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  45060. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  45061. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  45062. $core.addPackage('Compiler-Tests');
  45063. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  45064. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45065. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  45066. $core.addMethod(
  45067. $core.method({
  45068. selector: "analyze:forClass:",
  45069. protocol: 'convenience',
  45070. fn: function (aNode,aClass){
  45071. var self=this;
  45072. return $core.withContext(function($ctx1) {
  45073. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  45074. return aNode;
  45075. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  45076. },
  45077. args: ["aNode", "aClass"],
  45078. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  45079. referencedClasses: ["SemanticAnalyzer"],
  45080. messageSends: ["visit:", "on:"]
  45081. }),
  45082. $globals.ASTParsingTest);
  45083. $core.addMethod(
  45084. $core.method({
  45085. selector: "parse:",
  45086. protocol: 'parsing',
  45087. fn: function (aString){
  45088. var self=this;
  45089. return $core.withContext(function($ctx1) {
  45090. return $recv($globals.Smalltalk)._parse_(aString);
  45091. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  45092. },
  45093. args: ["aString"],
  45094. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  45095. referencedClasses: ["Smalltalk"],
  45096. messageSends: ["parse:"]
  45097. }),
  45098. $globals.ASTParsingTest);
  45099. $core.addMethod(
  45100. $core.method({
  45101. selector: "parse:forClass:",
  45102. protocol: 'parsing',
  45103. fn: function (aString,aClass){
  45104. var self=this;
  45105. return $core.withContext(function($ctx1) {
  45106. return self._analyze_forClass_(self._parse_(aString),aClass);
  45107. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  45108. },
  45109. args: ["aString", "aClass"],
  45110. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  45111. referencedClasses: [],
  45112. messageSends: ["analyze:forClass:", "parse:"]
  45113. }),
  45114. $globals.ASTParsingTest);
  45115. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  45116. $core.addMethod(
  45117. $core.method({
  45118. selector: "astPCNodeVisitor",
  45119. protocol: 'factory',
  45120. fn: function (){
  45121. var self=this;
  45122. return $core.withContext(function($ctx1) {
  45123. var $1;
  45124. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45125. $recv($1)._index_((0));
  45126. return $recv($1)._yourself();
  45127. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  45128. },
  45129. args: [],
  45130. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  45131. referencedClasses: ["ASTPCNodeVisitor"],
  45132. messageSends: ["index:", "new", "yourself"]
  45133. }),
  45134. $globals.ASTPCNodeVisitorTest);
  45135. $core.addMethod(
  45136. $core.method({
  45137. selector: "astPCNodeVisitorForSelector:",
  45138. protocol: 'factory',
  45139. fn: function (aString){
  45140. var self=this;
  45141. return $core.withContext(function($ctx1) {
  45142. var $1;
  45143. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45144. $recv($1)._selector_(aString);
  45145. $recv($1)._index_((0));
  45146. return $recv($1)._yourself();
  45147. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  45148. },
  45149. args: ["aString"],
  45150. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  45151. referencedClasses: ["ASTPCNodeVisitor"],
  45152. messageSends: ["selector:", "new", "index:", "yourself"]
  45153. }),
  45154. $globals.ASTPCNodeVisitorTest);
  45155. $core.addMethod(
  45156. $core.method({
  45157. selector: "testJSStatementNode",
  45158. protocol: 'tests',
  45159. fn: function (){
  45160. var self=this;
  45161. var ast,visitor;
  45162. return $core.withContext(function($ctx1) {
  45163. var $3,$2,$1;
  45164. ast=self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  45165. $3=self._astPCNodeVisitor();
  45166. $recv($3)._visit_(ast);
  45167. $2=$recv($3)._currentNode();
  45168. $1=$recv($2)._isJSStatementNode();
  45169. self._assert_($1);
  45170. return self;
  45171. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  45172. },
  45173. args: [],
  45174. 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",
  45175. referencedClasses: ["Object"],
  45176. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  45177. }),
  45178. $globals.ASTPCNodeVisitorTest);
  45179. $core.addMethod(
  45180. $core.method({
  45181. selector: "testLegacyJSStatementNode",
  45182. protocol: 'tests',
  45183. fn: function (){
  45184. var self=this;
  45185. var ast,visitor;
  45186. return $core.withContext(function($ctx1) {
  45187. var $3,$2,$1;
  45188. ast=self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  45189. $3=self._astPCNodeVisitor();
  45190. $recv($3)._visit_(ast);
  45191. $2=$recv($3)._currentNode();
  45192. $1=$recv($2)._isJSStatementNode();
  45193. self._assert_($1);
  45194. return self;
  45195. }, function($ctx1) {$ctx1.fill(self,"testLegacyJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  45196. },
  45197. args: [],
  45198. 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",
  45199. referencedClasses: ["Object"],
  45200. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  45201. }),
  45202. $globals.ASTPCNodeVisitorTest);
  45203. $core.addMethod(
  45204. $core.method({
  45205. selector: "testMessageSend",
  45206. protocol: 'tests',
  45207. fn: function (){
  45208. var self=this;
  45209. var ast;
  45210. return $core.withContext(function($ctx1) {
  45211. var $3,$2,$1;
  45212. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  45213. $3=self._astPCNodeVisitorForSelector_("yourself");
  45214. $recv($3)._visit_(ast);
  45215. $2=$recv($3)._currentNode();
  45216. $1=$recv($2)._selector();
  45217. self._assert_equals_($1,"yourself");
  45218. return self;
  45219. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45220. },
  45221. args: [],
  45222. 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'",
  45223. referencedClasses: ["Object"],
  45224. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45225. }),
  45226. $globals.ASTPCNodeVisitorTest);
  45227. $core.addMethod(
  45228. $core.method({
  45229. selector: "testMessageSendWithBlocks",
  45230. protocol: 'tests',
  45231. fn: function (){
  45232. var self=this;
  45233. var ast;
  45234. return $core.withContext(function($ctx1) {
  45235. var $3,$2,$1;
  45236. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  45237. $3=self._astPCNodeVisitorForSelector_("yourself");
  45238. $recv($3)._visit_(ast);
  45239. $2=$recv($3)._currentNode();
  45240. $1=$recv($2)._selector();
  45241. self._assert_equals_($1,"yourself");
  45242. return self;
  45243. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45244. },
  45245. args: [],
  45246. 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'",
  45247. referencedClasses: ["Object"],
  45248. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45249. }),
  45250. $globals.ASTPCNodeVisitorTest);
  45251. $core.addMethod(
  45252. $core.method({
  45253. selector: "testMessageSendWithInlining",
  45254. protocol: 'tests',
  45255. fn: function (){
  45256. var self=this;
  45257. var ast;
  45258. return $core.withContext(function($ctx1) {
  45259. var $3,$4,$2,$1,$7,$6,$5;
  45260. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45261. $ctx1.sendIdx["parse:forClass:"]=1;
  45262. $3=self._astPCNodeVisitorForSelector_("yourself");
  45263. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  45264. $recv($3)._visit_(ast);
  45265. $ctx1.sendIdx["visit:"]=1;
  45266. $4=$recv($3)._currentNode();
  45267. $ctx1.sendIdx["currentNode"]=1;
  45268. $2=$4;
  45269. $1=$recv($2)._selector();
  45270. $ctx1.sendIdx["selector"]=1;
  45271. self._assert_equals_($1,"yourself");
  45272. $ctx1.sendIdx["assert:equals:"]=1;
  45273. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45274. $7=self._astPCNodeVisitorForSelector_("asBoolean");
  45275. $recv($7)._visit_(ast);
  45276. $6=$recv($7)._currentNode();
  45277. $5=$recv($6)._selector();
  45278. self._assert_equals_($5,"asBoolean");
  45279. return self;
  45280. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45281. },
  45282. args: [],
  45283. 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'",
  45284. referencedClasses: ["Object"],
  45285. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45286. }),
  45287. $globals.ASTPCNodeVisitorTest);
  45288. $core.addMethod(
  45289. $core.method({
  45290. selector: "testNoMessageSend",
  45291. protocol: 'tests',
  45292. fn: function (){
  45293. var self=this;
  45294. var ast;
  45295. return $core.withContext(function($ctx1) {
  45296. var $3,$2,$1;
  45297. ast=self._parse_forClass_("foo ^ self",$globals.Object);
  45298. $3=self._astPCNodeVisitor();
  45299. $recv($3)._visit_(ast);
  45300. $2=$recv($3)._currentNode();
  45301. $1=$recv($2)._isNil();
  45302. self._assert_($1);
  45303. return self;
  45304. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45305. },
  45306. args: [],
  45307. 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",
  45308. referencedClasses: ["Object"],
  45309. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  45310. }),
  45311. $globals.ASTPCNodeVisitorTest);
  45312. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  45313. $core.addMethod(
  45314. $core.method({
  45315. selector: "testNodeAtPosition",
  45316. protocol: 'tests',
  45317. fn: function (){
  45318. var self=this;
  45319. var node;
  45320. return $core.withContext(function($ctx1) {
  45321. var $3,$4,$2,$1,$7,$8,$6,$5;
  45322. node=self._parse_("yourself\x0a\x09^ self");
  45323. $ctx1.sendIdx["parse:"]=1;
  45324. $3=node;
  45325. $4=(2).__at((4));
  45326. $ctx1.sendIdx["@"]=1;
  45327. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  45328. return nil;
  45329. }));
  45330. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  45331. $1=$recv($2)._source();
  45332. self._assert_equals_($1,"self");
  45333. $ctx1.sendIdx["assert:equals:"]=1;
  45334. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  45335. $ctx1.sendIdx["parse:"]=2;
  45336. $7=node;
  45337. $8=(2).__at((7));
  45338. $ctx1.sendIdx["@"]=2;
  45339. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  45340. return nil;
  45341. }));
  45342. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  45343. $5=$recv($6)._selector();
  45344. $ctx1.sendIdx["selector"]=1;
  45345. self._assert_equals_($5,"ifTrue:");
  45346. $ctx1.sendIdx["assert:equals:"]=2;
  45347. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  45348. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  45349. return nil;
  45350. })))._selector(),"foo");
  45351. return self;
  45352. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  45353. },
  45354. args: [],
  45355. 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'",
  45356. referencedClasses: [],
  45357. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  45358. }),
  45359. $globals.ASTPositionTest);
  45360. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  45361. $core.addMethod(
  45362. $core.method({
  45363. selector: "codeGeneratorClass",
  45364. protocol: 'accessing',
  45365. fn: function (){
  45366. var self=this;
  45367. return $globals.CodeGenerator;
  45368. },
  45369. args: [],
  45370. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  45371. referencedClasses: ["CodeGenerator"],
  45372. messageSends: []
  45373. }),
  45374. $globals.CodeGeneratorTest);
  45375. $core.addMethod(
  45376. $core.method({
  45377. selector: "compiler",
  45378. protocol: 'factory',
  45379. fn: function (){
  45380. var self=this;
  45381. return $core.withContext(function($ctx1) {
  45382. var $1;
  45383. $1=$recv($globals.Compiler)._new();
  45384. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  45385. return $recv($1)._yourself();
  45386. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  45387. },
  45388. args: [],
  45389. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  45390. referencedClasses: ["Compiler"],
  45391. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  45392. }),
  45393. $globals.CodeGeneratorTest);
  45394. $core.addMethod(
  45395. $core.method({
  45396. selector: "setUp",
  45397. protocol: 'initialization',
  45398. fn: function (){
  45399. var self=this;
  45400. return $core.withContext(function($ctx1) {
  45401. self["@receiver"]=$recv($globals.DoIt)._new();
  45402. return self;
  45403. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  45404. },
  45405. args: [],
  45406. source: "setUp\x0a\x09receiver := DoIt new",
  45407. referencedClasses: ["DoIt"],
  45408. messageSends: ["new"]
  45409. }),
  45410. $globals.CodeGeneratorTest);
  45411. $core.addMethod(
  45412. $core.method({
  45413. selector: "should:receiver:raise:",
  45414. protocol: 'testing',
  45415. fn: function (aString,anObject,anErrorClass){
  45416. var self=this;
  45417. var method,result;
  45418. return $core.withContext(function($ctx1) {
  45419. var $1,$2,$3,$receiver;
  45420. self["@receiver"]=anObject;
  45421. $recv((function(){
  45422. return $core.withContext(function($ctx2) {
  45423. return self._should_raise_((function(){
  45424. return $core.withContext(function($ctx3) {
  45425. $1=self._compiler();
  45426. $2=$recv(anObject)._class();
  45427. $ctx3.sendIdx["class"]=1;
  45428. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45429. method;
  45430. return $recv(self["@receiver"])._perform_($recv(method)._selector());
  45431. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45432. }),anErrorClass);
  45433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45434. }))._ensure_((function(){
  45435. return $core.withContext(function($ctx2) {
  45436. $3=method;
  45437. if(($receiver = $3) == null || $receiver.isNil){
  45438. return $3;
  45439. } else {
  45440. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45441. }
  45442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45443. }));
  45444. return self;
  45445. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  45446. },
  45447. args: ["aString", "anObject", "anErrorClass"],
  45448. 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 ] ]",
  45449. referencedClasses: [],
  45450. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  45451. }),
  45452. $globals.CodeGeneratorTest);
  45453. $core.addMethod(
  45454. $core.method({
  45455. selector: "should:receiver:return:",
  45456. protocol: 'testing',
  45457. fn: function (aString,anObject,aResult){
  45458. var self=this;
  45459. var method,result;
  45460. return $core.withContext(function($ctx1) {
  45461. var $1,$2;
  45462. self["@receiver"]=anObject;
  45463. $1=self._compiler();
  45464. $2=$recv(anObject)._class();
  45465. $ctx1.sendIdx["class"]=1;
  45466. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45467. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  45468. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45469. self._assert_equals_(aResult,result);
  45470. return self;
  45471. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  45472. },
  45473. args: ["aString", "anObject", "aResult"],
  45474. 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",
  45475. referencedClasses: [],
  45476. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  45477. }),
  45478. $globals.CodeGeneratorTest);
  45479. $core.addMethod(
  45480. $core.method({
  45481. selector: "should:return:",
  45482. protocol: 'testing',
  45483. fn: function (aString,anObject){
  45484. var self=this;
  45485. return $core.withContext(function($ctx1) {
  45486. return self._should_receiver_return_(aString,self["@receiver"],anObject);
  45487. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  45488. },
  45489. args: ["aString", "anObject"],
  45490. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  45491. referencedClasses: [],
  45492. messageSends: ["should:receiver:return:"]
  45493. }),
  45494. $globals.CodeGeneratorTest);
  45495. $core.addMethod(
  45496. $core.method({
  45497. selector: "tearDown",
  45498. protocol: 'initialization',
  45499. fn: function (){
  45500. var self=this;
  45501. return self;
  45502. },
  45503. args: [],
  45504. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  45505. referencedClasses: [],
  45506. messageSends: []
  45507. }),
  45508. $globals.CodeGeneratorTest);
  45509. $core.addMethod(
  45510. $core.method({
  45511. selector: "testAssignment",
  45512. protocol: 'tests',
  45513. fn: function (){
  45514. var self=this;
  45515. return $core.withContext(function($ctx1) {
  45516. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  45517. $ctx1.sendIdx["should:return:"]=1;
  45518. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  45519. $ctx1.sendIdx["should:return:"]=2;
  45520. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  45521. return self;
  45522. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  45523. },
  45524. args: [],
  45525. 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",
  45526. referencedClasses: [],
  45527. messageSends: ["should:return:"]
  45528. }),
  45529. $globals.CodeGeneratorTest);
  45530. $core.addMethod(
  45531. $core.method({
  45532. selector: "testBackslashSelectors",
  45533. protocol: 'tests',
  45534. fn: function (){
  45535. var self=this;
  45536. return $core.withContext(function($ctx1) {
  45537. self._should_return_("\x5c arg ^ 4",(4));
  45538. $ctx1.sendIdx["should:return:"]=1;
  45539. self._should_return_("\x5c\x5c arg ^ 42",(42));
  45540. return self;
  45541. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  45542. },
  45543. args: [],
  45544. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  45545. referencedClasses: [],
  45546. messageSends: ["should:return:"]
  45547. }),
  45548. $globals.CodeGeneratorTest);
  45549. $core.addMethod(
  45550. $core.method({
  45551. selector: "testBlockReturn",
  45552. protocol: 'tests',
  45553. fn: function (){
  45554. var self=this;
  45555. return $core.withContext(function($ctx1) {
  45556. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  45557. $ctx1.sendIdx["should:return:"]=1;
  45558. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  45559. $ctx1.sendIdx["should:return:"]=2;
  45560. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  45561. return self;
  45562. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  45563. },
  45564. args: [],
  45565. 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).",
  45566. referencedClasses: [],
  45567. messageSends: ["should:return:"]
  45568. }),
  45569. $globals.CodeGeneratorTest);
  45570. $core.addMethod(
  45571. $core.method({
  45572. selector: "testCascades",
  45573. protocol: 'tests',
  45574. fn: function (){
  45575. var self=this;
  45576. return $core.withContext(function($ctx1) {
  45577. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  45578. return self;
  45579. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  45580. },
  45581. args: [],
  45582. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  45583. referencedClasses: [],
  45584. messageSends: ["should:return:"]
  45585. }),
  45586. $globals.CodeGeneratorTest);
  45587. $core.addMethod(
  45588. $core.method({
  45589. selector: "testCascadesInDynamicArray",
  45590. protocol: 'tests',
  45591. fn: function (){
  45592. var self=this;
  45593. return $core.withContext(function($ctx1) {
  45594. self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  45595. return self;
  45596. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  45597. },
  45598. args: [],
  45599. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  45600. referencedClasses: [],
  45601. messageSends: ["should:return:"]
  45602. }),
  45603. $globals.CodeGeneratorTest);
  45604. $core.addMethod(
  45605. $core.method({
  45606. selector: "testCascadesInDynamicDictioary",
  45607. protocol: 'tests',
  45608. fn: function (){
  45609. var self=this;
  45610. return $core.withContext(function($ctx1) {
  45611. self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  45612. return self;
  45613. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  45614. },
  45615. args: [],
  45616. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  45617. referencedClasses: [],
  45618. messageSends: ["should:return:"]
  45619. }),
  45620. $globals.CodeGeneratorTest);
  45621. $core.addMethod(
  45622. $core.method({
  45623. selector: "testCascadesInSend",
  45624. protocol: 'tests',
  45625. fn: function (){
  45626. var self=this;
  45627. return $core.withContext(function($ctx1) {
  45628. self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  45629. return self;
  45630. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  45631. },
  45632. args: [],
  45633. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  45634. referencedClasses: [],
  45635. messageSends: ["should:return:"]
  45636. }),
  45637. $globals.CodeGeneratorTest);
  45638. $core.addMethod(
  45639. $core.method({
  45640. selector: "testCascadesWithInlining",
  45641. protocol: 'tests',
  45642. fn: function (){
  45643. var self=this;
  45644. return $core.withContext(function($ctx1) {
  45645. self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  45646. $ctx1.sendIdx["should:return:"]=1;
  45647. self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  45648. return self;
  45649. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  45650. },
  45651. args: [],
  45652. 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",
  45653. referencedClasses: [],
  45654. messageSends: ["should:return:"]
  45655. }),
  45656. $globals.CodeGeneratorTest);
  45657. $core.addMethod(
  45658. $core.method({
  45659. selector: "testDynamicArrayElementsOrdered",
  45660. protocol: 'tests',
  45661. fn: function (){
  45662. var self=this;
  45663. return $core.withContext(function($ctx1) {
  45664. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  45665. $ctx1.sendIdx["should:return:"]=1;
  45666. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  45667. return self;
  45668. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  45669. },
  45670. args: [],
  45671. 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).",
  45672. referencedClasses: [],
  45673. messageSends: ["should:return:"]
  45674. }),
  45675. $globals.CodeGeneratorTest);
  45676. $core.addMethod(
  45677. $core.method({
  45678. selector: "testDynamicDictionaryElementsOrdered",
  45679. protocol: 'tests',
  45680. fn: function (){
  45681. var self=this;
  45682. return $core.withContext(function($ctx1) {
  45683. 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)]));
  45684. return self;
  45685. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  45686. },
  45687. args: [],
  45688. 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}.",
  45689. referencedClasses: [],
  45690. messageSends: ["should:return:"]
  45691. }),
  45692. $globals.CodeGeneratorTest);
  45693. $core.addMethod(
  45694. $core.method({
  45695. selector: "testDynamicDictionaryWithMoreArrows",
  45696. protocol: 'tests',
  45697. fn: function (){
  45698. var self=this;
  45699. return $core.withContext(function($ctx1) {
  45700. var $2,$1;
  45701. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  45702. $ctx1.sendIdx["->"]=1;
  45703. $1=$recv($globals.HashedCollection)._with_($2);
  45704. self._should_return_("foo ^ #{1->2->3}",$1);
  45705. return self;
  45706. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  45707. },
  45708. args: [],
  45709. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  45710. referencedClasses: ["HashedCollection"],
  45711. messageSends: ["should:return:", "with:", "->"]
  45712. }),
  45713. $globals.CodeGeneratorTest);
  45714. $core.addMethod(
  45715. $core.method({
  45716. selector: "testGlobalVar",
  45717. protocol: 'tests',
  45718. fn: function (){
  45719. var self=this;
  45720. return $core.withContext(function($ctx1) {
  45721. self._should_return_("foo ^ eval class",$globals.BlockClosure);
  45722. $ctx1.sendIdx["should:return:"]=1;
  45723. self._should_return_("foo ^ Math cos: 0",(1));
  45724. $ctx1.sendIdx["should:return:"]=2;
  45725. self._should_return_("foo ^ NonExistingVar",nil);
  45726. return self;
  45727. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  45728. },
  45729. args: [],
  45730. 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",
  45731. referencedClasses: ["BlockClosure"],
  45732. messageSends: ["should:return:"]
  45733. }),
  45734. $globals.CodeGeneratorTest);
  45735. $core.addMethod(
  45736. $core.method({
  45737. selector: "testInnerTemporalDependentElementsOrdered",
  45738. protocol: 'tests',
  45739. fn: function (){
  45740. var self=this;
  45741. return $core.withContext(function($ctx1) {
  45742. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  45743. $2="foo".__minus_gt($globals.Array);
  45744. $ctx1.sendIdx["->"]=1;
  45745. $3="bar".__minus_gt((2));
  45746. $ctx1.sendIdx["->"]=2;
  45747. $1=[$2,$3];
  45748. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  45749. $ctx1.sendIdx["should:return:"]=1;
  45750. $5="foo".__minus_gt($globals.Array);
  45751. $ctx1.sendIdx["->"]=3;
  45752. $6="bar".__minus_gt((2));
  45753. $ctx1.sendIdx["->"]=4;
  45754. $4=[$5,$6];
  45755. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  45756. $ctx1.sendIdx["should:return:"]=2;
  45757. $8="foo".__minus_gt((1));
  45758. $ctx1.sendIdx["->"]=5;
  45759. $9="bar".__minus_gt((2));
  45760. $ctx1.sendIdx["->"]=6;
  45761. $7=[$8,$9];
  45762. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  45763. $ctx1.sendIdx["should:return:"]=3;
  45764. $11="foo".__minus_gt((1));
  45765. $ctx1.sendIdx["->"]=7;
  45766. $10=[$11,"bar".__minus_gt((2))];
  45767. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  45768. $ctx1.sendIdx["should:return:"]=4;
  45769. 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)]));
  45770. return self;
  45771. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  45772. },
  45773. args: [],
  45774. 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}.",
  45775. referencedClasses: ["Array"],
  45776. messageSends: ["should:return:", "->"]
  45777. }),
  45778. $globals.CodeGeneratorTest);
  45779. $core.addMethod(
  45780. $core.method({
  45781. selector: "testJSStatement",
  45782. protocol: 'tests',
  45783. fn: function (){
  45784. var self=this;
  45785. return $core.withContext(function($ctx1) {
  45786. self._should_return_("foo <return 2+3>",(5));
  45787. return self;
  45788. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  45789. },
  45790. args: [],
  45791. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  45792. referencedClasses: [],
  45793. messageSends: ["should:return:"]
  45794. }),
  45795. $globals.CodeGeneratorTest);
  45796. $core.addMethod(
  45797. $core.method({
  45798. selector: "testLexicalScope",
  45799. protocol: 'tests',
  45800. fn: function (){
  45801. var self=this;
  45802. return $core.withContext(function($ctx1) {
  45803. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  45804. return self;
  45805. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  45806. },
  45807. args: [],
  45808. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  45809. referencedClasses: [],
  45810. messageSends: ["should:return:"]
  45811. }),
  45812. $globals.CodeGeneratorTest);
  45813. $core.addMethod(
  45814. $core.method({
  45815. selector: "testLiterals",
  45816. protocol: 'tests',
  45817. fn: function (){
  45818. var self=this;
  45819. return $core.withContext(function($ctx1) {
  45820. self._should_return_("foo ^ 1",(1));
  45821. $ctx1.sendIdx["should:return:"]=1;
  45822. self._should_return_("foo ^ 'hello'","hello");
  45823. $ctx1.sendIdx["should:return:"]=2;
  45824. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  45825. $ctx1.sendIdx["should:return:"]=3;
  45826. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  45827. $ctx1.sendIdx["should:return:"]=4;
  45828. self._should_return_("foo ^ true",true);
  45829. $ctx1.sendIdx["should:return:"]=5;
  45830. self._should_return_("foo ^ false",false);
  45831. $ctx1.sendIdx["should:return:"]=6;
  45832. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  45833. $ctx1.sendIdx["should:return:"]=7;
  45834. self._should_return_("foo ^ #hello","hello");
  45835. $ctx1.sendIdx["should:return:"]=8;
  45836. self._should_return_("foo ^ $h","h");
  45837. $ctx1.sendIdx["should:return:"]=9;
  45838. self._should_return_("foo ^ -123.456",(-123.456));
  45839. $ctx1.sendIdx["should:return:"]=10;
  45840. self._should_return_("foo ^ -2.5e4",(-25000));
  45841. return self;
  45842. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  45843. },
  45844. args: [],
  45845. 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.",
  45846. referencedClasses: [],
  45847. messageSends: ["should:return:"]
  45848. }),
  45849. $globals.CodeGeneratorTest);
  45850. $core.addMethod(
  45851. $core.method({
  45852. selector: "testLocalReturn",
  45853. protocol: 'tests',
  45854. fn: function (){
  45855. var self=this;
  45856. return $core.withContext(function($ctx1) {
  45857. self._should_return_("foo ^ 1",(1));
  45858. $ctx1.sendIdx["should:return:"]=1;
  45859. self._should_return_("foo ^ 1 + 1",(2));
  45860. $ctx1.sendIdx["should:return:"]=2;
  45861. self._should_return_("foo ",self["@receiver"]);
  45862. $ctx1.sendIdx["should:return:"]=3;
  45863. self._should_return_("foo self asString",self["@receiver"]);
  45864. $ctx1.sendIdx["should:return:"]=4;
  45865. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  45866. return self;
  45867. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  45868. },
  45869. args: [],
  45870. 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",
  45871. referencedClasses: [],
  45872. messageSends: ["should:return:"]
  45873. }),
  45874. $globals.CodeGeneratorTest);
  45875. $core.addMethod(
  45876. $core.method({
  45877. selector: "testMessageSends",
  45878. protocol: 'tests',
  45879. fn: function (){
  45880. var self=this;
  45881. return $core.withContext(function($ctx1) {
  45882. self._should_return_("foo ^ 1 asString","1");
  45883. $ctx1.sendIdx["should:return:"]=1;
  45884. self._should_return_("foo ^ 1 + 1",(2));
  45885. $ctx1.sendIdx["should:return:"]=2;
  45886. self._should_return_("foo ^ 1 + 2 * 3",(9));
  45887. $ctx1.sendIdx["should:return:"]=3;
  45888. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  45889. $ctx1.sendIdx["should:return:"]=4;
  45890. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  45891. return self;
  45892. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  45893. },
  45894. args: [],
  45895. 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)",
  45896. referencedClasses: [],
  45897. messageSends: ["should:return:"]
  45898. }),
  45899. $globals.CodeGeneratorTest);
  45900. $core.addMethod(
  45901. $core.method({
  45902. selector: "testMistypedPragmaJSStatement",
  45903. protocol: 'tests',
  45904. fn: function (){
  45905. var self=this;
  45906. return $core.withContext(function($ctx1) {
  45907. self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",self["@receiver"],$globals.ParseError);
  45908. return self;
  45909. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  45910. },
  45911. args: [],
  45912. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  45913. referencedClasses: ["ParseError"],
  45914. messageSends: ["should:receiver:raise:"]
  45915. }),
  45916. $globals.CodeGeneratorTest);
  45917. $core.addMethod(
  45918. $core.method({
  45919. selector: "testMultipleSequences",
  45920. protocol: 'tests',
  45921. fn: function (){
  45922. var self=this;
  45923. return $core.withContext(function($ctx1) {
  45924. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  45925. return self;
  45926. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  45927. },
  45928. args: [],
  45929. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  45930. referencedClasses: [],
  45931. messageSends: ["should:return:"]
  45932. }),
  45933. $globals.CodeGeneratorTest);
  45934. $core.addMethod(
  45935. $core.method({
  45936. selector: "testMutableLiterals",
  45937. protocol: 'tests',
  45938. fn: function (){
  45939. var self=this;
  45940. return $core.withContext(function($ctx1) {
  45941. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  45942. return self;
  45943. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  45944. },
  45945. args: [],
  45946. 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)",
  45947. referencedClasses: [],
  45948. messageSends: ["should:return:"]
  45949. }),
  45950. $globals.CodeGeneratorTest);
  45951. $core.addMethod(
  45952. $core.method({
  45953. selector: "testNestedIfTrue",
  45954. protocol: 'tests',
  45955. fn: function (){
  45956. var self=this;
  45957. return $core.withContext(function($ctx1) {
  45958. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  45959. $ctx1.sendIdx["should:return:"]=1;
  45960. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  45961. $ctx1.sendIdx["should:return:"]=2;
  45962. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  45963. $ctx1.sendIdx["should:return:"]=3;
  45964. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  45965. return self;
  45966. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  45967. },
  45968. args: [],
  45969. 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.",
  45970. referencedClasses: [],
  45971. messageSends: ["should:return:"]
  45972. }),
  45973. $globals.CodeGeneratorTest);
  45974. $core.addMethod(
  45975. $core.method({
  45976. selector: "testNestedSends",
  45977. protocol: 'tests',
  45978. fn: function (){
  45979. var self=this;
  45980. return $core.withContext(function($ctx1) {
  45981. 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());
  45982. return self;
  45983. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  45984. },
  45985. args: [],
  45986. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  45987. referencedClasses: ["Point"],
  45988. messageSends: ["should:return:", "asString", "x:y:", "@"]
  45989. }),
  45990. $globals.CodeGeneratorTest);
  45991. $core.addMethod(
  45992. $core.method({
  45993. selector: "testNonLocalReturn",
  45994. protocol: 'tests',
  45995. fn: function (){
  45996. var self=this;
  45997. return $core.withContext(function($ctx1) {
  45998. self._should_return_("foo [ ^ 1 ] value",(1));
  45999. $ctx1.sendIdx["should:return:"]=1;
  46000. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  46001. $ctx1.sendIdx["should:return:"]=2;
  46002. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  46003. $ctx1.sendIdx["should:return:"]=3;
  46004. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  46005. return self;
  46006. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  46007. },
  46008. args: [],
  46009. 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",
  46010. referencedClasses: [],
  46011. messageSends: ["should:return:"]
  46012. }),
  46013. $globals.CodeGeneratorTest);
  46014. $core.addMethod(
  46015. $core.method({
  46016. selector: "testPascalCaseGlobal",
  46017. protocol: 'tests',
  46018. fn: function (){
  46019. var self=this;
  46020. return $core.withContext(function($ctx1) {
  46021. self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  46022. $ctx1.sendIdx["should:return:"]=1;
  46023. self._should_return_("foo ^NonExistent",nil);
  46024. return self;
  46025. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  46026. },
  46027. args: [],
  46028. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  46029. referencedClasses: ["Smalltalk"],
  46030. messageSends: ["should:return:", "at:", "globals"]
  46031. }),
  46032. $globals.CodeGeneratorTest);
  46033. $core.addMethod(
  46034. $core.method({
  46035. selector: "testPragmaJSStatement",
  46036. protocol: 'tests',
  46037. fn: function (){
  46038. var self=this;
  46039. return $core.withContext(function($ctx1) {
  46040. self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  46041. return self;
  46042. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  46043. },
  46044. args: [],
  46045. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  46046. referencedClasses: [],
  46047. messageSends: ["should:return:"]
  46048. }),
  46049. $globals.CodeGeneratorTest);
  46050. $core.addMethod(
  46051. $core.method({
  46052. selector: "testRootSuperSend",
  46053. protocol: 'tests',
  46054. fn: function (){
  46055. var self=this;
  46056. return $core.withContext(function($ctx1) {
  46057. self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  46058. return self;
  46059. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  46060. },
  46061. args: [],
  46062. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  46063. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  46064. messageSends: ["should:receiver:raise:", "new"]
  46065. }),
  46066. $globals.CodeGeneratorTest);
  46067. $core.addMethod(
  46068. $core.method({
  46069. selector: "testSendReceiverAndArgumentsOrdered",
  46070. protocol: 'tests',
  46071. fn: function (){
  46072. var self=this;
  46073. return $core.withContext(function($ctx1) {
  46074. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  46075. $ctx1.sendIdx["should:return:"]=1;
  46076. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  46077. return self;
  46078. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  46079. },
  46080. args: [],
  46081. 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}.",
  46082. referencedClasses: ["Array"],
  46083. messageSends: ["should:return:"]
  46084. }),
  46085. $globals.CodeGeneratorTest);
  46086. $core.addMethod(
  46087. $core.method({
  46088. selector: "testSuperSend",
  46089. protocol: 'tests',
  46090. fn: function (){
  46091. var self=this;
  46092. return $core.withContext(function($ctx1) {
  46093. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  46094. return self;
  46095. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  46096. },
  46097. args: [],
  46098. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  46099. referencedClasses: [],
  46100. messageSends: ["should:receiver:return:"]
  46101. }),
  46102. $globals.CodeGeneratorTest);
  46103. $core.addMethod(
  46104. $core.method({
  46105. selector: "testTempVariables",
  46106. protocol: 'tests',
  46107. fn: function (){
  46108. var self=this;
  46109. return $core.withContext(function($ctx1) {
  46110. self._should_return_("foo | a | ^ a",nil);
  46111. $ctx1.sendIdx["should:return:"]=1;
  46112. self._should_return_("foo | AVariable | ^ AVariable",nil);
  46113. $ctx1.sendIdx["should:return:"]=2;
  46114. self._should_return_("foo | a b c | ^ c",nil);
  46115. $ctx1.sendIdx["should:return:"]=3;
  46116. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  46117. $ctx1.sendIdx["should:return:"]=4;
  46118. self._should_return_("foo | a | a:= 1. ^ a",(1));
  46119. $ctx1.sendIdx["should:return:"]=5;
  46120. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  46121. return self;
  46122. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  46123. },
  46124. args: [],
  46125. 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.",
  46126. referencedClasses: [],
  46127. messageSends: ["should:return:"]
  46128. }),
  46129. $globals.CodeGeneratorTest);
  46130. $core.addMethod(
  46131. $core.method({
  46132. selector: "testThisContext",
  46133. protocol: 'tests',
  46134. fn: function (){
  46135. var self=this;
  46136. return $core.withContext(function($ctx1) {
  46137. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  46138. return self;
  46139. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  46140. },
  46141. args: [],
  46142. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  46143. referencedClasses: [],
  46144. messageSends: ["should:return:"]
  46145. }),
  46146. $globals.CodeGeneratorTest);
  46147. $core.addMethod(
  46148. $core.method({
  46149. selector: "testifFalse",
  46150. protocol: 'tests',
  46151. fn: function (){
  46152. var self=this;
  46153. return $core.withContext(function($ctx1) {
  46154. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  46155. $ctx1.sendIdx["should:return:"]=1;
  46156. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  46157. $ctx1.sendIdx["should:return:"]=2;
  46158. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  46159. $ctx1.sendIdx["should:return:"]=3;
  46160. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  46161. return self;
  46162. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  46163. },
  46164. args: [],
  46165. 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.",
  46166. referencedClasses: [],
  46167. messageSends: ["should:return:"]
  46168. }),
  46169. $globals.CodeGeneratorTest);
  46170. $core.addMethod(
  46171. $core.method({
  46172. selector: "testifFalseIfTrue",
  46173. protocol: 'tests',
  46174. fn: function (){
  46175. var self=this;
  46176. return $core.withContext(function($ctx1) {
  46177. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  46178. $ctx1.sendIdx["should:return:"]=1;
  46179. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  46180. $ctx1.sendIdx["should:return:"]=2;
  46181. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  46182. $ctx1.sendIdx["should:return:"]=3;
  46183. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  46184. return self;
  46185. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  46186. },
  46187. args: [],
  46188. 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.",
  46189. referencedClasses: [],
  46190. messageSends: ["should:return:"]
  46191. }),
  46192. $globals.CodeGeneratorTest);
  46193. $core.addMethod(
  46194. $core.method({
  46195. selector: "testifNil",
  46196. protocol: 'tests',
  46197. fn: function (){
  46198. var self=this;
  46199. return $core.withContext(function($ctx1) {
  46200. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  46201. $ctx1.sendIdx["should:return:"]=1;
  46202. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  46203. $ctx1.sendIdx["should:return:"]=2;
  46204. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  46205. $ctx1.sendIdx["should:return:"]=3;
  46206. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  46207. return self;
  46208. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  46209. },
  46210. args: [],
  46211. 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.",
  46212. referencedClasses: [],
  46213. messageSends: ["should:return:"]
  46214. }),
  46215. $globals.CodeGeneratorTest);
  46216. $core.addMethod(
  46217. $core.method({
  46218. selector: "testifNilIfNotNil",
  46219. protocol: 'tests',
  46220. fn: function (){
  46221. var self=this;
  46222. return $core.withContext(function($ctx1) {
  46223. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  46224. $ctx1.sendIdx["should:return:"]=1;
  46225. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  46226. $ctx1.sendIdx["should:return:"]=2;
  46227. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  46228. $ctx1.sendIdx["should:return:"]=3;
  46229. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  46230. return self;
  46231. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  46232. },
  46233. args: [],
  46234. 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.",
  46235. referencedClasses: [],
  46236. messageSends: ["should:return:"]
  46237. }),
  46238. $globals.CodeGeneratorTest);
  46239. $core.addMethod(
  46240. $core.method({
  46241. selector: "testifNotNil",
  46242. protocol: 'tests',
  46243. fn: function (){
  46244. var self=this;
  46245. return $core.withContext(function($ctx1) {
  46246. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  46247. $ctx1.sendIdx["should:return:"]=1;
  46248. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  46249. $ctx1.sendIdx["should:return:"]=2;
  46250. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  46251. $ctx1.sendIdx["should:return:"]=3;
  46252. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  46253. return self;
  46254. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  46255. },
  46256. args: [],
  46257. 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.",
  46258. referencedClasses: [],
  46259. messageSends: ["should:return:"]
  46260. }),
  46261. $globals.CodeGeneratorTest);
  46262. $core.addMethod(
  46263. $core.method({
  46264. selector: "testifNotNilWithArgument",
  46265. protocol: 'tests',
  46266. fn: function (){
  46267. var self=this;
  46268. return $core.withContext(function($ctx1) {
  46269. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  46270. $ctx1.sendIdx["should:return:"]=1;
  46271. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  46272. $ctx1.sendIdx["should:return:"]=2;
  46273. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  46274. $ctx1.sendIdx["should:return:"]=3;
  46275. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  46276. $ctx1.sendIdx["should:return:"]=4;
  46277. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  46278. $ctx1.sendIdx["should:return:"]=5;
  46279. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  46280. return self;
  46281. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  46282. },
  46283. args: [],
  46284. 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",
  46285. referencedClasses: [],
  46286. messageSends: ["should:return:"]
  46287. }),
  46288. $globals.CodeGeneratorTest);
  46289. $core.addMethod(
  46290. $core.method({
  46291. selector: "testifTrue",
  46292. protocol: 'tests',
  46293. fn: function (){
  46294. var self=this;
  46295. return $core.withContext(function($ctx1) {
  46296. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  46297. $ctx1.sendIdx["should:return:"]=1;
  46298. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  46299. $ctx1.sendIdx["should:return:"]=2;
  46300. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  46301. $ctx1.sendIdx["should:return:"]=3;
  46302. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  46303. return self;
  46304. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  46305. },
  46306. args: [],
  46307. 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.",
  46308. referencedClasses: [],
  46309. messageSends: ["should:return:"]
  46310. }),
  46311. $globals.CodeGeneratorTest);
  46312. $core.addMethod(
  46313. $core.method({
  46314. selector: "testifTrueIfFalse",
  46315. protocol: 'tests',
  46316. fn: function (){
  46317. var self=this;
  46318. return $core.withContext(function($ctx1) {
  46319. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  46320. $ctx1.sendIdx["should:return:"]=1;
  46321. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  46322. $ctx1.sendIdx["should:return:"]=2;
  46323. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  46324. $ctx1.sendIdx["should:return:"]=3;
  46325. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  46326. return self;
  46327. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  46328. },
  46329. args: [],
  46330. 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.",
  46331. referencedClasses: [],
  46332. messageSends: ["should:return:"]
  46333. }),
  46334. $globals.CodeGeneratorTest);
  46335. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46336. $core.addMethod(
  46337. $core.method({
  46338. selector: "analyze:forClass:",
  46339. protocol: 'parsing',
  46340. fn: function (aNode,aClass){
  46341. var self=this;
  46342. return $core.withContext(function($ctx1) {
  46343. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  46344. return aNode;
  46345. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  46346. },
  46347. args: ["aNode", "aClass"],
  46348. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46349. referencedClasses: ["SemanticAnalyzer"],
  46350. messageSends: ["visit:", "on:"]
  46351. }),
  46352. $globals.ASTInterpreterTest);
  46353. $core.addMethod(
  46354. $core.method({
  46355. selector: "interpret:receiver:withArguments:",
  46356. protocol: 'private',
  46357. fn: function (aString,anObject,aDictionary){
  46358. var self=this;
  46359. var ctx,ast,interpreter;
  46360. return $core.withContext(function($ctx1) {
  46361. var $1,$2,$3,$receiver;
  46362. interpreter=$recv($globals.ASTInterpreter)._new();
  46363. $ctx1.sendIdx["new"]=1;
  46364. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46365. $1=$recv($globals.AIContext)._new();
  46366. $recv($1)._receiver_(anObject);
  46367. $recv($1)._interpreter_(interpreter);
  46368. ctx=$recv($1)._yourself();
  46369. $2=$recv(ast)._sequenceNode();
  46370. if(($receiver = $2) == null || $receiver.isNil){
  46371. $2;
  46372. } else {
  46373. var sequence;
  46374. sequence=$receiver;
  46375. $recv($recv(sequence)._temps())._do_((function(each){
  46376. return $core.withContext(function($ctx2) {
  46377. return $recv(ctx)._defineLocal_(each);
  46378. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46379. }));
  46380. }
  46381. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46382. return $core.withContext(function($ctx2) {
  46383. return $recv(ctx)._localAt_put_(key,value);
  46384. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46385. }));
  46386. $3=interpreter;
  46387. $recv($3)._context_(ctx);
  46388. $recv($3)._node_(ast);
  46389. $recv($3)._enterNode();
  46390. $recv($3)._proceed();
  46391. return $recv($3)._result();
  46392. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  46393. },
  46394. args: ["aString", "anObject", "aDictionary"],
  46395. 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",
  46396. referencedClasses: ["ASTInterpreter", "AIContext"],
  46397. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  46398. }),
  46399. $globals.ASTInterpreterTest);
  46400. $core.addMethod(
  46401. $core.method({
  46402. selector: "parse:",
  46403. protocol: 'parsing',
  46404. fn: function (aString){
  46405. var self=this;
  46406. return $core.withContext(function($ctx1) {
  46407. return $recv($globals.Smalltalk)._parse_(aString);
  46408. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  46409. },
  46410. args: ["aString"],
  46411. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46412. referencedClasses: ["Smalltalk"],
  46413. messageSends: ["parse:"]
  46414. }),
  46415. $globals.ASTInterpreterTest);
  46416. $core.addMethod(
  46417. $core.method({
  46418. selector: "parse:forClass:",
  46419. protocol: 'parsing',
  46420. fn: function (aString,aClass){
  46421. var self=this;
  46422. return $core.withContext(function($ctx1) {
  46423. return self._analyze_forClass_(self._parse_(aString),aClass);
  46424. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  46425. },
  46426. args: ["aString", "aClass"],
  46427. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46428. referencedClasses: [],
  46429. messageSends: ["analyze:forClass:", "parse:"]
  46430. }),
  46431. $globals.ASTInterpreterTest);
  46432. $core.addMethod(
  46433. $core.method({
  46434. selector: "should:receiver:return:",
  46435. protocol: 'testing',
  46436. fn: function (aString,anObject,aResult){
  46437. var self=this;
  46438. return $core.withContext(function($ctx1) {
  46439. self["@receiver"]=anObject;
  46440. return self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  46441. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  46442. },
  46443. args: ["aString", "anObject", "aResult"],
  46444. 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",
  46445. referencedClasses: [],
  46446. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  46447. }),
  46448. $globals.ASTInterpreterTest);
  46449. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  46450. $core.addMethod(
  46451. $core.method({
  46452. selector: "interpret:receiver:withArguments:",
  46453. protocol: 'private',
  46454. fn: function (aString,anObject,aDictionary){
  46455. var self=this;
  46456. var ctx,ast,debugger_;
  46457. return $core.withContext(function($ctx1) {
  46458. var $1,$2,$3,$4,$5,$receiver;
  46459. $1=$recv($globals.AIContext)._new();
  46460. $ctx1.sendIdx["new"]=1;
  46461. $recv($1)._receiver_(anObject);
  46462. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  46463. ctx=$recv($1)._yourself();
  46464. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46465. $2=$recv(ast)._sequenceNode();
  46466. if(($receiver = $2) == null || $receiver.isNil){
  46467. $2;
  46468. } else {
  46469. var sequence;
  46470. sequence=$receiver;
  46471. $recv($recv(sequence)._temps())._do_((function(each){
  46472. return $core.withContext(function($ctx2) {
  46473. return $recv(ctx)._defineLocal_(each);
  46474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46475. }));
  46476. }
  46477. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46478. return $core.withContext(function($ctx2) {
  46479. return $recv(ctx)._localAt_put_(key,value);
  46480. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46481. }));
  46482. $3=$recv(ctx)._interpreter();
  46483. $ctx1.sendIdx["interpreter"]=1;
  46484. $recv($3)._context_(ctx);
  46485. $ctx1.sendIdx["context:"]=1;
  46486. $4=$recv(ctx)._interpreter();
  46487. $recv($4)._node_(ast);
  46488. $recv($4)._enterNode();
  46489. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  46490. $5=debugger_;
  46491. $recv($5)._proceed();
  46492. return $recv($5)._result();
  46493. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  46494. },
  46495. args: ["aString", "anObject", "aDictionary"],
  46496. 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",
  46497. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  46498. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  46499. }),
  46500. $globals.ASTDebuggerTest);
  46501. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46502. $core.addMethod(
  46503. $core.method({
  46504. selector: "codeGeneratorClass",
  46505. protocol: 'accessing',
  46506. fn: function (){
  46507. var self=this;
  46508. return $globals.InliningCodeGenerator;
  46509. },
  46510. args: [],
  46511. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  46512. referencedClasses: ["InliningCodeGenerator"],
  46513. messageSends: []
  46514. }),
  46515. $globals.InliningCodeGeneratorTest);
  46516. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  46517. $core.addMethod(
  46518. $core.method({
  46519. selector: "testClassRefVar",
  46520. protocol: 'tests',
  46521. fn: function (){
  46522. var self=this;
  46523. var node;
  46524. return $core.withContext(function($ctx1) {
  46525. var $1,$2;
  46526. $1=$recv($globals.VariableNode)._new();
  46527. $ctx1.sendIdx["new"]=1;
  46528. $recv($1)._value_("Object");
  46529. node=$recv($1)._yourself();
  46530. $2=$recv($globals.SemanticAnalyzer)._new();
  46531. $ctx1.sendIdx["new"]=2;
  46532. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  46533. $recv($2)._visit_(node);
  46534. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  46535. return self;
  46536. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  46537. },
  46538. args: [],
  46539. 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",
  46540. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  46541. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  46542. }),
  46543. $globals.ScopeVarTest);
  46544. $core.addMethod(
  46545. $core.method({
  46546. selector: "testInstanceVar",
  46547. protocol: 'tests',
  46548. fn: function (){
  46549. var self=this;
  46550. var node,scope;
  46551. return $core.withContext(function($ctx1) {
  46552. var $1;
  46553. $1=$recv($globals.VariableNode)._new();
  46554. $ctx1.sendIdx["new"]=1;
  46555. $recv($1)._value_("bzzz");
  46556. node=$recv($1)._yourself();
  46557. scope=$recv($globals.MethodLexicalScope)._new();
  46558. $recv(scope)._addIVar_("bzzz");
  46559. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  46560. return self;
  46561. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46562. },
  46563. args: [],
  46564. 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",
  46565. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46566. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  46567. }),
  46568. $globals.ScopeVarTest);
  46569. $core.addMethod(
  46570. $core.method({
  46571. selector: "testPseudoVar",
  46572. protocol: 'tests',
  46573. fn: function (){
  46574. var self=this;
  46575. var node,pseudoVars;
  46576. return $core.withContext(function($ctx1) {
  46577. var $1;
  46578. pseudoVars=["self", "super", "true", "false", "nil"];
  46579. $recv(pseudoVars)._do_((function(each){
  46580. return $core.withContext(function($ctx2) {
  46581. $1=$recv($globals.VariableNode)._new();
  46582. $ctx2.sendIdx["new"]=1;
  46583. $recv($1)._value_(each);
  46584. node=$recv($1)._yourself();
  46585. node;
  46586. return self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  46587. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46588. }));
  46589. return self;
  46590. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  46591. },
  46592. args: [],
  46593. 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]",
  46594. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46595. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  46596. }),
  46597. $globals.ScopeVarTest);
  46598. $core.addMethod(
  46599. $core.method({
  46600. selector: "testTempVar",
  46601. protocol: 'tests',
  46602. fn: function (){
  46603. var self=this;
  46604. var node,scope;
  46605. return $core.withContext(function($ctx1) {
  46606. var $1;
  46607. $1=$recv($globals.VariableNode)._new();
  46608. $ctx1.sendIdx["new"]=1;
  46609. $recv($1)._value_("bzzz");
  46610. node=$recv($1)._yourself();
  46611. scope=$recv($globals.MethodLexicalScope)._new();
  46612. $recv(scope)._addTemp_("bzzz");
  46613. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  46614. return self;
  46615. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46616. },
  46617. args: [],
  46618. 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",
  46619. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46620. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  46621. }),
  46622. $globals.ScopeVarTest);
  46623. $core.addMethod(
  46624. $core.method({
  46625. selector: "testUnknownVar",
  46626. protocol: 'tests',
  46627. fn: function (){
  46628. var self=this;
  46629. var node;
  46630. return $core.withContext(function($ctx1) {
  46631. var $1;
  46632. $1=$recv($globals.VariableNode)._new();
  46633. $ctx1.sendIdx["new"]=1;
  46634. $recv($1)._value_("bzzz");
  46635. node=$recv($1)._yourself();
  46636. self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  46637. return self;
  46638. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  46639. },
  46640. args: [],
  46641. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  46642. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46643. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  46644. }),
  46645. $globals.ScopeVarTest);
  46646. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  46647. $core.addMethod(
  46648. $core.method({
  46649. selector: "setUp",
  46650. protocol: 'running',
  46651. fn: function (){
  46652. var self=this;
  46653. return $core.withContext(function($ctx1) {
  46654. self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  46655. return self;
  46656. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  46657. },
  46658. args: [],
  46659. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  46660. referencedClasses: ["SemanticAnalyzer", "Object"],
  46661. messageSends: ["on:"]
  46662. }),
  46663. $globals.SemanticAnalyzerTest);
  46664. $core.addMethod(
  46665. $core.method({
  46666. selector: "testAssignment",
  46667. protocol: 'tests',
  46668. fn: function (){
  46669. var self=this;
  46670. var src,ast;
  46671. return $core.withContext(function($ctx1) {
  46672. src="foo self := 1";
  46673. ast=$recv($globals.Smalltalk)._parse_(src);
  46674. self._should_raise_((function(){
  46675. return $core.withContext(function($ctx2) {
  46676. return $recv(self["@analyzer"])._visit_(ast);
  46677. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46678. }),$globals.InvalidAssignmentError);
  46679. return self;
  46680. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46681. },
  46682. args: [],
  46683. 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",
  46684. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  46685. messageSends: ["parse:", "should:raise:", "visit:"]
  46686. }),
  46687. $globals.SemanticAnalyzerTest);
  46688. $core.addMethod(
  46689. $core.method({
  46690. selector: "testNonLocalReturn",
  46691. protocol: 'tests',
  46692. fn: function (){
  46693. var self=this;
  46694. var src,ast;
  46695. return $core.withContext(function($ctx1) {
  46696. src="foo | a | a + 1. ^ a";
  46697. ast=$recv($globals.Smalltalk)._parse_(src);
  46698. $recv(self["@analyzer"])._visit_(ast);
  46699. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46700. return self;
  46701. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46702. },
  46703. args: [],
  46704. 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",
  46705. referencedClasses: ["Smalltalk"],
  46706. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  46707. }),
  46708. $globals.SemanticAnalyzerTest);
  46709. $core.addMethod(
  46710. $core.method({
  46711. selector: "testNonLocalReturn2",
  46712. protocol: 'tests',
  46713. fn: function (){
  46714. var self=this;
  46715. var src,ast;
  46716. return $core.withContext(function($ctx1) {
  46717. src="foo | a | a + 1. [ [ ^ a] ]";
  46718. ast=$recv($globals.Smalltalk)._parse_(src);
  46719. $recv(self["@analyzer"])._visit_(ast);
  46720. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46721. return self;
  46722. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46723. },
  46724. args: [],
  46725. 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",
  46726. referencedClasses: ["Smalltalk"],
  46727. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  46728. }),
  46729. $globals.SemanticAnalyzerTest);
  46730. $core.addMethod(
  46731. $core.method({
  46732. selector: "testScope",
  46733. protocol: 'tests',
  46734. fn: function (){
  46735. var self=this;
  46736. var src,ast;
  46737. return $core.withContext(function($ctx1) {
  46738. var $4,$3,$2,$1;
  46739. src="foo | a | a + 1. [ | b | b := a ]";
  46740. ast=$recv($globals.Smalltalk)._parse_(src);
  46741. $recv(self["@analyzer"])._visit_(ast);
  46742. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  46743. $ctx1.sendIdx["dagChildren"]=1;
  46744. $3=$recv($4)._last();
  46745. $2=$recv($3)._scope();
  46746. $ctx1.sendIdx["scope"]=1;
  46747. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46748. self._deny_($1);
  46749. return self;
  46750. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46751. },
  46752. args: [],
  46753. 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.",
  46754. referencedClasses: ["Smalltalk"],
  46755. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  46756. }),
  46757. $globals.SemanticAnalyzerTest);
  46758. $core.addMethod(
  46759. $core.method({
  46760. selector: "testScope2",
  46761. protocol: 'tests',
  46762. fn: function (){
  46763. var self=this;
  46764. var src,ast;
  46765. return $core.withContext(function($ctx1) {
  46766. var $8,$7,$6,$5,$4,$3,$2,$1;
  46767. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46768. ast=$recv($globals.Smalltalk)._parse_(src);
  46769. $recv(self["@analyzer"])._visit_(ast);
  46770. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  46771. $ctx1.sendIdx["dagChildren"]=3;
  46772. $7=$recv($8)._last();
  46773. $6=$recv($7)._dagChildren();
  46774. $ctx1.sendIdx["dagChildren"]=2;
  46775. $5=$recv($6)._first();
  46776. $ctx1.sendIdx["first"]=2;
  46777. $4=$recv($5)._dagChildren();
  46778. $ctx1.sendIdx["dagChildren"]=1;
  46779. $3=$recv($4)._first();
  46780. $ctx1.sendIdx["first"]=1;
  46781. $2=$recv($3)._scope();
  46782. $ctx1.sendIdx["scope"]=1;
  46783. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46784. self._deny_($1);
  46785. return self;
  46786. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46787. },
  46788. args: [],
  46789. 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.",
  46790. referencedClasses: ["Smalltalk"],
  46791. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  46792. }),
  46793. $globals.SemanticAnalyzerTest);
  46794. $core.addMethod(
  46795. $core.method({
  46796. selector: "testScopeLevel",
  46797. protocol: 'tests',
  46798. fn: function (){
  46799. var self=this;
  46800. var src,ast;
  46801. return $core.withContext(function($ctx1) {
  46802. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  46803. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46804. ast=$recv($globals.Smalltalk)._parse_(src);
  46805. $recv(self["@analyzer"])._visit_(ast);
  46806. $2=$recv(ast)._scope();
  46807. $ctx1.sendIdx["scope"]=1;
  46808. $1=$recv($2)._scopeLevel();
  46809. $ctx1.sendIdx["scopeLevel"]=1;
  46810. self._assert_equals_($1,(1));
  46811. $ctx1.sendIdx["assert:equals:"]=1;
  46812. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  46813. $ctx1.sendIdx["dagChildren"]=3;
  46814. $9=$recv($10)._last();
  46815. $8=$recv($9)._dagChildren();
  46816. $ctx1.sendIdx["dagChildren"]=2;
  46817. $7=$recv($8)._first();
  46818. $ctx1.sendIdx["first"]=2;
  46819. $6=$recv($7)._dagChildren();
  46820. $ctx1.sendIdx["dagChildren"]=1;
  46821. $5=$recv($6)._first();
  46822. $ctx1.sendIdx["first"]=1;
  46823. $4=$recv($5)._scope();
  46824. $3=$recv($4)._scopeLevel();
  46825. self._assert_equals_($3,(3));
  46826. return self;
  46827. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46828. },
  46829. args: [],
  46830. 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",
  46831. referencedClasses: ["Smalltalk"],
  46832. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  46833. }),
  46834. $globals.SemanticAnalyzerTest);
  46835. $core.addMethod(
  46836. $core.method({
  46837. selector: "testUnknownVariables",
  46838. protocol: 'tests',
  46839. fn: function (){
  46840. var self=this;
  46841. var src,ast;
  46842. return $core.withContext(function($ctx1) {
  46843. src="foo | a | b + a";
  46844. ast=$recv($globals.Smalltalk)._parse_(src);
  46845. self._should_raise_((function(){
  46846. return $core.withContext(function($ctx2) {
  46847. return $recv(self["@analyzer"])._visit_(ast);
  46848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46849. }),$globals.UnknownVariableError);
  46850. return self;
  46851. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46852. },
  46853. args: [],
  46854. 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",
  46855. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46856. messageSends: ["parse:", "should:raise:", "visit:"]
  46857. }),
  46858. $globals.SemanticAnalyzerTest);
  46859. $core.addMethod(
  46860. $core.method({
  46861. selector: "testUnknownVariablesWithScope",
  46862. protocol: 'tests',
  46863. fn: function (){
  46864. var self=this;
  46865. var src,ast;
  46866. return $core.withContext(function($ctx1) {
  46867. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  46868. ast=$recv($globals.Smalltalk)._parse_(src);
  46869. self._should_raise_((function(){
  46870. return $core.withContext(function($ctx2) {
  46871. return $recv(self["@analyzer"])._visit_(ast);
  46872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46873. }),$globals.UnknownVariableError);
  46874. return self;
  46875. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46876. },
  46877. args: [],
  46878. 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",
  46879. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46880. messageSends: ["parse:", "should:raise:", "visit:"]
  46881. }),
  46882. $globals.SemanticAnalyzerTest);
  46883. $core.addMethod(
  46884. $core.method({
  46885. selector: "testVariableShadowing",
  46886. protocol: 'tests',
  46887. fn: function (){
  46888. var self=this;
  46889. var src,ast;
  46890. return $core.withContext(function($ctx1) {
  46891. src="foo | a | a + 1";
  46892. ast=$recv($globals.Smalltalk)._parse_(src);
  46893. $recv(self["@analyzer"])._visit_(ast);
  46894. return self;
  46895. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46896. },
  46897. args: [],
  46898. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46899. referencedClasses: ["Smalltalk"],
  46900. messageSends: ["parse:", "visit:"]
  46901. }),
  46902. $globals.SemanticAnalyzerTest);
  46903. $core.addMethod(
  46904. $core.method({
  46905. selector: "testVariableShadowing2",
  46906. protocol: 'tests',
  46907. fn: function (){
  46908. var self=this;
  46909. var src,ast;
  46910. return $core.withContext(function($ctx1) {
  46911. src="foo | a | a + 1. [ | a | a := 2 ]";
  46912. ast=$recv($globals.Smalltalk)._parse_(src);
  46913. self._should_raise_((function(){
  46914. return $core.withContext(function($ctx2) {
  46915. return $recv(self["@analyzer"])._visit_(ast);
  46916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46917. }),$globals.ShadowingVariableError);
  46918. return self;
  46919. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46920. },
  46921. args: [],
  46922. 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",
  46923. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46924. messageSends: ["parse:", "should:raise:", "visit:"]
  46925. }),
  46926. $globals.SemanticAnalyzerTest);
  46927. $core.addMethod(
  46928. $core.method({
  46929. selector: "testVariableShadowing3",
  46930. protocol: 'tests',
  46931. fn: function (){
  46932. var self=this;
  46933. var src,ast;
  46934. return $core.withContext(function($ctx1) {
  46935. src="foo | a | a + 1. [ | b | b := 2 ]";
  46936. ast=$recv($globals.Smalltalk)._parse_(src);
  46937. $recv(self["@analyzer"])._visit_(ast);
  46938. return self;
  46939. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46940. },
  46941. args: [],
  46942. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46943. referencedClasses: ["Smalltalk"],
  46944. messageSends: ["parse:", "visit:"]
  46945. }),
  46946. $globals.SemanticAnalyzerTest);
  46947. $core.addMethod(
  46948. $core.method({
  46949. selector: "testVariableShadowing4",
  46950. protocol: 'tests',
  46951. fn: function (){
  46952. var self=this;
  46953. var src,ast;
  46954. return $core.withContext(function($ctx1) {
  46955. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  46956. ast=$recv($globals.Smalltalk)._parse_(src);
  46957. $recv(self["@analyzer"])._visit_(ast);
  46958. return self;
  46959. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46960. },
  46961. args: [],
  46962. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46963. referencedClasses: ["Smalltalk"],
  46964. messageSends: ["parse:", "visit:"]
  46965. }),
  46966. $globals.SemanticAnalyzerTest);
  46967. $core.addMethod(
  46968. $core.method({
  46969. selector: "testVariableShadowing5",
  46970. protocol: 'tests',
  46971. fn: function (){
  46972. var self=this;
  46973. var src,ast;
  46974. return $core.withContext(function($ctx1) {
  46975. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  46976. ast=$recv($globals.Smalltalk)._parse_(src);
  46977. self._should_raise_((function(){
  46978. return $core.withContext(function($ctx2) {
  46979. return $recv(self["@analyzer"])._visit_(ast);
  46980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46981. }),$globals.ShadowingVariableError);
  46982. return self;
  46983. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46984. },
  46985. args: [],
  46986. 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",
  46987. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46988. messageSends: ["parse:", "should:raise:", "visit:"]
  46989. }),
  46990. $globals.SemanticAnalyzerTest);
  46991. $core.addMethod(
  46992. $core.method({
  46993. selector: "testVariablesLookup",
  46994. protocol: 'tests',
  46995. fn: function (){
  46996. var self=this;
  46997. var src,ast;
  46998. return $core.withContext(function($ctx1) {
  46999. 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;
  47000. src="foo | a | a + 1. [ | b | b := a ]";
  47001. ast=$recv($globals.Smalltalk)._parse_(src);
  47002. $recv(self["@analyzer"])._visit_(ast);
  47003. $7=$recv(ast)._dagChildren();
  47004. $ctx1.sendIdx["dagChildren"]=2;
  47005. $6=$recv($7)._first();
  47006. $ctx1.sendIdx["first"]=2;
  47007. $5=$recv($6)._dagChildren();
  47008. $ctx1.sendIdx["dagChildren"]=1;
  47009. $4=$recv($5)._first();
  47010. $ctx1.sendIdx["first"]=1;
  47011. $3=$recv($4)._receiver();
  47012. $ctx1.sendIdx["receiver"]=1;
  47013. $2=$recv($3)._binding();
  47014. $ctx1.sendIdx["binding"]=1;
  47015. $1=$recv($2)._isTempVar();
  47016. $ctx1.sendIdx["isTempVar"]=1;
  47017. self._assert_($1);
  47018. $ctx1.sendIdx["assert:"]=1;
  47019. $15=$recv(ast)._dagChildren();
  47020. $ctx1.sendIdx["dagChildren"]=4;
  47021. $14=$recv($15)._first();
  47022. $ctx1.sendIdx["first"]=4;
  47023. $13=$recv($14)._dagChildren();
  47024. $ctx1.sendIdx["dagChildren"]=3;
  47025. $12=$recv($13)._first();
  47026. $ctx1.sendIdx["first"]=3;
  47027. $11=$recv($12)._receiver();
  47028. $10=$recv($11)._binding();
  47029. $ctx1.sendIdx["binding"]=2;
  47030. $9=$recv($10)._scope();
  47031. $ctx1.sendIdx["scope"]=1;
  47032. $16=$recv(ast)._scope();
  47033. $ctx1.sendIdx["scope"]=2;
  47034. $8=$recv($9).__eq_eq($16);
  47035. $ctx1.sendIdx["=="]=1;
  47036. self._assert_($8);
  47037. $ctx1.sendIdx["assert:"]=2;
  47038. $27=$recv(ast)._dagChildren();
  47039. $ctx1.sendIdx["dagChildren"]=8;
  47040. $26=$recv($27)._first();
  47041. $ctx1.sendIdx["first"]=7;
  47042. $25=$recv($26)._dagChildren();
  47043. $ctx1.sendIdx["dagChildren"]=7;
  47044. $24=$recv($25)._last();
  47045. $ctx1.sendIdx["last"]=1;
  47046. $23=$recv($24)._dagChildren();
  47047. $ctx1.sendIdx["dagChildren"]=6;
  47048. $22=$recv($23)._first();
  47049. $ctx1.sendIdx["first"]=6;
  47050. $21=$recv($22)._dagChildren();
  47051. $ctx1.sendIdx["dagChildren"]=5;
  47052. $20=$recv($21)._first();
  47053. $ctx1.sendIdx["first"]=5;
  47054. $19=$recv($20)._left();
  47055. $ctx1.sendIdx["left"]=1;
  47056. $18=$recv($19)._binding();
  47057. $ctx1.sendIdx["binding"]=3;
  47058. $17=$recv($18)._isTempVar();
  47059. self._assert_($17);
  47060. $ctx1.sendIdx["assert:"]=3;
  47061. $39=$recv(ast)._dagChildren();
  47062. $ctx1.sendIdx["dagChildren"]=12;
  47063. $38=$recv($39)._first();
  47064. $ctx1.sendIdx["first"]=10;
  47065. $37=$recv($38)._dagChildren();
  47066. $ctx1.sendIdx["dagChildren"]=11;
  47067. $36=$recv($37)._last();
  47068. $ctx1.sendIdx["last"]=2;
  47069. $35=$recv($36)._dagChildren();
  47070. $ctx1.sendIdx["dagChildren"]=10;
  47071. $34=$recv($35)._first();
  47072. $ctx1.sendIdx["first"]=9;
  47073. $33=$recv($34)._dagChildren();
  47074. $ctx1.sendIdx["dagChildren"]=9;
  47075. $32=$recv($33)._first();
  47076. $ctx1.sendIdx["first"]=8;
  47077. $31=$recv($32)._left();
  47078. $30=$recv($31)._binding();
  47079. $29=$recv($30)._scope();
  47080. $ctx1.sendIdx["scope"]=3;
  47081. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  47082. $ctx1.sendIdx["dagChildren"]=13;
  47083. $41=$recv($42)._last();
  47084. $40=$recv($41)._scope();
  47085. $28=$recv($29).__eq_eq($40);
  47086. self._assert_($28);
  47087. return self;
  47088. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47089. },
  47090. args: [],
  47091. 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.",
  47092. referencedClasses: ["Smalltalk"],
  47093. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  47094. }),
  47095. $globals.SemanticAnalyzerTest);
  47096. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  47097. $core.addMethod(
  47098. $core.method({
  47099. selector: "setUp",
  47100. protocol: 'running',
  47101. fn: function (){
  47102. var self=this;
  47103. return $core.withContext(function($ctx1) {
  47104. var $1,$3,$4,$2;
  47105. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  47106. $3=$recv($globals.AIContext)._new();
  47107. $recv($3)._defineLocal_("local");
  47108. $recv($3)._localAt_put_("local",(3));
  47109. $4=$recv($3)._yourself();
  47110. $ctx1.sendIdx["yourself"]=1;
  47111. $2=$4;
  47112. $recv($1)._context_($2);
  47113. self["@analyzer"]=$recv($1)._yourself();
  47114. return self;
  47115. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  47116. },
  47117. args: [],
  47118. 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",
  47119. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  47120. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  47121. }),
  47122. $globals.AISemanticAnalyzerTest);
  47123. $core.addMethod(
  47124. $core.method({
  47125. selector: "testContextVariables",
  47126. protocol: 'tests',
  47127. fn: function (){
  47128. var self=this;
  47129. var src,ast;
  47130. return $core.withContext(function($ctx1) {
  47131. src="foo | a | local + a";
  47132. ast=$recv($globals.Smalltalk)._parse_(src);
  47133. self._shouldnt_raise_((function(){
  47134. return $core.withContext(function($ctx2) {
  47135. return $recv(self["@analyzer"])._visit_(ast);
  47136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47137. }),$globals.UnknownVariableError);
  47138. return self;
  47139. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  47140. },
  47141. args: [],
  47142. 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",
  47143. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47144. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  47145. }),
  47146. $globals.AISemanticAnalyzerTest);
  47147. });
  47148. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  47149. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  47150. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47151. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  47152. $core.addPackage('Kernel-Tests');
  47153. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  47154. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47155. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  47156. $core.addMethod(
  47157. $core.method({
  47158. selector: "testAddExtensionMethod",
  47159. protocol: 'tests',
  47160. fn: function (){
  47161. var self=this;
  47162. var method,dirty;
  47163. return $core.withContext(function($ctx1) {
  47164. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  47165. $2=self._class();
  47166. $ctx1.sendIdx["class"]=1;
  47167. $1=$recv($2)._package();
  47168. $ctx1.sendIdx["package"]=1;
  47169. dirty=$recv($1)._isDirty();
  47170. $ctx1.sendIdx["isDirty"]=1;
  47171. $4=self._class();
  47172. $ctx1.sendIdx["class"]=2;
  47173. $3=$recv($4)._package();
  47174. $ctx1.sendIdx["package"]=2;
  47175. $recv($3)._beClean();
  47176. $5=self._class();
  47177. $ctx1.sendIdx["class"]=3;
  47178. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  47179. $8=self._class();
  47180. $ctx1.sendIdx["class"]=4;
  47181. $7=$recv($8)._package();
  47182. $ctx1.sendIdx["package"]=3;
  47183. $6=$recv($7)._isDirty();
  47184. self._deny_($6);
  47185. $9=self._class();
  47186. $ctx1.sendIdx["class"]=5;
  47187. $recv($9)._removeCompiledMethod_(method);
  47188. $10=dirty;
  47189. if($core.assert($10)){
  47190. $recv($recv(self._class())._package())._beDirty();
  47191. }
  47192. return self;
  47193. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  47194. },
  47195. args: [],
  47196. 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 ]",
  47197. referencedClasses: [],
  47198. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  47199. }),
  47200. $globals.AnnouncementSubscriptionTest);
  47201. $core.addMethod(
  47202. $core.method({
  47203. selector: "testHandlesAnnouncement",
  47204. protocol: 'tests',
  47205. fn: function (){
  47206. var self=this;
  47207. var subscription,announcementClass1,announcementClass2,classBuilder;
  47208. return $core.withContext(function($ctx1) {
  47209. var $1,$2;
  47210. classBuilder=$recv($globals.ClassBuilder)._new();
  47211. $ctx1.sendIdx["new"]=1;
  47212. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  47213. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  47214. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  47215. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  47216. self._assert_equals_($1,true);
  47217. $ctx1.sendIdx["assert:equals:"]=1;
  47218. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  47219. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  47220. self._assert_equals_($2,true);
  47221. $ctx1.sendIdx["assert:equals:"]=2;
  47222. self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  47223. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  47224. return self;
  47225. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  47226. },
  47227. args: [],
  47228. 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.",
  47229. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  47230. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  47231. }),
  47232. $globals.AnnouncementSubscriptionTest);
  47233. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  47234. $core.addMethod(
  47235. $core.method({
  47236. selector: "testOnDo",
  47237. protocol: 'tests',
  47238. fn: function (){
  47239. var self=this;
  47240. var counter,announcer;
  47241. return $core.withContext(function($ctx1) {
  47242. var $1,$2;
  47243. counter=(0);
  47244. announcer=$recv($globals.Announcer)._new();
  47245. $ctx1.sendIdx["new"]=1;
  47246. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  47247. return $core.withContext(function($ctx2) {
  47248. counter=$recv(counter).__plus((1));
  47249. return counter;
  47250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47251. }));
  47252. $1=announcer;
  47253. $2=$recv($globals.SystemAnnouncement)._new();
  47254. $ctx1.sendIdx["new"]=2;
  47255. $recv($1)._announce_($2);
  47256. $ctx1.sendIdx["announce:"]=1;
  47257. self._assert_equals_(counter,(1));
  47258. $ctx1.sendIdx["assert:equals:"]=1;
  47259. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47260. self._assert_equals_(counter,(2));
  47261. return self;
  47262. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47263. },
  47264. args: [],
  47265. 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.",
  47266. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47267. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  47268. }),
  47269. $globals.AnnouncerTest);
  47270. $core.addMethod(
  47271. $core.method({
  47272. selector: "testOnDoFor",
  47273. protocol: 'tests',
  47274. fn: function (){
  47275. var self=this;
  47276. var counter,announcer;
  47277. return $core.withContext(function($ctx1) {
  47278. var $1,$2,$3,$4;
  47279. counter=(0);
  47280. announcer=$recv($globals.Announcer)._new();
  47281. $ctx1.sendIdx["new"]=1;
  47282. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  47283. return $core.withContext(function($ctx2) {
  47284. counter=$recv(counter).__plus((1));
  47285. return counter;
  47286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47287. }),self);
  47288. $1=announcer;
  47289. $2=$recv($globals.SystemAnnouncement)._new();
  47290. $ctx1.sendIdx["new"]=2;
  47291. $recv($1)._announce_($2);
  47292. $ctx1.sendIdx["announce:"]=1;
  47293. self._assert_equals_(counter,(1));
  47294. $ctx1.sendIdx["assert:equals:"]=1;
  47295. $3=announcer;
  47296. $4=$recv($globals.SystemAnnouncement)._new();
  47297. $ctx1.sendIdx["new"]=3;
  47298. $recv($3)._announce_($4);
  47299. $ctx1.sendIdx["announce:"]=2;
  47300. self._assert_equals_(counter,(2));
  47301. $ctx1.sendIdx["assert:equals:"]=2;
  47302. $recv(announcer)._unsubscribe_(self);
  47303. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47304. self._assert_equals_(counter,(2));
  47305. return self;
  47306. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47307. },
  47308. args: [],
  47309. 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.",
  47310. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47311. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  47312. }),
  47313. $globals.AnnouncerTest);
  47314. $core.addMethod(
  47315. $core.method({
  47316. selector: "testOnDoOnce",
  47317. protocol: 'tests',
  47318. fn: function (){
  47319. var self=this;
  47320. var counter,announcer;
  47321. return $core.withContext(function($ctx1) {
  47322. var $1,$2;
  47323. counter=(0);
  47324. announcer=$recv($globals.Announcer)._new();
  47325. $ctx1.sendIdx["new"]=1;
  47326. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  47327. return $core.withContext(function($ctx2) {
  47328. counter=$recv(counter).__plus((1));
  47329. return counter;
  47330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47331. }));
  47332. $1=announcer;
  47333. $2=$recv($globals.SystemAnnouncement)._new();
  47334. $ctx1.sendIdx["new"]=2;
  47335. $recv($1)._announce_($2);
  47336. $ctx1.sendIdx["announce:"]=1;
  47337. self._assert_equals_(counter,(1));
  47338. $ctx1.sendIdx["assert:equals:"]=1;
  47339. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47340. self._assert_equals_(counter,(1));
  47341. return self;
  47342. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47343. },
  47344. args: [],
  47345. 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.",
  47346. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47347. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  47348. }),
  47349. $globals.AnnouncerTest);
  47350. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  47351. $core.addMethod(
  47352. $core.method({
  47353. selector: "localReturnOnDoCatch",
  47354. protocol: 'fixture',
  47355. fn: function (){
  47356. var self=this;
  47357. return $core.withContext(function($ctx1) {
  47358. var $early={};
  47359. try {
  47360. $recv((function(){
  47361. throw $early=[(2)];
  47362. }))._on_do_($globals.Error,(function(){
  47363. }));
  47364. return (3);
  47365. }
  47366. catch(e) {if(e===$early)return e[0]; throw e}
  47367. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47368. },
  47369. args: [],
  47370. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  47371. referencedClasses: ["Error"],
  47372. messageSends: ["on:do:"]
  47373. }),
  47374. $globals.BlockClosureTest);
  47375. $core.addMethod(
  47376. $core.method({
  47377. selector: "localReturnOnDoMiss",
  47378. protocol: 'fixture',
  47379. fn: function (){
  47380. var self=this;
  47381. return $core.withContext(function($ctx1) {
  47382. var $early={};
  47383. try {
  47384. $recv((function(){
  47385. throw $early=[(2)];
  47386. }))._on_do_($globals.Class,(function(){
  47387. }));
  47388. return (3);
  47389. }
  47390. catch(e) {if(e===$early)return e[0]; throw e}
  47391. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47392. },
  47393. args: [],
  47394. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  47395. referencedClasses: ["Class"],
  47396. messageSends: ["on:do:"]
  47397. }),
  47398. $globals.BlockClosureTest);
  47399. $core.addMethod(
  47400. $core.method({
  47401. selector: "testCanClearInterval",
  47402. protocol: 'tests',
  47403. fn: function (){
  47404. var self=this;
  47405. return $core.withContext(function($ctx1) {
  47406. self._shouldnt_raise_((function(){
  47407. return $core.withContext(function($ctx2) {
  47408. return $recv($recv((function(){
  47409. return $core.withContext(function($ctx3) {
  47410. return $recv($recv($globals.Error)._new())._signal();
  47411. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47412. }))._valueWithInterval_((0)))._clearInterval();
  47413. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47414. }),$globals.Error);
  47415. return self;
  47416. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  47417. },
  47418. args: [],
  47419. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  47420. referencedClasses: ["Error"],
  47421. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  47422. }),
  47423. $globals.BlockClosureTest);
  47424. $core.addMethod(
  47425. $core.method({
  47426. selector: "testCanClearTimeout",
  47427. protocol: 'tests',
  47428. fn: function (){
  47429. var self=this;
  47430. return $core.withContext(function($ctx1) {
  47431. self._shouldnt_raise_((function(){
  47432. return $core.withContext(function($ctx2) {
  47433. return $recv($recv((function(){
  47434. return $core.withContext(function($ctx3) {
  47435. return $recv($recv($globals.Error)._new())._signal();
  47436. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47437. }))._valueWithTimeout_((0)))._clearTimeout();
  47438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47439. }),$globals.Error);
  47440. return self;
  47441. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  47442. },
  47443. args: [],
  47444. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  47445. referencedClasses: ["Error"],
  47446. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  47447. }),
  47448. $globals.BlockClosureTest);
  47449. $core.addMethod(
  47450. $core.method({
  47451. selector: "testCompiledSource",
  47452. protocol: 'tests',
  47453. fn: function (){
  47454. var self=this;
  47455. return $core.withContext(function($ctx1) {
  47456. self._assert_($recv($recv((function(){
  47457. return $core.withContext(function($ctx2) {
  47458. return (1).__plus((1));
  47459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47460. }))._compiledSource())._includesSubString_("function"));
  47461. return self;
  47462. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  47463. },
  47464. args: [],
  47465. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  47466. referencedClasses: [],
  47467. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  47468. }),
  47469. $globals.BlockClosureTest);
  47470. $core.addMethod(
  47471. $core.method({
  47472. selector: "testCurrySelf",
  47473. protocol: 'tests',
  47474. fn: function (){
  47475. var self=this;
  47476. var curriedMethod,array;
  47477. return $core.withContext(function($ctx1) {
  47478. curriedMethod=$recv($recv((function(selfarg,x){
  47479. return $core.withContext(function($ctx2) {
  47480. return $recv(selfarg)._at_(x);
  47481. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  47482. }))._currySelf())._asCompiledMethod_("foo:");
  47483. array=[(3), (1), (4)];
  47484. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  47485. $recv((function(){
  47486. return $core.withContext(function($ctx2) {
  47487. return self._assert_equals_($recv(array)._foo_((2)),(1));
  47488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47489. }))._ensure_((function(){
  47490. return $core.withContext(function($ctx2) {
  47491. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  47492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47493. }));
  47494. return self;
  47495. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  47496. },
  47497. args: [],
  47498. 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 ]",
  47499. referencedClasses: ["ClassBuilder", "Array"],
  47500. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  47501. }),
  47502. $globals.BlockClosureTest);
  47503. $core.addMethod(
  47504. $core.method({
  47505. selector: "testEnsure",
  47506. protocol: 'tests',
  47507. fn: function (){
  47508. var self=this;
  47509. return $core.withContext(function($ctx1) {
  47510. self._assert_equals_($recv((function(){
  47511. return (3);
  47512. }))._ensure_((function(){
  47513. return (4);
  47514. })),(3));
  47515. return self;
  47516. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  47517. },
  47518. args: [],
  47519. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  47520. referencedClasses: [],
  47521. messageSends: ["assert:equals:", "ensure:"]
  47522. }),
  47523. $globals.BlockClosureTest);
  47524. $core.addMethod(
  47525. $core.method({
  47526. selector: "testEnsureRaises",
  47527. protocol: 'tests',
  47528. fn: function (){
  47529. var self=this;
  47530. return $core.withContext(function($ctx1) {
  47531. self._should_raise_((function(){
  47532. return $core.withContext(function($ctx2) {
  47533. return $recv((function(){
  47534. return $core.withContext(function($ctx3) {
  47535. return $recv($recv($globals.Error)._new())._signal();
  47536. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47537. }))._ensure_((function(){
  47538. return true;
  47539. }));
  47540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47541. }),$globals.Error);
  47542. return self;
  47543. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  47544. },
  47545. args: [],
  47546. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  47547. referencedClasses: ["Error"],
  47548. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  47549. }),
  47550. $globals.BlockClosureTest);
  47551. $core.addMethod(
  47552. $core.method({
  47553. selector: "testExceptionSemantics",
  47554. protocol: 'tests',
  47555. fn: function (){
  47556. var self=this;
  47557. return $core.withContext(function($ctx1) {
  47558. self._timeout_((100));
  47559. $recv(self._async_((function(){
  47560. return $core.withContext(function($ctx2) {
  47561. return $recv((function(){
  47562. return $core.withContext(function($ctx3) {
  47563. self._assert_(true);
  47564. $recv($globals.Error)._signal();
  47565. self._deny_(true);
  47566. return self._finished();
  47567. $ctx3.sendIdx["finished"]=1;
  47568. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47569. }))._on_do_($globals.Error,(function(ex){
  47570. return $core.withContext(function($ctx3) {
  47571. return self._finished();
  47572. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  47573. }));
  47574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47575. })))._valueWithTimeout_((0));
  47576. return self;
  47577. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  47578. },
  47579. args: [],
  47580. 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",
  47581. referencedClasses: ["Error"],
  47582. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  47583. }),
  47584. $globals.BlockClosureTest);
  47585. $core.addMethod(
  47586. $core.method({
  47587. selector: "testLocalReturnOnDoCatch",
  47588. protocol: 'tests',
  47589. fn: function (){
  47590. var self=this;
  47591. return $core.withContext(function($ctx1) {
  47592. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  47593. return self;
  47594. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47595. },
  47596. args: [],
  47597. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  47598. referencedClasses: [],
  47599. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  47600. }),
  47601. $globals.BlockClosureTest);
  47602. $core.addMethod(
  47603. $core.method({
  47604. selector: "testLocalReturnOnDoMiss",
  47605. protocol: 'tests',
  47606. fn: function (){
  47607. var self=this;
  47608. return $core.withContext(function($ctx1) {
  47609. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  47610. return self;
  47611. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47612. },
  47613. args: [],
  47614. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  47615. referencedClasses: [],
  47616. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  47617. }),
  47618. $globals.BlockClosureTest);
  47619. $core.addMethod(
  47620. $core.method({
  47621. selector: "testNewWithValues",
  47622. protocol: 'tests',
  47623. fn: function (){
  47624. var self=this;
  47625. return $core.withContext(function($ctx1) {
  47626. function TestConstructor(arg1, arg2, arg3) {}
  47627. TestConstructor.prototype.name = "theTestPrototype";
  47628. var wrappedConstructor = $recv(TestConstructor);
  47629. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  47630. self._assert_(result instanceof TestConstructor);
  47631. self._assert_equals_(result.name, "theTestPrototype");
  47632. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  47633. self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  47634. return self;
  47635. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  47636. },
  47637. args: [],
  47638. 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'>",
  47639. referencedClasses: [],
  47640. messageSends: []
  47641. }),
  47642. $globals.BlockClosureTest);
  47643. $core.addMethod(
  47644. $core.method({
  47645. selector: "testNumArgs",
  47646. protocol: 'tests',
  47647. fn: function (){
  47648. var self=this;
  47649. return $core.withContext(function($ctx1) {
  47650. var $1;
  47651. $1=$recv((function(){
  47652. }))._numArgs();
  47653. $ctx1.sendIdx["numArgs"]=1;
  47654. self._assert_equals_($1,(0));
  47655. $ctx1.sendIdx["assert:equals:"]=1;
  47656. self._assert_equals_($recv((function(a,b){
  47657. }))._numArgs(),(2));
  47658. return self;
  47659. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  47660. },
  47661. args: [],
  47662. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  47663. referencedClasses: [],
  47664. messageSends: ["assert:equals:", "numArgs"]
  47665. }),
  47666. $globals.BlockClosureTest);
  47667. $core.addMethod(
  47668. $core.method({
  47669. selector: "testOnDo",
  47670. protocol: 'tests',
  47671. fn: function (){
  47672. var self=this;
  47673. return $core.withContext(function($ctx1) {
  47674. self._assert_($recv((function(){
  47675. return $core.withContext(function($ctx2) {
  47676. return $recv($recv($globals.Error)._new())._signal();
  47677. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47678. }))._on_do_($globals.Error,(function(ex){
  47679. return true;
  47680. })));
  47681. return self;
  47682. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  47683. },
  47684. args: [],
  47685. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  47686. referencedClasses: ["Error"],
  47687. messageSends: ["assert:", "on:do:", "signal", "new"]
  47688. }),
  47689. $globals.BlockClosureTest);
  47690. $core.addMethod(
  47691. $core.method({
  47692. selector: "testValue",
  47693. protocol: 'tests',
  47694. fn: function (){
  47695. var self=this;
  47696. return $core.withContext(function($ctx1) {
  47697. var $1;
  47698. $1=$recv((function(){
  47699. return $core.withContext(function($ctx2) {
  47700. return (1).__plus((1));
  47701. $ctx2.sendIdx["+"]=1;
  47702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47703. }))._value();
  47704. $ctx1.sendIdx["value"]=1;
  47705. self._assert_equals_($1,(2));
  47706. $ctx1.sendIdx["assert:equals:"]=1;
  47707. self._assert_equals_($recv((function(x){
  47708. return $core.withContext(function($ctx2) {
  47709. return $recv(x).__plus((1));
  47710. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  47711. }))._value_((2)),(3));
  47712. $ctx1.sendIdx["assert:equals:"]=2;
  47713. self._assert_equals_($recv((function(x,y){
  47714. return $core.withContext(function($ctx2) {
  47715. return $recv(x).__star(y);
  47716. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  47717. }))._value_value_((2),(4)),(8));
  47718. $ctx1.sendIdx["assert:equals:"]=3;
  47719. self._assert_equals_($recv((function(a,b,c){
  47720. return (1);
  47721. }))._value(),(1));
  47722. return self;
  47723. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  47724. },
  47725. args: [],
  47726. 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",
  47727. referencedClasses: [],
  47728. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  47729. }),
  47730. $globals.BlockClosureTest);
  47731. $core.addMethod(
  47732. $core.method({
  47733. selector: "testValueWithPossibleArguments",
  47734. protocol: 'tests',
  47735. fn: function (){
  47736. var self=this;
  47737. return $core.withContext(function($ctx1) {
  47738. var $1,$2;
  47739. $1=$recv((function(){
  47740. return (1);
  47741. }))._valueWithPossibleArguments_([(3), (4)]);
  47742. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  47743. self._assert_equals_($1,(1));
  47744. $ctx1.sendIdx["assert:equals:"]=1;
  47745. $2=$recv((function(a){
  47746. return $core.withContext(function($ctx2) {
  47747. return $recv(a).__plus((4));
  47748. $ctx2.sendIdx["+"]=1;
  47749. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  47750. }))._valueWithPossibleArguments_([(3), (4)]);
  47751. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  47752. self._assert_equals_($2,(7));
  47753. $ctx1.sendIdx["assert:equals:"]=2;
  47754. self._assert_equals_($recv((function(a,b){
  47755. return $core.withContext(function($ctx2) {
  47756. return $recv(a).__plus(b);
  47757. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  47758. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  47759. return self;
  47760. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  47761. },
  47762. args: [],
  47763. 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.",
  47764. referencedClasses: [],
  47765. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  47766. }),
  47767. $globals.BlockClosureTest);
  47768. $core.addMethod(
  47769. $core.method({
  47770. selector: "testWhileFalse",
  47771. protocol: 'tests',
  47772. fn: function (){
  47773. var self=this;
  47774. var i;
  47775. return $core.withContext(function($ctx1) {
  47776. i=(0);
  47777. $recv((function(){
  47778. return $core.withContext(function($ctx2) {
  47779. return $recv(i).__gt((5));
  47780. $ctx2.sendIdx[">"]=1;
  47781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47782. }))._whileFalse_((function(){
  47783. return $core.withContext(function($ctx2) {
  47784. i=$recv(i).__plus((1));
  47785. $ctx2.sendIdx["+"]=1;
  47786. return i;
  47787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47788. }));
  47789. self._assert_equals_(i,(6));
  47790. $ctx1.sendIdx["assert:equals:"]=1;
  47791. i=(0);
  47792. $recv((function(){
  47793. return $core.withContext(function($ctx2) {
  47794. i=$recv(i).__plus((1));
  47795. i;
  47796. return $recv(i).__gt((5));
  47797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47798. }))._whileFalse();
  47799. self._assert_equals_(i,(6));
  47800. return self;
  47801. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  47802. },
  47803. args: [],
  47804. 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",
  47805. referencedClasses: [],
  47806. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  47807. }),
  47808. $globals.BlockClosureTest);
  47809. $core.addMethod(
  47810. $core.method({
  47811. selector: "testWhileTrue",
  47812. protocol: 'tests',
  47813. fn: function (){
  47814. var self=this;
  47815. var i;
  47816. return $core.withContext(function($ctx1) {
  47817. i=(0);
  47818. $recv((function(){
  47819. return $core.withContext(function($ctx2) {
  47820. return $recv(i).__lt((5));
  47821. $ctx2.sendIdx["<"]=1;
  47822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47823. }))._whileTrue_((function(){
  47824. return $core.withContext(function($ctx2) {
  47825. i=$recv(i).__plus((1));
  47826. $ctx2.sendIdx["+"]=1;
  47827. return i;
  47828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47829. }));
  47830. self._assert_equals_(i,(5));
  47831. $ctx1.sendIdx["assert:equals:"]=1;
  47832. i=(0);
  47833. $recv((function(){
  47834. return $core.withContext(function($ctx2) {
  47835. i=$recv(i).__plus((1));
  47836. i;
  47837. return $recv(i).__lt((5));
  47838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47839. }))._whileTrue();
  47840. self._assert_equals_(i,(5));
  47841. return self;
  47842. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  47843. },
  47844. args: [],
  47845. 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",
  47846. referencedClasses: [],
  47847. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  47848. }),
  47849. $globals.BlockClosureTest);
  47850. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  47851. $core.addMethod(
  47852. $core.method({
  47853. selector: "testEquality",
  47854. protocol: 'tests',
  47855. fn: function (){
  47856. var self=this;
  47857. return $core.withContext(function($ctx1) {
  47858. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47859. $1=(0).__eq(false);
  47860. $ctx1.sendIdx["="]=1;
  47861. self._deny_($1);
  47862. $ctx1.sendIdx["deny:"]=1;
  47863. $2=false.__eq((0));
  47864. $ctx1.sendIdx["="]=2;
  47865. self._deny_($2);
  47866. $ctx1.sendIdx["deny:"]=2;
  47867. $3="".__eq(false);
  47868. $ctx1.sendIdx["="]=3;
  47869. self._deny_($3);
  47870. $ctx1.sendIdx["deny:"]=3;
  47871. $4=false.__eq("");
  47872. $ctx1.sendIdx["="]=4;
  47873. self._deny_($4);
  47874. $ctx1.sendIdx["deny:"]=4;
  47875. $5=true.__eq(true);
  47876. $ctx1.sendIdx["="]=5;
  47877. self._assert_($5);
  47878. $ctx1.sendIdx["assert:"]=1;
  47879. $6=false.__eq(true);
  47880. $ctx1.sendIdx["="]=6;
  47881. self._deny_($6);
  47882. $ctx1.sendIdx["deny:"]=5;
  47883. $7=true.__eq(false);
  47884. $ctx1.sendIdx["="]=7;
  47885. self._deny_($7);
  47886. $8=false.__eq(false);
  47887. $ctx1.sendIdx["="]=8;
  47888. self._assert_($8);
  47889. $ctx1.sendIdx["assert:"]=2;
  47890. $10=true._yourself();
  47891. $ctx1.sendIdx["yourself"]=1;
  47892. $9=$recv($10).__eq(true);
  47893. $ctx1.sendIdx["="]=9;
  47894. self._assert_($9);
  47895. $ctx1.sendIdx["assert:"]=3;
  47896. $12=true._yourself();
  47897. $ctx1.sendIdx["yourself"]=2;
  47898. $11=$recv($12).__eq(true._yourself());
  47899. self._assert_($11);
  47900. return self;
  47901. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  47902. },
  47903. args: [],
  47904. 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)",
  47905. referencedClasses: [],
  47906. messageSends: ["deny:", "=", "assert:", "yourself"]
  47907. }),
  47908. $globals.BooleanTest);
  47909. $core.addMethod(
  47910. $core.method({
  47911. selector: "testIdentity",
  47912. protocol: 'tests',
  47913. fn: function (){
  47914. var self=this;
  47915. return $core.withContext(function($ctx1) {
  47916. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47917. $1=(0).__eq_eq(false);
  47918. $ctx1.sendIdx["=="]=1;
  47919. self._deny_($1);
  47920. $ctx1.sendIdx["deny:"]=1;
  47921. $2=false.__eq_eq((0));
  47922. $ctx1.sendIdx["=="]=2;
  47923. self._deny_($2);
  47924. $ctx1.sendIdx["deny:"]=2;
  47925. $3="".__eq_eq(false);
  47926. $ctx1.sendIdx["=="]=3;
  47927. self._deny_($3);
  47928. $ctx1.sendIdx["deny:"]=3;
  47929. $4=false.__eq_eq("");
  47930. $ctx1.sendIdx["=="]=4;
  47931. self._deny_($4);
  47932. $ctx1.sendIdx["deny:"]=4;
  47933. $5=true.__eq_eq(true);
  47934. $ctx1.sendIdx["=="]=5;
  47935. self._assert_($5);
  47936. $ctx1.sendIdx["assert:"]=1;
  47937. $6=false.__eq_eq(true);
  47938. $ctx1.sendIdx["=="]=6;
  47939. self._deny_($6);
  47940. $ctx1.sendIdx["deny:"]=5;
  47941. $7=true.__eq_eq(false);
  47942. $ctx1.sendIdx["=="]=7;
  47943. self._deny_($7);
  47944. $8=false.__eq_eq(false);
  47945. $ctx1.sendIdx["=="]=8;
  47946. self._assert_($8);
  47947. $ctx1.sendIdx["assert:"]=2;
  47948. $10=true._yourself();
  47949. $ctx1.sendIdx["yourself"]=1;
  47950. $9=$recv($10).__eq_eq(true);
  47951. $ctx1.sendIdx["=="]=9;
  47952. self._assert_($9);
  47953. $ctx1.sendIdx["assert:"]=3;
  47954. $12=true._yourself();
  47955. $ctx1.sendIdx["yourself"]=2;
  47956. $11=$recv($12).__eq_eq(true._yourself());
  47957. self._assert_($11);
  47958. return self;
  47959. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  47960. },
  47961. args: [],
  47962. 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",
  47963. referencedClasses: [],
  47964. messageSends: ["deny:", "==", "assert:", "yourself"]
  47965. }),
  47966. $globals.BooleanTest);
  47967. $core.addMethod(
  47968. $core.method({
  47969. selector: "testIfTrueIfFalse",
  47970. protocol: 'tests',
  47971. fn: function (){
  47972. var self=this;
  47973. return $core.withContext(function($ctx1) {
  47974. var $1,$2,$3,$4,$5,$6,$7,$8;
  47975. if($core.assert(true)){
  47976. $1="alternative block";
  47977. }
  47978. self._assert_equals_($1,"alternative block");
  47979. $ctx1.sendIdx["assert:equals:"]=1;
  47980. if(!$core.assert(true)){
  47981. $2="alternative block";
  47982. }
  47983. self._assert_equals_($2,nil);
  47984. $ctx1.sendIdx["assert:equals:"]=2;
  47985. if($core.assert(false)){
  47986. $3="alternative block";
  47987. }
  47988. self._assert_equals_($3,nil);
  47989. $ctx1.sendIdx["assert:equals:"]=3;
  47990. if(!$core.assert(false)){
  47991. $4="alternative block";
  47992. }
  47993. self._assert_equals_($4,"alternative block");
  47994. $ctx1.sendIdx["assert:equals:"]=4;
  47995. if($core.assert(false)){
  47996. $5="alternative block";
  47997. } else {
  47998. $5="alternative block2";
  47999. }
  48000. self._assert_equals_($5,"alternative block2");
  48001. $ctx1.sendIdx["assert:equals:"]=5;
  48002. if($core.assert(false)){
  48003. $6="alternative block2";
  48004. } else {
  48005. $6="alternative block";
  48006. }
  48007. self._assert_equals_($6,"alternative block");
  48008. $ctx1.sendIdx["assert:equals:"]=6;
  48009. if($core.assert(true)){
  48010. $7="alternative block";
  48011. } else {
  48012. $7="alternative block2";
  48013. }
  48014. self._assert_equals_($7,"alternative block");
  48015. $ctx1.sendIdx["assert:equals:"]=7;
  48016. if($core.assert(true)){
  48017. $8="alternative block2";
  48018. } else {
  48019. $8="alternative block";
  48020. }
  48021. self._assert_equals_($8,"alternative block2");
  48022. return self;
  48023. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  48024. },
  48025. args: [],
  48026. 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'.",
  48027. referencedClasses: [],
  48028. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  48029. }),
  48030. $globals.BooleanTest);
  48031. $core.addMethod(
  48032. $core.method({
  48033. selector: "testIfTrueIfFalseWithBoxing",
  48034. protocol: 'tests',
  48035. fn: function (){
  48036. var self=this;
  48037. return $core.withContext(function($ctx1) {
  48038. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  48039. $2=true._yourself();
  48040. $ctx1.sendIdx["yourself"]=1;
  48041. if($core.assert($2)){
  48042. $1="alternative block";
  48043. }
  48044. self._assert_equals_($1,"alternative block");
  48045. $ctx1.sendIdx["assert:equals:"]=1;
  48046. $4=true._yourself();
  48047. $ctx1.sendIdx["yourself"]=2;
  48048. if(!$core.assert($4)){
  48049. $3="alternative block";
  48050. }
  48051. self._assert_equals_($3,nil);
  48052. $ctx1.sendIdx["assert:equals:"]=2;
  48053. $6=false._yourself();
  48054. $ctx1.sendIdx["yourself"]=3;
  48055. if($core.assert($6)){
  48056. $5="alternative block";
  48057. }
  48058. self._assert_equals_($5,nil);
  48059. $ctx1.sendIdx["assert:equals:"]=3;
  48060. $8=false._yourself();
  48061. $ctx1.sendIdx["yourself"]=4;
  48062. if(!$core.assert($8)){
  48063. $7="alternative block";
  48064. }
  48065. self._assert_equals_($7,"alternative block");
  48066. $ctx1.sendIdx["assert:equals:"]=4;
  48067. $10=false._yourself();
  48068. $ctx1.sendIdx["yourself"]=5;
  48069. if($core.assert($10)){
  48070. $9="alternative block";
  48071. } else {
  48072. $9="alternative block2";
  48073. }
  48074. self._assert_equals_($9,"alternative block2");
  48075. $ctx1.sendIdx["assert:equals:"]=5;
  48076. $12=false._yourself();
  48077. $ctx1.sendIdx["yourself"]=6;
  48078. if($core.assert($12)){
  48079. $11="alternative block2";
  48080. } else {
  48081. $11="alternative block";
  48082. }
  48083. self._assert_equals_($11,"alternative block");
  48084. $ctx1.sendIdx["assert:equals:"]=6;
  48085. $14=true._yourself();
  48086. $ctx1.sendIdx["yourself"]=7;
  48087. if($core.assert($14)){
  48088. $13="alternative block";
  48089. } else {
  48090. $13="alternative block2";
  48091. }
  48092. self._assert_equals_($13,"alternative block");
  48093. $ctx1.sendIdx["assert:equals:"]=7;
  48094. $16=true._yourself();
  48095. if($core.assert($16)){
  48096. $15="alternative block2";
  48097. } else {
  48098. $15="alternative block";
  48099. }
  48100. self._assert_equals_($15,"alternative block2");
  48101. return self;
  48102. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  48103. },
  48104. args: [],
  48105. 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'.",
  48106. referencedClasses: [],
  48107. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  48108. }),
  48109. $globals.BooleanTest);
  48110. $core.addMethod(
  48111. $core.method({
  48112. selector: "testLogic",
  48113. protocol: 'tests',
  48114. fn: function (){
  48115. var self=this;
  48116. return $core.withContext(function($ctx1) {
  48117. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  48118. $1=true.__and(true);
  48119. $ctx1.sendIdx["&"]=1;
  48120. self._assert_($1);
  48121. $ctx1.sendIdx["assert:"]=1;
  48122. $2=true.__and(false);
  48123. $ctx1.sendIdx["&"]=2;
  48124. self._deny_($2);
  48125. $ctx1.sendIdx["deny:"]=1;
  48126. $3=false.__and(true);
  48127. $ctx1.sendIdx["&"]=3;
  48128. self._deny_($3);
  48129. $ctx1.sendIdx["deny:"]=2;
  48130. $5=false.__and(false);
  48131. $ctx1.sendIdx["&"]=4;
  48132. $4=self._deny_($5);
  48133. $ctx1.sendIdx["deny:"]=3;
  48134. $6=true.__or(true);
  48135. $ctx1.sendIdx["|"]=1;
  48136. self._assert_($6);
  48137. $ctx1.sendIdx["assert:"]=2;
  48138. $7=true.__or(false);
  48139. $ctx1.sendIdx["|"]=2;
  48140. self._assert_($7);
  48141. $ctx1.sendIdx["assert:"]=3;
  48142. $8=false.__or(true);
  48143. $ctx1.sendIdx["|"]=3;
  48144. self._assert_($8);
  48145. $ctx1.sendIdx["assert:"]=4;
  48146. $10=false.__or(false);
  48147. $ctx1.sendIdx["|"]=4;
  48148. $9=self._deny_($10);
  48149. $ctx1.sendIdx["deny:"]=4;
  48150. $12=(1).__gt((0));
  48151. $ctx1.sendIdx[">"]=1;
  48152. $11=true.__and($12);
  48153. $ctx1.sendIdx["&"]=5;
  48154. self._assert_($11);
  48155. $ctx1.sendIdx["assert:"]=5;
  48156. $14=(1).__gt((0));
  48157. $ctx1.sendIdx[">"]=2;
  48158. $13=$recv($14).__and(false);
  48159. $ctx1.sendIdx["&"]=6;
  48160. self._deny_($13);
  48161. $ctx1.sendIdx["deny:"]=5;
  48162. $16=(1).__gt((0));
  48163. $ctx1.sendIdx[">"]=3;
  48164. $17=(1).__gt((2));
  48165. $ctx1.sendIdx[">"]=4;
  48166. $15=$recv($16).__and($17);
  48167. self._deny_($15);
  48168. $19=(1).__gt((0));
  48169. $ctx1.sendIdx[">"]=5;
  48170. $18=false.__or($19);
  48171. $ctx1.sendIdx["|"]=5;
  48172. self._assert_($18);
  48173. $ctx1.sendIdx["assert:"]=6;
  48174. $21=(1).__gt((0));
  48175. $ctx1.sendIdx[">"]=6;
  48176. $20=$recv($21).__or(false);
  48177. $ctx1.sendIdx["|"]=6;
  48178. self._assert_($20);
  48179. $ctx1.sendIdx["assert:"]=7;
  48180. $23=(1).__gt((0));
  48181. $ctx1.sendIdx[">"]=7;
  48182. $22=$recv($23).__or((1).__gt((2)));
  48183. self._assert_($22);
  48184. return self;
  48185. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  48186. },
  48187. args: [],
  48188. 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))",
  48189. referencedClasses: [],
  48190. messageSends: ["assert:", "&", "deny:", "|", ">"]
  48191. }),
  48192. $globals.BooleanTest);
  48193. $core.addMethod(
  48194. $core.method({
  48195. selector: "testLogicKeywords",
  48196. protocol: 'tests',
  48197. fn: function (){
  48198. var self=this;
  48199. return $core.withContext(function($ctx1) {
  48200. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  48201. $1=true._and_((function(){
  48202. return true;
  48203. }));
  48204. $ctx1.sendIdx["and:"]=1;
  48205. self._assert_($1);
  48206. $ctx1.sendIdx["assert:"]=1;
  48207. $2=true._and_((function(){
  48208. return false;
  48209. }));
  48210. $ctx1.sendIdx["and:"]=2;
  48211. self._deny_($2);
  48212. $ctx1.sendIdx["deny:"]=1;
  48213. $3=false._and_((function(){
  48214. return true;
  48215. }));
  48216. $ctx1.sendIdx["and:"]=3;
  48217. self._deny_($3);
  48218. $ctx1.sendIdx["deny:"]=2;
  48219. $5=false._and_((function(){
  48220. return false;
  48221. }));
  48222. $ctx1.sendIdx["and:"]=4;
  48223. $4=self._deny_($5);
  48224. $ctx1.sendIdx["deny:"]=3;
  48225. $6=true._or_((function(){
  48226. return true;
  48227. }));
  48228. $ctx1.sendIdx["or:"]=1;
  48229. self._assert_($6);
  48230. $ctx1.sendIdx["assert:"]=2;
  48231. $7=true._or_((function(){
  48232. return false;
  48233. }));
  48234. $ctx1.sendIdx["or:"]=2;
  48235. self._assert_($7);
  48236. $ctx1.sendIdx["assert:"]=3;
  48237. $8=false._or_((function(){
  48238. return true;
  48239. }));
  48240. $ctx1.sendIdx["or:"]=3;
  48241. self._assert_($8);
  48242. $ctx1.sendIdx["assert:"]=4;
  48243. $10=false._or_((function(){
  48244. return false;
  48245. }));
  48246. $ctx1.sendIdx["or:"]=4;
  48247. $9=self._deny_($10);
  48248. $ctx1.sendIdx["deny:"]=4;
  48249. $11=true._and_((function(){
  48250. return $core.withContext(function($ctx2) {
  48251. return (1).__gt((0));
  48252. $ctx2.sendIdx[">"]=1;
  48253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  48254. }));
  48255. $ctx1.sendIdx["and:"]=5;
  48256. self._assert_($11);
  48257. $ctx1.sendIdx["assert:"]=5;
  48258. $13=(1).__gt((0));
  48259. $ctx1.sendIdx[">"]=2;
  48260. $12=$recv($13)._and_((function(){
  48261. return false;
  48262. }));
  48263. $ctx1.sendIdx["and:"]=6;
  48264. self._deny_($12);
  48265. $ctx1.sendIdx["deny:"]=5;
  48266. $15=(1).__gt((0));
  48267. $ctx1.sendIdx[">"]=3;
  48268. $14=$recv($15)._and_((function(){
  48269. return $core.withContext(function($ctx2) {
  48270. return (1).__gt((2));
  48271. $ctx2.sendIdx[">"]=4;
  48272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  48273. }));
  48274. self._deny_($14);
  48275. $16=false._or_((function(){
  48276. return $core.withContext(function($ctx2) {
  48277. return (1).__gt((0));
  48278. $ctx2.sendIdx[">"]=5;
  48279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  48280. }));
  48281. $ctx1.sendIdx["or:"]=5;
  48282. self._assert_($16);
  48283. $ctx1.sendIdx["assert:"]=6;
  48284. $18=(1).__gt((0));
  48285. $ctx1.sendIdx[">"]=6;
  48286. $17=$recv($18)._or_((function(){
  48287. return false;
  48288. }));
  48289. $ctx1.sendIdx["or:"]=6;
  48290. self._assert_($17);
  48291. $ctx1.sendIdx["assert:"]=7;
  48292. $20=(1).__gt((0));
  48293. $ctx1.sendIdx[">"]=7;
  48294. $19=$recv($20)._or_((function(){
  48295. return $core.withContext(function($ctx2) {
  48296. return (1).__gt((2));
  48297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  48298. }));
  48299. self._assert_($19);
  48300. return self;
  48301. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  48302. },
  48303. args: [],
  48304. 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 ])",
  48305. referencedClasses: [],
  48306. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  48307. }),
  48308. $globals.BooleanTest);
  48309. $core.addMethod(
  48310. $core.method({
  48311. selector: "testNonBooleanError",
  48312. protocol: 'tests',
  48313. fn: function (){
  48314. var self=this;
  48315. return $core.withContext(function($ctx1) {
  48316. self._should_raise_((function(){
  48317. return $core.withContext(function($ctx2) {
  48318. if($core.assert("")){
  48319. } else {
  48320. }
  48321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48322. }),$globals.NonBooleanReceiver);
  48323. return self;
  48324. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  48325. },
  48326. args: [],
  48327. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  48328. referencedClasses: ["NonBooleanReceiver"],
  48329. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  48330. }),
  48331. $globals.BooleanTest);
  48332. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48333. $core.addMethod(
  48334. $core.method({
  48335. selector: "setUp",
  48336. protocol: 'running',
  48337. fn: function (){
  48338. var self=this;
  48339. return $core.withContext(function($ctx1) {
  48340. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48341. return self;
  48342. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  48343. },
  48344. args: [],
  48345. source: "setUp\x0a\x09builder := ClassBuilder new",
  48346. referencedClasses: ["ClassBuilder"],
  48347. messageSends: ["new"]
  48348. }),
  48349. $globals.ClassBuilderTest);
  48350. $core.addMethod(
  48351. $core.method({
  48352. selector: "tearDown",
  48353. protocol: 'running',
  48354. fn: function (){
  48355. var self=this;
  48356. return $core.withContext(function($ctx1) {
  48357. var $1,$receiver;
  48358. $1=self["@theClass"];
  48359. if(($receiver = $1) == null || $receiver.isNil){
  48360. $1;
  48361. } else {
  48362. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48363. self["@theClass"]=nil;
  48364. self["@theClass"];
  48365. }
  48366. return self;
  48367. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  48368. },
  48369. args: [],
  48370. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48371. referencedClasses: ["Smalltalk"],
  48372. messageSends: ["ifNotNil:", "removeClass:"]
  48373. }),
  48374. $globals.ClassBuilderTest);
  48375. $core.addMethod(
  48376. $core.method({
  48377. selector: "testClassCopy",
  48378. protocol: 'tests',
  48379. fn: function (){
  48380. var self=this;
  48381. return $core.withContext(function($ctx1) {
  48382. var $2,$1,$4,$3,$6,$5,$8,$7;
  48383. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48384. $2=$recv(self["@theClass"])._superclass();
  48385. $ctx1.sendIdx["superclass"]=1;
  48386. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48387. $ctx1.sendIdx["=="]=1;
  48388. self._assert_($1);
  48389. $ctx1.sendIdx["assert:"]=1;
  48390. $4=$recv(self["@theClass"])._instanceVariableNames();
  48391. $ctx1.sendIdx["instanceVariableNames"]=1;
  48392. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48393. $ctx1.sendIdx["=="]=2;
  48394. self._assert_($3);
  48395. $ctx1.sendIdx["assert:"]=2;
  48396. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48397. $ctx1.sendIdx["assert:equals:"]=1;
  48398. $6=$recv(self["@theClass"])._package();
  48399. $ctx1.sendIdx["package"]=1;
  48400. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48401. self._assert_($5);
  48402. $8=$recv(self["@theClass"])._methodDictionary();
  48403. $ctx1.sendIdx["methodDictionary"]=1;
  48404. $7=$recv($8)._keys();
  48405. $ctx1.sendIdx["keys"]=1;
  48406. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48407. return self;
  48408. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  48409. },
  48410. args: [],
  48411. 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",
  48412. referencedClasses: ["ObjectMock"],
  48413. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  48414. }),
  48415. $globals.ClassBuilderTest);
  48416. $core.addMethod(
  48417. $core.method({
  48418. selector: "testClassMigration",
  48419. protocol: 'tests',
  48420. fn: function (){
  48421. var self=this;
  48422. var instance,oldClass;
  48423. return $core.withContext(function($ctx1) {
  48424. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  48425. oldClass=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48426. $2=$recv($globals.Smalltalk)._globals();
  48427. $ctx1.sendIdx["globals"]=1;
  48428. $1=$recv($2)._at_("ObjectMock2");
  48429. $ctx1.sendIdx["at:"]=1;
  48430. instance=$recv($1)._new();
  48431. $4=$recv($globals.Smalltalk)._globals();
  48432. $ctx1.sendIdx["globals"]=2;
  48433. $3=$recv($4)._at_("ObjectMock2");
  48434. $ctx1.sendIdx["at:"]=2;
  48435. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  48436. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  48437. $ctx1.sendIdx["=="]=1;
  48438. self._deny_($5);
  48439. $ctx1.sendIdx["deny:"]=1;
  48440. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  48441. $ctx1.sendIdx["=="]=2;
  48442. self._assert_($6);
  48443. $ctx1.sendIdx["assert:"]=1;
  48444. self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  48445. $ctx1.sendIdx["assert:"]=2;
  48446. $7=$recv($globals.ObjectMock2)._selectors();
  48447. $ctx1.sendIdx["selectors"]=1;
  48448. self._assert_equals_($7,$recv(oldClass)._selectors());
  48449. $ctx1.sendIdx["assert:equals:"]=1;
  48450. $8=$recv($globals.ObjectMock2)._comment();
  48451. $ctx1.sendIdx["comment"]=1;
  48452. self._assert_equals_($8,$recv(oldClass)._comment());
  48453. $ctx1.sendIdx["assert:equals:"]=2;
  48454. $9=$recv($recv($globals.ObjectMock2)._package())._name();
  48455. $ctx1.sendIdx["name"]=1;
  48456. self._assert_equals_($9,"Kernel-Tests");
  48457. $11=$recv(instance)._class();
  48458. $ctx1.sendIdx["class"]=1;
  48459. $10=$recv($11).__eq_eq($globals.ObjectMock2);
  48460. self._deny_($10);
  48461. self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  48462. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48463. return self;
  48464. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  48465. },
  48466. args: [],
  48467. 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",
  48468. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  48469. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  48470. }),
  48471. $globals.ClassBuilderTest);
  48472. $core.addMethod(
  48473. $core.method({
  48474. selector: "testClassMigrationWithClassInstanceVariables",
  48475. protocol: 'tests',
  48476. fn: function (){
  48477. var self=this;
  48478. return $core.withContext(function($ctx1) {
  48479. var $1;
  48480. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48481. $1=$recv($globals.ObjectMock2)._class();
  48482. $ctx1.sendIdx["class"]=1;
  48483. $recv($1)._instanceVariableNames_("foo bar");
  48484. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48485. self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  48486. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48487. return self;
  48488. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  48489. },
  48490. args: [],
  48491. 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",
  48492. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  48493. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  48494. }),
  48495. $globals.ClassBuilderTest);
  48496. $core.addMethod(
  48497. $core.method({
  48498. selector: "testClassMigrationWithSubclasses",
  48499. protocol: 'tests',
  48500. fn: function (){
  48501. var self=this;
  48502. return $core.withContext(function($ctx1) {
  48503. var $2,$1,$4,$3;
  48504. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48505. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  48506. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  48507. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  48508. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  48509. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48510. $2=$recv($globals.ObjectMock)._subclasses();
  48511. $ctx1.sendIdx["subclasses"]=1;
  48512. $1=$recv($2)._includes_($globals.ObjectMock2);
  48513. $ctx1.sendIdx["includes:"]=1;
  48514. self._assert_($1);
  48515. $ctx1.sendIdx["assert:"]=1;
  48516. $4=$recv($globals.ObjectMock2)._subclasses();
  48517. $ctx1.sendIdx["subclasses"]=2;
  48518. $3=$recv($4)._includes_($globals.ObjectMock3);
  48519. $ctx1.sendIdx["includes:"]=2;
  48520. self._assert_($3);
  48521. $ctx1.sendIdx["assert:"]=2;
  48522. self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  48523. $recv($recv($globals.ObjectMock)._allSubclasses())._do_((function(each){
  48524. return $core.withContext(function($ctx2) {
  48525. return $recv($globals.Smalltalk)._removeClass_(each);
  48526. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48527. }));
  48528. return self;
  48529. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  48530. },
  48531. args: [],
  48532. 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 do: [ :each | Smalltalk removeClass: each ]",
  48533. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  48534. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  48535. }),
  48536. $globals.ClassBuilderTest);
  48537. $core.addMethod(
  48538. $core.method({
  48539. selector: "testInstanceVariableNames",
  48540. protocol: 'tests',
  48541. fn: function (){
  48542. var self=this;
  48543. return $core.withContext(function($ctx1) {
  48544. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  48545. return self;
  48546. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  48547. },
  48548. args: [],
  48549. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  48550. referencedClasses: [],
  48551. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  48552. }),
  48553. $globals.ClassBuilderTest);
  48554. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48555. $core.addMethod(
  48556. $core.method({
  48557. selector: "jsConstructor",
  48558. protocol: 'running',
  48559. fn: function (){
  48560. var self=this;
  48561. return $core.withContext(function($ctx1) {
  48562. function Foo(){}
  48563. Foo.prototype.valueOf = function () {return 4;};
  48564. return Foo;
  48565. ;
  48566. return self;
  48567. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  48568. },
  48569. args: [],
  48570. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  48571. referencedClasses: [],
  48572. messageSends: []
  48573. }),
  48574. $globals.ClassTest);
  48575. $core.addMethod(
  48576. $core.method({
  48577. selector: "setUp",
  48578. protocol: 'running',
  48579. fn: function (){
  48580. var self=this;
  48581. return $core.withContext(function($ctx1) {
  48582. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48583. return self;
  48584. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  48585. },
  48586. args: [],
  48587. source: "setUp\x0a\x09builder := ClassBuilder new",
  48588. referencedClasses: ["ClassBuilder"],
  48589. messageSends: ["new"]
  48590. }),
  48591. $globals.ClassTest);
  48592. $core.addMethod(
  48593. $core.method({
  48594. selector: "tearDown",
  48595. protocol: 'running',
  48596. fn: function (){
  48597. var self=this;
  48598. return $core.withContext(function($ctx1) {
  48599. var $1,$receiver;
  48600. $1=self["@theClass"];
  48601. if(($receiver = $1) == null || $receiver.isNil){
  48602. $1;
  48603. } else {
  48604. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48605. self["@theClass"]=nil;
  48606. self["@theClass"];
  48607. }
  48608. return self;
  48609. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  48610. },
  48611. args: [],
  48612. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48613. referencedClasses: ["Smalltalk"],
  48614. messageSends: ["ifNotNil:", "removeClass:"]
  48615. }),
  48616. $globals.ClassTest);
  48617. $core.addMethod(
  48618. $core.method({
  48619. selector: "testAllSubclasses",
  48620. protocol: 'tests',
  48621. fn: function (){
  48622. var self=this;
  48623. var subclasses,index;
  48624. return $core.withContext(function($ctx1) {
  48625. subclasses=$recv($globals.Object)._subclasses();
  48626. $ctx1.sendIdx["subclasses"]=1;
  48627. index=(1);
  48628. $recv((function(){
  48629. return $core.withContext(function($ctx2) {
  48630. return $recv(index).__gt($recv(subclasses)._size());
  48631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48632. }))._whileFalse_((function(){
  48633. return $core.withContext(function($ctx2) {
  48634. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  48635. index=$recv(index).__plus((1));
  48636. return index;
  48637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48638. }));
  48639. self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  48640. return self;
  48641. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  48642. },
  48643. args: [],
  48644. 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",
  48645. referencedClasses: ["Object"],
  48646. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  48647. }),
  48648. $globals.ClassTest);
  48649. $core.addMethod(
  48650. $core.method({
  48651. selector: "testMetaclassSubclasses",
  48652. protocol: 'tests',
  48653. fn: function (){
  48654. var self=this;
  48655. var subclasses;
  48656. return $core.withContext(function($ctx1) {
  48657. var $4,$3,$2,$1;
  48658. $4=$recv($globals.Object)._class();
  48659. $ctx1.sendIdx["class"]=1;
  48660. $3=$recv($4)._instanceClass();
  48661. $2=$recv($3)._subclasses();
  48662. $ctx1.sendIdx["subclasses"]=1;
  48663. $1=$recv($2)._select_((function(each){
  48664. return $core.withContext(function($ctx2) {
  48665. return $recv($recv(each)._isMetaclass())._not();
  48666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48667. }));
  48668. subclasses=$recv($1)._collect_((function(each){
  48669. return $core.withContext(function($ctx2) {
  48670. return $recv(each)._theMetaClass();
  48671. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48672. }));
  48673. self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  48674. return self;
  48675. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  48676. },
  48677. args: [],
  48678. 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",
  48679. referencedClasses: ["Object"],
  48680. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  48681. }),
  48682. $globals.ClassTest);
  48683. $core.addMethod(
  48684. $core.method({
  48685. selector: "testSetJavaScriptConstructor",
  48686. protocol: 'tests',
  48687. fn: function (){
  48688. var self=this;
  48689. var instance;
  48690. return $core.withContext(function($ctx1) {
  48691. var $2,$1,$4,$3,$6,$5,$8,$7;
  48692. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48693. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  48694. $2=$recv(self["@theClass"])._superclass();
  48695. $ctx1.sendIdx["superclass"]=1;
  48696. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48697. $ctx1.sendIdx["=="]=1;
  48698. self._assert_($1);
  48699. $ctx1.sendIdx["assert:"]=1;
  48700. $4=$recv(self["@theClass"])._instanceVariableNames();
  48701. $ctx1.sendIdx["instanceVariableNames"]=1;
  48702. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48703. $ctx1.sendIdx["=="]=2;
  48704. self._assert_($3);
  48705. $ctx1.sendIdx["assert:"]=2;
  48706. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48707. $ctx1.sendIdx["assert:equals:"]=1;
  48708. $6=$recv(self["@theClass"])._package();
  48709. $ctx1.sendIdx["package"]=1;
  48710. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48711. $ctx1.sendIdx["=="]=3;
  48712. self._assert_($5);
  48713. $ctx1.sendIdx["assert:"]=3;
  48714. $8=$recv(self["@theClass"])._methodDictionary();
  48715. $ctx1.sendIdx["methodDictionary"]=1;
  48716. $7=$recv($8)._keys();
  48717. $ctx1.sendIdx["keys"]=1;
  48718. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48719. $ctx1.sendIdx["assert:equals:"]=2;
  48720. instance=$recv(self["@theClass"])._new();
  48721. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48722. self._assert_equals_($recv(instance)._value(),(4));
  48723. $ctx1.sendIdx["assert:equals:"]=3;
  48724. self._shouldnt_raise_((function(){
  48725. return $core.withContext(function($ctx2) {
  48726. return $recv(instance)._foo_((9));
  48727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48728. }),$globals.Error);
  48729. self._assert_equals_($recv(instance)._foo(),(9));
  48730. return self;
  48731. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48732. },
  48733. args: [],
  48734. 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",
  48735. referencedClasses: ["ObjectMock", "Error"],
  48736. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48737. }),
  48738. $globals.ClassTest);
  48739. $core.addMethod(
  48740. $core.method({
  48741. selector: "testTrickySetJavaScriptConstructor",
  48742. protocol: 'tests',
  48743. fn: function (){
  48744. var self=this;
  48745. var instance;
  48746. return $core.withContext(function($ctx1) {
  48747. var $2,$1,$4,$3,$6,$5,$8,$7;
  48748. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48749. $recv(self["@theClass"])._javascriptConstructor_(self._trickyJsConstructor());
  48750. $2=$recv(self["@theClass"])._superclass();
  48751. $ctx1.sendIdx["superclass"]=1;
  48752. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48753. $ctx1.sendIdx["=="]=1;
  48754. self._assert_($1);
  48755. $ctx1.sendIdx["assert:"]=1;
  48756. $4=$recv(self["@theClass"])._instanceVariableNames();
  48757. $ctx1.sendIdx["instanceVariableNames"]=1;
  48758. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48759. $ctx1.sendIdx["=="]=2;
  48760. self._assert_($3);
  48761. $ctx1.sendIdx["assert:"]=2;
  48762. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48763. $ctx1.sendIdx["assert:equals:"]=1;
  48764. $6=$recv(self["@theClass"])._package();
  48765. $ctx1.sendIdx["package"]=1;
  48766. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48767. $ctx1.sendIdx["=="]=3;
  48768. self._assert_($5);
  48769. $ctx1.sendIdx["assert:"]=3;
  48770. $8=$recv(self["@theClass"])._methodDictionary();
  48771. $ctx1.sendIdx["methodDictionary"]=1;
  48772. $7=$recv($8)._keys();
  48773. $ctx1.sendIdx["keys"]=1;
  48774. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48775. $ctx1.sendIdx["assert:equals:"]=2;
  48776. instance=$recv(self["@theClass"])._new();
  48777. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48778. self._assert_equals_($recv(instance)._value(),(4));
  48779. $ctx1.sendIdx["assert:equals:"]=3;
  48780. self._shouldnt_raise_((function(){
  48781. return $core.withContext(function($ctx2) {
  48782. return $recv(instance)._foo_((9));
  48783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48784. }),$globals.Error);
  48785. self._assert_equals_($recv(instance)._foo(),(9));
  48786. return self;
  48787. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48788. },
  48789. args: [],
  48790. 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",
  48791. referencedClasses: ["ObjectMock", "Error"],
  48792. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48793. }),
  48794. $globals.ClassTest);
  48795. $core.addMethod(
  48796. $core.method({
  48797. selector: "trickyJsConstructor",
  48798. protocol: 'running',
  48799. fn: function (){
  48800. var self=this;
  48801. return $core.withContext(function($ctx1) {
  48802. function Foo(){}
  48803. Foo.prototype.valueOf = function () {return 4;};
  48804. Foo.prototype._foo = function () {return "bar";};
  48805. return Foo;
  48806. ;
  48807. return self;
  48808. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  48809. },
  48810. args: [],
  48811. 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'>",
  48812. referencedClasses: [],
  48813. messageSends: []
  48814. }),
  48815. $globals.ClassTest);
  48816. $core.addClass('CollectionTest', $globals.TestCase, ['sampleBlock'], 'Kernel-Tests');
  48817. $core.addMethod(
  48818. $core.method({
  48819. selector: "assertSameContents:as:",
  48820. protocol: 'convenience',
  48821. fn: function (aCollection,anotherCollection){
  48822. var self=this;
  48823. return $core.withContext(function($ctx1) {
  48824. var $2,$1,$4,$3;
  48825. $2=$recv(aCollection)._size();
  48826. $ctx1.sendIdx["size"]=1;
  48827. $1=$recv($2).__eq($recv(anotherCollection)._size());
  48828. $ctx1.sendIdx["="]=1;
  48829. self._assert_($1);
  48830. $ctx1.sendIdx["assert:"]=1;
  48831. $recv(aCollection)._do_((function(each){
  48832. return $core.withContext(function($ctx2) {
  48833. $4=$recv(aCollection)._occurrencesOf_(each);
  48834. $ctx2.sendIdx["occurrencesOf:"]=1;
  48835. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  48836. return self._assert_($3);
  48837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48838. }));
  48839. return self;
  48840. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  48841. },
  48842. args: ["aCollection", "anotherCollection"],
  48843. 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)) ]",
  48844. referencedClasses: [],
  48845. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  48846. }),
  48847. $globals.CollectionTest);
  48848. $core.addMethod(
  48849. $core.method({
  48850. selector: "collection",
  48851. protocol: 'fixture',
  48852. fn: function (){
  48853. var self=this;
  48854. return $core.withContext(function($ctx1) {
  48855. self._subclassResponsibility();
  48856. return self;
  48857. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  48858. },
  48859. args: [],
  48860. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  48861. referencedClasses: [],
  48862. messageSends: ["subclassResponsibility"]
  48863. }),
  48864. $globals.CollectionTest);
  48865. $core.addMethod(
  48866. $core.method({
  48867. selector: "collectionClass",
  48868. protocol: 'fixture',
  48869. fn: function (){
  48870. var self=this;
  48871. return $core.withContext(function($ctx1) {
  48872. return $recv(self._class())._collectionClass();
  48873. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  48874. },
  48875. args: [],
  48876. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  48877. referencedClasses: [],
  48878. messageSends: ["collectionClass", "class"]
  48879. }),
  48880. $globals.CollectionTest);
  48881. $core.addMethod(
  48882. $core.method({
  48883. selector: "collectionOfPrintStrings",
  48884. protocol: 'fixture',
  48885. fn: function (){
  48886. var self=this;
  48887. return $core.withContext(function($ctx1) {
  48888. self._subclassResponsibility();
  48889. return self;
  48890. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  48891. },
  48892. args: [],
  48893. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  48894. referencedClasses: [],
  48895. messageSends: ["subclassResponsibility"]
  48896. }),
  48897. $globals.CollectionTest);
  48898. $core.addMethod(
  48899. $core.method({
  48900. selector: "collectionSize",
  48901. protocol: 'fixture',
  48902. fn: function (){
  48903. var self=this;
  48904. return $core.withContext(function($ctx1) {
  48905. self._subclassResponsibility();
  48906. return self;
  48907. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  48908. },
  48909. args: [],
  48910. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  48911. referencedClasses: [],
  48912. messageSends: ["subclassResponsibility"]
  48913. }),
  48914. $globals.CollectionTest);
  48915. $core.addMethod(
  48916. $core.method({
  48917. selector: "collectionWithDuplicates",
  48918. protocol: 'fixture',
  48919. fn: function (){
  48920. var self=this;
  48921. return $core.withContext(function($ctx1) {
  48922. self._subclassResponsibility();
  48923. return self;
  48924. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  48925. },
  48926. args: [],
  48927. 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",
  48928. referencedClasses: [],
  48929. messageSends: ["subclassResponsibility"]
  48930. }),
  48931. $globals.CollectionTest);
  48932. $core.addMethod(
  48933. $core.method({
  48934. selector: "collectionWithNewValue",
  48935. protocol: 'fixture',
  48936. fn: function (){
  48937. var self=this;
  48938. return $core.withContext(function($ctx1) {
  48939. self._subclassResponsibility();
  48940. return self;
  48941. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  48942. },
  48943. args: [],
  48944. 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",
  48945. referencedClasses: [],
  48946. messageSends: ["subclassResponsibility"]
  48947. }),
  48948. $globals.CollectionTest);
  48949. $core.addMethod(
  48950. $core.method({
  48951. selector: "initialize",
  48952. protocol: 'initialization',
  48953. fn: function (){
  48954. var self=this;
  48955. return $core.withContext(function($ctx1) {
  48956. (
  48957. $ctx1.supercall = true,
  48958. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  48959. $ctx1.supercall = false;
  48960. self["@sampleBlock"]=(function(){
  48961. });
  48962. return self;
  48963. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  48964. },
  48965. args: [],
  48966. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  48967. referencedClasses: [],
  48968. messageSends: ["initialize"]
  48969. }),
  48970. $globals.CollectionTest);
  48971. $core.addMethod(
  48972. $core.method({
  48973. selector: "isCollectionReadOnly",
  48974. protocol: 'testing',
  48975. fn: function (){
  48976. var self=this;
  48977. return false;
  48978. },
  48979. args: [],
  48980. source: "isCollectionReadOnly\x0a\x09^ false",
  48981. referencedClasses: [],
  48982. messageSends: []
  48983. }),
  48984. $globals.CollectionTest);
  48985. $core.addMethod(
  48986. $core.method({
  48987. selector: "sampleNewValue",
  48988. protocol: 'fixture',
  48989. fn: function (){
  48990. var self=this;
  48991. return "N";
  48992. },
  48993. args: [],
  48994. 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'",
  48995. referencedClasses: [],
  48996. messageSends: []
  48997. }),
  48998. $globals.CollectionTest);
  48999. $core.addMethod(
  49000. $core.method({
  49001. selector: "sampleNewValueAsCollection",
  49002. protocol: 'fixture',
  49003. fn: function (){
  49004. var self=this;
  49005. return $core.withContext(function($ctx1) {
  49006. return $recv(self._collectionClass())._with_(self._sampleNewValue());
  49007. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  49008. },
  49009. args: [],
  49010. 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",
  49011. referencedClasses: [],
  49012. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  49013. }),
  49014. $globals.CollectionTest);
  49015. $core.addMethod(
  49016. $core.method({
  49017. selector: "testAddAll",
  49018. protocol: 'tests',
  49019. fn: function (){
  49020. var self=this;
  49021. return $core.withContext(function($ctx1) {
  49022. 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;
  49023. $2=self._collection();
  49024. $ctx1.sendIdx["collection"]=1;
  49025. $4=self._collectionClass();
  49026. $ctx1.sendIdx["collectionClass"]=1;
  49027. $3=$recv($4)._new();
  49028. $ctx1.sendIdx["new"]=1;
  49029. $recv($2)._addAll_($3);
  49030. $ctx1.sendIdx["addAll:"]=1;
  49031. $5=$recv($2)._yourself();
  49032. $ctx1.sendIdx["yourself"]=1;
  49033. $1=$5;
  49034. $6=self._collection();
  49035. $ctx1.sendIdx["collection"]=2;
  49036. self._assert_equals_($1,$6);
  49037. $ctx1.sendIdx["assert:equals:"]=1;
  49038. $9=self._collectionClass();
  49039. $ctx1.sendIdx["collectionClass"]=2;
  49040. $8=$recv($9)._new();
  49041. $ctx1.sendIdx["new"]=2;
  49042. $10=self._collection();
  49043. $ctx1.sendIdx["collection"]=3;
  49044. $recv($8)._addAll_($10);
  49045. $ctx1.sendIdx["addAll:"]=2;
  49046. $11=$recv($8)._yourself();
  49047. $ctx1.sendIdx["yourself"]=2;
  49048. $7=$11;
  49049. $12=self._collection();
  49050. $ctx1.sendIdx["collection"]=4;
  49051. self._assert_equals_($7,$12);
  49052. $ctx1.sendIdx["assert:equals:"]=2;
  49053. $15=self._collectionClass();
  49054. $ctx1.sendIdx["collectionClass"]=3;
  49055. $14=$recv($15)._new();
  49056. $ctx1.sendIdx["new"]=3;
  49057. $17=self._collectionClass();
  49058. $ctx1.sendIdx["collectionClass"]=4;
  49059. $16=$recv($17)._new();
  49060. $ctx1.sendIdx["new"]=4;
  49061. $recv($14)._addAll_($16);
  49062. $ctx1.sendIdx["addAll:"]=3;
  49063. $18=$recv($14)._yourself();
  49064. $ctx1.sendIdx["yourself"]=3;
  49065. $13=$18;
  49066. self._assert_equals_($13,$recv(self._collectionClass())._new());
  49067. $ctx1.sendIdx["assert:equals:"]=3;
  49068. $20=self._collection();
  49069. $ctx1.sendIdx["collection"]=5;
  49070. $21=self._sampleNewValueAsCollection();
  49071. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49072. $recv($20)._addAll_($21);
  49073. $ctx1.sendIdx["addAll:"]=4;
  49074. $22=$recv($20)._yourself();
  49075. $ctx1.sendIdx["yourself"]=4;
  49076. $19=$22;
  49077. $23=self._collectionWithNewValue();
  49078. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49079. self._assert_equals_($19,$23);
  49080. $25=self._sampleNewValueAsCollection();
  49081. $recv($25)._addAll_(self._collection());
  49082. $24=$recv($25)._yourself();
  49083. self._assertSameContents_as_($24,self._collectionWithNewValue());
  49084. return self;
  49085. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  49086. },
  49087. args: [],
  49088. 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",
  49089. referencedClasses: [],
  49090. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  49091. }),
  49092. $globals.CollectionTest);
  49093. $core.addMethod(
  49094. $core.method({
  49095. selector: "testAllSatisfy",
  49096. protocol: 'tests',
  49097. fn: function (){
  49098. var self=this;
  49099. var collection,anyOne;
  49100. return $core.withContext(function($ctx1) {
  49101. var $1;
  49102. collection=self._collection();
  49103. anyOne=$recv(collection)._anyOne();
  49104. $1=$recv(collection)._allSatisfy_((function(each){
  49105. return $core.withContext(function($ctx2) {
  49106. return $recv(collection)._includes_(each);
  49107. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49108. }));
  49109. $ctx1.sendIdx["allSatisfy:"]=1;
  49110. self._assert_($1);
  49111. self._deny_($recv(collection)._allSatisfy_((function(each){
  49112. return $core.withContext(function($ctx2) {
  49113. return $recv(each).__tild_eq(anyOne);
  49114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49115. })));
  49116. return self;
  49117. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  49118. },
  49119. args: [],
  49120. 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 ])",
  49121. referencedClasses: [],
  49122. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  49123. }),
  49124. $globals.CollectionTest);
  49125. $core.addMethod(
  49126. $core.method({
  49127. selector: "testAnyOne",
  49128. protocol: 'tests',
  49129. fn: function (){
  49130. var self=this;
  49131. return $core.withContext(function($ctx1) {
  49132. var $2,$1;
  49133. self._should_raise_((function(){
  49134. return $core.withContext(function($ctx2) {
  49135. return $recv($recv(self._collectionClass())._new())._anyOne();
  49136. $ctx2.sendIdx["anyOne"]=1;
  49137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49138. }),$globals.Error);
  49139. $2=self._collection();
  49140. $ctx1.sendIdx["collection"]=1;
  49141. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  49142. self._assert_($1);
  49143. return self;
  49144. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  49145. },
  49146. args: [],
  49147. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  49148. referencedClasses: ["Error"],
  49149. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  49150. }),
  49151. $globals.CollectionTest);
  49152. $core.addMethod(
  49153. $core.method({
  49154. selector: "testAnySatisfy",
  49155. protocol: 'tests',
  49156. fn: function (){
  49157. var self=this;
  49158. var anyOne;
  49159. return $core.withContext(function($ctx1) {
  49160. var $1,$3,$2;
  49161. $1=self._collection();
  49162. $ctx1.sendIdx["collection"]=1;
  49163. anyOne=$recv($1)._anyOne();
  49164. $3=self._collection();
  49165. $ctx1.sendIdx["collection"]=2;
  49166. $2=$recv($3)._anySatisfy_((function(each){
  49167. return $core.withContext(function($ctx2) {
  49168. return $recv(each).__eq(anyOne);
  49169. $ctx2.sendIdx["="]=1;
  49170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49171. }));
  49172. $ctx1.sendIdx["anySatisfy:"]=1;
  49173. self._assert_($2);
  49174. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  49175. return $core.withContext(function($ctx2) {
  49176. return $recv(each).__eq($recv($globals.Object)._new());
  49177. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49178. })));
  49179. return self;
  49180. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49181. },
  49182. args: [],
  49183. 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 ])",
  49184. referencedClasses: ["Object"],
  49185. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  49186. }),
  49187. $globals.CollectionTest);
  49188. $core.addMethod(
  49189. $core.method({
  49190. selector: "testAsArray",
  49191. protocol: 'tests',
  49192. fn: function (){
  49193. var self=this;
  49194. return $core.withContext(function($ctx1) {
  49195. var $1;
  49196. $1=self._collection();
  49197. $ctx1.sendIdx["collection"]=1;
  49198. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  49199. return self;
  49200. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  49201. },
  49202. args: [],
  49203. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  49204. referencedClasses: [],
  49205. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  49206. }),
  49207. $globals.CollectionTest);
  49208. $core.addMethod(
  49209. $core.method({
  49210. selector: "testAsOrderedCollection",
  49211. protocol: 'tests',
  49212. fn: function (){
  49213. var self=this;
  49214. return $core.withContext(function($ctx1) {
  49215. var $1;
  49216. $1=self._collection();
  49217. $ctx1.sendIdx["collection"]=1;
  49218. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  49219. return self;
  49220. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  49221. },
  49222. args: [],
  49223. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  49224. referencedClasses: [],
  49225. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  49226. }),
  49227. $globals.CollectionTest);
  49228. $core.addMethod(
  49229. $core.method({
  49230. selector: "testAsSet",
  49231. protocol: 'tests',
  49232. fn: function (){
  49233. var self=this;
  49234. var c,set;
  49235. return $core.withContext(function($ctx1) {
  49236. c=self._collectionWithDuplicates();
  49237. set=$recv(c)._asSet();
  49238. self._assert_equals_($recv(set)._size(),(6));
  49239. $recv(c)._do_((function(each){
  49240. return $core.withContext(function($ctx2) {
  49241. return self._assert_($recv(set)._includes_(each));
  49242. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49243. }));
  49244. return self;
  49245. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  49246. },
  49247. args: [],
  49248. 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) ]",
  49249. referencedClasses: [],
  49250. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  49251. }),
  49252. $globals.CollectionTest);
  49253. $core.addMethod(
  49254. $core.method({
  49255. selector: "testCollect",
  49256. protocol: 'tests',
  49257. fn: function (){
  49258. var self=this;
  49259. return $core.withContext(function($ctx1) {
  49260. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  49261. $2=self._collection();
  49262. $ctx1.sendIdx["collection"]=1;
  49263. $1=$recv($2)._collect_((function(each){
  49264. return each;
  49265. }));
  49266. $ctx1.sendIdx["collect:"]=1;
  49267. $3=self._collection();
  49268. $ctx1.sendIdx["collection"]=2;
  49269. self._assert_equals_($1,$3);
  49270. $ctx1.sendIdx["assert:equals:"]=1;
  49271. $5=self._collectionWithNewValue();
  49272. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49273. $4=$recv($5)._collect_((function(each){
  49274. return each;
  49275. }));
  49276. $ctx1.sendIdx["collect:"]=2;
  49277. self._assert_equals_($4,self._collectionWithNewValue());
  49278. $ctx1.sendIdx["assert:equals:"]=2;
  49279. $8=self._collectionClass();
  49280. $ctx1.sendIdx["collectionClass"]=1;
  49281. $7=$recv($8)._new();
  49282. $ctx1.sendIdx["new"]=1;
  49283. $6=$recv($7)._collect_((function(each){
  49284. return $core.withContext(function($ctx2) {
  49285. return $recv(each)._printString();
  49286. $ctx2.sendIdx["printString"]=1;
  49287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49288. }));
  49289. $ctx1.sendIdx["collect:"]=3;
  49290. self._assert_equals_($6,$recv(self._collectionClass())._new());
  49291. $ctx1.sendIdx["assert:equals:"]=3;
  49292. $11=self._collection();
  49293. $ctx1.sendIdx["collection"]=3;
  49294. $10=$recv($11)._collect_((function(){
  49295. return $core.withContext(function($ctx2) {
  49296. return self._sampleNewValue();
  49297. $ctx2.sendIdx["sampleNewValue"]=1;
  49298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  49299. }));
  49300. $ctx1.sendIdx["collect:"]=4;
  49301. $9=$recv($10)._detect_((function(){
  49302. return true;
  49303. }));
  49304. self._assert_equals_($9,self._sampleNewValue());
  49305. $ctx1.sendIdx["assert:equals:"]=4;
  49306. self._assert_equals_($recv(self._collection())._collect_((function(each){
  49307. return $core.withContext(function($ctx2) {
  49308. return $recv(each)._printString();
  49309. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49310. })),self._collectionOfPrintStrings());
  49311. return self;
  49312. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  49313. },
  49314. args: [],
  49315. 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",
  49316. referencedClasses: [],
  49317. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  49318. }),
  49319. $globals.CollectionTest);
  49320. $core.addMethod(
  49321. $core.method({
  49322. selector: "testComma",
  49323. protocol: 'tests',
  49324. fn: function (){
  49325. var self=this;
  49326. return $core.withContext(function($ctx1) {
  49327. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  49328. $2=self._collection();
  49329. $ctx1.sendIdx["collection"]=1;
  49330. $4=self._collectionClass();
  49331. $ctx1.sendIdx["collectionClass"]=1;
  49332. $3=$recv($4)._new();
  49333. $ctx1.sendIdx["new"]=1;
  49334. $1=$recv($2).__comma($3);
  49335. $ctx1.sendIdx[","]=1;
  49336. $5=self._collection();
  49337. $ctx1.sendIdx["collection"]=2;
  49338. self._assert_equals_($1,$5);
  49339. $ctx1.sendIdx["assert:equals:"]=1;
  49340. $8=self._collectionClass();
  49341. $ctx1.sendIdx["collectionClass"]=2;
  49342. $7=$recv($8)._new();
  49343. $ctx1.sendIdx["new"]=2;
  49344. $9=self._collection();
  49345. $ctx1.sendIdx["collection"]=3;
  49346. $6=$recv($7).__comma($9);
  49347. $ctx1.sendIdx[","]=2;
  49348. $10=self._collection();
  49349. $ctx1.sendIdx["collection"]=4;
  49350. self._assert_equals_($6,$10);
  49351. $ctx1.sendIdx["assert:equals:"]=2;
  49352. $13=self._collectionClass();
  49353. $ctx1.sendIdx["collectionClass"]=3;
  49354. $12=$recv($13)._new();
  49355. $ctx1.sendIdx["new"]=3;
  49356. $15=self._collectionClass();
  49357. $ctx1.sendIdx["collectionClass"]=4;
  49358. $14=$recv($15)._new();
  49359. $ctx1.sendIdx["new"]=4;
  49360. $11=$recv($12).__comma($14);
  49361. $ctx1.sendIdx[","]=3;
  49362. self._assert_equals_($11,$recv(self._collectionClass())._new());
  49363. $ctx1.sendIdx["assert:equals:"]=3;
  49364. $17=self._collection();
  49365. $ctx1.sendIdx["collection"]=5;
  49366. $18=self._sampleNewValueAsCollection();
  49367. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49368. $16=$recv($17).__comma($18);
  49369. $ctx1.sendIdx[","]=4;
  49370. $19=self._collectionWithNewValue();
  49371. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49372. self._assert_equals_($16,$19);
  49373. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  49374. return self;
  49375. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  49376. },
  49377. args: [],
  49378. 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",
  49379. referencedClasses: [],
  49380. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  49381. }),
  49382. $globals.CollectionTest);
  49383. $core.addMethod(
  49384. $core.method({
  49385. selector: "testCopy",
  49386. protocol: 'tests',
  49387. fn: function (){
  49388. var self=this;
  49389. return $core.withContext(function($ctx1) {
  49390. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  49391. $3=self._collectionClass();
  49392. $ctx1.sendIdx["collectionClass"]=1;
  49393. $2=$recv($3)._new();
  49394. $ctx1.sendIdx["new"]=1;
  49395. $1=$recv($2)._copy();
  49396. $ctx1.sendIdx["copy"]=1;
  49397. $5=self._collectionClass();
  49398. $ctx1.sendIdx["collectionClass"]=2;
  49399. $4=$recv($5)._new();
  49400. $ctx1.sendIdx["new"]=2;
  49401. self._assert_equals_($1,$4);
  49402. $ctx1.sendIdx["assert:equals:"]=1;
  49403. $7=self._collection();
  49404. $ctx1.sendIdx["collection"]=1;
  49405. $6=$recv($7)._copy();
  49406. $ctx1.sendIdx["copy"]=2;
  49407. $8=self._collection();
  49408. $ctx1.sendIdx["collection"]=2;
  49409. self._assert_equals_($6,$8);
  49410. $ctx1.sendIdx["assert:equals:"]=2;
  49411. $10=self._collectionWithNewValue();
  49412. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49413. $9=$recv($10)._copy();
  49414. $ctx1.sendIdx["copy"]=3;
  49415. $11=self._collectionWithNewValue();
  49416. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49417. self._assert_equals_($9,$11);
  49418. $15=self._collectionClass();
  49419. $ctx1.sendIdx["collectionClass"]=3;
  49420. $14=$recv($15)._new();
  49421. $ctx1.sendIdx["new"]=3;
  49422. $13=$recv($14)._copy();
  49423. $ctx1.sendIdx["copy"]=4;
  49424. $16=self._collection();
  49425. $ctx1.sendIdx["collection"]=3;
  49426. $12=$recv($13).__eq($16);
  49427. $ctx1.sendIdx["="]=1;
  49428. self._deny_($12);
  49429. $ctx1.sendIdx["deny:"]=1;
  49430. $19=self._collection();
  49431. $ctx1.sendIdx["collection"]=4;
  49432. $18=$recv($19)._copy();
  49433. $ctx1.sendIdx["copy"]=5;
  49434. $17=$recv($18).__eq($recv(self._collectionClass())._new());
  49435. $ctx1.sendIdx["="]=2;
  49436. self._deny_($17);
  49437. $ctx1.sendIdx["deny:"]=2;
  49438. self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
  49439. return self;
  49440. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  49441. },
  49442. args: [],
  49443. 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",
  49444. referencedClasses: [],
  49445. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49446. }),
  49447. $globals.CollectionTest);
  49448. $core.addMethod(
  49449. $core.method({
  49450. selector: "testCopySeparates",
  49451. protocol: 'tests',
  49452. fn: function (){
  49453. var self=this;
  49454. var original,copy;
  49455. return $core.withContext(function($ctx1) {
  49456. original=self._collection();
  49457. $ctx1.sendIdx["collection"]=1;
  49458. copy=$recv(original)._copy();
  49459. $recv(copy)._addAll_(self._sampleNewValueAsCollection());
  49460. self._assert_($recv(original).__eq(self._collection()));
  49461. return self;
  49462. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  49463. },
  49464. args: [],
  49465. 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",
  49466. referencedClasses: [],
  49467. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  49468. }),
  49469. $globals.CollectionTest);
  49470. $core.addMethod(
  49471. $core.method({
  49472. selector: "testDetect",
  49473. protocol: 'tests',
  49474. fn: function (){
  49475. var self=this;
  49476. return $core.withContext(function($ctx1) {
  49477. var $1,$2,$3,$4,$6,$5,$7;
  49478. self._shouldnt_raise_((function(){
  49479. return $core.withContext(function($ctx2) {
  49480. $1=self._collection();
  49481. $ctx2.sendIdx["collection"]=1;
  49482. return $recv($1)._detect_((function(){
  49483. return true;
  49484. }));
  49485. $ctx2.sendIdx["detect:"]=1;
  49486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49487. }),$globals.Error);
  49488. self._should_raise_((function(){
  49489. return $core.withContext(function($ctx2) {
  49490. $2=self._collection();
  49491. $ctx2.sendIdx["collection"]=2;
  49492. return $recv($2)._detect_((function(){
  49493. return false;
  49494. }));
  49495. $ctx2.sendIdx["detect:"]=2;
  49496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49497. }),$globals.Error);
  49498. $ctx1.sendIdx["should:raise:"]=1;
  49499. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  49500. return true;
  49501. }));
  49502. $ctx1.sendIdx["detect:"]=3;
  49503. $4=self._sampleNewValue();
  49504. $ctx1.sendIdx["sampleNewValue"]=1;
  49505. self._assert_equals_($3,$4);
  49506. $ctx1.sendIdx["assert:equals:"]=1;
  49507. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  49508. return $core.withContext(function($ctx2) {
  49509. $6=self._sampleNewValue();
  49510. $ctx2.sendIdx["sampleNewValue"]=2;
  49511. return $recv(each).__eq($6);
  49512. $ctx2.sendIdx["="]=1;
  49513. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49514. }));
  49515. $ctx1.sendIdx["detect:"]=4;
  49516. $7=self._sampleNewValue();
  49517. $ctx1.sendIdx["sampleNewValue"]=3;
  49518. self._assert_equals_($5,$7);
  49519. self._should_raise_((function(){
  49520. return $core.withContext(function($ctx2) {
  49521. return $recv(self._collection())._detect_((function(each){
  49522. return $core.withContext(function($ctx3) {
  49523. return $recv(each).__eq(self._sampleNewValue());
  49524. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  49525. }));
  49526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  49527. }),$globals.Error);
  49528. return self;
  49529. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  49530. },
  49531. args: [],
  49532. 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",
  49533. referencedClasses: ["Error"],
  49534. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49535. }),
  49536. $globals.CollectionTest);
  49537. $core.addMethod(
  49538. $core.method({
  49539. selector: "testDetectIfNone",
  49540. protocol: 'tests',
  49541. fn: function (){
  49542. var self=this;
  49543. var sentinel;
  49544. return $core.withContext(function($ctx1) {
  49545. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  49546. sentinel=$recv($globals.Object)._new();
  49547. $3=self._collection();
  49548. $ctx1.sendIdx["collection"]=1;
  49549. $2=$recv($3)._detect_ifNone_((function(){
  49550. return true;
  49551. }),(function(){
  49552. return sentinel;
  49553. }));
  49554. $ctx1.sendIdx["detect:ifNone:"]=1;
  49555. $1=$recv($2).__tild_eq(sentinel);
  49556. self._assert_($1);
  49557. $5=self._collection();
  49558. $ctx1.sendIdx["collection"]=2;
  49559. $4=$recv($5)._detect_ifNone_((function(){
  49560. return false;
  49561. }),(function(){
  49562. return sentinel;
  49563. }));
  49564. $ctx1.sendIdx["detect:ifNone:"]=2;
  49565. self._assert_equals_($4,sentinel);
  49566. $ctx1.sendIdx["assert:equals:"]=1;
  49567. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  49568. return true;
  49569. }),(function(){
  49570. return sentinel;
  49571. }));
  49572. $ctx1.sendIdx["detect:ifNone:"]=3;
  49573. $7=self._sampleNewValue();
  49574. $ctx1.sendIdx["sampleNewValue"]=1;
  49575. self._assert_equals_($6,$7);
  49576. $ctx1.sendIdx["assert:equals:"]=2;
  49577. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  49578. return $core.withContext(function($ctx2) {
  49579. $9=self._sampleNewValue();
  49580. $ctx2.sendIdx["sampleNewValue"]=2;
  49581. return $recv(each).__eq($9);
  49582. $ctx2.sendIdx["="]=1;
  49583. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  49584. }),(function(){
  49585. return sentinel;
  49586. }));
  49587. $ctx1.sendIdx["detect:ifNone:"]=4;
  49588. $10=self._sampleNewValue();
  49589. $ctx1.sendIdx["sampleNewValue"]=3;
  49590. self._assert_equals_($8,$10);
  49591. $ctx1.sendIdx["assert:equals:"]=3;
  49592. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  49593. return $core.withContext(function($ctx2) {
  49594. return $recv(each).__eq(self._sampleNewValue());
  49595. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  49596. }),(function(){
  49597. return sentinel;
  49598. })),sentinel);
  49599. return self;
  49600. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  49601. },
  49602. args: [],
  49603. 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",
  49604. referencedClasses: ["Object"],
  49605. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49606. }),
  49607. $globals.CollectionTest);
  49608. $core.addMethod(
  49609. $core.method({
  49610. selector: "testDo",
  49611. protocol: 'tests',
  49612. fn: function (){
  49613. var self=this;
  49614. var newCollection;
  49615. return $core.withContext(function($ctx1) {
  49616. var $1,$2;
  49617. newCollection=$recv($globals.OrderedCollection)._new();
  49618. $ctx1.sendIdx["new"]=1;
  49619. $1=self._collection();
  49620. $ctx1.sendIdx["collection"]=1;
  49621. $recv($1)._do_((function(each){
  49622. return $core.withContext(function($ctx2) {
  49623. return $recv(newCollection)._add_(each);
  49624. $ctx2.sendIdx["add:"]=1;
  49625. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49626. }));
  49627. $ctx1.sendIdx["do:"]=1;
  49628. self._assertSameContents_as_(self._collection(),newCollection);
  49629. $ctx1.sendIdx["assertSameContents:as:"]=1;
  49630. newCollection=$recv($globals.OrderedCollection)._new();
  49631. $2=self._collectionWithDuplicates();
  49632. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  49633. $recv($2)._do_((function(each){
  49634. return $core.withContext(function($ctx2) {
  49635. return $recv(newCollection)._add_(each);
  49636. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49637. }));
  49638. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  49639. return self;
  49640. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  49641. },
  49642. args: [],
  49643. 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",
  49644. referencedClasses: ["OrderedCollection"],
  49645. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  49646. }),
  49647. $globals.CollectionTest);
  49648. $core.addMethod(
  49649. $core.method({
  49650. selector: "testEquality",
  49651. protocol: 'tests',
  49652. fn: function (){
  49653. var self=this;
  49654. return $core.withContext(function($ctx1) {
  49655. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  49656. $2=self._collectionClass();
  49657. $ctx1.sendIdx["collectionClass"]=1;
  49658. $1=$recv($2)._new();
  49659. $ctx1.sendIdx["new"]=1;
  49660. $4=self._collectionClass();
  49661. $ctx1.sendIdx["collectionClass"]=2;
  49662. $3=$recv($4)._new();
  49663. $ctx1.sendIdx["new"]=2;
  49664. self._assert_equals_($1,$3);
  49665. $ctx1.sendIdx["assert:equals:"]=1;
  49666. $5=self._collection();
  49667. $ctx1.sendIdx["collection"]=1;
  49668. $6=self._collection();
  49669. $ctx1.sendIdx["collection"]=2;
  49670. self._assert_equals_($5,$6);
  49671. $ctx1.sendIdx["assert:equals:"]=2;
  49672. $7=self._collectionWithNewValue();
  49673. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49674. $8=self._collectionWithNewValue();
  49675. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49676. self._assert_equals_($7,$8);
  49677. $11=self._collectionClass();
  49678. $ctx1.sendIdx["collectionClass"]=3;
  49679. $10=$recv($11)._new();
  49680. $ctx1.sendIdx["new"]=3;
  49681. $12=self._collection();
  49682. $ctx1.sendIdx["collection"]=3;
  49683. $9=$recv($10).__eq($12);
  49684. $ctx1.sendIdx["="]=1;
  49685. self._deny_($9);
  49686. $ctx1.sendIdx["deny:"]=1;
  49687. $14=self._collection();
  49688. $ctx1.sendIdx["collection"]=4;
  49689. $13=$recv($14).__eq($recv(self._collectionClass())._new());
  49690. $ctx1.sendIdx["="]=2;
  49691. self._deny_($13);
  49692. $ctx1.sendIdx["deny:"]=2;
  49693. self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
  49694. return self;
  49695. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  49696. },
  49697. args: [],
  49698. 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",
  49699. referencedClasses: [],
  49700. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49701. }),
  49702. $globals.CollectionTest);
  49703. $core.addMethod(
  49704. $core.method({
  49705. selector: "testIfEmptyFamily",
  49706. protocol: 'tests',
  49707. fn: function (){
  49708. var self=this;
  49709. return $core.withContext(function($ctx1) {
  49710. 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;
  49711. $3=self._collectionClass();
  49712. $ctx1.sendIdx["collectionClass"]=1;
  49713. $2=$recv($3)._new();
  49714. $ctx1.sendIdx["new"]=1;
  49715. $1=$recv($2)._ifEmpty_((function(){
  49716. return (42);
  49717. }));
  49718. $ctx1.sendIdx["ifEmpty:"]=1;
  49719. self._assert_equals_($1,(42));
  49720. $ctx1.sendIdx["assert:equals:"]=1;
  49721. $5=self._collection();
  49722. $ctx1.sendIdx["collection"]=1;
  49723. $4=$recv($5)._ifEmpty_((function(){
  49724. return (42);
  49725. }));
  49726. $6=self._collection();
  49727. $ctx1.sendIdx["collection"]=2;
  49728. self._assert_equals_($4,$6);
  49729. $ctx1.sendIdx["assert:equals:"]=2;
  49730. $9=self._collectionClass();
  49731. $ctx1.sendIdx["collectionClass"]=2;
  49732. $8=$recv($9)._new();
  49733. $ctx1.sendIdx["new"]=2;
  49734. $7=$recv($8)._ifNotEmpty_((function(){
  49735. return (42);
  49736. }));
  49737. $ctx1.sendIdx["ifNotEmpty:"]=1;
  49738. $11=self._collectionClass();
  49739. $ctx1.sendIdx["collectionClass"]=3;
  49740. $10=$recv($11)._new();
  49741. $ctx1.sendIdx["new"]=3;
  49742. self._assert_equals_($7,$10);
  49743. $ctx1.sendIdx["assert:equals:"]=3;
  49744. $13=self._collection();
  49745. $ctx1.sendIdx["collection"]=3;
  49746. $12=$recv($13)._ifNotEmpty_((function(){
  49747. return (42);
  49748. }));
  49749. $ctx1.sendIdx["ifNotEmpty:"]=2;
  49750. self._assert_equals_($12,(42));
  49751. $ctx1.sendIdx["assert:equals:"]=4;
  49752. $15=self._collection();
  49753. $ctx1.sendIdx["collection"]=4;
  49754. $14=$recv($15)._ifNotEmpty_((function(col){
  49755. return col;
  49756. }));
  49757. $16=self._collection();
  49758. $ctx1.sendIdx["collection"]=5;
  49759. self._assert_equals_($14,$16);
  49760. $ctx1.sendIdx["assert:equals:"]=5;
  49761. $19=self._collectionClass();
  49762. $ctx1.sendIdx["collectionClass"]=4;
  49763. $18=$recv($19)._new();
  49764. $ctx1.sendIdx["new"]=4;
  49765. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  49766. return (42);
  49767. }),(function(){
  49768. return (999);
  49769. }));
  49770. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  49771. self._assert_equals_($17,(42));
  49772. $ctx1.sendIdx["assert:equals:"]=6;
  49773. $21=self._collection();
  49774. $ctx1.sendIdx["collection"]=6;
  49775. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  49776. return (42);
  49777. }),(function(){
  49778. return (999);
  49779. }));
  49780. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  49781. self._assert_equals_($20,(999));
  49782. $ctx1.sendIdx["assert:equals:"]=7;
  49783. $23=self._collection();
  49784. $ctx1.sendIdx["collection"]=7;
  49785. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  49786. return (42);
  49787. }),(function(col){
  49788. return col;
  49789. }));
  49790. $24=self._collection();
  49791. $ctx1.sendIdx["collection"]=8;
  49792. self._assert_equals_($22,$24);
  49793. $ctx1.sendIdx["assert:equals:"]=8;
  49794. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  49795. return (42);
  49796. }),(function(){
  49797. return (999);
  49798. }));
  49799. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  49800. self._assert_equals_($25,(999));
  49801. $ctx1.sendIdx["assert:equals:"]=9;
  49802. $27=self._collection();
  49803. $ctx1.sendIdx["collection"]=9;
  49804. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  49805. return (42);
  49806. }),(function(){
  49807. return (999);
  49808. }));
  49809. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  49810. self._assert_equals_($26,(42));
  49811. $ctx1.sendIdx["assert:equals:"]=10;
  49812. $29=self._collection();
  49813. $ctx1.sendIdx["collection"]=10;
  49814. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  49815. return col;
  49816. }),(function(){
  49817. return (999);
  49818. }));
  49819. self._assert_equals_($28,self._collection());
  49820. return self;
  49821. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  49822. },
  49823. args: [],
  49824. 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.",
  49825. referencedClasses: [],
  49826. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  49827. }),
  49828. $globals.CollectionTest);
  49829. $core.addMethod(
  49830. $core.method({
  49831. selector: "testIsEmpty",
  49832. protocol: 'tests',
  49833. fn: function (){
  49834. var self=this;
  49835. return $core.withContext(function($ctx1) {
  49836. var $1;
  49837. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  49838. $ctx1.sendIdx["isEmpty"]=1;
  49839. self._assert_($1);
  49840. self._deny_($recv(self._collection())._isEmpty());
  49841. return self;
  49842. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  49843. },
  49844. args: [],
  49845. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  49846. referencedClasses: [],
  49847. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  49848. }),
  49849. $globals.CollectionTest);
  49850. $core.addMethod(
  49851. $core.method({
  49852. selector: "testNoneSatisfy",
  49853. protocol: 'tests',
  49854. fn: function (){
  49855. var self=this;
  49856. var anyOne;
  49857. return $core.withContext(function($ctx1) {
  49858. var $1,$3,$2;
  49859. $1=self._collection();
  49860. $ctx1.sendIdx["collection"]=1;
  49861. anyOne=$recv($1)._anyOne();
  49862. $3=self._collection();
  49863. $ctx1.sendIdx["collection"]=2;
  49864. $2=$recv($3)._noneSatisfy_((function(each){
  49865. return $core.withContext(function($ctx2) {
  49866. return $recv(each).__eq(anyOne);
  49867. $ctx2.sendIdx["="]=1;
  49868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49869. }));
  49870. $ctx1.sendIdx["noneSatisfy:"]=1;
  49871. self._deny_($2);
  49872. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  49873. return $core.withContext(function($ctx2) {
  49874. return $recv(each).__eq($recv($globals.Object)._new());
  49875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49876. })));
  49877. return self;
  49878. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49879. },
  49880. args: [],
  49881. 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 ])",
  49882. referencedClasses: ["Object"],
  49883. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  49884. }),
  49885. $globals.CollectionTest);
  49886. $core.addMethod(
  49887. $core.method({
  49888. selector: "testRemoveAll",
  49889. protocol: 'tests',
  49890. fn: function (){
  49891. var self=this;
  49892. return $core.withContext(function($ctx1) {
  49893. var $2,$1;
  49894. $2=self._collection();
  49895. $recv($2)._removeAll();
  49896. $1=$recv($2)._yourself();
  49897. self._assert_equals_($1,$recv(self._collectionClass())._new());
  49898. return self;
  49899. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  49900. },
  49901. args: [],
  49902. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  49903. referencedClasses: [],
  49904. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  49905. }),
  49906. $globals.CollectionTest);
  49907. $core.addMethod(
  49908. $core.method({
  49909. selector: "testSelect",
  49910. protocol: 'tests',
  49911. fn: function (){
  49912. var self=this;
  49913. return $core.withContext(function($ctx1) {
  49914. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  49915. $2=self._collection();
  49916. $ctx1.sendIdx["collection"]=1;
  49917. $1=$recv($2)._select_((function(){
  49918. return false;
  49919. }));
  49920. $ctx1.sendIdx["select:"]=1;
  49921. $4=self._collectionClass();
  49922. $ctx1.sendIdx["collectionClass"]=1;
  49923. $3=$recv($4)._new();
  49924. $ctx1.sendIdx["new"]=1;
  49925. self._assert_equals_($1,$3);
  49926. $ctx1.sendIdx["assert:equals:"]=1;
  49927. $6=self._collection();
  49928. $ctx1.sendIdx["collection"]=2;
  49929. $5=$recv($6)._select_((function(){
  49930. return true;
  49931. }));
  49932. $ctx1.sendIdx["select:"]=2;
  49933. $7=self._collection();
  49934. $ctx1.sendIdx["collection"]=3;
  49935. self._assert_equals_($5,$7);
  49936. $ctx1.sendIdx["assert:equals:"]=2;
  49937. $9=self._collectionWithNewValue();
  49938. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49939. $8=$recv($9)._select_((function(each){
  49940. return $core.withContext(function($ctx2) {
  49941. $10=self._sampleNewValue();
  49942. $ctx2.sendIdx["sampleNewValue"]=1;
  49943. return $recv(each).__eq($10);
  49944. $ctx2.sendIdx["="]=1;
  49945. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49946. }));
  49947. $ctx1.sendIdx["select:"]=3;
  49948. self._assert_equals_($8,self._sampleNewValueAsCollection());
  49949. $ctx1.sendIdx["assert:equals:"]=3;
  49950. $12=self._collectionWithNewValue();
  49951. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49952. $11=$recv($12)._select_((function(each){
  49953. return $core.withContext(function($ctx2) {
  49954. $13=self._sampleNewValue();
  49955. $ctx2.sendIdx["sampleNewValue"]=2;
  49956. return $recv(each).__tild_eq($13);
  49957. $ctx2.sendIdx["~="]=1;
  49958. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  49959. }));
  49960. $ctx1.sendIdx["select:"]=4;
  49961. $14=self._collection();
  49962. $ctx1.sendIdx["collection"]=4;
  49963. self._assert_equals_($11,$14);
  49964. $ctx1.sendIdx["assert:equals:"]=4;
  49965. $16=self._collection();
  49966. $ctx1.sendIdx["collection"]=5;
  49967. $15=$recv($16)._select_((function(each){
  49968. return $core.withContext(function($ctx2) {
  49969. $17=self._sampleNewValue();
  49970. $ctx2.sendIdx["sampleNewValue"]=3;
  49971. return $recv(each).__eq($17);
  49972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  49973. }));
  49974. $ctx1.sendIdx["select:"]=5;
  49975. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49976. $ctx1.sendIdx["assert:equals:"]=5;
  49977. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  49978. return $core.withContext(function($ctx2) {
  49979. return $recv(each).__tild_eq(self._sampleNewValue());
  49980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49981. })),self._collection());
  49982. return self;
  49983. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  49984. },
  49985. args: [],
  49986. 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",
  49987. referencedClasses: [],
  49988. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  49989. }),
  49990. $globals.CollectionTest);
  49991. $core.addMethod(
  49992. $core.method({
  49993. selector: "testSingle",
  49994. protocol: 'tests',
  49995. fn: function (){
  49996. var self=this;
  49997. return $core.withContext(function($ctx1) {
  49998. self._should_raise_((function(){
  49999. return $core.withContext(function($ctx2) {
  50000. return $recv($recv(self._collectionClass())._new())._single();
  50001. $ctx2.sendIdx["single"]=1;
  50002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50003. }),$globals.Error);
  50004. $ctx1.sendIdx["should:raise:"]=1;
  50005. self._should_raise_((function(){
  50006. return $core.withContext(function($ctx2) {
  50007. return $recv(self._collection())._single();
  50008. $ctx2.sendIdx["single"]=2;
  50009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50010. }),$globals.Error);
  50011. self._assert_equals_($recv(self._sampleNewValueAsCollection())._single(),self._sampleNewValue());
  50012. return self;
  50013. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  50014. },
  50015. args: [],
  50016. 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",
  50017. referencedClasses: ["Error"],
  50018. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  50019. }),
  50020. $globals.CollectionTest);
  50021. $core.addMethod(
  50022. $core.method({
  50023. selector: "testSize",
  50024. protocol: 'tests',
  50025. fn: function (){
  50026. var self=this;
  50027. return $core.withContext(function($ctx1) {
  50028. var $1,$2;
  50029. $1=$recv($recv(self._collectionClass())._new())._size();
  50030. $ctx1.sendIdx["size"]=1;
  50031. self._assert_equals_($1,(0));
  50032. $ctx1.sendIdx["assert:equals:"]=1;
  50033. $2=$recv(self._sampleNewValueAsCollection())._size();
  50034. $ctx1.sendIdx["size"]=2;
  50035. self._assert_equals_($2,(1));
  50036. $ctx1.sendIdx["assert:equals:"]=2;
  50037. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  50038. return self;
  50039. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  50040. },
  50041. args: [],
  50042. 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",
  50043. referencedClasses: [],
  50044. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  50045. }),
  50046. $globals.CollectionTest);
  50047. $core.addMethod(
  50048. $core.method({
  50049. selector: "collectionClass",
  50050. protocol: 'fixture',
  50051. fn: function (){
  50052. var self=this;
  50053. return nil;
  50054. },
  50055. args: [],
  50056. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  50057. referencedClasses: [],
  50058. messageSends: []
  50059. }),
  50060. $globals.CollectionTest.klass);
  50061. $core.addMethod(
  50062. $core.method({
  50063. selector: "isAbstract",
  50064. protocol: 'testing',
  50065. fn: function (){
  50066. var self=this;
  50067. return $core.withContext(function($ctx1) {
  50068. return $recv(self._collectionClass())._isNil();
  50069. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  50070. },
  50071. args: [],
  50072. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  50073. referencedClasses: [],
  50074. messageSends: ["isNil", "collectionClass"]
  50075. }),
  50076. $globals.CollectionTest.klass);
  50077. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  50078. $core.addMethod(
  50079. $core.method({
  50080. selector: "collectionWithNewValue",
  50081. protocol: 'fixture',
  50082. fn: function (){
  50083. var self=this;
  50084. return $core.withContext(function($ctx1) {
  50085. self._subclassResponsibility();
  50086. return self;
  50087. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  50088. },
  50089. args: [],
  50090. 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",
  50091. referencedClasses: [],
  50092. messageSends: ["subclassResponsibility"]
  50093. }),
  50094. $globals.IndexableCollectionTest);
  50095. $core.addMethod(
  50096. $core.method({
  50097. selector: "sampleNewIndex",
  50098. protocol: 'fixture',
  50099. fn: function (){
  50100. var self=this;
  50101. return $core.withContext(function($ctx1) {
  50102. self._subclassResponsibility();
  50103. return self;
  50104. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  50105. },
  50106. args: [],
  50107. 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",
  50108. referencedClasses: [],
  50109. messageSends: ["subclassResponsibility"]
  50110. }),
  50111. $globals.IndexableCollectionTest);
  50112. $core.addMethod(
  50113. $core.method({
  50114. selector: "sampleNonIndexesDo:",
  50115. protocol: 'fixture',
  50116. fn: function (aBlock){
  50117. var self=this;
  50118. return $core.withContext(function($ctx1) {
  50119. self._subclassResponsibility();
  50120. return self;
  50121. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50122. },
  50123. args: ["aBlock"],
  50124. 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",
  50125. referencedClasses: [],
  50126. messageSends: ["subclassResponsibility"]
  50127. }),
  50128. $globals.IndexableCollectionTest);
  50129. $core.addMethod(
  50130. $core.method({
  50131. selector: "samplesDo:",
  50132. protocol: 'fixture',
  50133. fn: function (aBlock){
  50134. var self=this;
  50135. return $core.withContext(function($ctx1) {
  50136. self._subclassResponsibility();
  50137. return self;
  50138. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50139. },
  50140. args: ["aBlock"],
  50141. 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",
  50142. referencedClasses: [],
  50143. messageSends: ["subclassResponsibility"]
  50144. }),
  50145. $globals.IndexableCollectionTest);
  50146. $core.addMethod(
  50147. $core.method({
  50148. selector: "testAt",
  50149. protocol: 'tests',
  50150. fn: function (){
  50151. var self=this;
  50152. return $core.withContext(function($ctx1) {
  50153. var $1;
  50154. self._nonIndexesDo_((function(each){
  50155. return $core.withContext(function($ctx2) {
  50156. return self._should_raise_((function(){
  50157. return $core.withContext(function($ctx3) {
  50158. $1=self._collection();
  50159. $ctx3.sendIdx["collection"]=1;
  50160. return $recv($1)._at_(each);
  50161. $ctx3.sendIdx["at:"]=1;
  50162. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50163. }),$globals.Error);
  50164. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50165. }));
  50166. self._samplesDo_((function(index,value){
  50167. return $core.withContext(function($ctx2) {
  50168. return self._assert_equals_($recv(self._collection())._at_(index),value);
  50169. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50170. }));
  50171. return self;
  50172. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  50173. },
  50174. args: [],
  50175. 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 ]",
  50176. referencedClasses: ["Error"],
  50177. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  50178. }),
  50179. $globals.IndexableCollectionTest);
  50180. $core.addMethod(
  50181. $core.method({
  50182. selector: "testAtIfAbsent",
  50183. protocol: 'tests',
  50184. fn: function (){
  50185. var self=this;
  50186. return $core.withContext(function($ctx1) {
  50187. var $2,$1,$3;
  50188. self._nonIndexesDo_((function(each){
  50189. return $core.withContext(function($ctx2) {
  50190. $2=self._collection();
  50191. $ctx2.sendIdx["collection"]=1;
  50192. $1=$recv($2)._at_ifAbsent_(each,(function(){
  50193. return $core.withContext(function($ctx3) {
  50194. return self._sampleNewValue();
  50195. $ctx3.sendIdx["sampleNewValue"]=1;
  50196. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50197. }));
  50198. $ctx2.sendIdx["at:ifAbsent:"]=1;
  50199. $3=self._sampleNewValue();
  50200. $ctx2.sendIdx["sampleNewValue"]=2;
  50201. return self._assert_equals_($1,$3);
  50202. $ctx2.sendIdx["assert:equals:"]=1;
  50203. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50204. }));
  50205. self._samplesDo_((function(index,value){
  50206. return $core.withContext(function($ctx2) {
  50207. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  50208. return $core.withContext(function($ctx3) {
  50209. return self._sampleNewValue();
  50210. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50211. })),value);
  50212. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50213. }));
  50214. return self;
  50215. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  50216. },
  50217. args: [],
  50218. 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 ].",
  50219. referencedClasses: [],
  50220. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  50221. }),
  50222. $globals.IndexableCollectionTest);
  50223. $core.addMethod(
  50224. $core.method({
  50225. selector: "testAtIfAbsentPut",
  50226. protocol: 'tests',
  50227. fn: function (){
  50228. var self=this;
  50229. var newCollection;
  50230. return $core.withContext(function($ctx1) {
  50231. var $1;
  50232. newCollection=self._collection();
  50233. $ctx1.sendIdx["collection"]=1;
  50234. self._samplesDo_((function(index,value){
  50235. return $core.withContext(function($ctx2) {
  50236. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  50237. return $core.withContext(function($ctx3) {
  50238. return self._sampleNewValue();
  50239. $ctx3.sendIdx["sampleNewValue"]=1;
  50240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50241. }));
  50242. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  50243. return self._assert_equals_($1,value);
  50244. $ctx2.sendIdx["assert:equals:"]=1;
  50245. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50246. }));
  50247. self._assert_equals_(newCollection,self._collection());
  50248. $ctx1.sendIdx["assert:equals:"]=2;
  50249. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  50250. return $core.withContext(function($ctx2) {
  50251. return self._sampleNewValue();
  50252. $ctx2.sendIdx["sampleNewValue"]=2;
  50253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50254. })),self._sampleNewValue());
  50255. $ctx1.sendIdx["assert:equals:"]=3;
  50256. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50257. return self;
  50258. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50259. },
  50260. args: [],
  50261. 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",
  50262. referencedClasses: [],
  50263. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  50264. }),
  50265. $globals.IndexableCollectionTest);
  50266. $core.addMethod(
  50267. $core.method({
  50268. selector: "testAtIfPresent",
  50269. protocol: 'tests',
  50270. fn: function (){
  50271. var self=this;
  50272. var visited,sentinel;
  50273. return $core.withContext(function($ctx1) {
  50274. var $2,$1,$4,$3;
  50275. sentinel=$recv($globals.Object)._new();
  50276. self._nonIndexesDo_((function(each){
  50277. return $core.withContext(function($ctx2) {
  50278. visited=nil;
  50279. visited;
  50280. $2=self._collection();
  50281. $ctx2.sendIdx["collection"]=1;
  50282. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  50283. visited=value1;
  50284. visited;
  50285. return sentinel;
  50286. }));
  50287. $ctx2.sendIdx["at:ifPresent:"]=1;
  50288. self._assert_equals_($1,nil);
  50289. $ctx2.sendIdx["assert:equals:"]=1;
  50290. return self._assert_($recv(visited)._isNil());
  50291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50292. }));
  50293. self._samplesDo_((function(index,value){
  50294. return $core.withContext(function($ctx2) {
  50295. visited=nil;
  50296. visited;
  50297. $4=self._collection();
  50298. $ctx2.sendIdx["collection"]=2;
  50299. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  50300. visited=value2;
  50301. visited;
  50302. return sentinel;
  50303. }));
  50304. self._assert_equals_($3,sentinel);
  50305. $ctx2.sendIdx["assert:equals:"]=2;
  50306. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50307. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50308. }));
  50309. return self;
  50310. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50311. },
  50312. args: [],
  50313. 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) ]",
  50314. referencedClasses: ["Object"],
  50315. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  50316. }),
  50317. $globals.IndexableCollectionTest);
  50318. $core.addMethod(
  50319. $core.method({
  50320. selector: "testAtIfPresentIfAbsent",
  50321. protocol: 'tests',
  50322. fn: function (){
  50323. var self=this;
  50324. var visited,sentinel;
  50325. return $core.withContext(function($ctx1) {
  50326. var $2,$1,$3,$5,$4;
  50327. sentinel=$recv($globals.Object)._new();
  50328. self._nonIndexesDo_((function(each){
  50329. return $core.withContext(function($ctx2) {
  50330. visited=nil;
  50331. visited;
  50332. $2=self._collection();
  50333. $ctx2.sendIdx["collection"]=1;
  50334. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  50335. visited=value1;
  50336. visited;
  50337. return sentinel;
  50338. }),(function(){
  50339. return $core.withContext(function($ctx3) {
  50340. return self._sampleNewValue();
  50341. $ctx3.sendIdx["sampleNewValue"]=1;
  50342. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  50343. }));
  50344. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  50345. $3=self._sampleNewValue();
  50346. $ctx2.sendIdx["sampleNewValue"]=2;
  50347. self._assert_equals_($1,$3);
  50348. $ctx2.sendIdx["assert:equals:"]=1;
  50349. return self._assert_($recv(visited)._isNil());
  50350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50351. }));
  50352. self._samplesDo_((function(index,value){
  50353. return $core.withContext(function($ctx2) {
  50354. visited=nil;
  50355. visited;
  50356. $5=self._collection();
  50357. $ctx2.sendIdx["collection"]=2;
  50358. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  50359. visited=value2;
  50360. visited;
  50361. return sentinel;
  50362. }),(function(){
  50363. return $core.withContext(function($ctx3) {
  50364. return self._sampleNewValue();
  50365. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  50366. }));
  50367. self._assert_equals_($4,sentinel);
  50368. $ctx2.sendIdx["assert:equals:"]=2;
  50369. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50370. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  50371. }));
  50372. return self;
  50373. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50374. },
  50375. args: [],
  50376. 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) ]",
  50377. referencedClasses: ["Object"],
  50378. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  50379. }),
  50380. $globals.IndexableCollectionTest);
  50381. $core.addMethod(
  50382. $core.method({
  50383. selector: "testAtPut",
  50384. protocol: 'tests',
  50385. fn: function (){
  50386. var self=this;
  50387. var newCollection;
  50388. return $core.withContext(function($ctx1) {
  50389. newCollection=self._collection();
  50390. $ctx1.sendIdx["collection"]=1;
  50391. self._samplesDo_((function(index,value){
  50392. return $core.withContext(function($ctx2) {
  50393. return $recv(newCollection)._at_put_(index,value);
  50394. $ctx2.sendIdx["at:put:"]=1;
  50395. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50396. }));
  50397. self._assert_equals_(newCollection,self._collection());
  50398. $ctx1.sendIdx["assert:equals:"]=1;
  50399. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  50400. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50401. return self;
  50402. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50403. },
  50404. args: [],
  50405. 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",
  50406. referencedClasses: [],
  50407. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  50408. }),
  50409. $globals.IndexableCollectionTest);
  50410. $core.addMethod(
  50411. $core.method({
  50412. selector: "testIndexOf",
  50413. protocol: 'tests',
  50414. fn: function (){
  50415. var self=this;
  50416. return $core.withContext(function($ctx1) {
  50417. var $1;
  50418. self._should_raise_((function(){
  50419. return $core.withContext(function($ctx2) {
  50420. $1=self._collection();
  50421. $ctx2.sendIdx["collection"]=1;
  50422. return $recv($1)._indexOf_(self._sampleNewValue());
  50423. $ctx2.sendIdx["indexOf:"]=1;
  50424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50425. }),$globals.Error);
  50426. self._samplesDo_((function(index,value){
  50427. return $core.withContext(function($ctx2) {
  50428. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  50429. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  50430. }));
  50431. return self;
  50432. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  50433. },
  50434. args: [],
  50435. 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 ]",
  50436. referencedClasses: ["Error"],
  50437. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  50438. }),
  50439. $globals.IndexableCollectionTest);
  50440. $core.addMethod(
  50441. $core.method({
  50442. selector: "testIndexOfWithNull",
  50443. protocol: 'tests',
  50444. fn: function (){
  50445. var self=this;
  50446. var jsNull;
  50447. return $core.withContext(function($ctx1) {
  50448. var $2,$1;
  50449. jsNull=$recv($globals.JSON)._parse_("null");
  50450. self._samplesDo_((function(index,value){
  50451. return $core.withContext(function($ctx2) {
  50452. $2=self._collection();
  50453. $recv($2)._at_put_(index,jsNull);
  50454. $1=$recv($2)._indexOf_(jsNull);
  50455. return self._assert_equals_($1,index);
  50456. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50457. }));
  50458. return self;
  50459. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  50460. },
  50461. args: [],
  50462. 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 ]",
  50463. referencedClasses: ["JSON"],
  50464. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  50465. }),
  50466. $globals.IndexableCollectionTest);
  50467. $core.addMethod(
  50468. $core.method({
  50469. selector: "testWithIndexDo",
  50470. protocol: 'tests',
  50471. fn: function (){
  50472. var self=this;
  50473. var collection;
  50474. return $core.withContext(function($ctx1) {
  50475. collection=self._collection();
  50476. $ctx1.sendIdx["collection"]=1;
  50477. $recv(self._collection())._withIndexDo_((function(each,index){
  50478. return $core.withContext(function($ctx2) {
  50479. return self._assert_equals_($recv(collection)._at_(index),each);
  50480. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  50481. }));
  50482. return self;
  50483. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  50484. },
  50485. args: [],
  50486. 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 ]",
  50487. referencedClasses: [],
  50488. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  50489. }),
  50490. $globals.IndexableCollectionTest);
  50491. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  50492. $core.addMethod(
  50493. $core.method({
  50494. selector: "collectionKeys",
  50495. protocol: 'fixture',
  50496. fn: function (){
  50497. var self=this;
  50498. return $core.withContext(function($ctx1) {
  50499. self._subclassResponsibility();
  50500. return self;
  50501. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  50502. },
  50503. args: [],
  50504. source: "collectionKeys\x0a\x09self subclassResponsibility",
  50505. referencedClasses: [],
  50506. messageSends: ["subclassResponsibility"]
  50507. }),
  50508. $globals.AssociativeCollectionTest);
  50509. $core.addMethod(
  50510. $core.method({
  50511. selector: "collectionValues",
  50512. protocol: 'fixture',
  50513. fn: function (){
  50514. var self=this;
  50515. return $core.withContext(function($ctx1) {
  50516. self._subclassResponsibility();
  50517. return self;
  50518. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  50519. },
  50520. args: [],
  50521. source: "collectionValues\x0a\x09self subclassResponsibility",
  50522. referencedClasses: [],
  50523. messageSends: ["subclassResponsibility"]
  50524. }),
  50525. $globals.AssociativeCollectionTest);
  50526. $core.addMethod(
  50527. $core.method({
  50528. selector: "nonIndexesDo:",
  50529. protocol: 'fixture',
  50530. fn: function (aBlock){
  50531. var self=this;
  50532. return $core.withContext(function($ctx1) {
  50533. $recv(aBlock)._value_((5));
  50534. $ctx1.sendIdx["value:"]=1;
  50535. $recv(aBlock)._value_((function(){
  50536. }));
  50537. $ctx1.sendIdx["value:"]=2;
  50538. $recv(aBlock)._value_($recv($globals.Object)._new());
  50539. $ctx1.sendIdx["value:"]=3;
  50540. $recv(aBlock)._value_("z");
  50541. return self;
  50542. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50543. },
  50544. args: ["aBlock"],
  50545. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  50546. referencedClasses: ["Object"],
  50547. messageSends: ["value:", "new"]
  50548. }),
  50549. $globals.AssociativeCollectionTest);
  50550. $core.addMethod(
  50551. $core.method({
  50552. selector: "sampleNewIndex",
  50553. protocol: 'fixture',
  50554. fn: function (){
  50555. var self=this;
  50556. return "new";
  50557. },
  50558. args: [],
  50559. source: "sampleNewIndex\x0a\x09^ 'new'",
  50560. referencedClasses: [],
  50561. messageSends: []
  50562. }),
  50563. $globals.AssociativeCollectionTest);
  50564. $core.addMethod(
  50565. $core.method({
  50566. selector: "samplesDo:",
  50567. protocol: 'fixture',
  50568. fn: function (aBlock){
  50569. var self=this;
  50570. return $core.withContext(function($ctx1) {
  50571. $recv(aBlock)._value_value_("a",(2));
  50572. return self;
  50573. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50574. },
  50575. args: ["aBlock"],
  50576. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  50577. referencedClasses: [],
  50578. messageSends: ["value:value:"]
  50579. }),
  50580. $globals.AssociativeCollectionTest);
  50581. $core.addMethod(
  50582. $core.method({
  50583. selector: "testAddAll",
  50584. protocol: 'tests',
  50585. fn: function (){
  50586. var self=this;
  50587. return $core.withContext(function($ctx1) {
  50588. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  50589. (
  50590. $ctx1.supercall = true,
  50591. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  50592. $ctx1.supercall = false;
  50593. $2=self._collection();
  50594. $ctx1.sendIdx["collection"]=1;
  50595. $3=self._collection();
  50596. $ctx1.sendIdx["collection"]=2;
  50597. $recv($2)._addAll_($3);
  50598. $ctx1.sendIdx["addAll:"]=1;
  50599. $4=$recv($2)._yourself();
  50600. $ctx1.sendIdx["yourself"]=1;
  50601. $1=$4;
  50602. $5=self._collection();
  50603. $ctx1.sendIdx["collection"]=3;
  50604. self._assert_equals_($1,$5);
  50605. $ctx1.sendIdx["assert:equals:"]=1;
  50606. $7=self._collection();
  50607. $ctx1.sendIdx["collection"]=4;
  50608. $8=self._collectionWithNewValue();
  50609. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50610. $recv($7)._addAll_($8);
  50611. $ctx1.sendIdx["addAll:"]=2;
  50612. $9=$recv($7)._yourself();
  50613. $ctx1.sendIdx["yourself"]=2;
  50614. $6=$9;
  50615. $10=self._collectionWithNewValue();
  50616. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50617. self._assert_equals_($6,$10);
  50618. $ctx1.sendIdx["assert:equals:"]=2;
  50619. $12=self._collectionWithNewValue();
  50620. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50621. $recv($12)._addAll_(self._collection());
  50622. $11=$recv($12)._yourself();
  50623. self._assert_equals_($11,self._collectionWithNewValue());
  50624. return self;
  50625. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  50626. },
  50627. args: [],
  50628. 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",
  50629. referencedClasses: [],
  50630. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  50631. }),
  50632. $globals.AssociativeCollectionTest);
  50633. $core.addMethod(
  50634. $core.method({
  50635. selector: "testAsDictionary",
  50636. protocol: 'tests',
  50637. fn: function (){
  50638. var self=this;
  50639. return $core.withContext(function($ctx1) {
  50640. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  50641. return self;
  50642. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  50643. },
  50644. args: [],
  50645. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  50646. referencedClasses: ["Dictionary"],
  50647. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  50648. }),
  50649. $globals.AssociativeCollectionTest);
  50650. $core.addMethod(
  50651. $core.method({
  50652. selector: "testAsHashedCollection",
  50653. protocol: 'tests',
  50654. fn: function (){
  50655. var self=this;
  50656. return $core.withContext(function($ctx1) {
  50657. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  50658. return self;
  50659. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  50660. },
  50661. args: [],
  50662. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  50663. referencedClasses: ["HashedCollection"],
  50664. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  50665. }),
  50666. $globals.AssociativeCollectionTest);
  50667. $core.addMethod(
  50668. $core.method({
  50669. selector: "testComma",
  50670. protocol: 'tests',
  50671. fn: function (){
  50672. var self=this;
  50673. return $core.withContext(function($ctx1) {
  50674. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  50675. (
  50676. $ctx1.supercall = true,
  50677. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  50678. $ctx1.supercall = false;
  50679. $2=self._collection();
  50680. $ctx1.sendIdx["collection"]=1;
  50681. $3=self._collection();
  50682. $ctx1.sendIdx["collection"]=2;
  50683. $1=$recv($2).__comma($3);
  50684. $ctx1.sendIdx[","]=1;
  50685. $4=self._collection();
  50686. $ctx1.sendIdx["collection"]=3;
  50687. self._assert_equals_($1,$4);
  50688. $ctx1.sendIdx["assert:equals:"]=1;
  50689. $6=self._collection();
  50690. $ctx1.sendIdx["collection"]=4;
  50691. $7=self._collectionWithNewValue();
  50692. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50693. $5=$recv($6).__comma($7);
  50694. $ctx1.sendIdx[","]=2;
  50695. $8=self._collectionWithNewValue();
  50696. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50697. self._assert_equals_($5,$8);
  50698. $ctx1.sendIdx["assert:equals:"]=2;
  50699. $10=self._collectionWithNewValue();
  50700. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50701. $9=$recv($10).__comma(self._collection());
  50702. self._assert_equals_($9,self._collectionWithNewValue());
  50703. return self;
  50704. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  50705. },
  50706. args: [],
  50707. 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",
  50708. referencedClasses: [],
  50709. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  50710. }),
  50711. $globals.AssociativeCollectionTest);
  50712. $core.addMethod(
  50713. $core.method({
  50714. selector: "testFrom",
  50715. protocol: 'tests',
  50716. fn: function (){
  50717. var self=this;
  50718. var associations;
  50719. return $core.withContext(function($ctx1) {
  50720. var $1;
  50721. $1="a".__minus_gt((1));
  50722. $ctx1.sendIdx["->"]=1;
  50723. associations=[$1,"b".__minus_gt((2))];
  50724. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50725. return self;
  50726. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  50727. },
  50728. args: [],
  50729. 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 }.",
  50730. referencedClasses: [],
  50731. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  50732. }),
  50733. $globals.AssociativeCollectionTest);
  50734. $core.addMethod(
  50735. $core.method({
  50736. selector: "testKeys",
  50737. protocol: 'tests',
  50738. fn: function (){
  50739. var self=this;
  50740. return $core.withContext(function($ctx1) {
  50741. var $2,$1,$3,$4;
  50742. $2=$recv($recv(self._collectionClass())._new())._keys();
  50743. $ctx1.sendIdx["keys"]=1;
  50744. $1=$recv($2)._isEmpty();
  50745. self._assert_($1);
  50746. $3=$recv(self._collection())._keys();
  50747. $ctx1.sendIdx["keys"]=2;
  50748. $4=self._collectionKeys();
  50749. $ctx1.sendIdx["collectionKeys"]=1;
  50750. self._assertSameContents_as_($3,$4);
  50751. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50752. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  50753. return self;
  50754. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  50755. },
  50756. args: [],
  50757. 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 }",
  50758. referencedClasses: [],
  50759. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  50760. }),
  50761. $globals.AssociativeCollectionTest);
  50762. $core.addMethod(
  50763. $core.method({
  50764. selector: "testNewFromPairs",
  50765. protocol: 'tests',
  50766. fn: function (){
  50767. var self=this;
  50768. var flattenedAssociations;
  50769. return $core.withContext(function($ctx1) {
  50770. flattenedAssociations=["a",(1),"b",(2)];
  50771. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50772. return self;
  50773. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  50774. },
  50775. args: [],
  50776. 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 }.",
  50777. referencedClasses: [],
  50778. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  50779. }),
  50780. $globals.AssociativeCollectionTest);
  50781. $core.addMethod(
  50782. $core.method({
  50783. selector: "testPrintString",
  50784. protocol: 'tests',
  50785. fn: function (){
  50786. var self=this;
  50787. return $core.withContext(function($ctx1) {
  50788. var $3,$2,$1,$4;
  50789. $3=self._collectionClass();
  50790. $ctx1.sendIdx["collectionClass"]=1;
  50791. $2=$recv($3)._new();
  50792. $recv($2)._at_put_("firstname","James");
  50793. $ctx1.sendIdx["at:put:"]=1;
  50794. $recv($2)._at_put_("lastname","Bond");
  50795. $1=$recv($2)._printString();
  50796. $4=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  50797. $ctx1.sendIdx[","]=1;
  50798. self._assert_equals_($1,$4);
  50799. return self;
  50800. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  50801. },
  50802. args: [],
  50803. 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'')'",
  50804. referencedClasses: [],
  50805. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  50806. }),
  50807. $globals.AssociativeCollectionTest);
  50808. $core.addMethod(
  50809. $core.method({
  50810. selector: "testRemoveKey",
  50811. protocol: 'tests',
  50812. fn: function (){
  50813. var self=this;
  50814. return $core.withContext(function($ctx1) {
  50815. var $1,$2,$3,$5,$6,$4,$8,$7;
  50816. self._nonIndexesDo_((function(each){
  50817. var collection;
  50818. return $core.withContext(function($ctx2) {
  50819. collection=self._collection();
  50820. $ctx2.sendIdx["collection"]=1;
  50821. collection;
  50822. self._should_raise_((function(){
  50823. return $core.withContext(function($ctx3) {
  50824. return $recv(collection)._removeKey_(each);
  50825. $ctx3.sendIdx["removeKey:"]=1;
  50826. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50827. }),$globals.Error);
  50828. $1=collection;
  50829. $2=self._collection();
  50830. $ctx2.sendIdx["collection"]=2;
  50831. return self._assert_equals_($1,$2);
  50832. $ctx2.sendIdx["assert:equals:"]=1;
  50833. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50834. }));
  50835. self._samplesDo_((function(index,value){
  50836. var collection;
  50837. return $core.withContext(function($ctx2) {
  50838. collection=self._collection();
  50839. $ctx2.sendIdx["collection"]=3;
  50840. collection;
  50841. $3=$recv(collection)._removeKey_(index);
  50842. $ctx2.sendIdx["removeKey:"]=2;
  50843. self._assert_equals_($3,value);
  50844. $ctx2.sendIdx["assert:equals:"]=2;
  50845. $5=collection;
  50846. $6=self._collection();
  50847. $ctx2.sendIdx["collection"]=4;
  50848. $4=$recv($5).__eq($6);
  50849. return self._deny_($4);
  50850. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50851. }));
  50852. $8=self._collectionWithNewValue();
  50853. $recv($8)._removeKey_(self._sampleNewIndex());
  50854. $7=$recv($8)._yourself();
  50855. self._assert_equals_($7,self._collection());
  50856. return self;
  50857. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  50858. },
  50859. args: [],
  50860. 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",
  50861. referencedClasses: ["Error"],
  50862. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  50863. }),
  50864. $globals.AssociativeCollectionTest);
  50865. $core.addMethod(
  50866. $core.method({
  50867. selector: "testRemoveKeyIfAbsent",
  50868. protocol: 'tests',
  50869. fn: function (){
  50870. var self=this;
  50871. return $core.withContext(function($ctx1) {
  50872. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  50873. self._nonIndexesDo_((function(each){
  50874. var collection;
  50875. return $core.withContext(function($ctx2) {
  50876. collection=self._collection();
  50877. $ctx2.sendIdx["collection"]=1;
  50878. collection;
  50879. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  50880. return $core.withContext(function($ctx3) {
  50881. return self._sampleNewValue();
  50882. $ctx3.sendIdx["sampleNewValue"]=1;
  50883. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50884. }));
  50885. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  50886. $2=self._sampleNewValue();
  50887. $ctx2.sendIdx["sampleNewValue"]=2;
  50888. self._assert_equals_($1,$2);
  50889. $ctx2.sendIdx["assert:equals:"]=1;
  50890. $3=collection;
  50891. $4=self._collection();
  50892. $ctx2.sendIdx["collection"]=2;
  50893. return self._assert_equals_($3,$4);
  50894. $ctx2.sendIdx["assert:equals:"]=2;
  50895. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50896. }));
  50897. self._samplesDo_((function(index,value){
  50898. var collection;
  50899. return $core.withContext(function($ctx2) {
  50900. collection=self._collection();
  50901. $ctx2.sendIdx["collection"]=3;
  50902. collection;
  50903. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  50904. return $core.withContext(function($ctx3) {
  50905. return self._sampleNewValue();
  50906. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50907. }));
  50908. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  50909. self._assert_equals_($5,value);
  50910. $ctx2.sendIdx["assert:equals:"]=3;
  50911. $7=collection;
  50912. $8=self._collection();
  50913. $ctx2.sendIdx["collection"]=4;
  50914. $6=$recv($7).__eq($8);
  50915. return self._deny_($6);
  50916. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50917. }));
  50918. $10=self._collectionWithNewValue();
  50919. $recv($10)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  50920. return $core.withContext(function($ctx2) {
  50921. return self._assert_(false);
  50922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  50923. }));
  50924. $9=$recv($10)._yourself();
  50925. self._assert_equals_($9,self._collection());
  50926. return self;
  50927. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  50928. },
  50929. args: [],
  50930. 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",
  50931. referencedClasses: [],
  50932. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  50933. }),
  50934. $globals.AssociativeCollectionTest);
  50935. $core.addMethod(
  50936. $core.method({
  50937. selector: "testValues",
  50938. protocol: 'tests',
  50939. fn: function (){
  50940. var self=this;
  50941. return $core.withContext(function($ctx1) {
  50942. var $2,$1,$3,$4;
  50943. $2=$recv($recv(self._collectionClass())._new())._values();
  50944. $ctx1.sendIdx["values"]=1;
  50945. $1=$recv($2)._isEmpty();
  50946. self._assert_($1);
  50947. $3=$recv(self._collection())._values();
  50948. $ctx1.sendIdx["values"]=2;
  50949. $4=self._collectionValues();
  50950. $ctx1.sendIdx["collectionValues"]=1;
  50951. self._assertSameContents_as_($3,$4);
  50952. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50953. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  50954. return self;
  50955. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  50956. },
  50957. args: [],
  50958. 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 }",
  50959. referencedClasses: [],
  50960. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  50961. }),
  50962. $globals.AssociativeCollectionTest);
  50963. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  50964. $core.addMethod(
  50965. $core.method({
  50966. selector: "collection",
  50967. protocol: 'fixture',
  50968. fn: function (){
  50969. var self=this;
  50970. return $core.withContext(function($ctx1) {
  50971. var $1;
  50972. $1=$recv($globals.Dictionary)._new();
  50973. $recv($1)._at_put_((1),(1));
  50974. $ctx1.sendIdx["at:put:"]=1;
  50975. $recv($1)._at_put_("a",(2));
  50976. $ctx1.sendIdx["at:put:"]=2;
  50977. $recv($1)._at_put_(true,(3));
  50978. $ctx1.sendIdx["at:put:"]=3;
  50979. $recv($1)._at_put_((1).__at((3)),(-4));
  50980. $ctx1.sendIdx["at:put:"]=4;
  50981. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50982. return $recv($1)._yourself();
  50983. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  50984. },
  50985. args: [],
  50986. 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",
  50987. referencedClasses: ["Dictionary"],
  50988. messageSends: ["at:put:", "new", "@", "yourself"]
  50989. }),
  50990. $globals.DictionaryTest);
  50991. $core.addMethod(
  50992. $core.method({
  50993. selector: "collectionKeys",
  50994. protocol: 'fixture',
  50995. fn: function (){
  50996. var self=this;
  50997. return $core.withContext(function($ctx1) {
  50998. return [(1),"a",true,(1).__at((3)),self["@sampleBlock"]];
  50999. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  51000. },
  51001. args: [],
  51002. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  51003. referencedClasses: [],
  51004. messageSends: ["@"]
  51005. }),
  51006. $globals.DictionaryTest);
  51007. $core.addMethod(
  51008. $core.method({
  51009. selector: "collectionOfPrintStrings",
  51010. protocol: 'fixture',
  51011. fn: function (){
  51012. var self=this;
  51013. return $core.withContext(function($ctx1) {
  51014. var $1;
  51015. $1=$recv($globals.Dictionary)._new();
  51016. $recv($1)._at_put_((1),"1");
  51017. $ctx1.sendIdx["at:put:"]=1;
  51018. $recv($1)._at_put_("a","2");
  51019. $ctx1.sendIdx["at:put:"]=2;
  51020. $recv($1)._at_put_(true,"3");
  51021. $ctx1.sendIdx["at:put:"]=3;
  51022. $recv($1)._at_put_((1).__at((3)),"-4");
  51023. $ctx1.sendIdx["at:put:"]=4;
  51024. $recv($1)._at_put_(self["@sampleBlock"],"9");
  51025. return $recv($1)._yourself();
  51026. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  51027. },
  51028. args: [],
  51029. 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",
  51030. referencedClasses: ["Dictionary"],
  51031. messageSends: ["at:put:", "new", "@", "yourself"]
  51032. }),
  51033. $globals.DictionaryTest);
  51034. $core.addMethod(
  51035. $core.method({
  51036. selector: "collectionSize",
  51037. protocol: 'fixture',
  51038. fn: function (){
  51039. var self=this;
  51040. return (5);
  51041. },
  51042. args: [],
  51043. source: "collectionSize\x0a\x09^ 5",
  51044. referencedClasses: [],
  51045. messageSends: []
  51046. }),
  51047. $globals.DictionaryTest);
  51048. $core.addMethod(
  51049. $core.method({
  51050. selector: "collectionValues",
  51051. protocol: 'fixture',
  51052. fn: function (){
  51053. var self=this;
  51054. return [(1),(2),(3),(-4),(9)];
  51055. },
  51056. args: [],
  51057. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  51058. referencedClasses: [],
  51059. messageSends: []
  51060. }),
  51061. $globals.DictionaryTest);
  51062. $core.addMethod(
  51063. $core.method({
  51064. selector: "collectionWithDuplicates",
  51065. protocol: 'fixture',
  51066. fn: function (){
  51067. var self=this;
  51068. return $core.withContext(function($ctx1) {
  51069. var $1;
  51070. $1=$recv($globals.Dictionary)._new();
  51071. $recv($1)._at_put_((1),(1));
  51072. $ctx1.sendIdx["at:put:"]=1;
  51073. $recv($1)._at_put_("a",(2));
  51074. $ctx1.sendIdx["at:put:"]=2;
  51075. $recv($1)._at_put_(true,(3));
  51076. $ctx1.sendIdx["at:put:"]=3;
  51077. $recv($1)._at_put_((4),(-4));
  51078. $ctx1.sendIdx["at:put:"]=4;
  51079. $recv($1)._at_put_(self["@sampleBlock"],(9));
  51080. $ctx1.sendIdx["at:put:"]=5;
  51081. $recv($1)._at_put_("b",(1));
  51082. $ctx1.sendIdx["at:put:"]=6;
  51083. $recv($1)._at_put_((3),(3));
  51084. $ctx1.sendIdx["at:put:"]=7;
  51085. $recv($1)._at_put_(false,(12));
  51086. return $recv($1)._yourself();
  51087. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  51088. },
  51089. args: [],
  51090. 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",
  51091. referencedClasses: ["Dictionary"],
  51092. messageSends: ["at:put:", "new", "yourself"]
  51093. }),
  51094. $globals.DictionaryTest);
  51095. $core.addMethod(
  51096. $core.method({
  51097. selector: "collectionWithNewValue",
  51098. protocol: 'fixture',
  51099. fn: function (){
  51100. var self=this;
  51101. return $core.withContext(function($ctx1) {
  51102. var $1;
  51103. $1=$recv($globals.Dictionary)._new();
  51104. $recv($1)._at_put_((1),(1));
  51105. $ctx1.sendIdx["at:put:"]=1;
  51106. $recv($1)._at_put_("a",(2));
  51107. $ctx1.sendIdx["at:put:"]=2;
  51108. $recv($1)._at_put_(true,(3));
  51109. $ctx1.sendIdx["at:put:"]=3;
  51110. $recv($1)._at_put_((1).__at((3)),(-4));
  51111. $ctx1.sendIdx["at:put:"]=4;
  51112. $recv($1)._at_put_(self["@sampleBlock"],(9));
  51113. $ctx1.sendIdx["at:put:"]=5;
  51114. $recv($1)._at_put_("new","N");
  51115. return $recv($1)._yourself();
  51116. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  51117. },
  51118. args: [],
  51119. 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",
  51120. referencedClasses: ["Dictionary"],
  51121. messageSends: ["at:put:", "new", "@", "yourself"]
  51122. }),
  51123. $globals.DictionaryTest);
  51124. $core.addMethod(
  51125. $core.method({
  51126. selector: "sampleNewValueAsCollection",
  51127. protocol: 'fixture',
  51128. fn: function (){
  51129. var self=this;
  51130. return $core.withContext(function($ctx1) {
  51131. var $1;
  51132. $1=$recv($globals.Dictionary)._new();
  51133. $recv($1)._at_put_("new","N");
  51134. return $recv($1)._yourself();
  51135. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  51136. },
  51137. args: [],
  51138. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  51139. referencedClasses: ["Dictionary"],
  51140. messageSends: ["at:put:", "new", "yourself"]
  51141. }),
  51142. $globals.DictionaryTest);
  51143. $core.addMethod(
  51144. $core.method({
  51145. selector: "samplesDo:",
  51146. protocol: 'fixture',
  51147. fn: function (aBlock){
  51148. var self=this;
  51149. return $core.withContext(function($ctx1) {
  51150. (
  51151. $ctx1.supercall = true,
  51152. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51153. $ctx1.supercall = false;
  51154. $recv(aBlock)._value_value_(true,(3));
  51155. $ctx1.sendIdx["value:value:"]=1;
  51156. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  51157. $ctx1.sendIdx["value:value:"]=2;
  51158. $recv(aBlock)._value_value_(self["@sampleBlock"],(9));
  51159. return self;
  51160. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  51161. },
  51162. args: ["aBlock"],
  51163. 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",
  51164. referencedClasses: [],
  51165. messageSends: ["samplesDo:", "value:value:", "@"]
  51166. }),
  51167. $globals.DictionaryTest);
  51168. $core.addMethod(
  51169. $core.method({
  51170. selector: "testAccessing",
  51171. protocol: 'tests',
  51172. fn: function (){
  51173. var self=this;
  51174. var d;
  51175. return $core.withContext(function($ctx1) {
  51176. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  51177. d=$recv($globals.Dictionary)._new();
  51178. $recv(d)._at_put_("hello","world");
  51179. $ctx1.sendIdx["at:put:"]=1;
  51180. $1=$recv(d)._at_("hello");
  51181. $ctx1.sendIdx["at:"]=1;
  51182. self._assert_equals_($1,"world");
  51183. $ctx1.sendIdx["assert:equals:"]=1;
  51184. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  51185. return nil;
  51186. }));
  51187. $ctx1.sendIdx["at:ifAbsent:"]=1;
  51188. self._assert_equals_($2,"world");
  51189. $ctx1.sendIdx["assert:equals:"]=2;
  51190. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  51191. return nil;
  51192. }))).__eq("world"));
  51193. $ctx1.sendIdx["deny:"]=1;
  51194. $3=$recv(d)._includesKey_("hello");
  51195. $ctx1.sendIdx["includesKey:"]=1;
  51196. self._assert_($3);
  51197. $ctx1.sendIdx["assert:"]=1;
  51198. $4=$recv(d)._includesKey_("foo");
  51199. $ctx1.sendIdx["includesKey:"]=2;
  51200. self._deny_($4);
  51201. $ctx1.sendIdx["deny:"]=2;
  51202. $recv(d)._at_put_((1),(2));
  51203. $ctx1.sendIdx["at:put:"]=2;
  51204. $5=$recv(d)._at_((1));
  51205. $ctx1.sendIdx["at:"]=2;
  51206. self._assert_equals_($5,(2));
  51207. $ctx1.sendIdx["assert:equals:"]=3;
  51208. $6=d;
  51209. $7=(1).__at((3));
  51210. $ctx1.sendIdx["@"]=1;
  51211. $recv($6)._at_put_($7,(3));
  51212. $9=d;
  51213. $10=(1).__at((3));
  51214. $ctx1.sendIdx["@"]=2;
  51215. $8=$recv($9)._at_($10);
  51216. self._assert_equals_($8,(3));
  51217. $12=d;
  51218. $13=(1).__at((3));
  51219. $ctx1.sendIdx["@"]=3;
  51220. $11=$recv($12)._includesKey_($13);
  51221. $ctx1.sendIdx["includesKey:"]=3;
  51222. self._assert_($11);
  51223. self._deny_($recv(d)._includesKey_((3).__at((1))));
  51224. return self;
  51225. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  51226. },
  51227. args: [],
  51228. 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)",
  51229. referencedClasses: ["Dictionary"],
  51230. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  51231. }),
  51232. $globals.DictionaryTest);
  51233. $core.addMethod(
  51234. $core.method({
  51235. selector: "testDynamicDictionaries",
  51236. protocol: 'tests',
  51237. fn: function (){
  51238. var self=this;
  51239. return $core.withContext(function($ctx1) {
  51240. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  51241. return self;
  51242. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  51243. },
  51244. args: [],
  51245. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  51246. referencedClasses: ["Dictionary"],
  51247. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  51248. }),
  51249. $globals.DictionaryTest);
  51250. $core.addMethod(
  51251. $core.method({
  51252. selector: "collectionClass",
  51253. protocol: 'fixture',
  51254. fn: function (){
  51255. var self=this;
  51256. return $globals.Dictionary;
  51257. },
  51258. args: [],
  51259. source: "collectionClass\x0a\x09^ Dictionary",
  51260. referencedClasses: ["Dictionary"],
  51261. messageSends: []
  51262. }),
  51263. $globals.DictionaryTest.klass);
  51264. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51265. $core.addMethod(
  51266. $core.method({
  51267. selector: "collection",
  51268. protocol: 'fixture',
  51269. fn: function (){
  51270. var self=this;
  51271. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  51272. },
  51273. args: [],
  51274. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  51275. referencedClasses: [],
  51276. messageSends: []
  51277. }),
  51278. $globals.HashedCollectionTest);
  51279. $core.addMethod(
  51280. $core.method({
  51281. selector: "collectionKeys",
  51282. protocol: 'fixture',
  51283. fn: function (){
  51284. var self=this;
  51285. return ["b","a","c","d"];
  51286. },
  51287. args: [],
  51288. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  51289. referencedClasses: [],
  51290. messageSends: []
  51291. }),
  51292. $globals.HashedCollectionTest);
  51293. $core.addMethod(
  51294. $core.method({
  51295. selector: "collectionOfPrintStrings",
  51296. protocol: 'fixture',
  51297. fn: function (){
  51298. var self=this;
  51299. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  51300. },
  51301. args: [],
  51302. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  51303. referencedClasses: [],
  51304. messageSends: []
  51305. }),
  51306. $globals.HashedCollectionTest);
  51307. $core.addMethod(
  51308. $core.method({
  51309. selector: "collectionSize",
  51310. protocol: 'fixture',
  51311. fn: function (){
  51312. var self=this;
  51313. return (4);
  51314. },
  51315. args: [],
  51316. source: "collectionSize\x0a\x09^ 4",
  51317. referencedClasses: [],
  51318. messageSends: []
  51319. }),
  51320. $globals.HashedCollectionTest);
  51321. $core.addMethod(
  51322. $core.method({
  51323. selector: "collectionValues",
  51324. protocol: 'fixture',
  51325. fn: function (){
  51326. var self=this;
  51327. return [(1),(2),(3),(-4)];
  51328. },
  51329. args: [],
  51330. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  51331. referencedClasses: [],
  51332. messageSends: []
  51333. }),
  51334. $globals.HashedCollectionTest);
  51335. $core.addMethod(
  51336. $core.method({
  51337. selector: "collectionWithDuplicates",
  51338. protocol: 'fixture',
  51339. fn: function (){
  51340. var self=this;
  51341. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  51342. },
  51343. args: [],
  51344. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  51345. referencedClasses: [],
  51346. messageSends: []
  51347. }),
  51348. $globals.HashedCollectionTest);
  51349. $core.addMethod(
  51350. $core.method({
  51351. selector: "collectionWithNewValue",
  51352. protocol: 'fixture',
  51353. fn: function (){
  51354. var self=this;
  51355. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  51356. },
  51357. args: [],
  51358. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  51359. referencedClasses: [],
  51360. messageSends: []
  51361. }),
  51362. $globals.HashedCollectionTest);
  51363. $core.addMethod(
  51364. $core.method({
  51365. selector: "sampleNewValueAsCollection",
  51366. protocol: 'fixture',
  51367. fn: function (){
  51368. var self=this;
  51369. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  51370. },
  51371. args: [],
  51372. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  51373. referencedClasses: [],
  51374. messageSends: []
  51375. }),
  51376. $globals.HashedCollectionTest);
  51377. $core.addMethod(
  51378. $core.method({
  51379. selector: "testDynamicDictionaries",
  51380. protocol: 'tests',
  51381. fn: function (){
  51382. var self=this;
  51383. return $core.withContext(function($ctx1) {
  51384. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  51385. return self;
  51386. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  51387. },
  51388. args: [],
  51389. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  51390. referencedClasses: ["HashedCollection"],
  51391. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  51392. }),
  51393. $globals.HashedCollectionTest);
  51394. $core.addMethod(
  51395. $core.method({
  51396. selector: "collectionClass",
  51397. protocol: 'fixture',
  51398. fn: function (){
  51399. var self=this;
  51400. return $globals.HashedCollection;
  51401. },
  51402. args: [],
  51403. source: "collectionClass\x0a\x09^ HashedCollection",
  51404. referencedClasses: ["HashedCollection"],
  51405. messageSends: []
  51406. }),
  51407. $globals.HashedCollectionTest.klass);
  51408. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  51409. $core.addMethod(
  51410. $core.method({
  51411. selector: "collectionFirst",
  51412. protocol: 'fixture',
  51413. fn: function (){
  51414. var self=this;
  51415. return $core.withContext(function($ctx1) {
  51416. self._subclassResponsibility();
  51417. return self;
  51418. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  51419. },
  51420. args: [],
  51421. source: "collectionFirst\x0a\x09self subclassResponsibility",
  51422. referencedClasses: [],
  51423. messageSends: ["subclassResponsibility"]
  51424. }),
  51425. $globals.SequenceableCollectionTest);
  51426. $core.addMethod(
  51427. $core.method({
  51428. selector: "collectionFirstTwo",
  51429. protocol: 'fixture',
  51430. fn: function (){
  51431. var self=this;
  51432. return $core.withContext(function($ctx1) {
  51433. self._subclassResponsibility();
  51434. return self;
  51435. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  51436. },
  51437. args: [],
  51438. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  51439. referencedClasses: [],
  51440. messageSends: ["subclassResponsibility"]
  51441. }),
  51442. $globals.SequenceableCollectionTest);
  51443. $core.addMethod(
  51444. $core.method({
  51445. selector: "collectionLast",
  51446. protocol: 'fixture',
  51447. fn: function (){
  51448. var self=this;
  51449. return $core.withContext(function($ctx1) {
  51450. self._subclassResponsibility();
  51451. return self;
  51452. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  51453. },
  51454. args: [],
  51455. source: "collectionLast\x0a\x09self subclassResponsibility",
  51456. referencedClasses: [],
  51457. messageSends: ["subclassResponsibility"]
  51458. }),
  51459. $globals.SequenceableCollectionTest);
  51460. $core.addMethod(
  51461. $core.method({
  51462. selector: "collectionLastTwo",
  51463. protocol: 'fixture',
  51464. fn: function (){
  51465. var self=this;
  51466. return $core.withContext(function($ctx1) {
  51467. self._subclassResponsibility();
  51468. return self;
  51469. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  51470. },
  51471. args: [],
  51472. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  51473. referencedClasses: [],
  51474. messageSends: ["subclassResponsibility"]
  51475. }),
  51476. $globals.SequenceableCollectionTest);
  51477. $core.addMethod(
  51478. $core.method({
  51479. selector: "nonIndexesDo:",
  51480. protocol: 'fixture',
  51481. fn: function (aBlock){
  51482. var self=this;
  51483. return $core.withContext(function($ctx1) {
  51484. $recv(aBlock)._value_((0));
  51485. $ctx1.sendIdx["value:"]=1;
  51486. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  51487. $ctx1.sendIdx["value:"]=2;
  51488. $recv(aBlock)._value_("z");
  51489. return self;
  51490. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51491. },
  51492. args: ["aBlock"],
  51493. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  51494. referencedClasses: [],
  51495. messageSends: ["value:", "+", "collectionSize"]
  51496. }),
  51497. $globals.SequenceableCollectionTest);
  51498. $core.addMethod(
  51499. $core.method({
  51500. selector: "samplesDo:",
  51501. protocol: 'fixture',
  51502. fn: function (aBlock){
  51503. var self=this;
  51504. return $core.withContext(function($ctx1) {
  51505. $recv(aBlock)._value_value_((1),self._collectionFirst());
  51506. $ctx1.sendIdx["value:value:"]=1;
  51507. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  51508. return self;
  51509. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51510. },
  51511. args: ["aBlock"],
  51512. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  51513. referencedClasses: [],
  51514. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  51515. }),
  51516. $globals.SequenceableCollectionTest);
  51517. $core.addMethod(
  51518. $core.method({
  51519. selector: "testBeginsWith",
  51520. protocol: 'tests',
  51521. fn: function (){
  51522. var self=this;
  51523. return $core.withContext(function($ctx1) {
  51524. var $2,$1,$4,$5,$3,$7,$6;
  51525. $2=self._collection();
  51526. $ctx1.sendIdx["collection"]=1;
  51527. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  51528. $ctx1.sendIdx["beginsWith:"]=1;
  51529. self._assert_($1);
  51530. $ctx1.sendIdx["assert:"]=1;
  51531. $4=self._collection();
  51532. $ctx1.sendIdx["collection"]=2;
  51533. $5=self._collection();
  51534. $ctx1.sendIdx["collection"]=3;
  51535. $3=$recv($4)._beginsWith_($5);
  51536. $ctx1.sendIdx["beginsWith:"]=2;
  51537. self._assert_($3);
  51538. $ctx1.sendIdx["assert:"]=2;
  51539. $7=self._collection();
  51540. $ctx1.sendIdx["collection"]=4;
  51541. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  51542. $ctx1.sendIdx["beginsWith:"]=3;
  51543. self._assert_($6);
  51544. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  51545. return self;
  51546. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  51547. },
  51548. args: [],
  51549. 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)",
  51550. referencedClasses: [],
  51551. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  51552. }),
  51553. $globals.SequenceableCollectionTest);
  51554. $core.addMethod(
  51555. $core.method({
  51556. selector: "testEndsWith",
  51557. protocol: 'tests',
  51558. fn: function (){
  51559. var self=this;
  51560. return $core.withContext(function($ctx1) {
  51561. var $2,$1,$4,$5,$3,$7,$6;
  51562. $2=self._collection();
  51563. $ctx1.sendIdx["collection"]=1;
  51564. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  51565. $ctx1.sendIdx["endsWith:"]=1;
  51566. self._assert_($1);
  51567. $ctx1.sendIdx["assert:"]=1;
  51568. $4=self._collection();
  51569. $ctx1.sendIdx["collection"]=2;
  51570. $5=self._collection();
  51571. $ctx1.sendIdx["collection"]=3;
  51572. $3=$recv($4)._endsWith_($5);
  51573. $ctx1.sendIdx["endsWith:"]=2;
  51574. self._assert_($3);
  51575. $ctx1.sendIdx["assert:"]=2;
  51576. $7=self._collection();
  51577. $ctx1.sendIdx["collection"]=4;
  51578. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  51579. $ctx1.sendIdx["endsWith:"]=3;
  51580. self._assert_($6);
  51581. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  51582. return self;
  51583. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  51584. },
  51585. args: [],
  51586. 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)",
  51587. referencedClasses: [],
  51588. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  51589. }),
  51590. $globals.SequenceableCollectionTest);
  51591. $core.addMethod(
  51592. $core.method({
  51593. selector: "testFirst",
  51594. protocol: 'tests',
  51595. fn: function (){
  51596. var self=this;
  51597. return $core.withContext(function($ctx1) {
  51598. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  51599. return self;
  51600. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  51601. },
  51602. args: [],
  51603. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  51604. referencedClasses: [],
  51605. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  51606. }),
  51607. $globals.SequenceableCollectionTest);
  51608. $core.addMethod(
  51609. $core.method({
  51610. selector: "testFirstN",
  51611. protocol: 'tests',
  51612. fn: function (){
  51613. var self=this;
  51614. return $core.withContext(function($ctx1) {
  51615. var $2,$1,$4,$3,$6,$5,$7;
  51616. $2=self._collection();
  51617. $ctx1.sendIdx["collection"]=1;
  51618. $1=$recv($2)._first_((2));
  51619. $ctx1.sendIdx["first:"]=1;
  51620. self._assert_equals_($1,self._collectionFirstTwo());
  51621. $ctx1.sendIdx["assert:equals:"]=1;
  51622. $4=self._collection();
  51623. $ctx1.sendIdx["collection"]=2;
  51624. $3=$recv($4)._first_((0));
  51625. $ctx1.sendIdx["first:"]=2;
  51626. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51627. $ctx1.sendIdx["assert:equals:"]=2;
  51628. $6=self._collection();
  51629. $ctx1.sendIdx["collection"]=3;
  51630. $5=$recv($6)._first_(self._collectionSize());
  51631. $ctx1.sendIdx["first:"]=3;
  51632. $7=self._collection();
  51633. $ctx1.sendIdx["collection"]=4;
  51634. self._assert_equals_($5,$7);
  51635. self._should_raise_((function(){
  51636. return $core.withContext(function($ctx2) {
  51637. return $recv(self._collection())._first_((33));
  51638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51639. }),$globals.Error);
  51640. return self;
  51641. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  51642. },
  51643. args: [],
  51644. 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",
  51645. referencedClasses: ["Error"],
  51646. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51647. }),
  51648. $globals.SequenceableCollectionTest);
  51649. $core.addMethod(
  51650. $core.method({
  51651. selector: "testFourth",
  51652. protocol: 'tests',
  51653. fn: function (){
  51654. var self=this;
  51655. return $core.withContext(function($ctx1) {
  51656. var $2,$1;
  51657. $2=self._collection();
  51658. $ctx1.sendIdx["collection"]=1;
  51659. $1=$recv($2)._fourth();
  51660. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  51661. return self;
  51662. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  51663. },
  51664. args: [],
  51665. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  51666. referencedClasses: [],
  51667. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  51668. }),
  51669. $globals.SequenceableCollectionTest);
  51670. $core.addMethod(
  51671. $core.method({
  51672. selector: "testIndexOfStartingAt",
  51673. protocol: 'tests',
  51674. fn: function (){
  51675. var self=this;
  51676. var jsNull;
  51677. return $core.withContext(function($ctx1) {
  51678. var $2,$1,$4,$3;
  51679. jsNull=$recv($globals.JSON)._parse_("null");
  51680. self._samplesDo_((function(index,value){
  51681. return $core.withContext(function($ctx2) {
  51682. $2=self._collection();
  51683. $ctx2.sendIdx["collection"]=1;
  51684. $1=$recv($2)._indexOf_startingAt_(value,(1));
  51685. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51686. self._assert_equals_($1,index);
  51687. $ctx2.sendIdx["assert:equals:"]=1;
  51688. $4=self._collection();
  51689. $ctx2.sendIdx["collection"]=2;
  51690. $3=$recv($4)._indexOf_startingAt_(value,index);
  51691. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51692. self._assert_equals_($3,index);
  51693. $ctx2.sendIdx["assert:equals:"]=2;
  51694. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  51695. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51696. }));
  51697. return self;
  51698. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51699. },
  51700. args: [],
  51701. 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 ]",
  51702. referencedClasses: ["JSON"],
  51703. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  51704. }),
  51705. $globals.SequenceableCollectionTest);
  51706. $core.addMethod(
  51707. $core.method({
  51708. selector: "testIndexOfStartingAtWithNull",
  51709. protocol: 'tests',
  51710. fn: function (){
  51711. var self=this;
  51712. var jsNull;
  51713. return $core.withContext(function($ctx1) {
  51714. var $1,$2;
  51715. jsNull=$recv($globals.JSON)._parse_("null");
  51716. self._samplesDo_((function(index,value){
  51717. var collection;
  51718. return $core.withContext(function($ctx2) {
  51719. collection=self._collection();
  51720. collection;
  51721. $recv(collection)._at_put_(index,jsNull);
  51722. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  51723. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51724. self._assert_equals_($1,index);
  51725. $ctx2.sendIdx["assert:equals:"]=1;
  51726. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  51727. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51728. self._assert_equals_($2,index);
  51729. $ctx2.sendIdx["assert:equals:"]=2;
  51730. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  51731. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  51732. }));
  51733. return self;
  51734. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51735. },
  51736. args: [],
  51737. 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 ]",
  51738. referencedClasses: ["JSON"],
  51739. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  51740. }),
  51741. $globals.SequenceableCollectionTest);
  51742. $core.addMethod(
  51743. $core.method({
  51744. selector: "testLast",
  51745. protocol: 'tests',
  51746. fn: function (){
  51747. var self=this;
  51748. return $core.withContext(function($ctx1) {
  51749. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  51750. return self;
  51751. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  51752. },
  51753. args: [],
  51754. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  51755. referencedClasses: [],
  51756. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  51757. }),
  51758. $globals.SequenceableCollectionTest);
  51759. $core.addMethod(
  51760. $core.method({
  51761. selector: "testLastN",
  51762. protocol: 'tests',
  51763. fn: function (){
  51764. var self=this;
  51765. return $core.withContext(function($ctx1) {
  51766. var $2,$1,$4,$3,$6,$5,$7;
  51767. $2=self._collection();
  51768. $ctx1.sendIdx["collection"]=1;
  51769. $1=$recv($2)._last_((2));
  51770. $ctx1.sendIdx["last:"]=1;
  51771. self._assert_equals_($1,self._collectionLastTwo());
  51772. $ctx1.sendIdx["assert:equals:"]=1;
  51773. $4=self._collection();
  51774. $ctx1.sendIdx["collection"]=2;
  51775. $3=$recv($4)._last_((0));
  51776. $ctx1.sendIdx["last:"]=2;
  51777. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51778. $ctx1.sendIdx["assert:equals:"]=2;
  51779. $6=self._collection();
  51780. $ctx1.sendIdx["collection"]=3;
  51781. $5=$recv($6)._last_(self._collectionSize());
  51782. $ctx1.sendIdx["last:"]=3;
  51783. $7=self._collection();
  51784. $ctx1.sendIdx["collection"]=4;
  51785. self._assert_equals_($5,$7);
  51786. self._should_raise_((function(){
  51787. return $core.withContext(function($ctx2) {
  51788. return $recv(self._collection())._last_((33));
  51789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51790. }),$globals.Error);
  51791. return self;
  51792. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  51793. },
  51794. args: [],
  51795. 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",
  51796. referencedClasses: ["Error"],
  51797. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51798. }),
  51799. $globals.SequenceableCollectionTest);
  51800. $core.addMethod(
  51801. $core.method({
  51802. selector: "testSecond",
  51803. protocol: 'tests',
  51804. fn: function (){
  51805. var self=this;
  51806. return $core.withContext(function($ctx1) {
  51807. var $2,$1;
  51808. $2=self._collection();
  51809. $ctx1.sendIdx["collection"]=1;
  51810. $1=$recv($2)._second();
  51811. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  51812. return self;
  51813. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  51814. },
  51815. args: [],
  51816. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  51817. referencedClasses: [],
  51818. messageSends: ["assert:equals:", "second", "collection", "at:"]
  51819. }),
  51820. $globals.SequenceableCollectionTest);
  51821. $core.addMethod(
  51822. $core.method({
  51823. selector: "testThird",
  51824. protocol: 'tests',
  51825. fn: function (){
  51826. var self=this;
  51827. return $core.withContext(function($ctx1) {
  51828. var $2,$1;
  51829. $2=self._collection();
  51830. $ctx1.sendIdx["collection"]=1;
  51831. $1=$recv($2)._third();
  51832. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  51833. return self;
  51834. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  51835. },
  51836. args: [],
  51837. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  51838. referencedClasses: [],
  51839. messageSends: ["assert:equals:", "third", "collection", "at:"]
  51840. }),
  51841. $globals.SequenceableCollectionTest);
  51842. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  51843. $core.addMethod(
  51844. $core.method({
  51845. selector: "collection",
  51846. protocol: 'fixture',
  51847. fn: function (){
  51848. var self=this;
  51849. return [(1), (2), (3), (-4)];
  51850. },
  51851. args: [],
  51852. source: "collection\x0a\x09^ #(1 2 3 -4)",
  51853. referencedClasses: [],
  51854. messageSends: []
  51855. }),
  51856. $globals.ArrayTest);
  51857. $core.addMethod(
  51858. $core.method({
  51859. selector: "collectionFirst",
  51860. protocol: 'fixture',
  51861. fn: function (){
  51862. var self=this;
  51863. return (1);
  51864. },
  51865. args: [],
  51866. source: "collectionFirst\x0a\x09^ 1",
  51867. referencedClasses: [],
  51868. messageSends: []
  51869. }),
  51870. $globals.ArrayTest);
  51871. $core.addMethod(
  51872. $core.method({
  51873. selector: "collectionFirstTwo",
  51874. protocol: 'fixture',
  51875. fn: function (){
  51876. var self=this;
  51877. return [(1), (2)];
  51878. },
  51879. args: [],
  51880. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  51881. referencedClasses: [],
  51882. messageSends: []
  51883. }),
  51884. $globals.ArrayTest);
  51885. $core.addMethod(
  51886. $core.method({
  51887. selector: "collectionLast",
  51888. protocol: 'fixture',
  51889. fn: function (){
  51890. var self=this;
  51891. return (-4);
  51892. },
  51893. args: [],
  51894. source: "collectionLast\x0a\x09^ -4",
  51895. referencedClasses: [],
  51896. messageSends: []
  51897. }),
  51898. $globals.ArrayTest);
  51899. $core.addMethod(
  51900. $core.method({
  51901. selector: "collectionLastTwo",
  51902. protocol: 'fixture',
  51903. fn: function (){
  51904. var self=this;
  51905. return [(3), (-4)];
  51906. },
  51907. args: [],
  51908. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  51909. referencedClasses: [],
  51910. messageSends: []
  51911. }),
  51912. $globals.ArrayTest);
  51913. $core.addMethod(
  51914. $core.method({
  51915. selector: "collectionOfPrintStrings",
  51916. protocol: 'fixture',
  51917. fn: function (){
  51918. var self=this;
  51919. return ["1", "2", "3", "-4"];
  51920. },
  51921. args: [],
  51922. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  51923. referencedClasses: [],
  51924. messageSends: []
  51925. }),
  51926. $globals.ArrayTest);
  51927. $core.addMethod(
  51928. $core.method({
  51929. selector: "collectionSize",
  51930. protocol: 'fixture',
  51931. fn: function (){
  51932. var self=this;
  51933. return (4);
  51934. },
  51935. args: [],
  51936. source: "collectionSize\x0a\x09^ 4",
  51937. referencedClasses: [],
  51938. messageSends: []
  51939. }),
  51940. $globals.ArrayTest);
  51941. $core.addMethod(
  51942. $core.method({
  51943. selector: "collectionWithDuplicates",
  51944. protocol: 'fixture',
  51945. fn: function (){
  51946. var self=this;
  51947. return ["a", "b", "c", (1), (2), (1), "a", []];
  51948. },
  51949. args: [],
  51950. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  51951. referencedClasses: [],
  51952. messageSends: []
  51953. }),
  51954. $globals.ArrayTest);
  51955. $core.addMethod(
  51956. $core.method({
  51957. selector: "collectionWithNewValue",
  51958. protocol: 'fixture',
  51959. fn: function (){
  51960. var self=this;
  51961. return [(1), (2), (3), (-4), "N"];
  51962. },
  51963. args: [],
  51964. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  51965. referencedClasses: [],
  51966. messageSends: []
  51967. }),
  51968. $globals.ArrayTest);
  51969. $core.addMethod(
  51970. $core.method({
  51971. selector: "sampleNewIndex",
  51972. protocol: 'fixture',
  51973. fn: function (){
  51974. var self=this;
  51975. return (5);
  51976. },
  51977. args: [],
  51978. source: "sampleNewIndex\x0a\x09^ 5",
  51979. referencedClasses: [],
  51980. messageSends: []
  51981. }),
  51982. $globals.ArrayTest);
  51983. $core.addMethod(
  51984. $core.method({
  51985. selector: "samplesDo:",
  51986. protocol: 'fixture',
  51987. fn: function (aBlock){
  51988. var self=this;
  51989. return $core.withContext(function($ctx1) {
  51990. (
  51991. $ctx1.supercall = true,
  51992. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51993. $ctx1.supercall = false;
  51994. $recv(aBlock)._value_value_((3),(3));
  51995. return self;
  51996. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  51997. },
  51998. args: ["aBlock"],
  51999. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  52000. referencedClasses: [],
  52001. messageSends: ["samplesDo:", "value:value:"]
  52002. }),
  52003. $globals.ArrayTest);
  52004. $core.addMethod(
  52005. $core.method({
  52006. selector: "testAdd",
  52007. protocol: 'tests',
  52008. fn: function (){
  52009. var self=this;
  52010. var array;
  52011. return $core.withContext(function($ctx1) {
  52012. array=self._collection();
  52013. $recv(array)._add_((6));
  52014. self._assert_equals_($recv(array)._last(),(6));
  52015. return self;
  52016. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  52017. },
  52018. args: [],
  52019. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  52020. referencedClasses: [],
  52021. messageSends: ["collection", "add:", "assert:equals:", "last"]
  52022. }),
  52023. $globals.ArrayTest);
  52024. $core.addMethod(
  52025. $core.method({
  52026. selector: "testAddFirst",
  52027. protocol: 'tests',
  52028. fn: function (){
  52029. var self=this;
  52030. return $core.withContext(function($ctx1) {
  52031. var $3,$2,$1;
  52032. $3=self._collection();
  52033. $recv($3)._addFirst_((0));
  52034. $2=$recv($3)._yourself();
  52035. $1=$recv($2)._first();
  52036. self._assert_equals_($1,(0));
  52037. return self;
  52038. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  52039. },
  52040. args: [],
  52041. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  52042. referencedClasses: [],
  52043. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  52044. }),
  52045. $globals.ArrayTest);
  52046. $core.addMethod(
  52047. $core.method({
  52048. selector: "testPrintString",
  52049. protocol: 'tests',
  52050. fn: function (){
  52051. var self=this;
  52052. var array;
  52053. return $core.withContext(function($ctx1) {
  52054. var $1,$2,$3,$4,$5,$6,$7,$8;
  52055. array=$recv($globals.Array)._new();
  52056. $1=$recv(array)._printString();
  52057. $ctx1.sendIdx["printString"]=1;
  52058. self._assert_equals_($1,"an Array ()");
  52059. $ctx1.sendIdx["assert:equals:"]=1;
  52060. $2=array;
  52061. $recv($2)._add_((1));
  52062. $ctx1.sendIdx["add:"]=1;
  52063. $3=$recv($2)._add_((3));
  52064. $ctx1.sendIdx["add:"]=2;
  52065. $4=$recv(array)._printString();
  52066. $ctx1.sendIdx["printString"]=2;
  52067. self._assert_equals_($4,"an Array (1 3)");
  52068. $ctx1.sendIdx["assert:equals:"]=2;
  52069. $recv(array)._add_("foo");
  52070. $5=$recv(array)._printString();
  52071. $ctx1.sendIdx["printString"]=3;
  52072. self._assert_equals_($5,"an Array (1 3 'foo')");
  52073. $ctx1.sendIdx["assert:equals:"]=3;
  52074. $6=array;
  52075. $recv($6)._remove_((1));
  52076. $ctx1.sendIdx["remove:"]=1;
  52077. $recv($6)._remove_((3));
  52078. $7=$recv(array)._printString();
  52079. $ctx1.sendIdx["printString"]=4;
  52080. self._assert_equals_($7,"an Array ('foo')");
  52081. $ctx1.sendIdx["assert:equals:"]=4;
  52082. $recv(array)._addLast_((3));
  52083. $ctx1.sendIdx["addLast:"]=1;
  52084. $8=$recv(array)._printString();
  52085. $ctx1.sendIdx["printString"]=5;
  52086. self._assert_equals_($8,"an Array ('foo' 3)");
  52087. $ctx1.sendIdx["assert:equals:"]=5;
  52088. $recv(array)._addLast_((3));
  52089. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  52090. return self;
  52091. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  52092. },
  52093. args: [],
  52094. 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)'.",
  52095. referencedClasses: ["Array"],
  52096. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  52097. }),
  52098. $globals.ArrayTest);
  52099. $core.addMethod(
  52100. $core.method({
  52101. selector: "testRemove",
  52102. protocol: 'tests',
  52103. fn: function (){
  52104. var self=this;
  52105. var array;
  52106. return $core.withContext(function($ctx1) {
  52107. array=[(1), (2), (3), (4), (5)];
  52108. $recv(array)._remove_((3));
  52109. $ctx1.sendIdx["remove:"]=1;
  52110. self._assert_equals_(array,[(1), (2), (4), (5)]);
  52111. self._should_raise_((function(){
  52112. return $core.withContext(function($ctx2) {
  52113. return $recv(array)._remove_((3));
  52114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52115. }),$globals.Error);
  52116. return self;
  52117. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  52118. },
  52119. args: [],
  52120. 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",
  52121. referencedClasses: ["Error"],
  52122. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  52123. }),
  52124. $globals.ArrayTest);
  52125. $core.addMethod(
  52126. $core.method({
  52127. selector: "testRemoveFromTo",
  52128. protocol: 'tests',
  52129. fn: function (){
  52130. var self=this;
  52131. return $core.withContext(function($ctx1) {
  52132. var $1,$2;
  52133. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  52134. $ctx1.sendIdx["removeFrom:to:"]=1;
  52135. self._assert_equals_($1,[(4)]);
  52136. $ctx1.sendIdx["assert:equals:"]=1;
  52137. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  52138. $ctx1.sendIdx["removeFrom:to:"]=2;
  52139. self._assert_equals_($2,[(1), (4)]);
  52140. $ctx1.sendIdx["assert:equals:"]=2;
  52141. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  52142. return self;
  52143. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  52144. },
  52145. args: [],
  52146. 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)",
  52147. referencedClasses: [],
  52148. messageSends: ["assert:equals:", "removeFrom:to:"]
  52149. }),
  52150. $globals.ArrayTest);
  52151. $core.addMethod(
  52152. $core.method({
  52153. selector: "testRemoveIndex",
  52154. protocol: 'tests',
  52155. fn: function (){
  52156. var self=this;
  52157. return $core.withContext(function($ctx1) {
  52158. var $1,$2;
  52159. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  52160. $ctx1.sendIdx["removeIndex:"]=1;
  52161. self._assert_equals_($1,[(1), (3), (4)]);
  52162. $ctx1.sendIdx["assert:equals:"]=1;
  52163. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  52164. $ctx1.sendIdx["removeIndex:"]=2;
  52165. self._assert_equals_($2,[(2), (3), (4)]);
  52166. $ctx1.sendIdx["assert:equals:"]=2;
  52167. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  52168. return self;
  52169. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  52170. },
  52171. args: [],
  52172. 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: #()",
  52173. referencedClasses: [],
  52174. messageSends: ["assert:equals:", "removeIndex:"]
  52175. }),
  52176. $globals.ArrayTest);
  52177. $core.addMethod(
  52178. $core.method({
  52179. selector: "testRemoveLast",
  52180. protocol: 'tests',
  52181. fn: function (){
  52182. var self=this;
  52183. var array;
  52184. return $core.withContext(function($ctx1) {
  52185. array=[(1), (2)];
  52186. $recv(array)._removeLast();
  52187. self._assert_equals_($recv(array)._last(),(1));
  52188. return self;
  52189. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  52190. },
  52191. args: [],
  52192. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  52193. referencedClasses: [],
  52194. messageSends: ["removeLast", "assert:equals:", "last"]
  52195. }),
  52196. $globals.ArrayTest);
  52197. $core.addMethod(
  52198. $core.method({
  52199. selector: "testReversed",
  52200. protocol: 'tests',
  52201. fn: function (){
  52202. var self=this;
  52203. var array;
  52204. return $core.withContext(function($ctx1) {
  52205. array=[(5), (4), (3), (2), (1)];
  52206. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  52207. return self;
  52208. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  52209. },
  52210. args: [],
  52211. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  52212. referencedClasses: [],
  52213. messageSends: ["assert:equals:", "reversed"]
  52214. }),
  52215. $globals.ArrayTest);
  52216. $core.addMethod(
  52217. $core.method({
  52218. selector: "testSort",
  52219. protocol: 'tests',
  52220. fn: function (){
  52221. var self=this;
  52222. var array;
  52223. return $core.withContext(function($ctx1) {
  52224. array=[(10), (1), (5)];
  52225. $recv(array)._sort();
  52226. self._assert_equals_(array,[(1), (5), (10)]);
  52227. return self;
  52228. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  52229. },
  52230. args: [],
  52231. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  52232. referencedClasses: [],
  52233. messageSends: ["sort", "assert:equals:"]
  52234. }),
  52235. $globals.ArrayTest);
  52236. $core.addMethod(
  52237. $core.method({
  52238. selector: "collectionClass",
  52239. protocol: 'fixture',
  52240. fn: function (){
  52241. var self=this;
  52242. return $globals.Array;
  52243. },
  52244. args: [],
  52245. source: "collectionClass\x0a\x09^ Array",
  52246. referencedClasses: ["Array"],
  52247. messageSends: []
  52248. }),
  52249. $globals.ArrayTest.klass);
  52250. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52251. $core.addMethod(
  52252. $core.method({
  52253. selector: "collection",
  52254. protocol: 'fixture',
  52255. fn: function (){
  52256. var self=this;
  52257. return "helLo";
  52258. },
  52259. args: [],
  52260. source: "collection\x0a\x09^ 'helLo'",
  52261. referencedClasses: [],
  52262. messageSends: []
  52263. }),
  52264. $globals.StringTest);
  52265. $core.addMethod(
  52266. $core.method({
  52267. selector: "collectionFirst",
  52268. protocol: 'fixture',
  52269. fn: function (){
  52270. var self=this;
  52271. return "h";
  52272. },
  52273. args: [],
  52274. source: "collectionFirst\x0a\x09^ 'h'",
  52275. referencedClasses: [],
  52276. messageSends: []
  52277. }),
  52278. $globals.StringTest);
  52279. $core.addMethod(
  52280. $core.method({
  52281. selector: "collectionFirstTwo",
  52282. protocol: 'fixture',
  52283. fn: function (){
  52284. var self=this;
  52285. return "he";
  52286. },
  52287. args: [],
  52288. source: "collectionFirstTwo\x0a\x09^ 'he'",
  52289. referencedClasses: [],
  52290. messageSends: []
  52291. }),
  52292. $globals.StringTest);
  52293. $core.addMethod(
  52294. $core.method({
  52295. selector: "collectionLast",
  52296. protocol: 'fixture',
  52297. fn: function (){
  52298. var self=this;
  52299. return "o";
  52300. },
  52301. args: [],
  52302. source: "collectionLast\x0a\x09^ 'o'",
  52303. referencedClasses: [],
  52304. messageSends: []
  52305. }),
  52306. $globals.StringTest);
  52307. $core.addMethod(
  52308. $core.method({
  52309. selector: "collectionLastTwo",
  52310. protocol: 'fixture',
  52311. fn: function (){
  52312. var self=this;
  52313. return "Lo";
  52314. },
  52315. args: [],
  52316. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  52317. referencedClasses: [],
  52318. messageSends: []
  52319. }),
  52320. $globals.StringTest);
  52321. $core.addMethod(
  52322. $core.method({
  52323. selector: "collectionOfPrintStrings",
  52324. protocol: 'fixture',
  52325. fn: function (){
  52326. var self=this;
  52327. return "'h''e''l''L''o'";
  52328. },
  52329. args: [],
  52330. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  52331. referencedClasses: [],
  52332. messageSends: []
  52333. }),
  52334. $globals.StringTest);
  52335. $core.addMethod(
  52336. $core.method({
  52337. selector: "collectionSize",
  52338. protocol: 'fixture',
  52339. fn: function (){
  52340. var self=this;
  52341. return (5);
  52342. },
  52343. args: [],
  52344. source: "collectionSize\x0a\x09^ 5",
  52345. referencedClasses: [],
  52346. messageSends: []
  52347. }),
  52348. $globals.StringTest);
  52349. $core.addMethod(
  52350. $core.method({
  52351. selector: "collectionWithDuplicates",
  52352. protocol: 'fixture',
  52353. fn: function (){
  52354. var self=this;
  52355. return "abbaerten";
  52356. },
  52357. args: [],
  52358. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  52359. referencedClasses: [],
  52360. messageSends: []
  52361. }),
  52362. $globals.StringTest);
  52363. $core.addMethod(
  52364. $core.method({
  52365. selector: "collectionWithNewValue",
  52366. protocol: 'fixture',
  52367. fn: function (){
  52368. var self=this;
  52369. return "helLoN";
  52370. },
  52371. args: [],
  52372. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  52373. referencedClasses: [],
  52374. messageSends: []
  52375. }),
  52376. $globals.StringTest);
  52377. $core.addMethod(
  52378. $core.method({
  52379. selector: "sampleNewValueAsCollection",
  52380. protocol: 'fixture',
  52381. fn: function (){
  52382. var self=this;
  52383. return "N";
  52384. },
  52385. args: [],
  52386. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  52387. referencedClasses: [],
  52388. messageSends: []
  52389. }),
  52390. $globals.StringTest);
  52391. $core.addMethod(
  52392. $core.method({
  52393. selector: "samplesDo:",
  52394. protocol: 'fixture',
  52395. fn: function (aBlock){
  52396. var self=this;
  52397. return $core.withContext(function($ctx1) {
  52398. (
  52399. $ctx1.supercall = true,
  52400. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52401. $ctx1.supercall = false;
  52402. $recv(aBlock)._value_value_((3),"l");
  52403. return self;
  52404. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  52405. },
  52406. args: ["aBlock"],
  52407. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  52408. referencedClasses: [],
  52409. messageSends: ["samplesDo:", "value:value:"]
  52410. }),
  52411. $globals.StringTest);
  52412. $core.addMethod(
  52413. $core.method({
  52414. selector: "testAddAll",
  52415. protocol: 'tests',
  52416. fn: function (){
  52417. var self=this;
  52418. return $core.withContext(function($ctx1) {
  52419. var $1;
  52420. self._should_raise_((function(){
  52421. return $core.withContext(function($ctx2) {
  52422. $1=self._collection();
  52423. $ctx2.sendIdx["collection"]=1;
  52424. return $recv($1)._addAll_(self._collection());
  52425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52426. }),$globals.Error);
  52427. return self;
  52428. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  52429. },
  52430. args: [],
  52431. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  52432. referencedClasses: ["Error"],
  52433. messageSends: ["should:raise:", "addAll:", "collection"]
  52434. }),
  52435. $globals.StringTest);
  52436. $core.addMethod(
  52437. $core.method({
  52438. selector: "testAddRemove",
  52439. protocol: 'tests',
  52440. fn: function (){
  52441. var self=this;
  52442. return $core.withContext(function($ctx1) {
  52443. self._should_raise_((function(){
  52444. return $core.withContext(function($ctx2) {
  52445. return "hello"._add_("a");
  52446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52447. }),$globals.Error);
  52448. $ctx1.sendIdx["should:raise:"]=1;
  52449. self._should_raise_((function(){
  52450. return $core.withContext(function($ctx2) {
  52451. return "hello"._remove_("h");
  52452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52453. }),$globals.Error);
  52454. return self;
  52455. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  52456. },
  52457. args: [],
  52458. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  52459. referencedClasses: ["Error"],
  52460. messageSends: ["should:raise:", "add:", "remove:"]
  52461. }),
  52462. $globals.StringTest);
  52463. $core.addMethod(
  52464. $core.method({
  52465. selector: "testAsArray",
  52466. protocol: 'tests',
  52467. fn: function (){
  52468. var self=this;
  52469. return $core.withContext(function($ctx1) {
  52470. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  52471. return self;
  52472. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  52473. },
  52474. args: [],
  52475. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  52476. referencedClasses: [],
  52477. messageSends: ["assert:equals:", "asArray"]
  52478. }),
  52479. $globals.StringTest);
  52480. $core.addMethod(
  52481. $core.method({
  52482. selector: "testAsLowerCase",
  52483. protocol: 'tests',
  52484. fn: function (){
  52485. var self=this;
  52486. return $core.withContext(function($ctx1) {
  52487. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  52488. return self;
  52489. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  52490. },
  52491. args: [],
  52492. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  52493. referencedClasses: [],
  52494. messageSends: ["assert:equals:", "asLowercase"]
  52495. }),
  52496. $globals.StringTest);
  52497. $core.addMethod(
  52498. $core.method({
  52499. selector: "testAsNumber",
  52500. protocol: 'tests',
  52501. fn: function (){
  52502. var self=this;
  52503. return $core.withContext(function($ctx1) {
  52504. var $1,$2;
  52505. $1="3"._asNumber();
  52506. $ctx1.sendIdx["asNumber"]=1;
  52507. self._assert_equals_($1,(3));
  52508. $ctx1.sendIdx["assert:equals:"]=1;
  52509. $2="-3"._asNumber();
  52510. $ctx1.sendIdx["asNumber"]=2;
  52511. self._assert_equals_($2,(-3));
  52512. $ctx1.sendIdx["assert:equals:"]=2;
  52513. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  52514. return self;
  52515. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  52516. },
  52517. args: [],
  52518. 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.",
  52519. referencedClasses: [],
  52520. messageSends: ["assert:equals:", "asNumber"]
  52521. }),
  52522. $globals.StringTest);
  52523. $core.addMethod(
  52524. $core.method({
  52525. selector: "testAsUpperCase",
  52526. protocol: 'tests',
  52527. fn: function (){
  52528. var self=this;
  52529. return $core.withContext(function($ctx1) {
  52530. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  52531. return self;
  52532. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  52533. },
  52534. args: [],
  52535. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  52536. referencedClasses: [],
  52537. messageSends: ["assert:equals:", "asUppercase"]
  52538. }),
  52539. $globals.StringTest);
  52540. $core.addMethod(
  52541. $core.method({
  52542. selector: "testAsciiValue",
  52543. protocol: 'tests',
  52544. fn: function (){
  52545. var self=this;
  52546. var characterA,characterU;
  52547. return $core.withContext(function($ctx1) {
  52548. var $1;
  52549. characterA="A";
  52550. characterU="U";
  52551. $1=$recv(characterA)._asciiValue();
  52552. $ctx1.sendIdx["asciiValue"]=1;
  52553. self._assert_equals_($1,(65));
  52554. $ctx1.sendIdx["assert:equals:"]=1;
  52555. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  52556. return self;
  52557. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  52558. },
  52559. args: [],
  52560. 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",
  52561. referencedClasses: [],
  52562. messageSends: ["assert:equals:", "asciiValue"]
  52563. }),
  52564. $globals.StringTest);
  52565. $core.addMethod(
  52566. $core.method({
  52567. selector: "testAtIfAbsentPut",
  52568. protocol: 'tests',
  52569. fn: function (){
  52570. var self=this;
  52571. return $core.withContext(function($ctx1) {
  52572. self._should_raise_((function(){
  52573. return $core.withContext(function($ctx2) {
  52574. return "hello"._at_ifAbsentPut_((6),(function(){
  52575. return "a";
  52576. }));
  52577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52578. }),$globals.Error);
  52579. return self;
  52580. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  52581. },
  52582. args: [],
  52583. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  52584. referencedClasses: ["Error"],
  52585. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  52586. }),
  52587. $globals.StringTest);
  52588. $core.addMethod(
  52589. $core.method({
  52590. selector: "testAtPut",
  52591. protocol: 'tests',
  52592. fn: function (){
  52593. var self=this;
  52594. return $core.withContext(function($ctx1) {
  52595. self._should_raise_((function(){
  52596. return $core.withContext(function($ctx2) {
  52597. return "hello"._at_put_((1),"a");
  52598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52599. }),$globals.Error);
  52600. return self;
  52601. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  52602. },
  52603. args: [],
  52604. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  52605. referencedClasses: ["Error"],
  52606. messageSends: ["should:raise:", "at:put:"]
  52607. }),
  52608. $globals.StringTest);
  52609. $core.addMethod(
  52610. $core.method({
  52611. selector: "testCapitalized",
  52612. protocol: 'tests',
  52613. fn: function (){
  52614. var self=this;
  52615. return $core.withContext(function($ctx1) {
  52616. var $1,$2,$3;
  52617. $1="test"._capitalized();
  52618. $ctx1.sendIdx["capitalized"]=1;
  52619. self._assert_equals_($1,"Test");
  52620. $ctx1.sendIdx["assert:equals:"]=1;
  52621. $2="Test"._capitalized();
  52622. $ctx1.sendIdx["capitalized"]=2;
  52623. self._assert_equals_($2,"Test");
  52624. $ctx1.sendIdx["assert:equals:"]=2;
  52625. self._assert_equals_(""._capitalized(),"");
  52626. $ctx1.sendIdx["assert:equals:"]=3;
  52627. $3="Test"._isCapitalized();
  52628. $ctx1.sendIdx["isCapitalized"]=1;
  52629. self._assert_equals_($3,true);
  52630. $ctx1.sendIdx["assert:equals:"]=4;
  52631. self._assert_equals_("test"._isCapitalized(),false);
  52632. return self;
  52633. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  52634. },
  52635. args: [],
  52636. 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.",
  52637. referencedClasses: [],
  52638. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  52639. }),
  52640. $globals.StringTest);
  52641. $core.addMethod(
  52642. $core.method({
  52643. selector: "testCharCodeAt",
  52644. protocol: 'tests',
  52645. fn: function (){
  52646. var self=this;
  52647. return $core.withContext(function($ctx1) {
  52648. var $1,$2,$3,$4,$5;
  52649. $1="jackie"._charCodeAt_((1));
  52650. $ctx1.sendIdx["charCodeAt:"]=1;
  52651. self._assert_equals_($1,(106));
  52652. $ctx1.sendIdx["assert:equals:"]=1;
  52653. $2="jackie"._charCodeAt_((2));
  52654. $ctx1.sendIdx["charCodeAt:"]=2;
  52655. self._assert_equals_($2,(97));
  52656. $ctx1.sendIdx["assert:equals:"]=2;
  52657. $3="jackie"._charCodeAt_((3));
  52658. $ctx1.sendIdx["charCodeAt:"]=3;
  52659. self._assert_equals_($3,(99));
  52660. $ctx1.sendIdx["assert:equals:"]=3;
  52661. $4="jackie"._charCodeAt_((4));
  52662. $ctx1.sendIdx["charCodeAt:"]=4;
  52663. self._assert_equals_($4,(107));
  52664. $ctx1.sendIdx["assert:equals:"]=4;
  52665. $5="jackie"._charCodeAt_((5));
  52666. $ctx1.sendIdx["charCodeAt:"]=5;
  52667. self._assert_equals_($5,(105));
  52668. $ctx1.sendIdx["assert:equals:"]=5;
  52669. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  52670. return self;
  52671. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  52672. },
  52673. args: [],
  52674. 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",
  52675. referencedClasses: [],
  52676. messageSends: ["assert:equals:", "charCodeAt:"]
  52677. }),
  52678. $globals.StringTest);
  52679. $core.addMethod(
  52680. $core.method({
  52681. selector: "testCopyFromTo",
  52682. protocol: 'tests',
  52683. fn: function (){
  52684. var self=this;
  52685. return $core.withContext(function($ctx1) {
  52686. var $1;
  52687. $1="jackie"._copyFrom_to_((1),(3));
  52688. $ctx1.sendIdx["copyFrom:to:"]=1;
  52689. self._assert_equals_($1,"jac");
  52690. $ctx1.sendIdx["assert:equals:"]=1;
  52691. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  52692. return self;
  52693. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  52694. },
  52695. args: [],
  52696. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  52697. referencedClasses: [],
  52698. messageSends: ["assert:equals:", "copyFrom:to:"]
  52699. }),
  52700. $globals.StringTest);
  52701. $core.addMethod(
  52702. $core.method({
  52703. selector: "testCopySeparates",
  52704. protocol: 'tests',
  52705. fn: function (){
  52706. var self=this;
  52707. return $core.withContext(function($ctx1) {
  52708. var $3,$2,$1;
  52709. $3=self._collection();
  52710. $ctx1.sendIdx["collection"]=1;
  52711. $2=$recv($3)._copy();
  52712. $1=$recv($2).__eq_eq(self._collection());
  52713. self._assert_($1);
  52714. return self;
  52715. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  52716. },
  52717. args: [],
  52718. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  52719. referencedClasses: [],
  52720. messageSends: ["assert:", "==", "copy", "collection"]
  52721. }),
  52722. $globals.StringTest);
  52723. $core.addMethod(
  52724. $core.method({
  52725. selector: "testCopyWithoutAll",
  52726. protocol: 'tests',
  52727. fn: function (){
  52728. var self=this;
  52729. return $core.withContext(function($ctx1) {
  52730. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  52731. return self;
  52732. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  52733. },
  52734. args: [],
  52735. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  52736. referencedClasses: [],
  52737. messageSends: ["assert:equals:", "copyWithoutAll:"]
  52738. }),
  52739. $globals.StringTest);
  52740. $core.addMethod(
  52741. $core.method({
  52742. selector: "testEquality",
  52743. protocol: 'tests',
  52744. fn: function (){
  52745. var self=this;
  52746. return $core.withContext(function($ctx1) {
  52747. var $1,$2,$3;
  52748. self._assert_equals_("hello","hello");
  52749. $ctx1.sendIdx["assert:equals:"]=1;
  52750. $1="hello".__eq("world");
  52751. $ctx1.sendIdx["="]=1;
  52752. self._deny_($1);
  52753. $ctx1.sendIdx["deny:"]=1;
  52754. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  52755. })));
  52756. $ctx1.sendIdx["="]=2;
  52757. self._deny_($2);
  52758. $ctx1.sendIdx["deny:"]=2;
  52759. $3="hello"._yourself();
  52760. $ctx1.sendIdx["yourself"]=1;
  52761. self._assert_equals_("hello",$3);
  52762. $ctx1.sendIdx["assert:equals:"]=2;
  52763. self._assert_equals_("hello"._yourself(),"hello");
  52764. self._deny_("".__eq((0)));
  52765. return self;
  52766. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  52767. },
  52768. args: [],
  52769. 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",
  52770. referencedClasses: [],
  52771. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  52772. }),
  52773. $globals.StringTest);
  52774. $core.addMethod(
  52775. $core.method({
  52776. selector: "testIdentity",
  52777. protocol: 'tests',
  52778. fn: function (){
  52779. var self=this;
  52780. return $core.withContext(function($ctx1) {
  52781. var $1,$2,$4,$3,$5;
  52782. $1="hello".__eq_eq("hello");
  52783. $ctx1.sendIdx["=="]=1;
  52784. self._assert_($1);
  52785. $ctx1.sendIdx["assert:"]=1;
  52786. $2="hello".__eq_eq("world");
  52787. $ctx1.sendIdx["=="]=2;
  52788. self._deny_($2);
  52789. $ctx1.sendIdx["deny:"]=1;
  52790. $4="hello"._yourself();
  52791. $ctx1.sendIdx["yourself"]=1;
  52792. $3="hello".__eq_eq($4);
  52793. $ctx1.sendIdx["=="]=3;
  52794. self._assert_($3);
  52795. $ctx1.sendIdx["assert:"]=2;
  52796. $5=$recv("hello"._yourself()).__eq_eq("hello");
  52797. $ctx1.sendIdx["=="]=4;
  52798. self._assert_($5);
  52799. self._deny_("".__eq_eq((0)));
  52800. return self;
  52801. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  52802. },
  52803. args: [],
  52804. 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",
  52805. referencedClasses: [],
  52806. messageSends: ["assert:", "==", "deny:", "yourself"]
  52807. }),
  52808. $globals.StringTest);
  52809. $core.addMethod(
  52810. $core.method({
  52811. selector: "testIncludesSubString",
  52812. protocol: 'tests',
  52813. fn: function (){
  52814. var self=this;
  52815. return $core.withContext(function($ctx1) {
  52816. var $1;
  52817. $1="amber"._includesSubString_("ber");
  52818. $ctx1.sendIdx["includesSubString:"]=1;
  52819. self._assert_($1);
  52820. self._deny_("amber"._includesSubString_("zork"));
  52821. return self;
  52822. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  52823. },
  52824. args: [],
  52825. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  52826. referencedClasses: [],
  52827. messageSends: ["assert:", "includesSubString:", "deny:"]
  52828. }),
  52829. $globals.StringTest);
  52830. $core.addMethod(
  52831. $core.method({
  52832. selector: "testIndexOfStartingAtWithNull",
  52833. protocol: 'tests',
  52834. fn: function (){
  52835. var self=this;
  52836. return self;
  52837. },
  52838. args: [],
  52839. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52840. referencedClasses: [],
  52841. messageSends: []
  52842. }),
  52843. $globals.StringTest);
  52844. $core.addMethod(
  52845. $core.method({
  52846. selector: "testIndexOfWithNull",
  52847. protocol: 'tests',
  52848. fn: function (){
  52849. var self=this;
  52850. return self;
  52851. },
  52852. args: [],
  52853. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52854. referencedClasses: [],
  52855. messageSends: []
  52856. }),
  52857. $globals.StringTest);
  52858. $core.addMethod(
  52859. $core.method({
  52860. selector: "testIsVowel",
  52861. protocol: 'tests',
  52862. fn: function (){
  52863. var self=this;
  52864. var vowel,consonant;
  52865. return $core.withContext(function($ctx1) {
  52866. var $1;
  52867. vowel="u";
  52868. consonant="z";
  52869. $1=$recv(vowel)._isVowel();
  52870. $ctx1.sendIdx["isVowel"]=1;
  52871. self._assert_equals_($1,true);
  52872. $ctx1.sendIdx["assert:equals:"]=1;
  52873. self._assert_equals_($recv(consonant)._isVowel(),false);
  52874. return self;
  52875. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  52876. },
  52877. args: [],
  52878. 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",
  52879. referencedClasses: [],
  52880. messageSends: ["assert:equals:", "isVowel"]
  52881. }),
  52882. $globals.StringTest);
  52883. $core.addMethod(
  52884. $core.method({
  52885. selector: "testJoin",
  52886. protocol: 'tests',
  52887. fn: function (){
  52888. var self=this;
  52889. return $core.withContext(function($ctx1) {
  52890. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  52891. return self;
  52892. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  52893. },
  52894. args: [],
  52895. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  52896. referencedClasses: [],
  52897. messageSends: ["assert:equals:", "join:"]
  52898. }),
  52899. $globals.StringTest);
  52900. $core.addMethod(
  52901. $core.method({
  52902. selector: "testRemoveAll",
  52903. protocol: 'tests',
  52904. fn: function (){
  52905. var self=this;
  52906. return $core.withContext(function($ctx1) {
  52907. self._should_raise_((function(){
  52908. return $core.withContext(function($ctx2) {
  52909. return $recv(self._collection())._removeAll();
  52910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52911. }),$globals.Error);
  52912. return self;
  52913. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  52914. },
  52915. args: [],
  52916. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  52917. referencedClasses: ["Error"],
  52918. messageSends: ["should:raise:", "removeAll", "collection"]
  52919. }),
  52920. $globals.StringTest);
  52921. $core.addMethod(
  52922. $core.method({
  52923. selector: "testReversed",
  52924. protocol: 'tests',
  52925. fn: function (){
  52926. var self=this;
  52927. return $core.withContext(function($ctx1) {
  52928. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  52929. return self;
  52930. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  52931. },
  52932. args: [],
  52933. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  52934. referencedClasses: [],
  52935. messageSends: ["assert:equals:", "reversed"]
  52936. }),
  52937. $globals.StringTest);
  52938. $core.addMethod(
  52939. $core.method({
  52940. selector: "testStreamContents",
  52941. protocol: 'tests',
  52942. fn: function (){
  52943. var self=this;
  52944. return $core.withContext(function($ctx1) {
  52945. self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  52946. return $core.withContext(function($ctx2) {
  52947. $recv(aStream)._nextPutAll_("hello");
  52948. $ctx2.sendIdx["nextPutAll:"]=1;
  52949. $recv(aStream)._space();
  52950. return $recv(aStream)._nextPutAll_("world");
  52951. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  52952. })),"hello world");
  52953. return self;
  52954. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  52955. },
  52956. args: [],
  52957. 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'",
  52958. referencedClasses: ["String"],
  52959. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  52960. }),
  52961. $globals.StringTest);
  52962. $core.addMethod(
  52963. $core.method({
  52964. selector: "testSubStrings",
  52965. protocol: 'tests',
  52966. fn: function (){
  52967. var self=this;
  52968. return $core.withContext(function($ctx1) {
  52969. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  52970. return self;
  52971. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  52972. },
  52973. args: [],
  52974. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  52975. referencedClasses: [],
  52976. messageSends: ["assert:equals:", "subStrings:"]
  52977. }),
  52978. $globals.StringTest);
  52979. $core.addMethod(
  52980. $core.method({
  52981. selector: "testTrim",
  52982. protocol: 'tests',
  52983. fn: function (){
  52984. var self=this;
  52985. return $core.withContext(function($ctx1) {
  52986. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  52987. $ctx1.sendIdx["assert:equals:"]=1;
  52988. self._assert_equals_("jackie "._trimRight(),"jackie");
  52989. return self;
  52990. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  52991. },
  52992. args: [],
  52993. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  52994. referencedClasses: [],
  52995. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  52996. }),
  52997. $globals.StringTest);
  52998. $core.addMethod(
  52999. $core.method({
  53000. selector: "testValue",
  53001. protocol: 'tests',
  53002. fn: function (){
  53003. var self=this;
  53004. return $core.withContext(function($ctx1) {
  53005. self._assert_equals_("asString"._value_((1)),"1");
  53006. $ctx1.sendIdx["assert:equals:"]=1;
  53007. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  53008. return self;
  53009. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  53010. },
  53011. args: [],
  53012. 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')",
  53013. referencedClasses: [],
  53014. messageSends: ["assert:equals:", "value:", "collect:"]
  53015. }),
  53016. $globals.StringTest);
  53017. $core.addMethod(
  53018. $core.method({
  53019. selector: "collectionClass",
  53020. protocol: 'fixture',
  53021. fn: function (){
  53022. var self=this;
  53023. return $globals.String;
  53024. },
  53025. args: [],
  53026. source: "collectionClass\x0a\x09^ String",
  53027. referencedClasses: ["String"],
  53028. messageSends: []
  53029. }),
  53030. $globals.StringTest.klass);
  53031. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  53032. $core.addMethod(
  53033. $core.method({
  53034. selector: "collection",
  53035. protocol: 'fixture',
  53036. fn: function (){
  53037. var self=this;
  53038. return $core.withContext(function($ctx1) {
  53039. var $1;
  53040. $1=$recv($globals.Set)._new();
  53041. $recv($1)._add_($globals.Smalltalk);
  53042. $ctx1.sendIdx["add:"]=1;
  53043. $recv($1)._add_(nil);
  53044. $ctx1.sendIdx["add:"]=2;
  53045. $recv($1)._add_((3).__at((3)));
  53046. $ctx1.sendIdx["add:"]=3;
  53047. $recv($1)._add_(false);
  53048. $ctx1.sendIdx["add:"]=4;
  53049. $recv($1)._add_(self["@sampleBlock"]);
  53050. return $recv($1)._yourself();
  53051. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  53052. },
  53053. args: [],
  53054. 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",
  53055. referencedClasses: ["Set", "Smalltalk"],
  53056. messageSends: ["add:", "new", "@", "yourself"]
  53057. }),
  53058. $globals.SetTest);
  53059. $core.addMethod(
  53060. $core.method({
  53061. selector: "collectionOfPrintStrings",
  53062. protocol: 'fixture',
  53063. fn: function (){
  53064. var self=this;
  53065. return $core.withContext(function($ctx1) {
  53066. var $1;
  53067. $1=$recv($globals.Set)._new();
  53068. $recv($1)._add_("a SmalltalkImage");
  53069. $ctx1.sendIdx["add:"]=1;
  53070. $recv($1)._add_("nil");
  53071. $ctx1.sendIdx["add:"]=2;
  53072. $recv($1)._add_("3@3");
  53073. $ctx1.sendIdx["add:"]=3;
  53074. $recv($1)._add_("false");
  53075. $ctx1.sendIdx["add:"]=4;
  53076. $recv($1)._add_("a BlockClosure");
  53077. return $recv($1)._yourself();
  53078. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  53079. },
  53080. args: [],
  53081. 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",
  53082. referencedClasses: ["Set"],
  53083. messageSends: ["add:", "new", "yourself"]
  53084. }),
  53085. $globals.SetTest);
  53086. $core.addMethod(
  53087. $core.method({
  53088. selector: "collectionSize",
  53089. protocol: 'fixture',
  53090. fn: function (){
  53091. var self=this;
  53092. return (5);
  53093. },
  53094. args: [],
  53095. source: "collectionSize\x0a\x09^ 5",
  53096. referencedClasses: [],
  53097. messageSends: []
  53098. }),
  53099. $globals.SetTest);
  53100. $core.addMethod(
  53101. $core.method({
  53102. selector: "collectionWithDuplicates",
  53103. protocol: 'fixture',
  53104. fn: function (){
  53105. var self=this;
  53106. return $core.withContext(function($ctx1) {
  53107. var $1;
  53108. $1=self._collection();
  53109. $recv($1)._add_((0));
  53110. return $recv($1)._yourself();
  53111. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  53112. },
  53113. args: [],
  53114. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  53115. referencedClasses: [],
  53116. messageSends: ["add:", "collection", "yourself"]
  53117. }),
  53118. $globals.SetTest);
  53119. $core.addMethod(
  53120. $core.method({
  53121. selector: "collectionWithNewValue",
  53122. protocol: 'fixture',
  53123. fn: function (){
  53124. var self=this;
  53125. return $core.withContext(function($ctx1) {
  53126. var $1;
  53127. $1=$recv($globals.Set)._new();
  53128. $recv($1)._add_($globals.Smalltalk);
  53129. $ctx1.sendIdx["add:"]=1;
  53130. $recv($1)._add_(nil);
  53131. $ctx1.sendIdx["add:"]=2;
  53132. $recv($1)._add_((3).__at((3)));
  53133. $ctx1.sendIdx["add:"]=3;
  53134. $recv($1)._add_("N");
  53135. $ctx1.sendIdx["add:"]=4;
  53136. $recv($1)._add_(false);
  53137. $ctx1.sendIdx["add:"]=5;
  53138. $recv($1)._add_(self["@sampleBlock"]);
  53139. return $recv($1)._yourself();
  53140. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  53141. },
  53142. args: [],
  53143. 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",
  53144. referencedClasses: ["Set", "Smalltalk"],
  53145. messageSends: ["add:", "new", "@", "yourself"]
  53146. }),
  53147. $globals.SetTest);
  53148. $core.addMethod(
  53149. $core.method({
  53150. selector: "testAddAll",
  53151. protocol: 'tests',
  53152. fn: function (){
  53153. var self=this;
  53154. return $core.withContext(function($ctx1) {
  53155. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  53156. (
  53157. $ctx1.supercall = true,
  53158. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  53159. $ctx1.supercall = false;
  53160. $2=self._collection();
  53161. $ctx1.sendIdx["collection"]=1;
  53162. $3=self._collection();
  53163. $ctx1.sendIdx["collection"]=2;
  53164. $recv($2)._addAll_($3);
  53165. $ctx1.sendIdx["addAll:"]=1;
  53166. $4=$recv($2)._yourself();
  53167. $ctx1.sendIdx["yourself"]=1;
  53168. $1=$4;
  53169. $5=self._collection();
  53170. $ctx1.sendIdx["collection"]=3;
  53171. self._assert_equals_($1,$5);
  53172. $ctx1.sendIdx["assert:equals:"]=1;
  53173. $7=self._collection();
  53174. $ctx1.sendIdx["collection"]=4;
  53175. $8=self._collectionWithNewValue();
  53176. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53177. $recv($7)._addAll_($8);
  53178. $ctx1.sendIdx["addAll:"]=2;
  53179. $9=$recv($7)._yourself();
  53180. $ctx1.sendIdx["yourself"]=2;
  53181. $6=$9;
  53182. $10=self._collectionWithNewValue();
  53183. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53184. self._assert_equals_($6,$10);
  53185. $ctx1.sendIdx["assert:equals:"]=2;
  53186. $12=self._collectionWithNewValue();
  53187. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53188. $recv($12)._addAll_(self._collection());
  53189. $11=$recv($12)._yourself();
  53190. self._assert_equals_($11,self._collectionWithNewValue());
  53191. return self;
  53192. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  53193. },
  53194. args: [],
  53195. 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",
  53196. referencedClasses: [],
  53197. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  53198. }),
  53199. $globals.SetTest);
  53200. $core.addMethod(
  53201. $core.method({
  53202. selector: "testAddRemove",
  53203. protocol: 'tests',
  53204. fn: function (){
  53205. var self=this;
  53206. var set;
  53207. return $core.withContext(function($ctx1) {
  53208. var $1,$2;
  53209. set=$recv($globals.Set)._new();
  53210. self._assert_($recv(set)._isEmpty());
  53211. $ctx1.sendIdx["assert:"]=1;
  53212. $recv(set)._add_((3));
  53213. $ctx1.sendIdx["add:"]=1;
  53214. $1=$recv(set)._includes_((3));
  53215. $ctx1.sendIdx["includes:"]=1;
  53216. self._assert_($1);
  53217. $ctx1.sendIdx["assert:"]=2;
  53218. $recv(set)._add_((5));
  53219. $2=$recv(set)._includes_((5));
  53220. $ctx1.sendIdx["includes:"]=2;
  53221. self._assert_($2);
  53222. $recv(set)._remove_((3));
  53223. self._deny_($recv(set)._includes_((3)));
  53224. return self;
  53225. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  53226. },
  53227. args: [],
  53228. 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)",
  53229. referencedClasses: ["Set"],
  53230. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  53231. }),
  53232. $globals.SetTest);
  53233. $core.addMethod(
  53234. $core.method({
  53235. selector: "testAt",
  53236. protocol: 'tests',
  53237. fn: function (){
  53238. var self=this;
  53239. return $core.withContext(function($ctx1) {
  53240. self._should_raise_((function(){
  53241. return $core.withContext(function($ctx2) {
  53242. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  53243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53244. }),$globals.Error);
  53245. return self;
  53246. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  53247. },
  53248. args: [],
  53249. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  53250. referencedClasses: ["Set", "Error"],
  53251. messageSends: ["should:raise:", "at:put:", "new"]
  53252. }),
  53253. $globals.SetTest);
  53254. $core.addMethod(
  53255. $core.method({
  53256. selector: "testCollect",
  53257. protocol: 'tests',
  53258. fn: function (){
  53259. var self=this;
  53260. return $core.withContext(function($ctx1) {
  53261. var $2,$1;
  53262. (
  53263. $ctx1.supercall = true,
  53264. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($recv(self), []));
  53265. $ctx1.supercall = false;
  53266. $2=[(5), (6), (8)]._asSet();
  53267. $ctx1.sendIdx["asSet"]=1;
  53268. $1=$recv($2)._collect_((function(x){
  53269. return $core.withContext(function($ctx2) {
  53270. return $recv(x).__backslash_backslash((3));
  53271. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53272. }));
  53273. self._assert_equals_($1,[(0), (2)]._asSet());
  53274. return self;
  53275. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  53276. },
  53277. args: [],
  53278. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  53279. referencedClasses: [],
  53280. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  53281. }),
  53282. $globals.SetTest);
  53283. $core.addMethod(
  53284. $core.method({
  53285. selector: "testComma",
  53286. protocol: 'tests',
  53287. fn: function (){
  53288. var self=this;
  53289. return $core.withContext(function($ctx1) {
  53290. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  53291. (
  53292. $ctx1.supercall = true,
  53293. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  53294. $ctx1.supercall = false;
  53295. $2=self._collection();
  53296. $ctx1.sendIdx["collection"]=1;
  53297. $3=self._collection();
  53298. $ctx1.sendIdx["collection"]=2;
  53299. $1=$recv($2).__comma($3);
  53300. $ctx1.sendIdx[","]=1;
  53301. $4=self._collection();
  53302. $ctx1.sendIdx["collection"]=3;
  53303. self._assert_equals_($1,$4);
  53304. $ctx1.sendIdx["assert:equals:"]=1;
  53305. $6=self._collection();
  53306. $ctx1.sendIdx["collection"]=4;
  53307. $7=self._collectionWithNewValue();
  53308. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53309. $5=$recv($6).__comma($7);
  53310. $ctx1.sendIdx[","]=2;
  53311. $8=self._collectionWithNewValue();
  53312. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53313. self._assert_equals_($5,$8);
  53314. $ctx1.sendIdx["assert:equals:"]=2;
  53315. $10=self._collectionWithNewValue();
  53316. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53317. $9=$recv($10).__comma(self._collection());
  53318. self._assert_equals_($9,self._collectionWithNewValue());
  53319. return self;
  53320. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  53321. },
  53322. args: [],
  53323. 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",
  53324. referencedClasses: [],
  53325. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  53326. }),
  53327. $globals.SetTest);
  53328. $core.addMethod(
  53329. $core.method({
  53330. selector: "testComparing",
  53331. protocol: 'tests',
  53332. fn: function (){
  53333. var self=this;
  53334. return $core.withContext(function($ctx1) {
  53335. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  53336. $1=[(0), (2)]._asSet();
  53337. $ctx1.sendIdx["asSet"]=1;
  53338. $2=[(0), (2)]._asSet();
  53339. $ctx1.sendIdx["asSet"]=2;
  53340. self._assert_equals_($1,$2);
  53341. $ctx1.sendIdx["assert:equals:"]=1;
  53342. $3=[(2), (0)]._asSet();
  53343. $ctx1.sendIdx["asSet"]=3;
  53344. $4=[(0), (2)]._asSet();
  53345. $ctx1.sendIdx["asSet"]=4;
  53346. self._assert_equals_($3,$4);
  53347. $6=[(0), (2), (3)]._asSet();
  53348. $ctx1.sendIdx["asSet"]=5;
  53349. $7=[(0), (2)]._asSet();
  53350. $ctx1.sendIdx["asSet"]=6;
  53351. $5=$recv($6).__eq($7);
  53352. $ctx1.sendIdx["="]=1;
  53353. self._deny_($5);
  53354. $ctx1.sendIdx["deny:"]=1;
  53355. $9=[(1), (2)]._asSet();
  53356. $ctx1.sendIdx["asSet"]=7;
  53357. $8=$recv($9).__eq([(0), (2)]._asSet());
  53358. self._deny_($8);
  53359. return self;
  53360. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  53361. },
  53362. args: [],
  53363. 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",
  53364. referencedClasses: [],
  53365. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  53366. }),
  53367. $globals.SetTest);
  53368. $core.addMethod(
  53369. $core.method({
  53370. selector: "testPrintString",
  53371. protocol: 'tests',
  53372. fn: function (){
  53373. var self=this;
  53374. var set;
  53375. return $core.withContext(function($ctx1) {
  53376. var $1,$2,$3,$4,$5,$6,$7,$8;
  53377. set=$recv($globals.Set)._new();
  53378. $1=$recv(set)._printString();
  53379. $ctx1.sendIdx["printString"]=1;
  53380. self._assert_equals_($1,"a Set ()");
  53381. $ctx1.sendIdx["assert:equals:"]=1;
  53382. $2=set;
  53383. $recv($2)._add_((1));
  53384. $ctx1.sendIdx["add:"]=1;
  53385. $3=$recv($2)._add_((3));
  53386. $ctx1.sendIdx["add:"]=2;
  53387. $4=$recv(set)._printString();
  53388. $ctx1.sendIdx["printString"]=2;
  53389. self._assert_equals_($4,"a Set (1 3)");
  53390. $ctx1.sendIdx["assert:equals:"]=2;
  53391. $recv(set)._add_("foo");
  53392. $ctx1.sendIdx["add:"]=3;
  53393. $5=$recv(set)._printString();
  53394. $ctx1.sendIdx["printString"]=3;
  53395. self._assert_equals_($5,"a Set (1 3 'foo')");
  53396. $ctx1.sendIdx["assert:equals:"]=3;
  53397. $6=set;
  53398. $recv($6)._remove_((1));
  53399. $ctx1.sendIdx["remove:"]=1;
  53400. $recv($6)._remove_((3));
  53401. $7=$recv(set)._printString();
  53402. $ctx1.sendIdx["printString"]=4;
  53403. self._assert_equals_($7,"a Set ('foo')");
  53404. $ctx1.sendIdx["assert:equals:"]=4;
  53405. $recv(set)._add_((3));
  53406. $ctx1.sendIdx["add:"]=4;
  53407. $8=$recv(set)._printString();
  53408. $ctx1.sendIdx["printString"]=5;
  53409. self._assert_equals_($8,"a Set (3 'foo')");
  53410. $ctx1.sendIdx["assert:equals:"]=5;
  53411. $recv(set)._add_((3));
  53412. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  53413. return self;
  53414. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  53415. },
  53416. args: [],
  53417. 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'')'",
  53418. referencedClasses: ["Set"],
  53419. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  53420. }),
  53421. $globals.SetTest);
  53422. $core.addMethod(
  53423. $core.method({
  53424. selector: "testUnboxedObjects",
  53425. protocol: 'tests',
  53426. fn: function (){
  53427. var self=this;
  53428. return $core.withContext(function($ctx1) {
  53429. var $4,$3,$2,$1;
  53430. $4="foo"._yourself();
  53431. $ctx1.sendIdx["yourself"]=1;
  53432. $3=[$4,"foo"._yourself()];
  53433. $2=$recv($3)._asSet();
  53434. $1=$recv($2)._asArray();
  53435. self._assert_equals_($1,["foo"]);
  53436. return self;
  53437. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  53438. },
  53439. args: [],
  53440. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  53441. referencedClasses: [],
  53442. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  53443. }),
  53444. $globals.SetTest);
  53445. $core.addMethod(
  53446. $core.method({
  53447. selector: "testUnicity",
  53448. protocol: 'tests',
  53449. fn: function (){
  53450. var self=this;
  53451. var set;
  53452. return $core.withContext(function($ctx1) {
  53453. var $1;
  53454. set=$recv($globals.Set)._new();
  53455. $recv(set)._add_((21));
  53456. $ctx1.sendIdx["add:"]=1;
  53457. $recv(set)._add_("hello");
  53458. $ctx1.sendIdx["add:"]=2;
  53459. $recv(set)._add_((21));
  53460. $ctx1.sendIdx["add:"]=3;
  53461. $1=$recv(set)._size();
  53462. $ctx1.sendIdx["size"]=1;
  53463. self._assert_equals_($1,(2));
  53464. $ctx1.sendIdx["assert:equals:"]=1;
  53465. $recv(set)._add_("hello");
  53466. self._assert_equals_($recv(set)._size(),(2));
  53467. $ctx1.sendIdx["assert:equals:"]=2;
  53468. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  53469. return self;
  53470. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  53471. },
  53472. args: [],
  53473. 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')",
  53474. referencedClasses: ["Set"],
  53475. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  53476. }),
  53477. $globals.SetTest);
  53478. $core.addMethod(
  53479. $core.method({
  53480. selector: "collectionClass",
  53481. protocol: 'fixture',
  53482. fn: function (){
  53483. var self=this;
  53484. return $globals.Set;
  53485. },
  53486. args: [],
  53487. source: "collectionClass\x0a\x09^ Set",
  53488. referencedClasses: ["Set"],
  53489. messageSends: []
  53490. }),
  53491. $globals.SetTest.klass);
  53492. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  53493. $core.addMethod(
  53494. $core.method({
  53495. selector: "testShow",
  53496. protocol: 'tests',
  53497. fn: function (){
  53498. var self=this;
  53499. var originalTranscript;
  53500. return $core.withContext(function($ctx1) {
  53501. originalTranscript=$recv($globals.Transcript)._current();
  53502. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  53503. $ctx1.sendIdx["register:"]=1;
  53504. self._shouldnt_raise_((function(){
  53505. return $core.withContext(function($ctx2) {
  53506. return $recv($globals.Transcript)._show_("Hello console!");
  53507. $ctx2.sendIdx["show:"]=1;
  53508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53509. }),$globals.Error);
  53510. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53511. self._shouldnt_raise_((function(){
  53512. return $core.withContext(function($ctx2) {
  53513. return $recv($globals.Transcript)._show_(console);
  53514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53515. }),$globals.Error);
  53516. $recv($globals.Transcript)._register_(originalTranscript);
  53517. return self;
  53518. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  53519. },
  53520. args: [],
  53521. 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.",
  53522. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  53523. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  53524. }),
  53525. $globals.ConsoleTranscriptTest);
  53526. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  53527. $core.addMethod(
  53528. $core.method({
  53529. selector: "testEquality",
  53530. protocol: 'tests',
  53531. fn: function (){
  53532. var self=this;
  53533. var now;
  53534. return $core.withContext(function($ctx1) {
  53535. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53536. now=$recv($globals.Date)._new();
  53537. $1=$recv(now).__eq(now);
  53538. $ctx1.sendIdx["="]=1;
  53539. self._assert_($1);
  53540. $ctx1.sendIdx["assert:"]=1;
  53541. $3=now;
  53542. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53543. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53544. $2=$recv($3).__eq($4);
  53545. $ctx1.sendIdx["="]=2;
  53546. self._deny_($2);
  53547. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53548. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53549. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53550. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53551. $5=$recv($6).__eq($7);
  53552. $ctx1.sendIdx["="]=3;
  53553. self._assert_($5);
  53554. $ctx1.sendIdx["assert:"]=2;
  53555. $9=now;
  53556. $11=$recv(now)._asMilliseconds();
  53557. $ctx1.sendIdx["asMilliseconds"]=1;
  53558. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53559. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53560. $8=$recv($9).__eq($10);
  53561. $ctx1.sendIdx["="]=4;
  53562. self._assert_($8);
  53563. $ctx1.sendIdx["assert:"]=3;
  53564. self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  53565. return self;
  53566. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  53567. },
  53568. args: [],
  53569. 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",
  53570. referencedClasses: ["Date"],
  53571. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53572. }),
  53573. $globals.DateTest);
  53574. $core.addMethod(
  53575. $core.method({
  53576. selector: "testIdentity",
  53577. protocol: 'tests',
  53578. fn: function (){
  53579. var self=this;
  53580. var now;
  53581. return $core.withContext(function($ctx1) {
  53582. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53583. now=$recv($globals.Date)._new();
  53584. $1=$recv(now).__eq_eq(now);
  53585. $ctx1.sendIdx["=="]=1;
  53586. self._assert_($1);
  53587. $3=now;
  53588. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53589. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53590. $2=$recv($3).__eq_eq($4);
  53591. $ctx1.sendIdx["=="]=2;
  53592. self._deny_($2);
  53593. $ctx1.sendIdx["deny:"]=1;
  53594. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53595. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53596. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53597. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53598. $5=$recv($6).__eq_eq($7);
  53599. $ctx1.sendIdx["=="]=3;
  53600. self._deny_($5);
  53601. $ctx1.sendIdx["deny:"]=2;
  53602. $9=now;
  53603. $11=$recv(now)._asMilliseconds();
  53604. $ctx1.sendIdx["asMilliseconds"]=1;
  53605. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53606. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53607. $8=$recv($9).__eq_eq($10);
  53608. $ctx1.sendIdx["=="]=4;
  53609. self._deny_($8);
  53610. $ctx1.sendIdx["deny:"]=3;
  53611. self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  53612. return self;
  53613. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  53614. },
  53615. args: [],
  53616. 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",
  53617. referencedClasses: ["Date"],
  53618. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53619. }),
  53620. $globals.DateTest);
  53621. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  53622. $core.addMethod(
  53623. $core.method({
  53624. selector: "jsNull",
  53625. protocol: 'accessing',
  53626. fn: function (){
  53627. var self=this;
  53628. return $core.withContext(function($ctx1) {
  53629. return null;
  53630. return self;
  53631. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  53632. },
  53633. args: [],
  53634. source: "jsNull\x0a\x09<inlineJS: 'return null'>",
  53635. referencedClasses: [],
  53636. messageSends: []
  53637. }),
  53638. $globals.JSObjectProxyTest);
  53639. $core.addMethod(
  53640. $core.method({
  53641. selector: "jsObject",
  53642. protocol: 'accessing',
  53643. fn: function (){
  53644. var self=this;
  53645. return $core.withContext(function($ctx1) {
  53646. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  53647. return self;
  53648. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  53649. },
  53650. args: [],
  53651. 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}'>",
  53652. referencedClasses: [],
  53653. messageSends: []
  53654. }),
  53655. $globals.JSObjectProxyTest);
  53656. $core.addMethod(
  53657. $core.method({
  53658. selector: "jsUndefined",
  53659. protocol: 'accessing',
  53660. fn: function (){
  53661. var self=this;
  53662. return $core.withContext(function($ctx1) {
  53663. return;
  53664. return self;
  53665. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  53666. },
  53667. args: [],
  53668. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  53669. referencedClasses: [],
  53670. messageSends: []
  53671. }),
  53672. $globals.JSObjectProxyTest);
  53673. $core.addMethod(
  53674. $core.method({
  53675. selector: "testAtIfAbsent",
  53676. protocol: 'tests',
  53677. fn: function (){
  53678. var self=this;
  53679. var testObject;
  53680. return $core.withContext(function($ctx1) {
  53681. var $1,$2,$3;
  53682. testObject=self._jsObject();
  53683. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  53684. return "Property does not exist";
  53685. }));
  53686. $ctx1.sendIdx["at:ifAbsent:"]=1;
  53687. self._assert_equals_($1,"Property does not exist");
  53688. $ctx1.sendIdx["assert:equals:"]=1;
  53689. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  53690. return "Property does not exist";
  53691. }));
  53692. $ctx1.sendIdx["at:ifAbsent:"]=2;
  53693. self._assert_equals_($2,nil);
  53694. $ctx1.sendIdx["assert:equals:"]=2;
  53695. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  53696. return "Property does not exist";
  53697. }));
  53698. $ctx1.sendIdx["at:ifAbsent:"]=3;
  53699. self._assert_equals_($3,(1));
  53700. $ctx1.sendIdx["assert:equals:"]=3;
  53701. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  53702. return "Property does not exist";
  53703. })),nil);
  53704. return self;
  53705. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53706. },
  53707. args: [],
  53708. 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.",
  53709. referencedClasses: [],
  53710. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  53711. }),
  53712. $globals.JSObjectProxyTest);
  53713. $core.addMethod(
  53714. $core.method({
  53715. selector: "testAtIfPresent",
  53716. protocol: 'tests',
  53717. fn: function (){
  53718. var self=this;
  53719. var testObject;
  53720. return $core.withContext(function($ctx1) {
  53721. var $2,$1,$4,$3,$6,$5;
  53722. testObject=self._jsObject();
  53723. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  53724. return $core.withContext(function($ctx2) {
  53725. $2=$recv(x)._asString();
  53726. $ctx2.sendIdx["asString"]=1;
  53727. return "hello ".__comma($2);
  53728. $ctx2.sendIdx[","]=1;
  53729. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53730. }));
  53731. $ctx1.sendIdx["at:ifPresent:"]=1;
  53732. self._assert_equals_($1,nil);
  53733. $ctx1.sendIdx["assert:equals:"]=1;
  53734. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  53735. return $core.withContext(function($ctx2) {
  53736. $4=$recv(x)._asString();
  53737. $ctx2.sendIdx["asString"]=2;
  53738. return "hello ".__comma($4);
  53739. $ctx2.sendIdx[","]=2;
  53740. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  53741. }));
  53742. $ctx1.sendIdx["at:ifPresent:"]=2;
  53743. self._assert_equals_($3,"hello nil");
  53744. $ctx1.sendIdx["assert:equals:"]=2;
  53745. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  53746. return $core.withContext(function($ctx2) {
  53747. $6=$recv(x)._asString();
  53748. $ctx2.sendIdx["asString"]=3;
  53749. return "hello ".__comma($6);
  53750. $ctx2.sendIdx[","]=3;
  53751. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53752. }));
  53753. $ctx1.sendIdx["at:ifPresent:"]=3;
  53754. self._assert_equals_($5,"hello 1");
  53755. $ctx1.sendIdx["assert:equals:"]=3;
  53756. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  53757. return $core.withContext(function($ctx2) {
  53758. return "hello ".__comma($recv(x)._asString());
  53759. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  53760. })),"hello nil");
  53761. return self;
  53762. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53763. },
  53764. args: [],
  53765. 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'.",
  53766. referencedClasses: [],
  53767. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  53768. }),
  53769. $globals.JSObjectProxyTest);
  53770. $core.addMethod(
  53771. $core.method({
  53772. selector: "testAtIfPresentIfAbsent",
  53773. protocol: 'tests',
  53774. fn: function (){
  53775. var self=this;
  53776. var testObject;
  53777. return $core.withContext(function($ctx1) {
  53778. var $2,$1,$4,$3,$6,$5;
  53779. testObject=self._jsObject();
  53780. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  53781. return $core.withContext(function($ctx2) {
  53782. $2=$recv(x)._asString();
  53783. $ctx2.sendIdx["asString"]=1;
  53784. return "hello ".__comma($2);
  53785. $ctx2.sendIdx[","]=1;
  53786. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53787. }),(function(){
  53788. return "not present";
  53789. }));
  53790. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53791. self._assert_equals_($1,"not present");
  53792. $ctx1.sendIdx["assert:equals:"]=1;
  53793. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  53794. return $core.withContext(function($ctx2) {
  53795. $4=$recv(x)._asString();
  53796. $ctx2.sendIdx["asString"]=2;
  53797. return "hello ".__comma($4);
  53798. $ctx2.sendIdx[","]=2;
  53799. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53800. }),(function(){
  53801. return "not present";
  53802. }));
  53803. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  53804. self._assert_equals_($3,"hello nil");
  53805. $ctx1.sendIdx["assert:equals:"]=2;
  53806. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  53807. return $core.withContext(function($ctx2) {
  53808. $6=$recv(x)._asString();
  53809. $ctx2.sendIdx["asString"]=3;
  53810. return "hello ".__comma($6);
  53811. $ctx2.sendIdx[","]=3;
  53812. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  53813. }),(function(){
  53814. return "not present";
  53815. }));
  53816. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  53817. self._assert_equals_($5,"hello 1");
  53818. $ctx1.sendIdx["assert:equals:"]=3;
  53819. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  53820. return $core.withContext(function($ctx2) {
  53821. return "hello ".__comma($recv(x)._asString());
  53822. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  53823. }),(function(){
  53824. return "not present";
  53825. })),"hello nil");
  53826. return self;
  53827. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53828. },
  53829. args: [],
  53830. 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'.",
  53831. referencedClasses: [],
  53832. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  53833. }),
  53834. $globals.JSObjectProxyTest);
  53835. $core.addMethod(
  53836. $core.method({
  53837. selector: "testAtPut",
  53838. protocol: 'tests',
  53839. fn: function (){
  53840. var self=this;
  53841. var testObject;
  53842. return $core.withContext(function($ctx1) {
  53843. var $2,$1;
  53844. testObject=self._jsObject();
  53845. $2=$recv(testObject)._at_("abc");
  53846. $ctx1.sendIdx["at:"]=1;
  53847. $1=$recv($2).__tild_eq("xyz");
  53848. self._assert_($1);
  53849. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  53850. $ctx1.sendIdx["assert:equals:"]=1;
  53851. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  53852. return self;
  53853. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  53854. },
  53855. args: [],
  53856. 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'",
  53857. referencedClasses: [],
  53858. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  53859. }),
  53860. $globals.JSObjectProxyTest);
  53861. $core.addMethod(
  53862. $core.method({
  53863. selector: "testComparison",
  53864. protocol: 'tests',
  53865. fn: function (){
  53866. var self=this;
  53867. return $core.withContext(function($ctx1) {
  53868. var $1,$2;
  53869. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  53870. $1=$recv(console).__eq(console);
  53871. $ctx1.sendIdx["="]=1;
  53872. self._assert_($1);
  53873. $2=$recv(console).__eq($recv($globals.Object)._new());
  53874. $ctx1.sendIdx["="]=2;
  53875. self._deny_($2);
  53876. $ctx1.sendIdx["deny:"]=1;
  53877. self._deny_($recv(console).__eq(self._jsObject()));
  53878. return self;
  53879. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  53880. },
  53881. args: [],
  53882. 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",
  53883. referencedClasses: ["Object"],
  53884. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  53885. }),
  53886. $globals.JSObjectProxyTest);
  53887. $core.addMethod(
  53888. $core.method({
  53889. selector: "testDNU",
  53890. protocol: 'tests',
  53891. fn: function (){
  53892. var self=this;
  53893. return $core.withContext(function($ctx1) {
  53894. self._should_raise_((function(){
  53895. return $core.withContext(function($ctx2) {
  53896. return $recv(self._jsObject())._foo();
  53897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53898. }),$globals.MessageNotUnderstood);
  53899. return self;
  53900. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  53901. },
  53902. args: [],
  53903. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  53904. referencedClasses: ["MessageNotUnderstood"],
  53905. messageSends: ["should:raise:", "foo", "jsObject"]
  53906. }),
  53907. $globals.JSObjectProxyTest);
  53908. $core.addMethod(
  53909. $core.method({
  53910. selector: "testDNURegression1057",
  53911. protocol: 'tests',
  53912. fn: function (){
  53913. var self=this;
  53914. var jsObject;
  53915. return $core.withContext(function($ctx1) {
  53916. var $1;
  53917. jsObject=[];
  53918. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53919. $ctx1.sendIdx["basicAt:put:"]=1;
  53920. $recv(jsObject)._basicAt_put_("foo",(3));
  53921. self._shouldnt_raise_((function(){
  53922. return $core.withContext(function($ctx2) {
  53923. return $recv(jsObject)._foo();
  53924. $ctx2.sendIdx["foo"]=1;
  53925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53926. }),$globals.Error);
  53927. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53928. $1=$recv(jsObject)._foo();
  53929. $ctx1.sendIdx["foo"]=2;
  53930. self._assert_equals_($1,(3));
  53931. $ctx1.sendIdx["assert:equals:"]=1;
  53932. self._shouldnt_raise_((function(){
  53933. return $core.withContext(function($ctx2) {
  53934. return $recv(jsObject)._foo_((4));
  53935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53936. }),$globals.Error);
  53937. self._assert_equals_($recv(jsObject)._foo(),(4));
  53938. return self;
  53939. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53940. },
  53941. args: [],
  53942. 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",
  53943. referencedClasses: ["Error"],
  53944. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  53945. }),
  53946. $globals.JSObjectProxyTest);
  53947. $core.addMethod(
  53948. $core.method({
  53949. selector: "testDNURegression1059",
  53950. protocol: 'tests',
  53951. fn: function (){
  53952. var self=this;
  53953. var jsObject;
  53954. return $core.withContext(function($ctx1) {
  53955. jsObject=[];
  53956. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53957. $ctx1.sendIdx["basicAt:put:"]=1;
  53958. $recv(jsObject)._basicAt_put_("x",(3));
  53959. $ctx1.sendIdx["basicAt:put:"]=2;
  53960. $recv(jsObject)._basicAt_put_("x:",(function(){
  53961. return $core.withContext(function($ctx2) {
  53962. return self._error();
  53963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53964. }));
  53965. self._shouldnt_raise_((function(){
  53966. return $core.withContext(function($ctx2) {
  53967. return $recv(jsObject)._x_((4));
  53968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53969. }),$globals.Error);
  53970. self._assert_equals_($recv(jsObject)._x(),(4));
  53971. return self;
  53972. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53973. },
  53974. args: [],
  53975. 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",
  53976. referencedClasses: ["Error"],
  53977. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  53978. }),
  53979. $globals.JSObjectProxyTest);
  53980. $core.addMethod(
  53981. $core.method({
  53982. selector: "testDNURegression1062",
  53983. protocol: 'tests',
  53984. fn: function (){
  53985. var self=this;
  53986. var jsObject,stored;
  53987. return $core.withContext(function($ctx1) {
  53988. jsObject=[];
  53989. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53990. $ctx1.sendIdx["basicAt:put:"]=1;
  53991. $recv(jsObject)._basicAt_put_("x",(function(v){
  53992. stored=v;
  53993. return stored;
  53994. }));
  53995. self._shouldnt_raise_((function(){
  53996. return $core.withContext(function($ctx2) {
  53997. return $recv(jsObject)._x_((4));
  53998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53999. }),$globals.Error);
  54000. self._assert_equals_(stored,(4));
  54001. return self;
  54002. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  54003. },
  54004. args: [],
  54005. 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",
  54006. referencedClasses: ["Error"],
  54007. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  54008. }),
  54009. $globals.JSObjectProxyTest);
  54010. $core.addMethod(
  54011. $core.method({
  54012. selector: "testDNUWithAllowJavaScriptCalls",
  54013. protocol: 'tests',
  54014. fn: function (){
  54015. var self=this;
  54016. var jsObject;
  54017. return $core.withContext(function($ctx1) {
  54018. jsObject=[];
  54019. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54020. self._should_raise_((function(){
  54021. return $core.withContext(function($ctx2) {
  54022. return $recv(jsObject)._foo();
  54023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54024. }),$globals.MessageNotUnderstood);
  54025. return self;
  54026. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54027. },
  54028. args: [],
  54029. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  54030. referencedClasses: ["MessageNotUnderstood"],
  54031. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  54032. }),
  54033. $globals.JSObjectProxyTest);
  54034. $core.addMethod(
  54035. $core.method({
  54036. selector: "testMessageSend",
  54037. protocol: 'tests',
  54038. fn: function (){
  54039. var self=this;
  54040. return $core.withContext(function($ctx1) {
  54041. var $2,$1,$4,$3;
  54042. $2=self._jsObject();
  54043. $ctx1.sendIdx["jsObject"]=1;
  54044. $1=$recv($2)._a();
  54045. self._assert_equals_($1,(1));
  54046. $ctx1.sendIdx["assert:equals:"]=1;
  54047. $4=self._jsObject();
  54048. $ctx1.sendIdx["jsObject"]=2;
  54049. $3=$recv($4)._b();
  54050. self._assert_equals_($3,(2));
  54051. $ctx1.sendIdx["assert:equals:"]=2;
  54052. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  54053. return self;
  54054. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  54055. },
  54056. args: [],
  54057. 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",
  54058. referencedClasses: [],
  54059. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  54060. }),
  54061. $globals.JSObjectProxyTest);
  54062. $core.addMethod(
  54063. $core.method({
  54064. selector: "testMethodWithArguments",
  54065. protocol: 'tests',
  54066. fn: function (){
  54067. var self=this;
  54068. return $core.withContext(function($ctx1) {
  54069. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  54070. return self;
  54071. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  54072. },
  54073. args: [],
  54074. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  54075. referencedClasses: [],
  54076. messageSends: ["assert:equals:", "c:", "jsObject"]
  54077. }),
  54078. $globals.JSObjectProxyTest);
  54079. $core.addMethod(
  54080. $core.method({
  54081. selector: "testPrinting",
  54082. protocol: 'tests',
  54083. fn: function (){
  54084. var self=this;
  54085. return $core.withContext(function($ctx1) {
  54086. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  54087. return self;
  54088. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  54089. },
  54090. args: [],
  54091. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  54092. referencedClasses: [],
  54093. messageSends: ["assert:equals:", "printString", "jsObject"]
  54094. }),
  54095. $globals.JSObjectProxyTest);
  54096. $core.addMethod(
  54097. $core.method({
  54098. selector: "testPropertyThatReturnsEmptyString",
  54099. protocol: 'tests',
  54100. fn: function (){
  54101. var self=this;
  54102. var object;
  54103. return $core.withContext(function($ctx1) {
  54104. var $1;
  54105. object=self._jsObject();
  54106. $1=$recv(object)._d();
  54107. $ctx1.sendIdx["d"]=1;
  54108. self._assert_equals_($1,"");
  54109. $ctx1.sendIdx["assert:equals:"]=1;
  54110. $recv(object)._d_("hello");
  54111. self._assert_equals_($recv(object)._d(),"hello");
  54112. return self;
  54113. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  54114. },
  54115. args: [],
  54116. 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'",
  54117. referencedClasses: [],
  54118. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  54119. }),
  54120. $globals.JSObjectProxyTest);
  54121. $core.addMethod(
  54122. $core.method({
  54123. selector: "testPropertyThatReturnsUndefined",
  54124. protocol: 'tests',
  54125. fn: function (){
  54126. var self=this;
  54127. var object;
  54128. return $core.withContext(function($ctx1) {
  54129. object=self._jsObject();
  54130. self._shouldnt_raise_((function(){
  54131. return $core.withContext(function($ctx2) {
  54132. return $recv(object)._e();
  54133. $ctx2.sendIdx["e"]=1;
  54134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54135. }),$globals.MessageNotUnderstood);
  54136. self._assert_($recv($recv(object)._e())._isNil());
  54137. return self;
  54138. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  54139. },
  54140. args: [],
  54141. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  54142. referencedClasses: ["MessageNotUnderstood"],
  54143. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  54144. }),
  54145. $globals.JSObjectProxyTest);
  54146. $core.addMethod(
  54147. $core.method({
  54148. selector: "testSetPropertyWithFalsyValue",
  54149. protocol: 'tests',
  54150. fn: function (){
  54151. var self=this;
  54152. var jsObject;
  54153. return $core.withContext(function($ctx1) {
  54154. var $1,$2,$3,$4,$5;
  54155. jsObject=self._jsObject();
  54156. $1=$recv(jsObject)._a();
  54157. $ctx1.sendIdx["a"]=1;
  54158. self._assert_equals_($1,(1));
  54159. $ctx1.sendIdx["assert:equals:"]=1;
  54160. $recv(jsObject)._a_(self._jsNull());
  54161. $ctx1.sendIdx["a:"]=1;
  54162. $2=$recv(jsObject)._a();
  54163. $ctx1.sendIdx["a"]=2;
  54164. self._assert_equals_($2,nil);
  54165. $ctx1.sendIdx["assert:equals:"]=2;
  54166. $recv(jsObject)._a_((0));
  54167. $ctx1.sendIdx["a:"]=2;
  54168. $3=$recv(jsObject)._a();
  54169. $ctx1.sendIdx["a"]=3;
  54170. self._assert_equals_($3,(0));
  54171. $ctx1.sendIdx["assert:equals:"]=3;
  54172. $recv(jsObject)._a_(self._jsUndefined());
  54173. $ctx1.sendIdx["a:"]=3;
  54174. $4=$recv(jsObject)._a();
  54175. $ctx1.sendIdx["a"]=4;
  54176. self._assert_equals_($4,nil);
  54177. $ctx1.sendIdx["assert:equals:"]=4;
  54178. $recv(jsObject)._a_("");
  54179. $ctx1.sendIdx["a:"]=4;
  54180. $5=$recv(jsObject)._a();
  54181. $ctx1.sendIdx["a"]=5;
  54182. self._assert_equals_($5,"");
  54183. $ctx1.sendIdx["assert:equals:"]=5;
  54184. $recv(jsObject)._a_(false);
  54185. self._assert_equals_($recv(jsObject)._a(),false);
  54186. return self;
  54187. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54188. },
  54189. args: [],
  54190. 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",
  54191. referencedClasses: [],
  54192. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  54193. }),
  54194. $globals.JSObjectProxyTest);
  54195. $core.addMethod(
  54196. $core.method({
  54197. selector: "testValue",
  54198. protocol: 'tests',
  54199. fn: function (){
  54200. var self=this;
  54201. var testObject;
  54202. return $core.withContext(function($ctx1) {
  54203. testObject=self._jsObject();
  54204. $recv(testObject)._at_put_("value","aValue");
  54205. self._assert_equals_($recv(testObject)._value(),"aValue");
  54206. return self;
  54207. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  54208. },
  54209. args: [],
  54210. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  54211. referencedClasses: [],
  54212. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  54213. }),
  54214. $globals.JSObjectProxyTest);
  54215. $core.addMethod(
  54216. $core.method({
  54217. selector: "testYourself",
  54218. protocol: 'tests',
  54219. fn: function (){
  54220. var self=this;
  54221. var object;
  54222. return $core.withContext(function($ctx1) {
  54223. var $1;
  54224. $1=self._jsObject();
  54225. $recv($1)._d_("test");
  54226. object=$recv($1)._yourself();
  54227. self._assert_equals_($recv(object)._d(),"test");
  54228. return self;
  54229. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  54230. },
  54231. args: [],
  54232. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  54233. referencedClasses: [],
  54234. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  54235. }),
  54236. $globals.JSObjectProxyTest);
  54237. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  54238. $core.addMethod(
  54239. $core.method({
  54240. selector: "testCatchingException",
  54241. protocol: 'tests',
  54242. fn: function (){
  54243. var self=this;
  54244. return $core.withContext(function($ctx1) {
  54245. $recv((function(){
  54246. return $core.withContext(function($ctx2) {
  54247. return self._throwException();
  54248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54249. }))._on_do_($globals.Error,(function(error){
  54250. return $core.withContext(function($ctx2) {
  54251. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  54252. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  54253. }));
  54254. return self;
  54255. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  54256. },
  54257. args: [],
  54258. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  54259. referencedClasses: ["Error"],
  54260. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  54261. }),
  54262. $globals.JavaScriptExceptionTest);
  54263. $core.addMethod(
  54264. $core.method({
  54265. selector: "testRaisingException",
  54266. protocol: 'tests',
  54267. fn: function (){
  54268. var self=this;
  54269. return $core.withContext(function($ctx1) {
  54270. self._should_raise_((function(){
  54271. return $core.withContext(function($ctx2) {
  54272. return self._throwException();
  54273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54274. }),$globals.JavaScriptException);
  54275. return self;
  54276. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  54277. },
  54278. args: [],
  54279. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  54280. referencedClasses: ["JavaScriptException"],
  54281. messageSends: ["should:raise:", "throwException"]
  54282. }),
  54283. $globals.JavaScriptExceptionTest);
  54284. $core.addMethod(
  54285. $core.method({
  54286. selector: "throwException",
  54287. protocol: 'helpers',
  54288. fn: function (){
  54289. var self=this;
  54290. return $core.withContext(function($ctx1) {
  54291. throw "test";
  54292. return self;
  54293. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  54294. },
  54295. args: [],
  54296. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  54297. referencedClasses: [],
  54298. messageSends: []
  54299. }),
  54300. $globals.JavaScriptExceptionTest);
  54301. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  54302. $core.addMethod(
  54303. $core.method({
  54304. selector: "testValue",
  54305. protocol: 'tests',
  54306. fn: function (){
  54307. var self=this;
  54308. var messageSend;
  54309. return $core.withContext(function($ctx1) {
  54310. var $1;
  54311. $1=$recv($globals.MessageSend)._new();
  54312. $ctx1.sendIdx["new"]=1;
  54313. $recv($1)._receiver_($recv($globals.Object)._new());
  54314. $recv($1)._selector_("asString");
  54315. messageSend=$recv($1)._yourself();
  54316. self._assert_equals_($recv(messageSend)._value(),"an Object");
  54317. return self;
  54318. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  54319. },
  54320. args: [],
  54321. 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'",
  54322. referencedClasses: ["MessageSend", "Object"],
  54323. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  54324. }),
  54325. $globals.MessageSendTest);
  54326. $core.addMethod(
  54327. $core.method({
  54328. selector: "testValueWithArguments",
  54329. protocol: 'tests',
  54330. fn: function (){
  54331. var self=this;
  54332. var messageSend;
  54333. return $core.withContext(function($ctx1) {
  54334. var $1;
  54335. $1=$recv($globals.MessageSend)._new();
  54336. $recv($1)._receiver_((2));
  54337. $recv($1)._selector_("+");
  54338. messageSend=$recv($1)._yourself();
  54339. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  54340. $ctx1.sendIdx["assert:equals:"]=1;
  54341. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  54342. return self;
  54343. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  54344. },
  54345. args: [],
  54346. 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",
  54347. referencedClasses: ["MessageSend"],
  54348. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  54349. }),
  54350. $globals.MessageSendTest);
  54351. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  54352. $core.addMethod(
  54353. $core.method({
  54354. selector: "codeGeneratorClass",
  54355. protocol: 'accessing',
  54356. fn: function (){
  54357. var self=this;
  54358. return $globals.CodeGenerator;
  54359. },
  54360. args: [],
  54361. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  54362. referencedClasses: ["CodeGenerator"],
  54363. messageSends: []
  54364. }),
  54365. $globals.MethodInheritanceTest);
  54366. $core.addMethod(
  54367. $core.method({
  54368. selector: "compiler",
  54369. protocol: 'factory',
  54370. fn: function (){
  54371. var self=this;
  54372. return $core.withContext(function($ctx1) {
  54373. var $1;
  54374. $1=$recv($globals.Compiler)._new();
  54375. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  54376. return $recv($1)._yourself();
  54377. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  54378. },
  54379. args: [],
  54380. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  54381. referencedClasses: ["Compiler"],
  54382. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  54383. }),
  54384. $globals.MethodInheritanceTest);
  54385. $core.addMethod(
  54386. $core.method({
  54387. selector: "deinstallBottom",
  54388. protocol: 'testing',
  54389. fn: function (){
  54390. var self=this;
  54391. return $core.withContext(function($ctx1) {
  54392. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  54393. return self;
  54394. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  54395. },
  54396. args: [],
  54397. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  54398. referencedClasses: [],
  54399. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  54400. }),
  54401. $globals.MethodInheritanceTest);
  54402. $core.addMethod(
  54403. $core.method({
  54404. selector: "deinstallMiddle",
  54405. protocol: 'testing',
  54406. fn: function (){
  54407. var self=this;
  54408. return $core.withContext(function($ctx1) {
  54409. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  54410. return self;
  54411. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  54412. },
  54413. args: [],
  54414. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  54415. referencedClasses: [],
  54416. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  54417. }),
  54418. $globals.MethodInheritanceTest);
  54419. $core.addMethod(
  54420. $core.method({
  54421. selector: "deinstallTop",
  54422. protocol: 'testing',
  54423. fn: function (){
  54424. var self=this;
  54425. return $core.withContext(function($ctx1) {
  54426. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  54427. return self;
  54428. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  54429. },
  54430. args: [],
  54431. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  54432. referencedClasses: [],
  54433. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  54434. }),
  54435. $globals.MethodInheritanceTest);
  54436. $core.addMethod(
  54437. $core.method({
  54438. selector: "installBottom:",
  54439. protocol: 'testing',
  54440. fn: function (aString){
  54441. var self=this;
  54442. return $core.withContext(function($ctx1) {
  54443. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  54444. return self;
  54445. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  54446. },
  54447. args: ["aString"],
  54448. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  54449. referencedClasses: [],
  54450. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  54451. }),
  54452. $globals.MethodInheritanceTest);
  54453. $core.addMethod(
  54454. $core.method({
  54455. selector: "installMiddle:",
  54456. protocol: 'testing',
  54457. fn: function (aString){
  54458. var self=this;
  54459. return $core.withContext(function($ctx1) {
  54460. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  54461. return self;
  54462. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  54463. },
  54464. args: ["aString"],
  54465. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  54466. referencedClasses: [],
  54467. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  54468. }),
  54469. $globals.MethodInheritanceTest);
  54470. $core.addMethod(
  54471. $core.method({
  54472. selector: "installTop:",
  54473. protocol: 'testing',
  54474. fn: function (aString){
  54475. var self=this;
  54476. return $core.withContext(function($ctx1) {
  54477. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  54478. return self;
  54479. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  54480. },
  54481. args: ["aString"],
  54482. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  54483. referencedClasses: [],
  54484. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  54485. }),
  54486. $globals.MethodInheritanceTest);
  54487. $core.addMethod(
  54488. $core.method({
  54489. selector: "setUp",
  54490. protocol: 'initialization',
  54491. fn: function (){
  54492. var self=this;
  54493. return $core.withContext(function($ctx1) {
  54494. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  54495. $ctx1.sendIdx["new"]=1;
  54496. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  54497. $ctx1.sendIdx["new"]=2;
  54498. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  54499. self["@method"]=nil;
  54500. self["@performBlock"]=(function(){
  54501. return $core.withContext(function($ctx2) {
  54502. return self._error_("performBlock not initialized");
  54503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54504. });
  54505. return self;
  54506. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  54507. },
  54508. args: [],
  54509. 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' ]",
  54510. referencedClasses: [],
  54511. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  54512. }),
  54513. $globals.MethodInheritanceTest);
  54514. $core.addMethod(
  54515. $core.method({
  54516. selector: "shouldMNU",
  54517. protocol: 'testing',
  54518. fn: function (){
  54519. var self=this;
  54520. return $core.withContext(function($ctx1) {
  54521. self._shouldMNUTop();
  54522. self._shouldMNUMiddle();
  54523. self._shouldMNUBottom();
  54524. return self;
  54525. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  54526. },
  54527. args: [],
  54528. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  54529. referencedClasses: [],
  54530. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  54531. }),
  54532. $globals.MethodInheritanceTest);
  54533. $core.addMethod(
  54534. $core.method({
  54535. selector: "shouldMNUBottom",
  54536. protocol: 'testing',
  54537. fn: function (){
  54538. var self=this;
  54539. return $core.withContext(function($ctx1) {
  54540. self._should_raise_((function(){
  54541. return $core.withContext(function($ctx2) {
  54542. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54544. }),$globals.MessageNotUnderstood);
  54545. return self;
  54546. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  54547. },
  54548. args: [],
  54549. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  54550. referencedClasses: ["MessageNotUnderstood"],
  54551. messageSends: ["should:raise:", "value:"]
  54552. }),
  54553. $globals.MethodInheritanceTest);
  54554. $core.addMethod(
  54555. $core.method({
  54556. selector: "shouldMNUMiddle",
  54557. protocol: 'testing',
  54558. fn: function (){
  54559. var self=this;
  54560. return $core.withContext(function($ctx1) {
  54561. self._should_raise_((function(){
  54562. return $core.withContext(function($ctx2) {
  54563. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54565. }),$globals.MessageNotUnderstood);
  54566. return self;
  54567. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  54568. },
  54569. args: [],
  54570. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  54571. referencedClasses: ["MessageNotUnderstood"],
  54572. messageSends: ["should:raise:", "value:"]
  54573. }),
  54574. $globals.MethodInheritanceTest);
  54575. $core.addMethod(
  54576. $core.method({
  54577. selector: "shouldMNUTop",
  54578. protocol: 'testing',
  54579. fn: function (){
  54580. var self=this;
  54581. return $core.withContext(function($ctx1) {
  54582. self._should_raise_((function(){
  54583. return $core.withContext(function($ctx2) {
  54584. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54586. }),$globals.MessageNotUnderstood);
  54587. return self;
  54588. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  54589. },
  54590. args: [],
  54591. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  54592. referencedClasses: ["MessageNotUnderstood"],
  54593. messageSends: ["should:raise:", "value:"]
  54594. }),
  54595. $globals.MethodInheritanceTest);
  54596. $core.addMethod(
  54597. $core.method({
  54598. selector: "shouldReturn:",
  54599. protocol: 'testing',
  54600. fn: function (anObject){
  54601. var self=this;
  54602. var result;
  54603. return $core.withContext(function($ctx1) {
  54604. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54605. $ctx1.sendIdx["value:"]=1;
  54606. self._assert_equals_(["top",anObject],["top",result]);
  54607. $ctx1.sendIdx["assert:equals:"]=1;
  54608. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54609. $ctx1.sendIdx["value:"]=2;
  54610. self._assert_equals_(["middle",anObject],["middle",result]);
  54611. $ctx1.sendIdx["assert:equals:"]=2;
  54612. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54613. self._assert_equals_(["bottom",anObject],["bottom",result]);
  54614. return self;
  54615. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  54616. },
  54617. args: ["anObject"],
  54618. 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 }",
  54619. referencedClasses: [],
  54620. messageSends: ["value:", "assert:equals:"]
  54621. }),
  54622. $globals.MethodInheritanceTest);
  54623. $core.addMethod(
  54624. $core.method({
  54625. selector: "shouldReturn:and:and:",
  54626. protocol: 'testing',
  54627. fn: function (anObject,anObject2,anObject3){
  54628. var self=this;
  54629. var result;
  54630. return $core.withContext(function($ctx1) {
  54631. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54632. $ctx1.sendIdx["value:"]=1;
  54633. self._assert_equals_(["top",anObject],["top",result]);
  54634. $ctx1.sendIdx["assert:equals:"]=1;
  54635. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54636. $ctx1.sendIdx["value:"]=2;
  54637. self._assert_equals_(["middle",anObject2],["middle",result]);
  54638. $ctx1.sendIdx["assert:equals:"]=2;
  54639. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54640. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  54641. return self;
  54642. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  54643. },
  54644. args: ["anObject", "anObject2", "anObject3"],
  54645. 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 }",
  54646. referencedClasses: [],
  54647. messageSends: ["value:", "assert:equals:"]
  54648. }),
  54649. $globals.MethodInheritanceTest);
  54650. $core.addMethod(
  54651. $core.method({
  54652. selector: "targetClassBottom",
  54653. protocol: 'accessing',
  54654. fn: function (){
  54655. var self=this;
  54656. return $globals.JavaScriptException;
  54657. },
  54658. args: [],
  54659. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  54660. referencedClasses: ["JavaScriptException"],
  54661. messageSends: []
  54662. }),
  54663. $globals.MethodInheritanceTest);
  54664. $core.addMethod(
  54665. $core.method({
  54666. selector: "targetClassMiddle",
  54667. protocol: 'accessing',
  54668. fn: function (){
  54669. var self=this;
  54670. return $globals.Error;
  54671. },
  54672. args: [],
  54673. source: "targetClassMiddle\x0a\x09^ Error",
  54674. referencedClasses: ["Error"],
  54675. messageSends: []
  54676. }),
  54677. $globals.MethodInheritanceTest);
  54678. $core.addMethod(
  54679. $core.method({
  54680. selector: "targetClassTop",
  54681. protocol: 'accessing',
  54682. fn: function (){
  54683. var self=this;
  54684. return $globals.Object;
  54685. },
  54686. args: [],
  54687. source: "targetClassTop\x0a\x09^ Object",
  54688. referencedClasses: ["Object"],
  54689. messageSends: []
  54690. }),
  54691. $globals.MethodInheritanceTest);
  54692. $core.addMethod(
  54693. $core.method({
  54694. selector: "tearDown",
  54695. protocol: 'initialization',
  54696. fn: function (){
  54697. var self=this;
  54698. return $core.withContext(function($ctx1) {
  54699. $recv((function(){
  54700. return $core.withContext(function($ctx2) {
  54701. return self._deinstallTop();
  54702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54703. }))._on_do_($globals.Error,(function(){
  54704. }));
  54705. $ctx1.sendIdx["on:do:"]=1;
  54706. $recv((function(){
  54707. return $core.withContext(function($ctx2) {
  54708. return self._deinstallMiddle();
  54709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54710. }))._on_do_($globals.Error,(function(){
  54711. }));
  54712. $ctx1.sendIdx["on:do:"]=2;
  54713. $recv((function(){
  54714. return $core.withContext(function($ctx2) {
  54715. return self._deinstallBottom();
  54716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54717. }))._on_do_($globals.Error,(function(){
  54718. }));
  54719. return self;
  54720. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  54721. },
  54722. args: [],
  54723. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  54724. referencedClasses: ["Error"],
  54725. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  54726. }),
  54727. $globals.MethodInheritanceTest);
  54728. $core.addMethod(
  54729. $core.method({
  54730. selector: "testMNU11",
  54731. protocol: 'tests',
  54732. fn: function (){
  54733. var self=this;
  54734. return $core.withContext(function($ctx1) {
  54735. self["@performBlock"]=(function(x){
  54736. return $core.withContext(function($ctx2) {
  54737. return $recv(x)._foo();
  54738. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54739. });
  54740. self._shouldMNU();
  54741. $ctx1.sendIdx["shouldMNU"]=1;
  54742. self._installTop_("foo ^ false");
  54743. $ctx1.sendIdx["installTop:"]=1;
  54744. self._installTop_("foo ^ true");
  54745. self._deinstallTop();
  54746. self._shouldMNU();
  54747. return self;
  54748. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  54749. },
  54750. args: [],
  54751. 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",
  54752. referencedClasses: [],
  54753. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  54754. }),
  54755. $globals.MethodInheritanceTest);
  54756. $core.addMethod(
  54757. $core.method({
  54758. selector: "testMNU22",
  54759. protocol: 'tests',
  54760. fn: function (){
  54761. var self=this;
  54762. return $core.withContext(function($ctx1) {
  54763. self["@performBlock"]=(function(x){
  54764. return $core.withContext(function($ctx2) {
  54765. return $recv(x)._foo();
  54766. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54767. });
  54768. self._shouldMNU();
  54769. $ctx1.sendIdx["shouldMNU"]=1;
  54770. self._installMiddle_("foo ^ false");
  54771. $ctx1.sendIdx["installMiddle:"]=1;
  54772. self._installMiddle_("foo ^ true");
  54773. self._deinstallMiddle();
  54774. self._shouldMNU();
  54775. return self;
  54776. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  54777. },
  54778. args: [],
  54779. 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",
  54780. referencedClasses: [],
  54781. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  54782. }),
  54783. $globals.MethodInheritanceTest);
  54784. $core.addMethod(
  54785. $core.method({
  54786. selector: "testReturns1",
  54787. protocol: 'tests',
  54788. fn: function (){
  54789. var self=this;
  54790. return $core.withContext(function($ctx1) {
  54791. self["@performBlock"]=(function(x){
  54792. return $core.withContext(function($ctx2) {
  54793. return $recv(x)._foo();
  54794. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54795. });
  54796. self._installTop_("foo ^ false");
  54797. $ctx1.sendIdx["installTop:"]=1;
  54798. self._shouldReturn_(false);
  54799. $ctx1.sendIdx["shouldReturn:"]=1;
  54800. self._installTop_("foo ^ true");
  54801. self._shouldReturn_(true);
  54802. return self;
  54803. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  54804. },
  54805. args: [],
  54806. 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",
  54807. referencedClasses: [],
  54808. messageSends: ["foo", "installTop:", "shouldReturn:"]
  54809. }),
  54810. $globals.MethodInheritanceTest);
  54811. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  54812. $core.addMethod(
  54813. $core.method({
  54814. selector: "testAbs",
  54815. protocol: 'tests',
  54816. fn: function (){
  54817. var self=this;
  54818. return $core.withContext(function($ctx1) {
  54819. var $1;
  54820. $1=(4)._abs();
  54821. $ctx1.sendIdx["abs"]=1;
  54822. self._assert_equals_($1,(4));
  54823. $ctx1.sendIdx["assert:equals:"]=1;
  54824. self._assert_equals_((-4)._abs(),(4));
  54825. return self;
  54826. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  54827. },
  54828. args: [],
  54829. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  54830. referencedClasses: [],
  54831. messageSends: ["assert:equals:", "abs"]
  54832. }),
  54833. $globals.NumberTest);
  54834. $core.addMethod(
  54835. $core.method({
  54836. selector: "testArithmetic",
  54837. protocol: 'tests',
  54838. fn: function (){
  54839. var self=this;
  54840. return $core.withContext(function($ctx1) {
  54841. var $1,$2,$3,$5,$4;
  54842. $1=(1.5).__plus((1));
  54843. $ctx1.sendIdx["+"]=1;
  54844. self._assert_equals_($1,(2.5));
  54845. $ctx1.sendIdx["assert:equals:"]=1;
  54846. $2=(2).__minus((1));
  54847. $ctx1.sendIdx["-"]=1;
  54848. self._assert_equals_($2,(1));
  54849. $ctx1.sendIdx["assert:equals:"]=2;
  54850. self._assert_equals_((-2).__minus((1)),(-3));
  54851. $ctx1.sendIdx["assert:equals:"]=3;
  54852. self._assert_equals_((12).__slash((2)),(6));
  54853. $ctx1.sendIdx["assert:equals:"]=4;
  54854. $3=(3).__star((4));
  54855. $ctx1.sendIdx["*"]=1;
  54856. self._assert_equals_($3,(12));
  54857. $ctx1.sendIdx["assert:equals:"]=5;
  54858. self._assert_equals_((7).__slash_slash((2)),(3));
  54859. $ctx1.sendIdx["assert:equals:"]=6;
  54860. self._assert_equals_((7).__backslash_backslash((2)),(1));
  54861. $ctx1.sendIdx["assert:equals:"]=7;
  54862. $5=(1).__plus((2));
  54863. $ctx1.sendIdx["+"]=2;
  54864. $4=$recv($5).__star((3));
  54865. $ctx1.sendIdx["*"]=2;
  54866. self._assert_equals_($4,(9));
  54867. $ctx1.sendIdx["assert:equals:"]=8;
  54868. self._assert_equals_((1).__plus((2).__star((3))),(7));
  54869. return self;
  54870. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  54871. },
  54872. args: [],
  54873. 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",
  54874. referencedClasses: [],
  54875. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  54876. }),
  54877. $globals.NumberTest);
  54878. $core.addMethod(
  54879. $core.method({
  54880. selector: "testAsNumber",
  54881. protocol: 'tests',
  54882. fn: function (){
  54883. var self=this;
  54884. return $core.withContext(function($ctx1) {
  54885. self._assert_equals_((3)._asNumber(),(3));
  54886. return self;
  54887. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  54888. },
  54889. args: [],
  54890. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  54891. referencedClasses: [],
  54892. messageSends: ["assert:equals:", "asNumber"]
  54893. }),
  54894. $globals.NumberTest);
  54895. $core.addMethod(
  54896. $core.method({
  54897. selector: "testCeiling",
  54898. protocol: 'tests',
  54899. fn: function (){
  54900. var self=this;
  54901. return $core.withContext(function($ctx1) {
  54902. var $1,$2;
  54903. $1=(1.2)._ceiling();
  54904. $ctx1.sendIdx["ceiling"]=1;
  54905. self._assert_equals_($1,(2));
  54906. $ctx1.sendIdx["assert:equals:"]=1;
  54907. $2=(-1.2)._ceiling();
  54908. $ctx1.sendIdx["ceiling"]=2;
  54909. self._assert_equals_($2,(-1));
  54910. $ctx1.sendIdx["assert:equals:"]=2;
  54911. self._assert_equals_((1)._ceiling(),(1));
  54912. return self;
  54913. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  54914. },
  54915. args: [],
  54916. 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.",
  54917. referencedClasses: [],
  54918. messageSends: ["assert:equals:", "ceiling"]
  54919. }),
  54920. $globals.NumberTest);
  54921. $core.addMethod(
  54922. $core.method({
  54923. selector: "testComparison",
  54924. protocol: 'tests',
  54925. fn: function (){
  54926. var self=this;
  54927. return $core.withContext(function($ctx1) {
  54928. var $1,$2,$3,$4;
  54929. $1=(3).__gt((2));
  54930. $ctx1.sendIdx[">"]=1;
  54931. self._assert_($1);
  54932. $ctx1.sendIdx["assert:"]=1;
  54933. $2=(2).__lt((3));
  54934. $ctx1.sendIdx["<"]=1;
  54935. self._assert_($2);
  54936. $ctx1.sendIdx["assert:"]=2;
  54937. self._deny_((3).__lt((2)));
  54938. $ctx1.sendIdx["deny:"]=1;
  54939. self._deny_((2).__gt((3)));
  54940. $3=(3).__gt_eq((3));
  54941. $ctx1.sendIdx[">="]=1;
  54942. self._assert_($3);
  54943. $ctx1.sendIdx["assert:"]=3;
  54944. self._assert_((3.1).__gt_eq((3)));
  54945. $ctx1.sendIdx["assert:"]=4;
  54946. $4=(3).__lt_eq((3));
  54947. $ctx1.sendIdx["<="]=1;
  54948. self._assert_($4);
  54949. $ctx1.sendIdx["assert:"]=5;
  54950. self._assert_((3).__lt_eq((3.1)));
  54951. return self;
  54952. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  54953. },
  54954. args: [],
  54955. 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",
  54956. referencedClasses: [],
  54957. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  54958. }),
  54959. $globals.NumberTest);
  54960. $core.addMethod(
  54961. $core.method({
  54962. selector: "testCopying",
  54963. protocol: 'tests',
  54964. fn: function (){
  54965. var self=this;
  54966. return $core.withContext(function($ctx1) {
  54967. var $1;
  54968. $1=$recv((1)._copy()).__eq_eq((1));
  54969. $ctx1.sendIdx["=="]=1;
  54970. self._assert_($1);
  54971. $ctx1.sendIdx["assert:"]=1;
  54972. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  54973. return self;
  54974. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  54975. },
  54976. args: [],
  54977. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  54978. referencedClasses: [],
  54979. messageSends: ["assert:", "==", "copy", "deepCopy"]
  54980. }),
  54981. $globals.NumberTest);
  54982. $core.addMethod(
  54983. $core.method({
  54984. selector: "testEquality",
  54985. protocol: 'tests',
  54986. fn: function (){
  54987. var self=this;
  54988. return $core.withContext(function($ctx1) {
  54989. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  54990. $1=(1).__eq((1));
  54991. $ctx1.sendIdx["="]=1;
  54992. self._assert_($1);
  54993. $ctx1.sendIdx["assert:"]=1;
  54994. $2=(0).__eq((0));
  54995. $ctx1.sendIdx["="]=2;
  54996. self._assert_($2);
  54997. $ctx1.sendIdx["assert:"]=2;
  54998. $3=(1).__eq((0));
  54999. $ctx1.sendIdx["="]=3;
  55000. self._deny_($3);
  55001. $ctx1.sendIdx["deny:"]=1;
  55002. $5=(1)._yourself();
  55003. $ctx1.sendIdx["yourself"]=1;
  55004. $4=$recv($5).__eq((1));
  55005. $ctx1.sendIdx["="]=4;
  55006. self._assert_($4);
  55007. $ctx1.sendIdx["assert:"]=3;
  55008. $7=(1)._yourself();
  55009. $ctx1.sendIdx["yourself"]=2;
  55010. $6=(1).__eq($7);
  55011. $ctx1.sendIdx["="]=5;
  55012. self._assert_($6);
  55013. $ctx1.sendIdx["assert:"]=4;
  55014. $9=(1)._yourself();
  55015. $ctx1.sendIdx["yourself"]=3;
  55016. $8=$recv($9).__eq((1)._yourself());
  55017. $ctx1.sendIdx["="]=6;
  55018. self._assert_($8);
  55019. $10=(0).__eq(false);
  55020. $ctx1.sendIdx["="]=7;
  55021. self._deny_($10);
  55022. $ctx1.sendIdx["deny:"]=2;
  55023. $11=false.__eq((0));
  55024. $ctx1.sendIdx["="]=8;
  55025. self._deny_($11);
  55026. $ctx1.sendIdx["deny:"]=3;
  55027. $12="".__eq((0));
  55028. $ctx1.sendIdx["="]=9;
  55029. self._deny_($12);
  55030. $ctx1.sendIdx["deny:"]=4;
  55031. self._deny_((0).__eq(""));
  55032. return self;
  55033. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  55034. },
  55035. args: [],
  55036. 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 = ''",
  55037. referencedClasses: [],
  55038. messageSends: ["assert:", "=", "deny:", "yourself"]
  55039. }),
  55040. $globals.NumberTest);
  55041. $core.addMethod(
  55042. $core.method({
  55043. selector: "testFloor",
  55044. protocol: 'tests',
  55045. fn: function (){
  55046. var self=this;
  55047. return $core.withContext(function($ctx1) {
  55048. var $1,$2;
  55049. $1=(1.2)._floor();
  55050. $ctx1.sendIdx["floor"]=1;
  55051. self._assert_equals_($1,(1));
  55052. $ctx1.sendIdx["assert:equals:"]=1;
  55053. $2=(-1.2)._floor();
  55054. $ctx1.sendIdx["floor"]=2;
  55055. self._assert_equals_($2,(-2));
  55056. $ctx1.sendIdx["assert:equals:"]=2;
  55057. self._assert_equals_((1)._floor(),(1));
  55058. return self;
  55059. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  55060. },
  55061. args: [],
  55062. 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.",
  55063. referencedClasses: [],
  55064. messageSends: ["assert:equals:", "floor"]
  55065. }),
  55066. $globals.NumberTest);
  55067. $core.addMethod(
  55068. $core.method({
  55069. selector: "testHexNumbers",
  55070. protocol: 'tests',
  55071. fn: function (){
  55072. var self=this;
  55073. return $core.withContext(function($ctx1) {
  55074. var $1,$2,$3,$4,$5;
  55075. self._assert_equals_((9),(9));
  55076. $ctx1.sendIdx["assert:equals:"]=1;
  55077. $1=(10)._truncated();
  55078. $ctx1.sendIdx["truncated"]=1;
  55079. self._assert_equals_($1,(10));
  55080. $ctx1.sendIdx["assert:equals:"]=2;
  55081. $2=(11)._truncated();
  55082. $ctx1.sendIdx["truncated"]=2;
  55083. self._assert_equals_($2,(11));
  55084. $ctx1.sendIdx["assert:equals:"]=3;
  55085. $3=(12)._truncated();
  55086. $ctx1.sendIdx["truncated"]=3;
  55087. self._assert_equals_($3,(12));
  55088. $ctx1.sendIdx["assert:equals:"]=4;
  55089. $4=(13)._truncated();
  55090. $ctx1.sendIdx["truncated"]=4;
  55091. self._assert_equals_($4,(13));
  55092. $ctx1.sendIdx["assert:equals:"]=5;
  55093. $5=(14)._truncated();
  55094. $ctx1.sendIdx["truncated"]=5;
  55095. self._assert_equals_($5,(14));
  55096. $ctx1.sendIdx["assert:equals:"]=6;
  55097. self._assert_equals_((15)._truncated(),(15));
  55098. return self;
  55099. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  55100. },
  55101. args: [],
  55102. 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",
  55103. referencedClasses: [],
  55104. messageSends: ["assert:equals:", "truncated"]
  55105. }),
  55106. $globals.NumberTest);
  55107. $core.addMethod(
  55108. $core.method({
  55109. selector: "testIdentity",
  55110. protocol: 'tests',
  55111. fn: function (){
  55112. var self=this;
  55113. return $core.withContext(function($ctx1) {
  55114. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  55115. $1=(1).__eq_eq((1));
  55116. $ctx1.sendIdx["=="]=1;
  55117. self._assert_($1);
  55118. $ctx1.sendIdx["assert:"]=1;
  55119. $2=(0).__eq_eq((0));
  55120. $ctx1.sendIdx["=="]=2;
  55121. self._assert_($2);
  55122. $ctx1.sendIdx["assert:"]=2;
  55123. $3=(1).__eq_eq((0));
  55124. $ctx1.sendIdx["=="]=3;
  55125. self._deny_($3);
  55126. $ctx1.sendIdx["deny:"]=1;
  55127. $5=(1)._yourself();
  55128. $ctx1.sendIdx["yourself"]=1;
  55129. $4=$recv($5).__eq_eq((1));
  55130. $ctx1.sendIdx["=="]=4;
  55131. self._assert_($4);
  55132. $ctx1.sendIdx["assert:"]=3;
  55133. $7=(1)._yourself();
  55134. $ctx1.sendIdx["yourself"]=2;
  55135. $6=(1).__eq_eq($7);
  55136. $ctx1.sendIdx["=="]=5;
  55137. self._assert_($6);
  55138. $ctx1.sendIdx["assert:"]=4;
  55139. $9=(1)._yourself();
  55140. $ctx1.sendIdx["yourself"]=3;
  55141. $8=$recv($9).__eq_eq((1)._yourself());
  55142. $ctx1.sendIdx["=="]=6;
  55143. self._assert_($8);
  55144. self._deny_((1).__eq_eq((2)));
  55145. return self;
  55146. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  55147. },
  55148. args: [],
  55149. 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",
  55150. referencedClasses: [],
  55151. messageSends: ["assert:", "==", "deny:", "yourself"]
  55152. }),
  55153. $globals.NumberTest);
  55154. $core.addMethod(
  55155. $core.method({
  55156. selector: "testInvalidHexNumbers",
  55157. protocol: 'tests',
  55158. fn: function (){
  55159. var self=this;
  55160. return $core.withContext(function($ctx1) {
  55161. self._should_raise_((function(){
  55162. return $core.withContext(function($ctx2) {
  55163. return (16)._rG();
  55164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55165. }),$globals.MessageNotUnderstood);
  55166. $ctx1.sendIdx["should:raise:"]=1;
  55167. self._should_raise_((function(){
  55168. return $core.withContext(function($ctx2) {
  55169. return (16)._rg();
  55170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55171. }),$globals.MessageNotUnderstood);
  55172. $ctx1.sendIdx["should:raise:"]=2;
  55173. self._should_raise_((function(){
  55174. return $core.withContext(function($ctx2) {
  55175. return (16)._rH();
  55176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55177. }),$globals.MessageNotUnderstood);
  55178. $ctx1.sendIdx["should:raise:"]=3;
  55179. self._should_raise_((function(){
  55180. return $core.withContext(function($ctx2) {
  55181. return (16)._rh();
  55182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  55183. }),$globals.MessageNotUnderstood);
  55184. $ctx1.sendIdx["should:raise:"]=4;
  55185. self._should_raise_((function(){
  55186. return $core.withContext(function($ctx2) {
  55187. return (16)._rI();
  55188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  55189. }),$globals.MessageNotUnderstood);
  55190. $ctx1.sendIdx["should:raise:"]=5;
  55191. self._should_raise_((function(){
  55192. return $core.withContext(function($ctx2) {
  55193. return (16)._ri();
  55194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  55195. }),$globals.MessageNotUnderstood);
  55196. $ctx1.sendIdx["should:raise:"]=6;
  55197. self._should_raise_((function(){
  55198. return $core.withContext(function($ctx2) {
  55199. return (16)._rJ();
  55200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  55201. }),$globals.MessageNotUnderstood);
  55202. $ctx1.sendIdx["should:raise:"]=7;
  55203. self._should_raise_((function(){
  55204. return $core.withContext(function($ctx2) {
  55205. return (16)._rj();
  55206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  55207. }),$globals.MessageNotUnderstood);
  55208. $ctx1.sendIdx["should:raise:"]=8;
  55209. self._should_raise_((function(){
  55210. return $core.withContext(function($ctx2) {
  55211. return (16)._rK();
  55212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  55213. }),$globals.MessageNotUnderstood);
  55214. $ctx1.sendIdx["should:raise:"]=9;
  55215. self._should_raise_((function(){
  55216. return $core.withContext(function($ctx2) {
  55217. return (16)._rk();
  55218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  55219. }),$globals.MessageNotUnderstood);
  55220. $ctx1.sendIdx["should:raise:"]=10;
  55221. self._should_raise_((function(){
  55222. return $core.withContext(function($ctx2) {
  55223. return (16)._rL();
  55224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  55225. }),$globals.MessageNotUnderstood);
  55226. $ctx1.sendIdx["should:raise:"]=11;
  55227. self._should_raise_((function(){
  55228. return $core.withContext(function($ctx2) {
  55229. return (16)._rl();
  55230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  55231. }),$globals.MessageNotUnderstood);
  55232. $ctx1.sendIdx["should:raise:"]=12;
  55233. self._should_raise_((function(){
  55234. return $core.withContext(function($ctx2) {
  55235. return (16)._rM();
  55236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  55237. }),$globals.MessageNotUnderstood);
  55238. $ctx1.sendIdx["should:raise:"]=13;
  55239. self._should_raise_((function(){
  55240. return $core.withContext(function($ctx2) {
  55241. return (16)._rm();
  55242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  55243. }),$globals.MessageNotUnderstood);
  55244. $ctx1.sendIdx["should:raise:"]=14;
  55245. self._should_raise_((function(){
  55246. return $core.withContext(function($ctx2) {
  55247. return (16)._rN();
  55248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  55249. }),$globals.MessageNotUnderstood);
  55250. $ctx1.sendIdx["should:raise:"]=15;
  55251. self._should_raise_((function(){
  55252. return $core.withContext(function($ctx2) {
  55253. return (16)._rn();
  55254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  55255. }),$globals.MessageNotUnderstood);
  55256. $ctx1.sendIdx["should:raise:"]=16;
  55257. self._should_raise_((function(){
  55258. return $core.withContext(function($ctx2) {
  55259. return (16)._rO();
  55260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  55261. }),$globals.MessageNotUnderstood);
  55262. $ctx1.sendIdx["should:raise:"]=17;
  55263. self._should_raise_((function(){
  55264. return $core.withContext(function($ctx2) {
  55265. return (16)._ro();
  55266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  55267. }),$globals.MessageNotUnderstood);
  55268. $ctx1.sendIdx["should:raise:"]=18;
  55269. self._should_raise_((function(){
  55270. return $core.withContext(function($ctx2) {
  55271. return (16)._rP();
  55272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  55273. }),$globals.MessageNotUnderstood);
  55274. $ctx1.sendIdx["should:raise:"]=19;
  55275. self._should_raise_((function(){
  55276. return $core.withContext(function($ctx2) {
  55277. return (16)._rp();
  55278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  55279. }),$globals.MessageNotUnderstood);
  55280. $ctx1.sendIdx["should:raise:"]=20;
  55281. self._should_raise_((function(){
  55282. return $core.withContext(function($ctx2) {
  55283. return (16)._rQ();
  55284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  55285. }),$globals.MessageNotUnderstood);
  55286. $ctx1.sendIdx["should:raise:"]=21;
  55287. self._should_raise_((function(){
  55288. return $core.withContext(function($ctx2) {
  55289. return (16)._rq();
  55290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  55291. }),$globals.MessageNotUnderstood);
  55292. $ctx1.sendIdx["should:raise:"]=22;
  55293. self._should_raise_((function(){
  55294. return $core.withContext(function($ctx2) {
  55295. return (16)._rR();
  55296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  55297. }),$globals.MessageNotUnderstood);
  55298. $ctx1.sendIdx["should:raise:"]=23;
  55299. self._should_raise_((function(){
  55300. return $core.withContext(function($ctx2) {
  55301. return (16)._rr();
  55302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  55303. }),$globals.MessageNotUnderstood);
  55304. $ctx1.sendIdx["should:raise:"]=24;
  55305. self._should_raise_((function(){
  55306. return $core.withContext(function($ctx2) {
  55307. return (16)._rS();
  55308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  55309. }),$globals.MessageNotUnderstood);
  55310. $ctx1.sendIdx["should:raise:"]=25;
  55311. self._should_raise_((function(){
  55312. return $core.withContext(function($ctx2) {
  55313. return (16)._rs();
  55314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  55315. }),$globals.MessageNotUnderstood);
  55316. $ctx1.sendIdx["should:raise:"]=26;
  55317. self._should_raise_((function(){
  55318. return $core.withContext(function($ctx2) {
  55319. return (16)._rT();
  55320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  55321. }),$globals.MessageNotUnderstood);
  55322. $ctx1.sendIdx["should:raise:"]=27;
  55323. self._should_raise_((function(){
  55324. return $core.withContext(function($ctx2) {
  55325. return (16)._rt();
  55326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  55327. }),$globals.MessageNotUnderstood);
  55328. $ctx1.sendIdx["should:raise:"]=28;
  55329. self._should_raise_((function(){
  55330. return $core.withContext(function($ctx2) {
  55331. return (16)._rU();
  55332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  55333. }),$globals.MessageNotUnderstood);
  55334. $ctx1.sendIdx["should:raise:"]=29;
  55335. self._should_raise_((function(){
  55336. return $core.withContext(function($ctx2) {
  55337. return (16)._ru();
  55338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  55339. }),$globals.MessageNotUnderstood);
  55340. $ctx1.sendIdx["should:raise:"]=30;
  55341. self._should_raise_((function(){
  55342. return $core.withContext(function($ctx2) {
  55343. return (16)._rV();
  55344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  55345. }),$globals.MessageNotUnderstood);
  55346. $ctx1.sendIdx["should:raise:"]=31;
  55347. self._should_raise_((function(){
  55348. return $core.withContext(function($ctx2) {
  55349. return (16)._rv();
  55350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  55351. }),$globals.MessageNotUnderstood);
  55352. $ctx1.sendIdx["should:raise:"]=32;
  55353. self._should_raise_((function(){
  55354. return $core.withContext(function($ctx2) {
  55355. return (16)._rW();
  55356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  55357. }),$globals.MessageNotUnderstood);
  55358. $ctx1.sendIdx["should:raise:"]=33;
  55359. self._should_raise_((function(){
  55360. return $core.withContext(function($ctx2) {
  55361. return (16)._rw();
  55362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  55363. }),$globals.MessageNotUnderstood);
  55364. $ctx1.sendIdx["should:raise:"]=34;
  55365. self._should_raise_((function(){
  55366. return $core.withContext(function($ctx2) {
  55367. return (16)._rX();
  55368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  55369. }),$globals.MessageNotUnderstood);
  55370. $ctx1.sendIdx["should:raise:"]=35;
  55371. self._should_raise_((function(){
  55372. return $core.withContext(function($ctx2) {
  55373. return (16)._rx();
  55374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  55375. }),$globals.MessageNotUnderstood);
  55376. $ctx1.sendIdx["should:raise:"]=36;
  55377. self._should_raise_((function(){
  55378. return $core.withContext(function($ctx2) {
  55379. return (16)._rY();
  55380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  55381. }),$globals.MessageNotUnderstood);
  55382. $ctx1.sendIdx["should:raise:"]=37;
  55383. self._should_raise_((function(){
  55384. return $core.withContext(function($ctx2) {
  55385. return (16)._ry();
  55386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  55387. }),$globals.MessageNotUnderstood);
  55388. $ctx1.sendIdx["should:raise:"]=38;
  55389. self._should_raise_((function(){
  55390. return $core.withContext(function($ctx2) {
  55391. return (16)._rZ();
  55392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  55393. }),$globals.MessageNotUnderstood);
  55394. $ctx1.sendIdx["should:raise:"]=39;
  55395. self._should_raise_((function(){
  55396. return $core.withContext(function($ctx2) {
  55397. return (16)._rz();
  55398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  55399. }),$globals.MessageNotUnderstood);
  55400. $ctx1.sendIdx["should:raise:"]=40;
  55401. self._should_raise_((function(){
  55402. return $core.withContext(function($ctx2) {
  55403. return (11259375)._Z();
  55404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  55405. }),$globals.MessageNotUnderstood);
  55406. return self;
  55407. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  55408. },
  55409. args: [],
  55410. 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.",
  55411. referencedClasses: ["MessageNotUnderstood"],
  55412. 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"]
  55413. }),
  55414. $globals.NumberTest);
  55415. $core.addMethod(
  55416. $core.method({
  55417. selector: "testLog",
  55418. protocol: 'tests',
  55419. fn: function (){
  55420. var self=this;
  55421. return $core.withContext(function($ctx1) {
  55422. self._assert_equals_((10000)._log(),(4));
  55423. $ctx1.sendIdx["assert:equals:"]=1;
  55424. self._assert_equals_((512)._log_((2)),(9));
  55425. $ctx1.sendIdx["assert:equals:"]=2;
  55426. self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  55427. return self;
  55428. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  55429. },
  55430. args: [],
  55431. 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.",
  55432. referencedClasses: ["Number"],
  55433. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  55434. }),
  55435. $globals.NumberTest);
  55436. $core.addMethod(
  55437. $core.method({
  55438. selector: "testMinMax",
  55439. protocol: 'tests',
  55440. fn: function (){
  55441. var self=this;
  55442. return $core.withContext(function($ctx1) {
  55443. self._assert_equals_((2)._max_((5)),(5));
  55444. $ctx1.sendIdx["assert:equals:"]=1;
  55445. self._assert_equals_((2)._min_((5)),(2));
  55446. return self;
  55447. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  55448. },
  55449. args: [],
  55450. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  55451. referencedClasses: [],
  55452. messageSends: ["assert:equals:", "max:", "min:"]
  55453. }),
  55454. $globals.NumberTest);
  55455. $core.addMethod(
  55456. $core.method({
  55457. selector: "testNegated",
  55458. protocol: 'tests',
  55459. fn: function (){
  55460. var self=this;
  55461. return $core.withContext(function($ctx1) {
  55462. var $1;
  55463. $1=(3)._negated();
  55464. $ctx1.sendIdx["negated"]=1;
  55465. self._assert_equals_($1,(-3));
  55466. $ctx1.sendIdx["assert:equals:"]=1;
  55467. self._assert_equals_((-3)._negated(),(3));
  55468. return self;
  55469. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  55470. },
  55471. args: [],
  55472. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  55473. referencedClasses: [],
  55474. messageSends: ["assert:equals:", "negated"]
  55475. }),
  55476. $globals.NumberTest);
  55477. $core.addMethod(
  55478. $core.method({
  55479. selector: "testPrintShowingDecimalPlaces",
  55480. protocol: 'tests',
  55481. fn: function (){
  55482. var self=this;
  55483. return $core.withContext(function($ctx1) {
  55484. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  55485. $1=(23)._printShowingDecimalPlaces_((2));
  55486. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  55487. self._assert_equals_($1,"23.00");
  55488. $ctx1.sendIdx["assert:equals:"]=1;
  55489. $2=(23.5698)._printShowingDecimalPlaces_((2));
  55490. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  55491. self._assert_equals_($2,"23.57");
  55492. $ctx1.sendIdx["assert:equals:"]=2;
  55493. $4=(234.567)._negated();
  55494. $ctx1.sendIdx["negated"]=1;
  55495. $3=$recv($4)._printShowingDecimalPlaces_((5));
  55496. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  55497. self._assert_equals_($3,"-234.56700");
  55498. $ctx1.sendIdx["assert:equals:"]=3;
  55499. $5=(23.4567)._printShowingDecimalPlaces_((0));
  55500. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  55501. self._assert_equals_($5,"23");
  55502. $ctx1.sendIdx["assert:equals:"]=4;
  55503. $6=(23.5567)._printShowingDecimalPlaces_((0));
  55504. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  55505. self._assert_equals_($6,"24");
  55506. $ctx1.sendIdx["assert:equals:"]=5;
  55507. $8=(23.4567)._negated();
  55508. $ctx1.sendIdx["negated"]=2;
  55509. $7=$recv($8)._printShowingDecimalPlaces_((0));
  55510. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  55511. self._assert_equals_($7,"-23");
  55512. $ctx1.sendIdx["assert:equals:"]=6;
  55513. $10=(23.5567)._negated();
  55514. $ctx1.sendIdx["negated"]=3;
  55515. $9=$recv($10)._printShowingDecimalPlaces_((0));
  55516. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  55517. self._assert_equals_($9,"-24");
  55518. $ctx1.sendIdx["assert:equals:"]=7;
  55519. $11=(100000000)._printShowingDecimalPlaces_((1));
  55520. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  55521. self._assert_equals_($11,"100000000.0");
  55522. $ctx1.sendIdx["assert:equals:"]=8;
  55523. $12=(0.98)._printShowingDecimalPlaces_((5));
  55524. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  55525. self._assert_equals_($12,"0.98000");
  55526. $ctx1.sendIdx["assert:equals:"]=9;
  55527. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  55528. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  55529. self._assert_equals_($13,"-0.98");
  55530. $ctx1.sendIdx["assert:equals:"]=10;
  55531. $14=(2.567)._printShowingDecimalPlaces_((2));
  55532. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  55533. self._assert_equals_($14,"2.57");
  55534. $ctx1.sendIdx["assert:equals:"]=11;
  55535. $15=(-2.567)._printShowingDecimalPlaces_((2));
  55536. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  55537. self._assert_equals_($15,"-2.57");
  55538. $ctx1.sendIdx["assert:equals:"]=12;
  55539. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  55540. return self;
  55541. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  55542. },
  55543. args: [],
  55544. 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'.",
  55545. referencedClasses: [],
  55546. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  55547. }),
  55548. $globals.NumberTest);
  55549. $core.addMethod(
  55550. $core.method({
  55551. selector: "testRaisedTo",
  55552. protocol: 'tests',
  55553. fn: function (){
  55554. var self=this;
  55555. return $core.withContext(function($ctx1) {
  55556. var $1,$2,$3;
  55557. $1=(2)._raisedTo_((4));
  55558. $ctx1.sendIdx["raisedTo:"]=1;
  55559. self._assert_equals_($1,(16));
  55560. $ctx1.sendIdx["assert:equals:"]=1;
  55561. $2=(2)._raisedTo_((0));
  55562. $ctx1.sendIdx["raisedTo:"]=2;
  55563. self._assert_equals_($2,(1));
  55564. $ctx1.sendIdx["assert:equals:"]=2;
  55565. $3=(2)._raisedTo_((-3));
  55566. $ctx1.sendIdx["raisedTo:"]=3;
  55567. self._assert_equals_($3,(0.125));
  55568. $ctx1.sendIdx["assert:equals:"]=3;
  55569. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  55570. $ctx1.sendIdx["assert:equals:"]=4;
  55571. self._assert_equals_((2).__star_star((4)),(16));
  55572. return self;
  55573. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  55574. },
  55575. args: [],
  55576. 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.",
  55577. referencedClasses: [],
  55578. messageSends: ["assert:equals:", "raisedTo:", "**"]
  55579. }),
  55580. $globals.NumberTest);
  55581. $core.addMethod(
  55582. $core.method({
  55583. selector: "testRounded",
  55584. protocol: 'tests',
  55585. fn: function (){
  55586. var self=this;
  55587. return $core.withContext(function($ctx1) {
  55588. var $1,$2;
  55589. $1=(3)._rounded();
  55590. $ctx1.sendIdx["rounded"]=1;
  55591. self._assert_equals_($1,(3));
  55592. $ctx1.sendIdx["assert:equals:"]=1;
  55593. $2=(3.212)._rounded();
  55594. $ctx1.sendIdx["rounded"]=2;
  55595. self._assert_equals_($2,(3));
  55596. $ctx1.sendIdx["assert:equals:"]=2;
  55597. self._assert_equals_((3.51)._rounded(),(4));
  55598. return self;
  55599. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  55600. },
  55601. args: [],
  55602. 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",
  55603. referencedClasses: [],
  55604. messageSends: ["assert:equals:", "rounded"]
  55605. }),
  55606. $globals.NumberTest);
  55607. $core.addMethod(
  55608. $core.method({
  55609. selector: "testSign",
  55610. protocol: 'tests',
  55611. fn: function (){
  55612. var self=this;
  55613. return $core.withContext(function($ctx1) {
  55614. var $1,$2;
  55615. $1=(5)._sign();
  55616. $ctx1.sendIdx["sign"]=1;
  55617. self._assert_equals_($1,(1));
  55618. $ctx1.sendIdx["assert:equals:"]=1;
  55619. $2=(0)._sign();
  55620. $ctx1.sendIdx["sign"]=2;
  55621. self._assert_equals_($2,(0));
  55622. $ctx1.sendIdx["assert:equals:"]=2;
  55623. self._assert_equals_((-1.4)._sign(),(-1));
  55624. return self;
  55625. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  55626. },
  55627. args: [],
  55628. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  55629. referencedClasses: [],
  55630. messageSends: ["assert:equals:", "sign"]
  55631. }),
  55632. $globals.NumberTest);
  55633. $core.addMethod(
  55634. $core.method({
  55635. selector: "testSqrt",
  55636. protocol: 'tests',
  55637. fn: function (){
  55638. var self=this;
  55639. return $core.withContext(function($ctx1) {
  55640. var $1;
  55641. $1=(4)._sqrt();
  55642. $ctx1.sendIdx["sqrt"]=1;
  55643. self._assert_equals_($1,(2));
  55644. $ctx1.sendIdx["assert:equals:"]=1;
  55645. self._assert_equals_((16)._sqrt(),(4));
  55646. return self;
  55647. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  55648. },
  55649. args: [],
  55650. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  55651. referencedClasses: [],
  55652. messageSends: ["assert:equals:", "sqrt"]
  55653. }),
  55654. $globals.NumberTest);
  55655. $core.addMethod(
  55656. $core.method({
  55657. selector: "testSquared",
  55658. protocol: 'tests',
  55659. fn: function (){
  55660. var self=this;
  55661. return $core.withContext(function($ctx1) {
  55662. self._assert_equals_((4)._squared(),(16));
  55663. return self;
  55664. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  55665. },
  55666. args: [],
  55667. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  55668. referencedClasses: [],
  55669. messageSends: ["assert:equals:", "squared"]
  55670. }),
  55671. $globals.NumberTest);
  55672. $core.addMethod(
  55673. $core.method({
  55674. selector: "testTimesRepeat",
  55675. protocol: 'tests',
  55676. fn: function (){
  55677. var self=this;
  55678. var i;
  55679. return $core.withContext(function($ctx1) {
  55680. i=(0);
  55681. (0)._timesRepeat_((function(){
  55682. return $core.withContext(function($ctx2) {
  55683. i=$recv(i).__plus((1));
  55684. $ctx2.sendIdx["+"]=1;
  55685. return i;
  55686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55687. }));
  55688. $ctx1.sendIdx["timesRepeat:"]=1;
  55689. self._assert_equals_(i,(0));
  55690. $ctx1.sendIdx["assert:equals:"]=1;
  55691. (5)._timesRepeat_((function(){
  55692. return $core.withContext(function($ctx2) {
  55693. i=$recv(i).__plus((1));
  55694. return i;
  55695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55696. }));
  55697. self._assert_equals_(i,(5));
  55698. return self;
  55699. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  55700. },
  55701. args: [],
  55702. 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",
  55703. referencedClasses: [],
  55704. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  55705. }),
  55706. $globals.NumberTest);
  55707. $core.addMethod(
  55708. $core.method({
  55709. selector: "testTo",
  55710. protocol: 'tests',
  55711. fn: function (){
  55712. var self=this;
  55713. return $core.withContext(function($ctx1) {
  55714. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  55715. return self;
  55716. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  55717. },
  55718. args: [],
  55719. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  55720. referencedClasses: [],
  55721. messageSends: ["assert:equals:", "to:"]
  55722. }),
  55723. $globals.NumberTest);
  55724. $core.addMethod(
  55725. $core.method({
  55726. selector: "testToBy",
  55727. protocol: 'tests',
  55728. fn: function (){
  55729. var self=this;
  55730. return $core.withContext(function($ctx1) {
  55731. var $1;
  55732. $1=(0)._to_by_((6),(2));
  55733. $ctx1.sendIdx["to:by:"]=1;
  55734. self._assert_equals_($1,[(0), (2), (4), (6)]);
  55735. self._should_raise_((function(){
  55736. return $core.withContext(function($ctx2) {
  55737. return (1)._to_by_((4),(0));
  55738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55739. }),$globals.Error);
  55740. return self;
  55741. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  55742. },
  55743. args: [],
  55744. 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",
  55745. referencedClasses: ["Error"],
  55746. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  55747. }),
  55748. $globals.NumberTest);
  55749. $core.addMethod(
  55750. $core.method({
  55751. selector: "testTrigonometry",
  55752. protocol: 'tests',
  55753. fn: function (){
  55754. var self=this;
  55755. return $core.withContext(function($ctx1) {
  55756. self._assert_equals_((0)._cos(),(1));
  55757. $ctx1.sendIdx["assert:equals:"]=1;
  55758. self._assert_equals_((0)._sin(),(0));
  55759. $ctx1.sendIdx["assert:equals:"]=2;
  55760. self._assert_equals_((0)._tan(),(0));
  55761. $ctx1.sendIdx["assert:equals:"]=3;
  55762. self._assert_equals_((1)._arcCos(),(0));
  55763. $ctx1.sendIdx["assert:equals:"]=4;
  55764. self._assert_equals_((0)._arcSin(),(0));
  55765. $ctx1.sendIdx["assert:equals:"]=5;
  55766. self._assert_equals_((0)._arcTan(),(0));
  55767. return self;
  55768. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  55769. },
  55770. args: [],
  55771. 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.",
  55772. referencedClasses: [],
  55773. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  55774. }),
  55775. $globals.NumberTest);
  55776. $core.addMethod(
  55777. $core.method({
  55778. selector: "testTruncated",
  55779. protocol: 'tests',
  55780. fn: function (){
  55781. var self=this;
  55782. return $core.withContext(function($ctx1) {
  55783. var $1,$2;
  55784. $1=(3)._truncated();
  55785. $ctx1.sendIdx["truncated"]=1;
  55786. self._assert_equals_($1,(3));
  55787. $ctx1.sendIdx["assert:equals:"]=1;
  55788. $2=(3.212)._truncated();
  55789. $ctx1.sendIdx["truncated"]=2;
  55790. self._assert_equals_($2,(3));
  55791. $ctx1.sendIdx["assert:equals:"]=2;
  55792. self._assert_equals_((3.51)._truncated(),(3));
  55793. return self;
  55794. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  55795. },
  55796. args: [],
  55797. 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",
  55798. referencedClasses: [],
  55799. messageSends: ["assert:equals:", "truncated"]
  55800. }),
  55801. $globals.NumberTest);
  55802. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  55803. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  55804. $core.addMethod(
  55805. $core.method({
  55806. selector: "foo",
  55807. protocol: 'not yet classified',
  55808. fn: function (){
  55809. var self=this;
  55810. return self["@foo"];
  55811. },
  55812. args: [],
  55813. source: "foo\x0a\x09^ foo",
  55814. referencedClasses: [],
  55815. messageSends: []
  55816. }),
  55817. $globals.ObjectMock);
  55818. $core.addMethod(
  55819. $core.method({
  55820. selector: "foo:",
  55821. protocol: 'not yet classified',
  55822. fn: function (anObject){
  55823. var self=this;
  55824. self["@foo"]=anObject;
  55825. return self;
  55826. },
  55827. args: ["anObject"],
  55828. source: "foo: anObject\x0a\x09foo := anObject",
  55829. referencedClasses: [],
  55830. messageSends: []
  55831. }),
  55832. $globals.ObjectMock);
  55833. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  55834. $core.addMethod(
  55835. $core.method({
  55836. selector: "notDefined",
  55837. protocol: 'tests',
  55838. fn: function (){
  55839. var self=this;
  55840. return $core.withContext(function($ctx1) {
  55841. return void 0;;
  55842. return self;
  55843. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  55844. },
  55845. args: [],
  55846. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  55847. referencedClasses: [],
  55848. messageSends: []
  55849. }),
  55850. $globals.ObjectTest);
  55851. $core.addMethod(
  55852. $core.method({
  55853. selector: "testBasicAccess",
  55854. protocol: 'tests',
  55855. fn: function (){
  55856. var self=this;
  55857. var o;
  55858. return $core.withContext(function($ctx1) {
  55859. var $1;
  55860. o=$recv($globals.Object)._new();
  55861. $recv(o)._basicAt_put_("a",(1));
  55862. $1=$recv(o)._basicAt_("a");
  55863. $ctx1.sendIdx["basicAt:"]=1;
  55864. self._assert_equals_($1,(1));
  55865. $ctx1.sendIdx["assert:equals:"]=1;
  55866. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  55867. return self;
  55868. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  55869. },
  55870. args: [],
  55871. 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",
  55872. referencedClasses: ["Object"],
  55873. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  55874. }),
  55875. $globals.ObjectTest);
  55876. $core.addMethod(
  55877. $core.method({
  55878. selector: "testBasicPerform",
  55879. protocol: 'tests',
  55880. fn: function (){
  55881. var self=this;
  55882. var o;
  55883. return $core.withContext(function($ctx1) {
  55884. o=$recv($globals.Object)._new();
  55885. $recv(o)._basicAt_put_("func",(function(){
  55886. return "hello";
  55887. }));
  55888. $ctx1.sendIdx["basicAt:put:"]=1;
  55889. $recv(o)._basicAt_put_("func2",(function(a){
  55890. return $core.withContext(function($ctx2) {
  55891. return $recv(a).__plus((1));
  55892. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  55893. }));
  55894. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  55895. $ctx1.sendIdx["assert:equals:"]=1;
  55896. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  55897. return self;
  55898. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  55899. },
  55900. args: [],
  55901. 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",
  55902. referencedClasses: ["Object"],
  55903. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  55904. }),
  55905. $globals.ObjectTest);
  55906. $core.addMethod(
  55907. $core.method({
  55908. selector: "testDNU",
  55909. protocol: 'tests',
  55910. fn: function (){
  55911. var self=this;
  55912. return $core.withContext(function($ctx1) {
  55913. self._should_raise_((function(){
  55914. return $core.withContext(function($ctx2) {
  55915. return $recv($recv($globals.Object)._new())._foo();
  55916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55917. }),$globals.MessageNotUnderstood);
  55918. return self;
  55919. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  55920. },
  55921. args: [],
  55922. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  55923. referencedClasses: ["Object", "MessageNotUnderstood"],
  55924. messageSends: ["should:raise:", "foo", "new"]
  55925. }),
  55926. $globals.ObjectTest);
  55927. $core.addMethod(
  55928. $core.method({
  55929. selector: "testEquality",
  55930. protocol: 'tests',
  55931. fn: function (){
  55932. var self=this;
  55933. var o;
  55934. return $core.withContext(function($ctx1) {
  55935. var $1,$2,$4,$3;
  55936. o=$recv($globals.Object)._new();
  55937. $ctx1.sendIdx["new"]=1;
  55938. $1=$recv(o).__eq($recv($globals.Object)._new());
  55939. $ctx1.sendIdx["="]=1;
  55940. self._deny_($1);
  55941. $2=$recv(o).__eq(o);
  55942. $ctx1.sendIdx["="]=2;
  55943. self._assert_($2);
  55944. $ctx1.sendIdx["assert:"]=1;
  55945. $4=$recv(o)._yourself();
  55946. $ctx1.sendIdx["yourself"]=1;
  55947. $3=$recv($4).__eq(o);
  55948. $ctx1.sendIdx["="]=3;
  55949. self._assert_($3);
  55950. $ctx1.sendIdx["assert:"]=2;
  55951. self._assert_($recv(o).__eq($recv(o)._yourself()));
  55952. return self;
  55953. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  55954. },
  55955. args: [],
  55956. 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)",
  55957. referencedClasses: ["Object"],
  55958. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  55959. }),
  55960. $globals.ObjectTest);
  55961. $core.addMethod(
  55962. $core.method({
  55963. selector: "testHalt",
  55964. protocol: 'tests',
  55965. fn: function (){
  55966. var self=this;
  55967. return $core.withContext(function($ctx1) {
  55968. self._should_raise_((function(){
  55969. return $core.withContext(function($ctx2) {
  55970. return $recv($recv($globals.Object)._new())._halt();
  55971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55972. }),$globals.Error);
  55973. return self;
  55974. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  55975. },
  55976. args: [],
  55977. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  55978. referencedClasses: ["Object", "Error"],
  55979. messageSends: ["should:raise:", "halt", "new"]
  55980. }),
  55981. $globals.ObjectTest);
  55982. $core.addMethod(
  55983. $core.method({
  55984. selector: "testIdentity",
  55985. protocol: 'tests',
  55986. fn: function (){
  55987. var self=this;
  55988. var o;
  55989. return $core.withContext(function($ctx1) {
  55990. var $1,$2,$4,$3;
  55991. o=$recv($globals.Object)._new();
  55992. $ctx1.sendIdx["new"]=1;
  55993. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  55994. $ctx1.sendIdx["=="]=1;
  55995. self._deny_($1);
  55996. $2=$recv(o).__eq_eq(o);
  55997. $ctx1.sendIdx["=="]=2;
  55998. self._assert_($2);
  55999. $ctx1.sendIdx["assert:"]=1;
  56000. $4=$recv(o)._yourself();
  56001. $ctx1.sendIdx["yourself"]=1;
  56002. $3=$recv($4).__eq_eq(o);
  56003. $ctx1.sendIdx["=="]=3;
  56004. self._assert_($3);
  56005. $ctx1.sendIdx["assert:"]=2;
  56006. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  56007. return self;
  56008. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  56009. },
  56010. args: [],
  56011. 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",
  56012. referencedClasses: ["Object"],
  56013. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  56014. }),
  56015. $globals.ObjectTest);
  56016. $core.addMethod(
  56017. $core.method({
  56018. selector: "testIfNil",
  56019. protocol: 'tests',
  56020. fn: function (){
  56021. var self=this;
  56022. return $core.withContext(function($ctx1) {
  56023. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  56024. $2=$recv($globals.Object)._new();
  56025. $ctx1.sendIdx["new"]=1;
  56026. $1=$recv($2)._isNil();
  56027. self._deny_($1);
  56028. $ctx1.sendIdx["deny:"]=1;
  56029. $5=$recv($globals.Object)._new();
  56030. $ctx1.sendIdx["new"]=2;
  56031. if(($receiver = $5) == null || $receiver.isNil){
  56032. $4=true;
  56033. } else {
  56034. $4=$5;
  56035. }
  56036. $3=$recv($4).__eq(true);
  56037. self._deny_($3);
  56038. $7=$recv($globals.Object)._new();
  56039. $ctx1.sendIdx["new"]=3;
  56040. if(($receiver = $7) == null || $receiver.isNil){
  56041. $6=$7;
  56042. } else {
  56043. $6=true;
  56044. }
  56045. self._assert_equals_($6,true);
  56046. $ctx1.sendIdx["assert:equals:"]=1;
  56047. $9=$recv($globals.Object)._new();
  56048. $ctx1.sendIdx["new"]=4;
  56049. if(($receiver = $9) == null || $receiver.isNil){
  56050. $8=false;
  56051. } else {
  56052. $8=true;
  56053. }
  56054. self._assert_equals_($8,true);
  56055. $ctx1.sendIdx["assert:equals:"]=2;
  56056. $11=$recv($globals.Object)._new();
  56057. if(($receiver = $11) == null || $receiver.isNil){
  56058. $10=false;
  56059. } else {
  56060. $10=true;
  56061. }
  56062. self._assert_equals_($10,true);
  56063. return self;
  56064. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  56065. },
  56066. args: [],
  56067. 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",
  56068. referencedClasses: ["Object"],
  56069. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56070. }),
  56071. $globals.ObjectTest);
  56072. $core.addMethod(
  56073. $core.method({
  56074. selector: "testInstVars",
  56075. protocol: 'tests',
  56076. fn: function (){
  56077. var self=this;
  56078. var o;
  56079. return $core.withContext(function($ctx1) {
  56080. var $1,$2;
  56081. o=$recv($globals.ObjectMock)._new();
  56082. $1=$recv(o)._instVarAt_("foo");
  56083. $ctx1.sendIdx["instVarAt:"]=1;
  56084. self._assert_equals_($1,nil);
  56085. $ctx1.sendIdx["assert:equals:"]=1;
  56086. $recv(o)._instVarAt_put_("foo",(1));
  56087. $2=$recv(o)._instVarAt_("foo");
  56088. $ctx1.sendIdx["instVarAt:"]=2;
  56089. self._assert_equals_($2,(1));
  56090. $ctx1.sendIdx["assert:equals:"]=2;
  56091. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  56092. return self;
  56093. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  56094. },
  56095. args: [],
  56096. 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",
  56097. referencedClasses: ["ObjectMock"],
  56098. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  56099. }),
  56100. $globals.ObjectTest);
  56101. $core.addMethod(
  56102. $core.method({
  56103. selector: "testNilUndefined",
  56104. protocol: 'tests',
  56105. fn: function (){
  56106. var self=this;
  56107. return $core.withContext(function($ctx1) {
  56108. self._assert_equals_(self._notDefined(),nil);
  56109. return self;
  56110. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  56111. },
  56112. args: [],
  56113. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  56114. referencedClasses: [],
  56115. messageSends: ["assert:equals:", "notDefined"]
  56116. }),
  56117. $globals.ObjectTest);
  56118. $core.addMethod(
  56119. $core.method({
  56120. selector: "testYourself",
  56121. protocol: 'tests',
  56122. fn: function (){
  56123. var self=this;
  56124. var o;
  56125. return $core.withContext(function($ctx1) {
  56126. o=$recv($globals.ObjectMock)._new();
  56127. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  56128. return self;
  56129. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  56130. },
  56131. args: [],
  56132. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  56133. referencedClasses: ["ObjectMock"],
  56134. messageSends: ["new", "assert:", "==", "yourself"]
  56135. }),
  56136. $globals.ObjectTest);
  56137. $core.addMethod(
  56138. $core.method({
  56139. selector: "testidentityHash",
  56140. protocol: 'tests',
  56141. fn: function (){
  56142. var self=this;
  56143. var o1,o2;
  56144. return $core.withContext(function($ctx1) {
  56145. var $2,$3,$1,$5,$4;
  56146. o1=$recv($globals.Object)._new();
  56147. $ctx1.sendIdx["new"]=1;
  56148. o2=$recv($globals.Object)._new();
  56149. $2=$recv(o1)._identityHash();
  56150. $ctx1.sendIdx["identityHash"]=1;
  56151. $3=$recv(o1)._identityHash();
  56152. $ctx1.sendIdx["identityHash"]=2;
  56153. $1=$recv($2).__eq_eq($3);
  56154. $ctx1.sendIdx["=="]=1;
  56155. self._assert_($1);
  56156. $5=$recv(o1)._identityHash();
  56157. $ctx1.sendIdx["identityHash"]=3;
  56158. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  56159. self._deny_($4);
  56160. return self;
  56161. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  56162. },
  56163. args: [],
  56164. 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",
  56165. referencedClasses: ["Object"],
  56166. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  56167. }),
  56168. $globals.ObjectTest);
  56169. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  56170. $core.addMethod(
  56171. $core.method({
  56172. selector: "testAccessing",
  56173. protocol: 'tests',
  56174. fn: function (){
  56175. var self=this;
  56176. return $core.withContext(function($ctx1) {
  56177. var $2,$1,$3,$6,$5,$4;
  56178. $2=$recv($globals.Point)._x_y_((3),(4));
  56179. $ctx1.sendIdx["x:y:"]=1;
  56180. $1=$recv($2)._x();
  56181. $ctx1.sendIdx["x"]=1;
  56182. self._assert_equals_($1,(3));
  56183. $ctx1.sendIdx["assert:equals:"]=1;
  56184. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  56185. $ctx1.sendIdx["y"]=1;
  56186. self._assert_equals_($3,(4));
  56187. $ctx1.sendIdx["assert:equals:"]=2;
  56188. $6=$recv($globals.Point)._new();
  56189. $ctx1.sendIdx["new"]=1;
  56190. $5=$recv($6)._x_((3));
  56191. $4=$recv($5)._x();
  56192. self._assert_equals_($4,(3));
  56193. $ctx1.sendIdx["assert:equals:"]=3;
  56194. self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  56195. return self;
  56196. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  56197. },
  56198. args: [],
  56199. 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",
  56200. referencedClasses: ["Point"],
  56201. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  56202. }),
  56203. $globals.PointTest);
  56204. $core.addMethod(
  56205. $core.method({
  56206. selector: "testArithmetic",
  56207. protocol: 'tests',
  56208. fn: function (){
  56209. var self=this;
  56210. return $core.withContext(function($ctx1) {
  56211. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  56212. $2=(3).__at((4));
  56213. $ctx1.sendIdx["@"]=1;
  56214. $3=(3).__at((4));
  56215. $ctx1.sendIdx["@"]=2;
  56216. $1=$recv($2).__star($3);
  56217. $4=$recv($globals.Point)._x_y_((9),(16));
  56218. $ctx1.sendIdx["x:y:"]=1;
  56219. self._assert_equals_($1,$4);
  56220. $ctx1.sendIdx["assert:equals:"]=1;
  56221. $6=(3).__at((4));
  56222. $ctx1.sendIdx["@"]=3;
  56223. $7=(3).__at((4));
  56224. $ctx1.sendIdx["@"]=4;
  56225. $5=$recv($6).__plus($7);
  56226. $8=$recv($globals.Point)._x_y_((6),(8));
  56227. $ctx1.sendIdx["x:y:"]=2;
  56228. self._assert_equals_($5,$8);
  56229. $ctx1.sendIdx["assert:equals:"]=2;
  56230. $10=(3).__at((4));
  56231. $ctx1.sendIdx["@"]=5;
  56232. $11=(3).__at((4));
  56233. $ctx1.sendIdx["@"]=6;
  56234. $9=$recv($10).__minus($11);
  56235. $12=$recv($globals.Point)._x_y_((0),(0));
  56236. $ctx1.sendIdx["x:y:"]=3;
  56237. self._assert_equals_($9,$12);
  56238. $ctx1.sendIdx["assert:equals:"]=3;
  56239. $14=(6).__at((8));
  56240. $ctx1.sendIdx["@"]=7;
  56241. $13=$recv($14).__slash((3).__at((4)));
  56242. self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  56243. return self;
  56244. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  56245. },
  56246. args: [],
  56247. 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)",
  56248. referencedClasses: ["Point"],
  56249. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  56250. }),
  56251. $globals.PointTest);
  56252. $core.addMethod(
  56253. $core.method({
  56254. selector: "testAt",
  56255. protocol: 'tests',
  56256. fn: function (){
  56257. var self=this;
  56258. return $core.withContext(function($ctx1) {
  56259. self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  56260. return self;
  56261. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  56262. },
  56263. args: [],
  56264. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  56265. referencedClasses: ["Point"],
  56266. messageSends: ["assert:equals:", "@", "x:y:"]
  56267. }),
  56268. $globals.PointTest);
  56269. $core.addMethod(
  56270. $core.method({
  56271. selector: "testComparison",
  56272. protocol: 'tests',
  56273. fn: function (){
  56274. var self=this;
  56275. return $core.withContext(function($ctx1) {
  56276. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  56277. $2=(3).__at((4));
  56278. $ctx1.sendIdx["@"]=1;
  56279. $3=(4).__at((5));
  56280. $ctx1.sendIdx["@"]=2;
  56281. $1=$recv($2).__lt($3);
  56282. $ctx1.sendIdx["<"]=1;
  56283. self._assert_($1);
  56284. $ctx1.sendIdx["assert:"]=1;
  56285. $5=(3).__at((4));
  56286. $ctx1.sendIdx["@"]=3;
  56287. $6=(4).__at((4));
  56288. $ctx1.sendIdx["@"]=4;
  56289. $4=$recv($5).__lt($6);
  56290. self._deny_($4);
  56291. $ctx1.sendIdx["deny:"]=1;
  56292. $8=(4).__at((5));
  56293. $ctx1.sendIdx["@"]=5;
  56294. $9=(4).__at((5));
  56295. $ctx1.sendIdx["@"]=6;
  56296. $7=$recv($8).__lt_eq($9);
  56297. $ctx1.sendIdx["<="]=1;
  56298. self._assert_($7);
  56299. $ctx1.sendIdx["assert:"]=2;
  56300. $11=(4).__at((5));
  56301. $ctx1.sendIdx["@"]=7;
  56302. $12=(3).__at((5));
  56303. $ctx1.sendIdx["@"]=8;
  56304. $10=$recv($11).__lt_eq($12);
  56305. self._deny_($10);
  56306. $ctx1.sendIdx["deny:"]=2;
  56307. $14=(5).__at((6));
  56308. $ctx1.sendIdx["@"]=9;
  56309. $15=(4).__at((5));
  56310. $ctx1.sendIdx["@"]=10;
  56311. $13=$recv($14).__gt($15);
  56312. $ctx1.sendIdx[">"]=1;
  56313. self._assert_($13);
  56314. $ctx1.sendIdx["assert:"]=3;
  56315. $17=(5).__at((6));
  56316. $ctx1.sendIdx["@"]=11;
  56317. $18=(6).__at((6));
  56318. $ctx1.sendIdx["@"]=12;
  56319. $16=$recv($17).__gt($18);
  56320. self._deny_($16);
  56321. $ctx1.sendIdx["deny:"]=3;
  56322. $20=(4).__at((5));
  56323. $ctx1.sendIdx["@"]=13;
  56324. $21=(4).__at((5));
  56325. $ctx1.sendIdx["@"]=14;
  56326. $19=$recv($20).__gt_eq($21);
  56327. $ctx1.sendIdx[">="]=1;
  56328. self._assert_($19);
  56329. $23=(4).__at((5));
  56330. $ctx1.sendIdx["@"]=15;
  56331. $22=$recv($23).__gt_eq((5).__at((5)));
  56332. self._deny_($22);
  56333. return self;
  56334. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  56335. },
  56336. args: [],
  56337. 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)",
  56338. referencedClasses: [],
  56339. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  56340. }),
  56341. $globals.PointTest);
  56342. $core.addMethod(
  56343. $core.method({
  56344. selector: "testEgality",
  56345. protocol: 'tests',
  56346. fn: function (){
  56347. var self=this;
  56348. return $core.withContext(function($ctx1) {
  56349. var $2,$3,$1,$5,$4;
  56350. $2=(3).__at((4));
  56351. $ctx1.sendIdx["@"]=1;
  56352. $3=(3).__at((4));
  56353. $ctx1.sendIdx["@"]=2;
  56354. $1=$recv($2).__eq($3);
  56355. $ctx1.sendIdx["="]=1;
  56356. self._assert_($1);
  56357. $5=(3).__at((5));
  56358. $ctx1.sendIdx["@"]=3;
  56359. $4=$recv($5).__eq((3).__at((6)));
  56360. self._deny_($4);
  56361. return self;
  56362. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  56363. },
  56364. args: [],
  56365. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  56366. referencedClasses: [],
  56367. messageSends: ["assert:", "=", "@", "deny:"]
  56368. }),
  56369. $globals.PointTest);
  56370. $core.addMethod(
  56371. $core.method({
  56372. selector: "testNew",
  56373. protocol: 'tests',
  56374. fn: function (){
  56375. var self=this;
  56376. return $core.withContext(function($ctx1) {
  56377. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  56378. $3=$recv($globals.Point)._new();
  56379. $ctx1.sendIdx["new"]=1;
  56380. $2=$recv($3)._x_((3));
  56381. $ctx1.sendIdx["x:"]=1;
  56382. $1=$recv($2)._y();
  56383. $ctx1.sendIdx["y"]=1;
  56384. self._assert_equals_($1,nil);
  56385. $ctx1.sendIdx["assert:equals:"]=1;
  56386. $7=$recv($globals.Point)._new();
  56387. $ctx1.sendIdx["new"]=2;
  56388. $6=$recv($7)._x_((3));
  56389. $5=$recv($6)._x();
  56390. $ctx1.sendIdx["x"]=1;
  56391. $4=$recv($5).__eq((0));
  56392. $ctx1.sendIdx["="]=1;
  56393. self._deny_($4);
  56394. $ctx1.sendIdx["deny:"]=1;
  56395. $10=$recv($globals.Point)._new();
  56396. $ctx1.sendIdx["new"]=3;
  56397. $9=$recv($10)._y_((4));
  56398. $ctx1.sendIdx["y:"]=1;
  56399. $8=$recv($9)._x();
  56400. self._assert_equals_($8,nil);
  56401. self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  56402. return self;
  56403. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  56404. },
  56405. args: [],
  56406. 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",
  56407. referencedClasses: ["Point"],
  56408. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  56409. }),
  56410. $globals.PointTest);
  56411. $core.addMethod(
  56412. $core.method({
  56413. selector: "testTranslateBy",
  56414. protocol: 'tests',
  56415. fn: function (){
  56416. var self=this;
  56417. return $core.withContext(function($ctx1) {
  56418. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  56419. $2=(3).__at((3));
  56420. $ctx1.sendIdx["@"]=1;
  56421. $3=(0).__at((1));
  56422. $ctx1.sendIdx["@"]=2;
  56423. $1=$recv($2)._translateBy_($3);
  56424. $ctx1.sendIdx["translateBy:"]=1;
  56425. $4=(3).__at((4));
  56426. $ctx1.sendIdx["@"]=3;
  56427. self._assert_equals_($1,$4);
  56428. $ctx1.sendIdx["assert:equals:"]=1;
  56429. $6=(3).__at((3));
  56430. $ctx1.sendIdx["@"]=4;
  56431. $8=(1)._negated();
  56432. $ctx1.sendIdx["negated"]=1;
  56433. $7=(0).__at($8);
  56434. $ctx1.sendIdx["@"]=5;
  56435. $5=$recv($6)._translateBy_($7);
  56436. $ctx1.sendIdx["translateBy:"]=2;
  56437. $9=(3).__at((2));
  56438. $ctx1.sendIdx["@"]=6;
  56439. self._assert_equals_($5,$9);
  56440. $ctx1.sendIdx["assert:equals:"]=2;
  56441. $11=(3).__at((3));
  56442. $ctx1.sendIdx["@"]=7;
  56443. $12=(2).__at((3));
  56444. $ctx1.sendIdx["@"]=8;
  56445. $10=$recv($11)._translateBy_($12);
  56446. $ctx1.sendIdx["translateBy:"]=3;
  56447. $13=(5).__at((6));
  56448. $ctx1.sendIdx["@"]=9;
  56449. self._assert_equals_($10,$13);
  56450. $ctx1.sendIdx["assert:equals:"]=3;
  56451. $15=(3).__at((3));
  56452. $ctx1.sendIdx["@"]=10;
  56453. $16=$recv((3)._negated()).__at((0));
  56454. $ctx1.sendIdx["@"]=11;
  56455. $14=$recv($15)._translateBy_($16);
  56456. self._assert_equals_($14,(0).__at((3)));
  56457. return self;
  56458. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  56459. },
  56460. args: [],
  56461. 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.",
  56462. referencedClasses: [],
  56463. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  56464. }),
  56465. $globals.PointTest);
  56466. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  56467. $core.addMethod(
  56468. $core.method({
  56469. selector: "testNextIfAbsent",
  56470. protocol: 'tests',
  56471. fn: function (){
  56472. var self=this;
  56473. var queue;
  56474. return $core.withContext(function($ctx1) {
  56475. var $2,$1;
  56476. queue=$recv($globals.Queue)._new();
  56477. $recv(queue)._nextPut_("index1");
  56478. $2=$recv(queue)._nextIfAbsent_("empty");
  56479. $ctx1.sendIdx["nextIfAbsent:"]=1;
  56480. $1=$recv($2).__eq("index1");
  56481. $ctx1.sendIdx["="]=1;
  56482. self._assert_($1);
  56483. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  56484. return self;
  56485. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  56486. },
  56487. args: [],
  56488. 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'",
  56489. referencedClasses: ["Queue"],
  56490. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  56491. }),
  56492. $globals.QueueTest);
  56493. $core.addMethod(
  56494. $core.method({
  56495. selector: "testQueueNext",
  56496. protocol: 'tests',
  56497. fn: function (){
  56498. var self=this;
  56499. var queue;
  56500. return $core.withContext(function($ctx1) {
  56501. var $1,$3,$2,$5,$4;
  56502. queue=$recv($globals.Queue)._new();
  56503. $1=queue;
  56504. $recv($1)._nextPut_("index1");
  56505. $ctx1.sendIdx["nextPut:"]=1;
  56506. $recv($1)._nextPut_("index2");
  56507. $3=$recv(queue)._next();
  56508. $ctx1.sendIdx["next"]=1;
  56509. $2=$recv($3).__eq("index1");
  56510. $ctx1.sendIdx["="]=1;
  56511. self._assert_($2);
  56512. $5=$recv(queue)._next();
  56513. $ctx1.sendIdx["next"]=2;
  56514. $4=$recv($5).__eq("index");
  56515. self._deny_($4);
  56516. self._should_raise_((function(){
  56517. return $core.withContext(function($ctx2) {
  56518. return $recv(queue)._next();
  56519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56520. }),$globals.Error);
  56521. return self;
  56522. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  56523. },
  56524. args: [],
  56525. 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",
  56526. referencedClasses: ["Queue", "Error"],
  56527. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  56528. }),
  56529. $globals.QueueTest);
  56530. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  56531. $core.addMethod(
  56532. $core.method({
  56533. selector: "testAtRandomNumber",
  56534. protocol: 'tests',
  56535. fn: function (){
  56536. var self=this;
  56537. var val;
  56538. return $core.withContext(function($ctx1) {
  56539. (100)._timesRepeat_((function(){
  56540. return $core.withContext(function($ctx2) {
  56541. val=(10)._atRandom();
  56542. val;
  56543. self._assert_($recv(val).__gt((0)));
  56544. $ctx2.sendIdx["assert:"]=1;
  56545. return self._assert_($recv(val).__lt((11)));
  56546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56547. }));
  56548. return self;
  56549. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  56550. },
  56551. args: [],
  56552. 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]",
  56553. referencedClasses: [],
  56554. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  56555. }),
  56556. $globals.RandomTest);
  56557. $core.addMethod(
  56558. $core.method({
  56559. selector: "testAtRandomSequenceableCollection",
  56560. protocol: 'tests',
  56561. fn: function (){
  56562. var self=this;
  56563. var val;
  56564. return $core.withContext(function($ctx1) {
  56565. var $3,$4,$2,$1;
  56566. (100)._timesRepeat_((function(){
  56567. return $core.withContext(function($ctx2) {
  56568. val="abc"._atRandom();
  56569. val;
  56570. $3=$recv(val).__eq("a");
  56571. $ctx2.sendIdx["="]=1;
  56572. $4=$recv(val).__eq("b");
  56573. $ctx2.sendIdx["="]=2;
  56574. $2=$recv($3).__or($4);
  56575. $1=$recv($2).__or($recv(val).__eq("c"));
  56576. $ctx2.sendIdx["|"]=1;
  56577. return self._assert_($1);
  56578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56579. }));
  56580. return self;
  56581. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  56582. },
  56583. args: [],
  56584. 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].",
  56585. referencedClasses: [],
  56586. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  56587. }),
  56588. $globals.RandomTest);
  56589. $core.addMethod(
  56590. $core.method({
  56591. selector: "textNext",
  56592. protocol: 'tests',
  56593. fn: function (){
  56594. var self=this;
  56595. return $core.withContext(function($ctx1) {
  56596. var $1;
  56597. (10000)._timesRepeat_((function(){
  56598. var current,next;
  56599. return $core.withContext(function($ctx2) {
  56600. next=$recv($recv($globals.Random)._new())._next();
  56601. next;
  56602. self._assert_($recv(next).__gt_eq((0)));
  56603. $ctx2.sendIdx["assert:"]=1;
  56604. self._assert_($recv(next).__lt((1)));
  56605. $1=$recv(current).__eq(next);
  56606. $ctx2.sendIdx["="]=1;
  56607. self._deny_($1);
  56608. return $recv(next).__eq(current);
  56609. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  56610. }));
  56611. return self;
  56612. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  56613. },
  56614. args: [],
  56615. 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 ]",
  56616. referencedClasses: ["Random"],
  56617. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  56618. }),
  56619. $globals.RandomTest);
  56620. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  56621. $core.addMethod(
  56622. $core.method({
  56623. selector: "collectionClass",
  56624. protocol: 'accessing',
  56625. fn: function (){
  56626. var self=this;
  56627. return $core.withContext(function($ctx1) {
  56628. return $recv(self._class())._collectionClass();
  56629. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  56630. },
  56631. args: [],
  56632. source: "collectionClass\x0a\x09^ self class collectionClass",
  56633. referencedClasses: [],
  56634. messageSends: ["collectionClass", "class"]
  56635. }),
  56636. $globals.StreamTest);
  56637. $core.addMethod(
  56638. $core.method({
  56639. selector: "newCollection",
  56640. protocol: 'accessing',
  56641. fn: function (){
  56642. var self=this;
  56643. return $core.withContext(function($ctx1) {
  56644. return $recv(self._collectionClass())._new();
  56645. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  56646. },
  56647. args: [],
  56648. source: "newCollection\x0a\x09^ self collectionClass new",
  56649. referencedClasses: [],
  56650. messageSends: ["new", "collectionClass"]
  56651. }),
  56652. $globals.StreamTest);
  56653. $core.addMethod(
  56654. $core.method({
  56655. selector: "newStream",
  56656. protocol: 'accessing',
  56657. fn: function (){
  56658. var self=this;
  56659. return $core.withContext(function($ctx1) {
  56660. return $recv($recv(self._collectionClass())._new())._stream();
  56661. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  56662. },
  56663. args: [],
  56664. source: "newStream\x0a\x09^ self collectionClass new stream",
  56665. referencedClasses: [],
  56666. messageSends: ["stream", "new", "collectionClass"]
  56667. }),
  56668. $globals.StreamTest);
  56669. $core.addMethod(
  56670. $core.method({
  56671. selector: "testAtStartAtEnd",
  56672. protocol: 'tests',
  56673. fn: function (){
  56674. var self=this;
  56675. var stream;
  56676. return $core.withContext(function($ctx1) {
  56677. var $1,$2,$3,$4;
  56678. stream=self._newStream();
  56679. $1=$recv(stream)._atStart();
  56680. $ctx1.sendIdx["atStart"]=1;
  56681. self._assert_($1);
  56682. $ctx1.sendIdx["assert:"]=1;
  56683. $2=$recv(stream)._atEnd();
  56684. $ctx1.sendIdx["atEnd"]=1;
  56685. self._assert_($2);
  56686. $ctx1.sendIdx["assert:"]=2;
  56687. $recv(stream)._nextPutAll_(self._newCollection());
  56688. $3=$recv(stream)._atEnd();
  56689. $ctx1.sendIdx["atEnd"]=2;
  56690. self._assert_($3);
  56691. $4=$recv(stream)._atStart();
  56692. $ctx1.sendIdx["atStart"]=2;
  56693. self._deny_($4);
  56694. $ctx1.sendIdx["deny:"]=1;
  56695. $recv(stream)._position_((1));
  56696. self._deny_($recv(stream)._atEnd());
  56697. $ctx1.sendIdx["deny:"]=2;
  56698. self._deny_($recv(stream)._atStart());
  56699. return self;
  56700. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  56701. },
  56702. args: [],
  56703. 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",
  56704. referencedClasses: [],
  56705. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  56706. }),
  56707. $globals.StreamTest);
  56708. $core.addMethod(
  56709. $core.method({
  56710. selector: "testContents",
  56711. protocol: 'tests',
  56712. fn: function (){
  56713. var self=this;
  56714. var stream;
  56715. return $core.withContext(function($ctx1) {
  56716. var $1,$2;
  56717. stream=self._newStream();
  56718. $1=stream;
  56719. $2=self._newCollection();
  56720. $ctx1.sendIdx["newCollection"]=1;
  56721. $recv($1)._nextPutAll_($2);
  56722. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  56723. return self;
  56724. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  56725. },
  56726. args: [],
  56727. 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",
  56728. referencedClasses: [],
  56729. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  56730. }),
  56731. $globals.StreamTest);
  56732. $core.addMethod(
  56733. $core.method({
  56734. selector: "testIsEmpty",
  56735. protocol: 'tests',
  56736. fn: function (){
  56737. var self=this;
  56738. var stream;
  56739. return $core.withContext(function($ctx1) {
  56740. var $1;
  56741. stream=self._newStream();
  56742. $1=$recv(stream)._isEmpty();
  56743. $ctx1.sendIdx["isEmpty"]=1;
  56744. self._assert_($1);
  56745. $recv(stream)._nextPutAll_(self._newCollection());
  56746. self._deny_($recv(stream)._isEmpty());
  56747. return self;
  56748. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  56749. },
  56750. args: [],
  56751. 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",
  56752. referencedClasses: [],
  56753. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  56754. }),
  56755. $globals.StreamTest);
  56756. $core.addMethod(
  56757. $core.method({
  56758. selector: "testPosition",
  56759. protocol: 'tests',
  56760. fn: function (){
  56761. var self=this;
  56762. var collection,stream;
  56763. return $core.withContext(function($ctx1) {
  56764. var $1,$2,$3;
  56765. collection=self._newCollection();
  56766. stream=self._newStream();
  56767. $recv(stream)._nextPutAll_(collection);
  56768. $1=$recv(stream)._position();
  56769. $ctx1.sendIdx["position"]=1;
  56770. self._assert_equals_($1,$recv(collection)._size());
  56771. $ctx1.sendIdx["assert:equals:"]=1;
  56772. $recv(stream)._position_((0));
  56773. $2=$recv(stream)._position();
  56774. $ctx1.sendIdx["position"]=2;
  56775. self._assert_equals_($2,(0));
  56776. $ctx1.sendIdx["assert:equals:"]=2;
  56777. $recv(stream)._next();
  56778. $ctx1.sendIdx["next"]=1;
  56779. $3=$recv(stream)._position();
  56780. $ctx1.sendIdx["position"]=3;
  56781. self._assert_equals_($3,(1));
  56782. $ctx1.sendIdx["assert:equals:"]=3;
  56783. $recv(stream)._next();
  56784. self._assert_equals_($recv(stream)._position(),(2));
  56785. return self;
  56786. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  56787. },
  56788. args: [],
  56789. 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",
  56790. referencedClasses: [],
  56791. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  56792. }),
  56793. $globals.StreamTest);
  56794. $core.addMethod(
  56795. $core.method({
  56796. selector: "testReading",
  56797. protocol: 'tests',
  56798. fn: function (){
  56799. var self=this;
  56800. var stream,collection;
  56801. return $core.withContext(function($ctx1) {
  56802. var $1,$2;
  56803. collection=self._newCollection();
  56804. stream=self._newStream();
  56805. $1=stream;
  56806. $recv($1)._nextPutAll_(collection);
  56807. $recv($1)._position_((0));
  56808. $recv(collection)._do_((function(each){
  56809. return $core.withContext(function($ctx2) {
  56810. $2=$recv(stream)._next();
  56811. $ctx2.sendIdx["next"]=1;
  56812. return self._assert_equals_($2,each);
  56813. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56814. }));
  56815. self._assert_($recv($recv(stream)._next())._isNil());
  56816. return self;
  56817. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  56818. },
  56819. args: [],
  56820. 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",
  56821. referencedClasses: [],
  56822. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  56823. }),
  56824. $globals.StreamTest);
  56825. $core.addMethod(
  56826. $core.method({
  56827. selector: "testStreamContents",
  56828. protocol: 'tests',
  56829. fn: function (){
  56830. var self=this;
  56831. return self;
  56832. },
  56833. args: [],
  56834. source: "testStreamContents",
  56835. referencedClasses: [],
  56836. messageSends: []
  56837. }),
  56838. $globals.StreamTest);
  56839. $core.addMethod(
  56840. $core.method({
  56841. selector: "testWrite",
  56842. protocol: 'tests',
  56843. fn: function (){
  56844. var self=this;
  56845. var stream,collection;
  56846. return $core.withContext(function($ctx1) {
  56847. collection=self._newCollection();
  56848. stream=self._newStream();
  56849. $recv(collection)._do_((function(each){
  56850. return $core.withContext(function($ctx2) {
  56851. return $recv(stream).__lt_lt(each);
  56852. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56853. }));
  56854. self._assert_equals_($recv(stream)._contents(),collection);
  56855. return self;
  56856. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  56857. },
  56858. args: [],
  56859. 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",
  56860. referencedClasses: [],
  56861. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  56862. }),
  56863. $globals.StreamTest);
  56864. $core.addMethod(
  56865. $core.method({
  56866. selector: "testWriting",
  56867. protocol: 'tests',
  56868. fn: function (){
  56869. var self=this;
  56870. var stream,collection;
  56871. return $core.withContext(function($ctx1) {
  56872. var $1;
  56873. collection=self._newCollection();
  56874. stream=self._newStream();
  56875. $ctx1.sendIdx["newStream"]=1;
  56876. $recv(collection)._do_((function(each){
  56877. return $core.withContext(function($ctx2) {
  56878. return $recv(stream)._nextPut_(each);
  56879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56880. }));
  56881. $1=$recv(stream)._contents();
  56882. $ctx1.sendIdx["contents"]=1;
  56883. self._assert_equals_($1,collection);
  56884. $ctx1.sendIdx["assert:equals:"]=1;
  56885. stream=self._newStream();
  56886. $recv(stream)._nextPutAll_(collection);
  56887. self._assert_equals_($recv(stream)._contents(),collection);
  56888. return self;
  56889. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  56890. },
  56891. args: [],
  56892. 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",
  56893. referencedClasses: [],
  56894. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  56895. }),
  56896. $globals.StreamTest);
  56897. $core.addMethod(
  56898. $core.method({
  56899. selector: "collectionClass",
  56900. protocol: 'accessing',
  56901. fn: function (){
  56902. var self=this;
  56903. return nil;
  56904. },
  56905. args: [],
  56906. source: "collectionClass\x0a\x09^ nil",
  56907. referencedClasses: [],
  56908. messageSends: []
  56909. }),
  56910. $globals.StreamTest.klass);
  56911. $core.addMethod(
  56912. $core.method({
  56913. selector: "isAbstract",
  56914. protocol: 'testing',
  56915. fn: function (){
  56916. var self=this;
  56917. return $core.withContext(function($ctx1) {
  56918. return $recv(self._collectionClass())._isNil();
  56919. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  56920. },
  56921. args: [],
  56922. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  56923. referencedClasses: [],
  56924. messageSends: ["isNil", "collectionClass"]
  56925. }),
  56926. $globals.StreamTest.klass);
  56927. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56928. $core.addMethod(
  56929. $core.method({
  56930. selector: "newCollection",
  56931. protocol: 'accessing',
  56932. fn: function (){
  56933. var self=this;
  56934. return $core.withContext(function($ctx1) {
  56935. return [true,(1),(3).__at((4)),"foo"];
  56936. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  56937. },
  56938. args: [],
  56939. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  56940. referencedClasses: [],
  56941. messageSends: ["@"]
  56942. }),
  56943. $globals.ArrayStreamTest);
  56944. $core.addMethod(
  56945. $core.method({
  56946. selector: "collectionClass",
  56947. protocol: 'accessing',
  56948. fn: function (){
  56949. var self=this;
  56950. return $globals.Array;
  56951. },
  56952. args: [],
  56953. source: "collectionClass\x0a\x09^ Array",
  56954. referencedClasses: ["Array"],
  56955. messageSends: []
  56956. }),
  56957. $globals.ArrayStreamTest.klass);
  56958. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56959. $core.addMethod(
  56960. $core.method({
  56961. selector: "newCollection",
  56962. protocol: 'accessing',
  56963. fn: function (){
  56964. var self=this;
  56965. return "hello world";
  56966. },
  56967. args: [],
  56968. source: "newCollection\x0a\x09^ 'hello world'",
  56969. referencedClasses: [],
  56970. messageSends: []
  56971. }),
  56972. $globals.StringStreamTest);
  56973. $core.addMethod(
  56974. $core.method({
  56975. selector: "collectionClass",
  56976. protocol: 'accessing',
  56977. fn: function (){
  56978. var self=this;
  56979. return $globals.String;
  56980. },
  56981. args: [],
  56982. source: "collectionClass\x0a\x09^ String",
  56983. referencedClasses: ["String"],
  56984. messageSends: []
  56985. }),
  56986. $globals.StringStreamTest.klass);
  56987. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  56988. $core.addMethod(
  56989. $core.method({
  56990. selector: "testCopying",
  56991. protocol: 'tests',
  56992. fn: function (){
  56993. var self=this;
  56994. return $core.withContext(function($ctx1) {
  56995. self._assert_equals_(nil._copy(),nil);
  56996. return self;
  56997. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  56998. },
  56999. args: [],
  57000. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  57001. referencedClasses: [],
  57002. messageSends: ["assert:equals:", "copy"]
  57003. }),
  57004. $globals.UndefinedTest);
  57005. $core.addMethod(
  57006. $core.method({
  57007. selector: "testDeepCopy",
  57008. protocol: 'tests',
  57009. fn: function (){
  57010. var self=this;
  57011. return $core.withContext(function($ctx1) {
  57012. self._assert_($recv(nil._deepCopy()).__eq(nil));
  57013. return self;
  57014. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  57015. },
  57016. args: [],
  57017. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  57018. referencedClasses: [],
  57019. messageSends: ["assert:", "=", "deepCopy"]
  57020. }),
  57021. $globals.UndefinedTest);
  57022. $core.addMethod(
  57023. $core.method({
  57024. selector: "testIfNil",
  57025. protocol: 'tests',
  57026. fn: function (){
  57027. var self=this;
  57028. return $core.withContext(function($ctx1) {
  57029. var $1,$3,$2,$4,$6,$5,$receiver;
  57030. if(($receiver = nil) == null || $receiver.isNil){
  57031. $1=true;
  57032. } else {
  57033. $1=nil;
  57034. }
  57035. self._assert_equals_($1,true);
  57036. $ctx1.sendIdx["assert:equals:"]=1;
  57037. if(($receiver = nil) == null || $receiver.isNil){
  57038. $3=nil;
  57039. } else {
  57040. $3=true;
  57041. }
  57042. $2=$recv($3).__eq(true);
  57043. $ctx1.sendIdx["="]=1;
  57044. self._deny_($2);
  57045. $ctx1.sendIdx["deny:"]=1;
  57046. if(($receiver = nil) == null || $receiver.isNil){
  57047. $4=true;
  57048. } else {
  57049. $4=false;
  57050. }
  57051. self._assert_equals_($4,true);
  57052. if(($receiver = nil) == null || $receiver.isNil){
  57053. $6=false;
  57054. } else {
  57055. $6=true;
  57056. }
  57057. $5=$recv($6).__eq(true);
  57058. self._deny_($5);
  57059. return self;
  57060. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  57061. },
  57062. args: [],
  57063. 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",
  57064. referencedClasses: [],
  57065. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  57066. }),
  57067. $globals.UndefinedTest);
  57068. $core.addMethod(
  57069. $core.method({
  57070. selector: "testIsNil",
  57071. protocol: 'tests',
  57072. fn: function (){
  57073. var self=this;
  57074. return $core.withContext(function($ctx1) {
  57075. self._assert_(nil._isNil());
  57076. self._deny_(nil._notNil());
  57077. return self;
  57078. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  57079. },
  57080. args: [],
  57081. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  57082. referencedClasses: [],
  57083. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  57084. }),
  57085. $globals.UndefinedTest);
  57086. });
  57087. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  57088. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  57089. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  57090. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  57091. $core.addPackage('Platform-DOM-Tests');
  57092. $core.packages["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  57093. $core.packages["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  57094. $core.addClass('PlatformDomTest', $globals.TestCase, ['fixtureDiv'], 'Platform-DOM-Tests');
  57095. $core.addMethod(
  57096. $core.method({
  57097. selector: "testEntityConversion",
  57098. protocol: 'testing',
  57099. fn: function (){
  57100. var self=this;
  57101. return $core.withContext(function($ctx1) {
  57102. var $1;
  57103. $1=$recv($globals.PlatformDom)._isFeasible();
  57104. if($core.assert($1)){
  57105. self._assert_equals_("&copy;"._htmlTextContent(),"©");
  57106. }
  57107. return self;
  57108. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  57109. },
  57110. args: [],
  57111. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  57112. referencedClasses: ["PlatformDom"],
  57113. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  57114. }),
  57115. $globals.PlatformDomTest);
  57116. $core.addMethod(
  57117. $core.method({
  57118. selector: "testTextContentDoesNotRunScript",
  57119. protocol: 'testing',
  57120. fn: function (){
  57121. var self=this;
  57122. return $core.withContext(function($ctx1) {
  57123. var $1;
  57124. $1=$recv($globals.PlatformDom)._isFeasible();
  57125. if($core.assert($1)){
  57126. self._shouldnt_raise_((function(){
  57127. return $core.withContext(function($ctx2) {
  57128. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  57129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57130. }),$globals.Error);
  57131. }
  57132. return self;
  57133. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  57134. },
  57135. args: [],
  57136. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  57137. referencedClasses: ["PlatformDom", "Error"],
  57138. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  57139. }),
  57140. $globals.PlatformDomTest);
  57141. });
  57142. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  57143. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  57144. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  57145. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  57146. $core.addPackage('SUnit-Tests');
  57147. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  57148. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  57149. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  57150. $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.";
  57151. $core.addMethod(
  57152. $core.method({
  57153. selector: "setUp",
  57154. protocol: 'running',
  57155. fn: function (){
  57156. var self=this;
  57157. return $core.withContext(function($ctx1) {
  57158. self["@empty"]=$recv($globals.Set)._new();
  57159. self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  57160. return self;
  57161. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  57162. },
  57163. args: [],
  57164. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  57165. referencedClasses: ["Set"],
  57166. messageSends: ["new", "with:with:"]
  57167. }),
  57168. $globals.ExampleSetTest);
  57169. $core.addMethod(
  57170. $core.method({
  57171. selector: "testAdd",
  57172. protocol: 'tests',
  57173. fn: function (){
  57174. var self=this;
  57175. return $core.withContext(function($ctx1) {
  57176. $recv(self["@empty"])._add_((5));
  57177. self._assert_($recv(self["@empty"])._includes_((5)));
  57178. return self;
  57179. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  57180. },
  57181. args: [],
  57182. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  57183. referencedClasses: [],
  57184. messageSends: ["add:", "assert:", "includes:"]
  57185. }),
  57186. $globals.ExampleSetTest);
  57187. $core.addMethod(
  57188. $core.method({
  57189. selector: "testGrow",
  57190. protocol: 'tests',
  57191. fn: function (){
  57192. var self=this;
  57193. return $core.withContext(function($ctx1) {
  57194. $recv(self["@empty"])._addAll_((1)._to_((100)));
  57195. self._assert_equals_($recv(self["@empty"])._size(),(100));
  57196. return self;
  57197. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  57198. },
  57199. args: [],
  57200. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  57201. referencedClasses: [],
  57202. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  57203. }),
  57204. $globals.ExampleSetTest);
  57205. $core.addMethod(
  57206. $core.method({
  57207. selector: "testIllegal",
  57208. protocol: 'tests',
  57209. fn: function (){
  57210. var self=this;
  57211. return $core.withContext(function($ctx1) {
  57212. self._should_raise_((function(){
  57213. return $core.withContext(function($ctx2) {
  57214. return $recv(self["@empty"])._at_((5));
  57215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57216. }),$globals.Error);
  57217. $ctx1.sendIdx["should:raise:"]=1;
  57218. self._should_raise_((function(){
  57219. return $core.withContext(function($ctx2) {
  57220. return $recv(self["@empty"])._at_put_((5),"abc");
  57221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57222. }),$globals.Error);
  57223. return self;
  57224. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  57225. },
  57226. args: [],
  57227. 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",
  57228. referencedClasses: ["Error"],
  57229. messageSends: ["should:raise:", "at:", "at:put:"]
  57230. }),
  57231. $globals.ExampleSetTest);
  57232. $core.addMethod(
  57233. $core.method({
  57234. selector: "testIncludes",
  57235. protocol: 'tests',
  57236. fn: function (){
  57237. var self=this;
  57238. return $core.withContext(function($ctx1) {
  57239. var $1;
  57240. $1=$recv(self["@full"])._includes_((5));
  57241. $ctx1.sendIdx["includes:"]=1;
  57242. self._assert_($1);
  57243. $ctx1.sendIdx["assert:"]=1;
  57244. self._assert_($recv(self["@full"])._includes_("abc"));
  57245. return self;
  57246. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  57247. },
  57248. args: [],
  57249. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  57250. referencedClasses: [],
  57251. messageSends: ["assert:", "includes:"]
  57252. }),
  57253. $globals.ExampleSetTest);
  57254. $core.addMethod(
  57255. $core.method({
  57256. selector: "testOccurrences",
  57257. protocol: 'tests',
  57258. fn: function (){
  57259. var self=this;
  57260. return $core.withContext(function($ctx1) {
  57261. var $1,$2;
  57262. $1=$recv(self["@empty"])._occurrencesOf_((0));
  57263. $ctx1.sendIdx["occurrencesOf:"]=1;
  57264. self._assert_equals_($1,(0));
  57265. $ctx1.sendIdx["assert:equals:"]=1;
  57266. $2=$recv(self["@full"])._occurrencesOf_((5));
  57267. $ctx1.sendIdx["occurrencesOf:"]=2;
  57268. self._assert_equals_($2,(1));
  57269. $ctx1.sendIdx["assert:equals:"]=2;
  57270. $recv(self["@full"])._add_((5));
  57271. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  57272. return self;
  57273. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  57274. },
  57275. args: [],
  57276. 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",
  57277. referencedClasses: [],
  57278. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  57279. }),
  57280. $globals.ExampleSetTest);
  57281. $core.addMethod(
  57282. $core.method({
  57283. selector: "testRemove",
  57284. protocol: 'tests',
  57285. fn: function (){
  57286. var self=this;
  57287. return $core.withContext(function($ctx1) {
  57288. var $1;
  57289. $recv(self["@full"])._remove_((5));
  57290. $1=$recv(self["@full"])._includes_("abc");
  57291. $ctx1.sendIdx["includes:"]=1;
  57292. self._assert_($1);
  57293. self._deny_($recv(self["@full"])._includes_((5)));
  57294. return self;
  57295. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  57296. },
  57297. args: [],
  57298. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  57299. referencedClasses: [],
  57300. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  57301. }),
  57302. $globals.ExampleSetTest);
  57303. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  57304. $core.addMethod(
  57305. $core.method({
  57306. selector: "fakeError",
  57307. protocol: 'helpers',
  57308. fn: function (){
  57309. var self=this;
  57310. return $core.withContext(function($ctx1) {
  57311. self["@flag"]="bad";
  57312. self._timeout_((30));
  57313. self["@flag"]=$recv(self._async_((function(){
  57314. return $core.withContext(function($ctx2) {
  57315. self["@flag"]="ok";
  57316. self["@flag"];
  57317. return self._error_("Intentional");
  57318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57319. })))._valueWithTimeout_((20));
  57320. return self;
  57321. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  57322. },
  57323. args: [],
  57324. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  57325. referencedClasses: [],
  57326. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57327. }),
  57328. $globals.SUnitAsyncTest);
  57329. $core.addMethod(
  57330. $core.method({
  57331. selector: "fakeErrorFailingInTearDown",
  57332. protocol: 'helpers',
  57333. fn: function (){
  57334. var self=this;
  57335. return $core.withContext(function($ctx1) {
  57336. self["@flag"]="bad";
  57337. self._timeout_((30));
  57338. self["@flag"]=$recv(self._async_((function(){
  57339. return $core.withContext(function($ctx2) {
  57340. return self._error_("Intentional");
  57341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57342. })))._valueWithTimeout_((20));
  57343. return self;
  57344. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  57345. },
  57346. args: [],
  57347. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  57348. referencedClasses: [],
  57349. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57350. }),
  57351. $globals.SUnitAsyncTest);
  57352. $core.addMethod(
  57353. $core.method({
  57354. selector: "fakeFailure",
  57355. protocol: 'helpers',
  57356. fn: function (){
  57357. var self=this;
  57358. return $core.withContext(function($ctx1) {
  57359. self["@flag"]="bad";
  57360. self._timeout_((30));
  57361. self["@flag"]=$recv(self._async_((function(){
  57362. return $core.withContext(function($ctx2) {
  57363. self["@flag"]="ok";
  57364. self["@flag"];
  57365. return self._assert_(false);
  57366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57367. })))._valueWithTimeout_((20));
  57368. return self;
  57369. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  57370. },
  57371. args: [],
  57372. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  57373. referencedClasses: [],
  57374. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  57375. }),
  57376. $globals.SUnitAsyncTest);
  57377. $core.addMethod(
  57378. $core.method({
  57379. selector: "fakeMultipleTimeoutFailing",
  57380. protocol: 'helpers',
  57381. fn: function (){
  57382. var self=this;
  57383. return $core.withContext(function($ctx1) {
  57384. var $1;
  57385. self._timeout_((100));
  57386. $ctx1.sendIdx["timeout:"]=1;
  57387. $1=self._async_((function(){
  57388. return $core.withContext(function($ctx2) {
  57389. self._timeout_((20));
  57390. return $recv(self._async_((function(){
  57391. return $core.withContext(function($ctx3) {
  57392. return self._finished();
  57393. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57394. })))._valueWithTimeout_((30));
  57395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57396. }));
  57397. $ctx1.sendIdx["async:"]=1;
  57398. $recv($1)._valueWithTimeout_((20));
  57399. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57400. return self;
  57401. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  57402. },
  57403. args: [],
  57404. 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",
  57405. referencedClasses: [],
  57406. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57407. }),
  57408. $globals.SUnitAsyncTest);
  57409. $core.addMethod(
  57410. $core.method({
  57411. selector: "fakeMultipleTimeoutPassing",
  57412. protocol: 'helpers',
  57413. fn: function (){
  57414. var self=this;
  57415. return $core.withContext(function($ctx1) {
  57416. var $1;
  57417. self._timeout_((20));
  57418. $ctx1.sendIdx["timeout:"]=1;
  57419. $1=self._async_((function(){
  57420. return $core.withContext(function($ctx2) {
  57421. self._timeout_((40));
  57422. return $recv(self._async_((function(){
  57423. return $core.withContext(function($ctx3) {
  57424. return self._finished();
  57425. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57426. })))._valueWithTimeout_((20));
  57427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57428. }));
  57429. $ctx1.sendIdx["async:"]=1;
  57430. $recv($1)._valueWithTimeout_((10));
  57431. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57432. return self;
  57433. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  57434. },
  57435. args: [],
  57436. 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",
  57437. referencedClasses: [],
  57438. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57439. }),
  57440. $globals.SUnitAsyncTest);
  57441. $core.addMethod(
  57442. $core.method({
  57443. selector: "fakeTimeout",
  57444. protocol: 'helpers',
  57445. fn: function (){
  57446. var self=this;
  57447. return $core.withContext(function($ctx1) {
  57448. self._timeout_((10));
  57449. $recv(self._async_((function(){
  57450. return $core.withContext(function($ctx2) {
  57451. return self._finished();
  57452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57453. })))._valueWithTimeout_((20));
  57454. return self;
  57455. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  57456. },
  57457. args: [],
  57458. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  57459. referencedClasses: [],
  57460. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57461. }),
  57462. $globals.SUnitAsyncTest);
  57463. $core.addMethod(
  57464. $core.method({
  57465. selector: "selectorSetOf:",
  57466. protocol: 'private',
  57467. fn: function (aCollection){
  57468. var self=this;
  57469. return $core.withContext(function($ctx1) {
  57470. return $recv($recv(aCollection)._collect_((function(each){
  57471. return $core.withContext(function($ctx2) {
  57472. return $recv(each)._selector();
  57473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57474. })))._asSet();
  57475. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  57476. },
  57477. args: ["aCollection"],
  57478. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  57479. referencedClasses: [],
  57480. messageSends: ["asSet", "collect:", "selector"]
  57481. }),
  57482. $globals.SUnitAsyncTest);
  57483. $core.addMethod(
  57484. $core.method({
  57485. selector: "setUp",
  57486. protocol: 'running',
  57487. fn: function (){
  57488. var self=this;
  57489. self["@flag"]="ok";
  57490. return self;
  57491. },
  57492. args: [],
  57493. source: "setUp\x0a\x09flag := 'ok'",
  57494. referencedClasses: [],
  57495. messageSends: []
  57496. }),
  57497. $globals.SUnitAsyncTest);
  57498. $core.addMethod(
  57499. $core.method({
  57500. selector: "tearDown",
  57501. protocol: 'running',
  57502. fn: function (){
  57503. var self=this;
  57504. return $core.withContext(function($ctx1) {
  57505. self._assert_equals_("ok",self["@flag"]);
  57506. return self;
  57507. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  57508. },
  57509. args: [],
  57510. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  57511. referencedClasses: [],
  57512. messageSends: ["assert:equals:"]
  57513. }),
  57514. $globals.SUnitAsyncTest);
  57515. $core.addMethod(
  57516. $core.method({
  57517. selector: "testAsyncErrorsAndFailures",
  57518. protocol: 'tests',
  57519. fn: function (){
  57520. var self=this;
  57521. var suite,runner,result,assertBlock;
  57522. return $core.withContext(function($ctx1) {
  57523. var $1,$2,$3,$4;
  57524. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  57525. return $core.withContext(function($ctx2) {
  57526. return $recv(self._class())._selector_(each);
  57527. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57528. }));
  57529. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57530. self._timeout_((200));
  57531. result=$recv(runner)._result();
  57532. $ctx1.sendIdx["result"]=1;
  57533. assertBlock=self._async_((function(){
  57534. return $core.withContext(function($ctx2) {
  57535. $1=self._selectorSetOf_($recv(result)._errors());
  57536. $ctx2.sendIdx["selectorSetOf:"]=1;
  57537. $2=["fakeError"]._asSet();
  57538. $ctx2.sendIdx["asSet"]=1;
  57539. self._assert_equals_($1,$2);
  57540. $ctx2.sendIdx["assert:equals:"]=1;
  57541. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  57542. return self._finished();
  57543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57544. }));
  57545. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57546. return $core.withContext(function($ctx2) {
  57547. $3=$recv($recv(ann)._result()).__eq_eq(result);
  57548. if($core.assert($3)){
  57549. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57550. return $recv($4)._ifTrue_(assertBlock);
  57551. }
  57552. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57553. }));
  57554. $recv(runner)._run();
  57555. return self;
  57556. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57557. },
  57558. args: [],
  57559. 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",
  57560. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  57561. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57562. }),
  57563. $globals.SUnitAsyncTest);
  57564. $core.addMethod(
  57565. $core.method({
  57566. selector: "testAsyncNeedsTimeout",
  57567. protocol: 'tests',
  57568. fn: function (){
  57569. var self=this;
  57570. return $core.withContext(function($ctx1) {
  57571. self._should_raise_((function(){
  57572. return $core.withContext(function($ctx2) {
  57573. return self._async_((function(){
  57574. }));
  57575. $ctx2.sendIdx["async:"]=1;
  57576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57577. }),$globals.Error);
  57578. self._timeout_((0));
  57579. self._shouldnt_raise_((function(){
  57580. return $core.withContext(function($ctx2) {
  57581. return self._async_((function(){
  57582. }));
  57583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57584. }),$globals.Error);
  57585. self._finished();
  57586. return self;
  57587. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57588. },
  57589. args: [],
  57590. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  57591. referencedClasses: ["Error"],
  57592. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  57593. }),
  57594. $globals.SUnitAsyncTest);
  57595. $core.addMethod(
  57596. $core.method({
  57597. selector: "testFinishedNeedsTimeout",
  57598. protocol: 'tests',
  57599. fn: function (){
  57600. var self=this;
  57601. return $core.withContext(function($ctx1) {
  57602. self._should_raise_((function(){
  57603. return $core.withContext(function($ctx2) {
  57604. return self._finished();
  57605. $ctx2.sendIdx["finished"]=1;
  57606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57607. }),$globals.Error);
  57608. self._timeout_((0));
  57609. self._shouldnt_raise_((function(){
  57610. return $core.withContext(function($ctx2) {
  57611. return self._finished();
  57612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57613. }),$globals.Error);
  57614. return self;
  57615. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57616. },
  57617. args: [],
  57618. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  57619. referencedClasses: ["Error"],
  57620. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  57621. }),
  57622. $globals.SUnitAsyncTest);
  57623. $core.addMethod(
  57624. $core.method({
  57625. selector: "testIsAsyncReturnsCorrectValues",
  57626. protocol: 'tests',
  57627. fn: function (){
  57628. var self=this;
  57629. return $core.withContext(function($ctx1) {
  57630. var $1,$2;
  57631. $1=self._isAsync();
  57632. $ctx1.sendIdx["isAsync"]=1;
  57633. self._deny_($1);
  57634. $ctx1.sendIdx["deny:"]=1;
  57635. self._timeout_((0));
  57636. $2=self._isAsync();
  57637. $ctx1.sendIdx["isAsync"]=2;
  57638. self._assert_($2);
  57639. self._finished();
  57640. self._deny_(self._isAsync());
  57641. return self;
  57642. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  57643. },
  57644. args: [],
  57645. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  57646. referencedClasses: [],
  57647. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  57648. }),
  57649. $globals.SUnitAsyncTest);
  57650. $core.addMethod(
  57651. $core.method({
  57652. selector: "testPass",
  57653. protocol: 'tests',
  57654. fn: function (){
  57655. var self=this;
  57656. return $core.withContext(function($ctx1) {
  57657. self["@flag"]="bad";
  57658. self._timeout_((10));
  57659. self["@flag"]=$recv(self._async_((function(){
  57660. return $core.withContext(function($ctx2) {
  57661. self._assert_(true);
  57662. self._finished();
  57663. self["@flag"]="ok";
  57664. return self["@flag"];
  57665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57666. })))._valueWithTimeout_((5));
  57667. return self;
  57668. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  57669. },
  57670. args: [],
  57671. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  57672. referencedClasses: [],
  57673. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  57674. }),
  57675. $globals.SUnitAsyncTest);
  57676. $core.addMethod(
  57677. $core.method({
  57678. selector: "testTimeouts",
  57679. protocol: 'tests',
  57680. fn: function (){
  57681. var self=this;
  57682. var suite,runner,result,assertBlock;
  57683. return $core.withContext(function($ctx1) {
  57684. var $1,$2,$3;
  57685. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  57686. return $core.withContext(function($ctx2) {
  57687. return $recv(self._class())._selector_(each);
  57688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57689. }));
  57690. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57691. self._timeout_((200));
  57692. result=$recv(runner)._result();
  57693. $ctx1.sendIdx["result"]=1;
  57694. assertBlock=self._async_((function(){
  57695. return $core.withContext(function($ctx2) {
  57696. $1=self._selectorSetOf_($recv(result)._errors());
  57697. $ctx2.sendIdx["selectorSetOf:"]=1;
  57698. self._assert_equals_($1,$recv($globals.Set)._new());
  57699. $ctx2.sendIdx["assert:equals:"]=1;
  57700. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  57701. return self._finished();
  57702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57703. }));
  57704. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57705. return $core.withContext(function($ctx2) {
  57706. $2=$recv($recv(ann)._result()).__eq_eq(result);
  57707. if($core.assert($2)){
  57708. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57709. return $recv($3)._ifTrue_(assertBlock);
  57710. }
  57711. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57712. }));
  57713. $recv(runner)._run();
  57714. return self;
  57715. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57716. },
  57717. args: [],
  57718. 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",
  57719. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  57720. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57721. }),
  57722. $globals.SUnitAsyncTest);
  57723. $core.addMethod(
  57724. $core.method({
  57725. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  57726. protocol: 'tests',
  57727. fn: function (){
  57728. var self=this;
  57729. var x;
  57730. return $core.withContext(function($ctx1) {
  57731. var $1;
  57732. self["@flag"]="bad";
  57733. self._timeout_((10));
  57734. x=(0);
  57735. $1=self._async_((function(){
  57736. return $core.withContext(function($ctx2) {
  57737. self._finished();
  57738. $ctx2.sendIdx["finished"]=1;
  57739. self["@flag"]="ok";
  57740. self["@flag"];
  57741. x=$recv(x).__plus((1));
  57742. $ctx2.sendIdx["+"]=1;
  57743. x;
  57744. return self._assert_equals_(x,(1));
  57745. $ctx2.sendIdx["assert:equals:"]=1;
  57746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57747. }));
  57748. $ctx1.sendIdx["async:"]=1;
  57749. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  57750. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57751. self["@flag"]=$recv(self._async_((function(){
  57752. return $core.withContext(function($ctx2) {
  57753. self._finished();
  57754. self["@flag"]="ok";
  57755. self["@flag"];
  57756. x=$recv(x).__plus((1));
  57757. x;
  57758. return self._assert_equals_(x,(1));
  57759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57760. })))._valueWithTimeout_((0));
  57761. return self;
  57762. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  57763. },
  57764. args: [],
  57765. 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.",
  57766. referencedClasses: [],
  57767. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  57768. }),
  57769. $globals.SUnitAsyncTest);
  57770. });
  57771. define('amber/devel',[
  57772. './lang',
  57773. './compatibility', // pre-fetch, dep of ./boot
  57774. './boot', // pre-fetch, dep of ./helpers
  57775. './helpers', // pre-fetch, dep of ./deploy
  57776. './deploy', // pre-fetch, dep of ./lang
  57777. // --- packages of the development only Amber begin here ---
  57778. 'amber_core/Platform-DOM',
  57779. 'amber_core/SUnit',
  57780. 'amber_core/Compiler-Tests',
  57781. 'amber_core/Kernel-Tests',
  57782. 'amber_core/Platform-DOM-Tests',
  57783. 'amber_core/SUnit-Tests'
  57784. // --- packages of the development only Amber end here ---
  57785. ], function (amber) { return amber; });
  57786. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  57787. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  57788. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  57789. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  57790. $core.addPackage('AmberCli');
  57791. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  57792. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  57793. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  57794. $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.";
  57795. $core.addMethod(
  57796. $core.method({
  57797. selector: "commandLineSwitches",
  57798. protocol: 'commandline',
  57799. fn: function (){
  57800. var self=this;
  57801. var switches;
  57802. return $core.withContext(function($ctx1) {
  57803. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  57804. return $core.withContext(function($ctx2) {
  57805. return $recv(each)._selector();
  57806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57807. }));
  57808. $ctx1.sendIdx["collect:"]=1;
  57809. switches=$recv(switches)._select_((function(each){
  57810. return $core.withContext(function($ctx2) {
  57811. return $recv(each)._match_("^[^:]*:$");
  57812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57813. }));
  57814. switches=$recv(switches)._collect_((function(each){
  57815. return $core.withContext(function($ctx2) {
  57816. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  57817. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  57818. }));
  57819. return switches;
  57820. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  57821. },
  57822. args: [],
  57823. 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",
  57824. referencedClasses: [],
  57825. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  57826. }),
  57827. $globals.AmberCli.klass);
  57828. $core.addMethod(
  57829. $core.method({
  57830. selector: "config:",
  57831. protocol: 'commands',
  57832. fn: function (args){
  57833. var self=this;
  57834. return $core.withContext(function($ctx1) {
  57835. $recv($recv($globals.Configurator)._new())._start();
  57836. return self;
  57837. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  57838. },
  57839. args: ["args"],
  57840. source: "config: args\x0a\x09Configurator new start",
  57841. referencedClasses: ["Configurator"],
  57842. messageSends: ["start", "new"]
  57843. }),
  57844. $globals.AmberCli.klass);
  57845. $core.addMethod(
  57846. $core.method({
  57847. selector: "handleArguments:",
  57848. protocol: 'commandline',
  57849. fn: function (args){
  57850. var self=this;
  57851. var selector;
  57852. return $core.withContext(function($ctx1) {
  57853. var $1;
  57854. $1=$recv(args)._first();
  57855. $ctx1.sendIdx["first"]=1;
  57856. selector=self._selectorForCommandLineSwitch_($1);
  57857. $recv(args)._remove_($recv(args)._first());
  57858. self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  57859. return self;
  57860. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  57861. },
  57862. args: ["args"],
  57863. 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)",
  57864. referencedClasses: ["Array"],
  57865. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  57866. }),
  57867. $globals.AmberCli.klass);
  57868. $core.addMethod(
  57869. $core.method({
  57870. selector: "help:",
  57871. protocol: 'commands',
  57872. fn: function (args){
  57873. var self=this;
  57874. return $core.withContext(function($ctx1) {
  57875. $recv($globals.Transcript)._show_("Available commands");
  57876. $recv(self._commandLineSwitches())._do_((function(each){
  57877. return $core.withContext(function($ctx2) {
  57878. return $recv(console)._log_(each);
  57879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57880. }));
  57881. return self;
  57882. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  57883. },
  57884. args: ["args"],
  57885. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  57886. referencedClasses: ["Transcript"],
  57887. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  57888. }),
  57889. $globals.AmberCli.klass);
  57890. $core.addMethod(
  57891. $core.method({
  57892. selector: "init:",
  57893. protocol: 'commands',
  57894. fn: function (args){
  57895. var self=this;
  57896. return $core.withContext(function($ctx1) {
  57897. $recv($recv($globals.Initer)._new())._start();
  57898. return self;
  57899. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  57900. },
  57901. args: ["args"],
  57902. source: "init: args\x0a\x09Initer new start",
  57903. referencedClasses: ["Initer"],
  57904. messageSends: ["start", "new"]
  57905. }),
  57906. $globals.AmberCli.klass);
  57907. $core.addMethod(
  57908. $core.method({
  57909. selector: "main",
  57910. protocol: 'startup',
  57911. fn: function (){
  57912. var self=this;
  57913. var args,packageJSON;
  57914. return $core.withContext(function($ctx1) {
  57915. var $7,$6,$5,$4,$3,$2,$1;
  57916. var $early={};
  57917. try {
  57918. packageJSON=$recv(require)._value_("../package.json");
  57919. $7=$recv(packageJSON)._version();
  57920. $ctx1.sendIdx["version"]=1;
  57921. $6="Welcome to Amber CLI version ".__comma($7);
  57922. $5=$recv($6).__comma(" (Amber ");
  57923. $ctx1.sendIdx[","]=5;
  57924. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  57925. $ctx1.sendIdx[","]=4;
  57926. $3=$recv($4).__comma(", NodeJS ");
  57927. $ctx1.sendIdx[","]=3;
  57928. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  57929. $ctx1.sendIdx[","]=2;
  57930. $1=$recv($2).__comma(").");
  57931. $ctx1.sendIdx[","]=1;
  57932. $recv($globals.Transcript)._show_($1);
  57933. args=$recv(process)._argv();
  57934. $recv(args)._removeFrom_to_((1),(2));
  57935. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  57936. return $core.withContext(function($ctx2) {
  57937. return self._help_(nil);
  57938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57939. }),(function(){
  57940. return $core.withContext(function($ctx2) {
  57941. throw $early=[self._handleArguments_(args)];
  57942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57943. }));
  57944. return self;
  57945. }
  57946. catch(e) {if(e===$early)return e[0]; throw e}
  57947. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.klass)});
  57948. },
  57949. args: [],
  57950. 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]",
  57951. referencedClasses: ["Transcript", "Smalltalk"],
  57952. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  57953. }),
  57954. $globals.AmberCli.klass);
  57955. $core.addMethod(
  57956. $core.method({
  57957. selector: "repl:",
  57958. protocol: 'commands',
  57959. fn: function (args){
  57960. var self=this;
  57961. return $core.withContext(function($ctx1) {
  57962. return $recv($recv($globals.Repl)._new())._createInterface();
  57963. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  57964. },
  57965. args: ["args"],
  57966. source: "repl: args\x0a\x09^ Repl new createInterface",
  57967. referencedClasses: ["Repl"],
  57968. messageSends: ["createInterface", "new"]
  57969. }),
  57970. $globals.AmberCli.klass);
  57971. $core.addMethod(
  57972. $core.method({
  57973. selector: "selectorForCommandLineSwitch:",
  57974. protocol: 'commandline',
  57975. fn: function (aSwitch){
  57976. var self=this;
  57977. var command,selector;
  57978. return $core.withContext(function($ctx1) {
  57979. var $1;
  57980. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  57981. if($core.assert($1)){
  57982. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  57983. return $core.withContext(function($ctx2) {
  57984. return $recv($recv(each)._second())._asUppercase();
  57985. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57986. }))).__comma(":");
  57987. selector;
  57988. } else {
  57989. selector="help:";
  57990. selector;
  57991. }
  57992. return selector;
  57993. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  57994. },
  57995. args: ["aSwitch"],
  57996. 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",
  57997. referencedClasses: [],
  57998. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  57999. }),
  58000. $globals.AmberCli.klass);
  58001. $core.addMethod(
  58002. $core.method({
  58003. selector: "serve:",
  58004. protocol: 'commands',
  58005. fn: function (args){
  58006. var self=this;
  58007. return $core.withContext(function($ctx1) {
  58008. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  58009. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  58010. },
  58011. args: ["args"],
  58012. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  58013. referencedClasses: ["FileServer"],
  58014. messageSends: ["start", "createServerWithArguments:"]
  58015. }),
  58016. $globals.AmberCli.klass);
  58017. $core.addMethod(
  58018. $core.method({
  58019. selector: "version:",
  58020. protocol: 'commands',
  58021. fn: function (arguments_){
  58022. var self=this;
  58023. return self;
  58024. },
  58025. args: ["arguments"],
  58026. source: "version: arguments",
  58027. referencedClasses: [],
  58028. messageSends: []
  58029. }),
  58030. $globals.AmberCli.klass);
  58031. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  58032. $core.addMethod(
  58033. $core.method({
  58034. selector: "dirname",
  58035. protocol: 'private',
  58036. fn: function (){
  58037. var self=this;
  58038. return $core.withContext(function($ctx1) {
  58039. return __dirname;
  58040. return self;
  58041. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  58042. },
  58043. args: [],
  58044. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  58045. referencedClasses: [],
  58046. messageSends: []
  58047. }),
  58048. $globals.BaseFileManipulator);
  58049. $core.addMethod(
  58050. $core.method({
  58051. selector: "initialize",
  58052. protocol: 'initialization',
  58053. fn: function (){
  58054. var self=this;
  58055. return $core.withContext(function($ctx1) {
  58056. (
  58057. $ctx1.supercall = true,
  58058. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  58059. $ctx1.supercall = false;
  58060. self["@path"]=$recv(require)._value_("path");
  58061. $ctx1.sendIdx["value:"]=1;
  58062. self["@fs"]=$recv(require)._value_("fs");
  58063. return self;
  58064. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  58065. },
  58066. args: [],
  58067. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  58068. referencedClasses: [],
  58069. messageSends: ["initialize", "value:"]
  58070. }),
  58071. $globals.BaseFileManipulator);
  58072. $core.addMethod(
  58073. $core.method({
  58074. selector: "rootDirname",
  58075. protocol: 'private',
  58076. fn: function (){
  58077. var self=this;
  58078. return $core.withContext(function($ctx1) {
  58079. return $recv(self["@path"])._join_with_(self._dirname(),"..");
  58080. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  58081. },
  58082. args: [],
  58083. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  58084. referencedClasses: [],
  58085. messageSends: ["join:with:", "dirname"]
  58086. }),
  58087. $globals.BaseFileManipulator);
  58088. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  58089. $core.addMethod(
  58090. $core.method({
  58091. selector: "initialize",
  58092. protocol: 'initialization',
  58093. fn: function (){
  58094. var self=this;
  58095. return $core.withContext(function($ctx1) {
  58096. (
  58097. $ctx1.supercall = true,
  58098. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  58099. $ctx1.supercall = false;
  58100. return self;
  58101. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  58102. },
  58103. args: [],
  58104. source: "initialize\x0a\x09super initialize",
  58105. referencedClasses: [],
  58106. messageSends: ["initialize"]
  58107. }),
  58108. $globals.Configurator);
  58109. $core.addMethod(
  58110. $core.method({
  58111. selector: "start",
  58112. protocol: 'action',
  58113. fn: function (){
  58114. var self=this;
  58115. return $core.withContext(function($ctx1) {
  58116. var $receiver;
  58117. self._writeConfigThenDo_((function(err){
  58118. return $core.withContext(function($ctx2) {
  58119. if(($receiver = err) == null || $receiver.isNil){
  58120. return $recv(process)._exit();
  58121. } else {
  58122. return $recv(process)._exit_((111));
  58123. }
  58124. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  58125. }));
  58126. return self;
  58127. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  58128. },
  58129. args: [],
  58130. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  58131. referencedClasses: [],
  58132. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  58133. }),
  58134. $globals.Configurator);
  58135. $core.addMethod(
  58136. $core.method({
  58137. selector: "writeConfigThenDo:",
  58138. protocol: 'action',
  58139. fn: function (aBlock){
  58140. var self=this;
  58141. return $core.withContext(function($ctx1) {
  58142. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  58143. return self;
  58144. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  58145. },
  58146. args: ["aBlock"],
  58147. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  58148. referencedClasses: [],
  58149. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  58150. }),
  58151. $globals.Configurator);
  58152. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  58153. $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.";
  58154. $core.addMethod(
  58155. $core.method({
  58156. selector: "base64Decode:",
  58157. protocol: 'private',
  58158. fn: function (aString){
  58159. var self=this;
  58160. return $core.withContext(function($ctx1) {
  58161. return (new Buffer(aString, "base64").toString());
  58162. return self;
  58163. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  58164. },
  58165. args: ["aString"],
  58166. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  58167. referencedClasses: [],
  58168. messageSends: []
  58169. }),
  58170. $globals.FileServer);
  58171. $core.addMethod(
  58172. $core.method({
  58173. selector: "basePath",
  58174. protocol: 'accessing',
  58175. fn: function (){
  58176. var self=this;
  58177. return $core.withContext(function($ctx1) {
  58178. var $1,$receiver;
  58179. $1=self["@basePath"];
  58180. if(($receiver = $1) == null || $receiver.isNil){
  58181. return $recv(self._class())._defaultBasePath();
  58182. } else {
  58183. return $1;
  58184. }
  58185. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  58186. },
  58187. args: [],
  58188. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  58189. referencedClasses: [],
  58190. messageSends: ["ifNil:", "defaultBasePath", "class"]
  58191. }),
  58192. $globals.FileServer);
  58193. $core.addMethod(
  58194. $core.method({
  58195. selector: "basePath:",
  58196. protocol: 'accessing',
  58197. fn: function (aString){
  58198. var self=this;
  58199. return $core.withContext(function($ctx1) {
  58200. self["@basePath"]=aString;
  58201. self._validateBasePath();
  58202. return self;
  58203. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  58204. },
  58205. args: ["aString"],
  58206. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  58207. referencedClasses: [],
  58208. messageSends: ["validateBasePath"]
  58209. }),
  58210. $globals.FileServer);
  58211. $core.addMethod(
  58212. $core.method({
  58213. selector: "checkDirectoryLayout",
  58214. protocol: 'initialization',
  58215. fn: function (){
  58216. var self=this;
  58217. return $core.withContext(function($ctx1) {
  58218. var $1;
  58219. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  58220. if(!$core.assert($1)){
  58221. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  58222. $ctx1.sendIdx["warn:"]=1;
  58223. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  58224. $ctx1.sendIdx["warn:"]=2;
  58225. $recv(console)._warn_(" You can also specify a page to be served by default,");
  58226. $ctx1.sendIdx["warn:"]=3;
  58227. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  58228. }
  58229. return self;
  58230. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  58231. },
  58232. args: [],
  58233. 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.'].",
  58234. referencedClasses: [],
  58235. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  58236. }),
  58237. $globals.FileServer);
  58238. $core.addMethod(
  58239. $core.method({
  58240. selector: "fallbackPage",
  58241. protocol: 'accessing',
  58242. fn: function (){
  58243. var self=this;
  58244. return self["@fallbackPage"];
  58245. },
  58246. args: [],
  58247. source: "fallbackPage\x0a\x09^ fallbackPage",
  58248. referencedClasses: [],
  58249. messageSends: []
  58250. }),
  58251. $globals.FileServer);
  58252. $core.addMethod(
  58253. $core.method({
  58254. selector: "fallbackPage:",
  58255. protocol: 'accessing',
  58256. fn: function (aString){
  58257. var self=this;
  58258. self["@fallbackPage"]=aString;
  58259. return self;
  58260. },
  58261. args: ["aString"],
  58262. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  58263. referencedClasses: [],
  58264. messageSends: []
  58265. }),
  58266. $globals.FileServer);
  58267. $core.addMethod(
  58268. $core.method({
  58269. selector: "handleGETRequest:respondTo:",
  58270. protocol: 'request handling',
  58271. fn: function (aRequest,aResponse){
  58272. var self=this;
  58273. var uri,filename;
  58274. return $core.withContext(function($ctx1) {
  58275. var $1;
  58276. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  58277. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  58278. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  58279. return $core.withContext(function($ctx2) {
  58280. if($core.assert(aBoolean)){
  58281. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  58282. if($core.assert($1)){
  58283. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  58284. } else {
  58285. return self._respondFileNamed_to_(filename,aResponse);
  58286. }
  58287. } else {
  58288. return self._respondNotFoundTo_(aResponse);
  58289. }
  58290. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  58291. }));
  58292. return self;
  58293. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  58294. },
  58295. args: ["aRequest", "aResponse"],
  58296. 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]]]",
  58297. referencedClasses: [],
  58298. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  58299. }),
  58300. $globals.FileServer);
  58301. $core.addMethod(
  58302. $core.method({
  58303. selector: "handleOPTIONSRequest:respondTo:",
  58304. protocol: 'request handling',
  58305. fn: function (aRequest,aResponse){
  58306. var self=this;
  58307. return $core.withContext(function($ctx1) {
  58308. $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)]));
  58309. $recv(aResponse)._end();
  58310. return self;
  58311. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58312. },
  58313. args: ["aRequest", "aResponse"],
  58314. 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",
  58315. referencedClasses: [],
  58316. messageSends: ["writeHead:options:", "end"]
  58317. }),
  58318. $globals.FileServer);
  58319. $core.addMethod(
  58320. $core.method({
  58321. selector: "handlePUTRequest:respondTo:",
  58322. protocol: 'request handling',
  58323. fn: function (aRequest,aResponse){
  58324. var self=this;
  58325. var file,stream;
  58326. return $core.withContext(function($ctx1) {
  58327. var $1,$2,$3,$4;
  58328. $1=self._isAuthenticated_(aRequest);
  58329. if(!$core.assert($1)){
  58330. self._respondAuthenticationRequiredTo_(aResponse);
  58331. return nil;
  58332. }
  58333. file=".".__comma($recv(aRequest)._url());
  58334. $ctx1.sendIdx[","]=1;
  58335. stream=$recv(self["@fs"])._createWriteStream_(file);
  58336. $recv(stream)._on_do_("error",(function(error){
  58337. return $core.withContext(function($ctx2) {
  58338. $2=console;
  58339. $3="Error creating WriteStream for file ".__comma(file);
  58340. $ctx2.sendIdx[","]=2;
  58341. $recv($2)._warn_($3);
  58342. $ctx2.sendIdx["warn:"]=1;
  58343. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  58344. $ctx2.sendIdx["warn:"]=2;
  58345. $recv(console)._warn_(" The exact error is: ".__comma(error));
  58346. return self._respondNotCreatedTo_(aResponse);
  58347. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58348. }));
  58349. $ctx1.sendIdx["on:do:"]=1;
  58350. $recv(stream)._on_do_("close",(function(){
  58351. return $core.withContext(function($ctx2) {
  58352. return self._respondCreatedTo_(aResponse);
  58353. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58354. }));
  58355. $ctx1.sendIdx["on:do:"]=2;
  58356. $recv(aRequest)._setEncoding_("utf8");
  58357. $recv(aRequest)._on_do_("data",(function(data){
  58358. return $core.withContext(function($ctx2) {
  58359. return $recv(stream)._write_(data);
  58360. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  58361. }));
  58362. $ctx1.sendIdx["on:do:"]=3;
  58363. $recv(aRequest)._on_do_("end",(function(){
  58364. return $core.withContext(function($ctx2) {
  58365. $4=$recv(stream)._writable();
  58366. if($core.assert($4)){
  58367. return $recv(stream)._end();
  58368. }
  58369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58370. }));
  58371. return self;
  58372. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  58373. },
  58374. args: ["aRequest", "aResponse"],
  58375. 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]]",
  58376. referencedClasses: [],
  58377. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  58378. }),
  58379. $globals.FileServer);
  58380. $core.addMethod(
  58381. $core.method({
  58382. selector: "handleRequest:respondTo:",
  58383. protocol: 'request handling',
  58384. fn: function (aRequest,aResponse){
  58385. var self=this;
  58386. return $core.withContext(function($ctx1) {
  58387. var $2,$1,$4,$3,$5;
  58388. $2=$recv(aRequest)._method();
  58389. $ctx1.sendIdx["method"]=1;
  58390. $1=$recv($2).__eq("PUT");
  58391. $ctx1.sendIdx["="]=1;
  58392. if($core.assert($1)){
  58393. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  58394. }
  58395. $4=$recv(aRequest)._method();
  58396. $ctx1.sendIdx["method"]=2;
  58397. $3=$recv($4).__eq("GET");
  58398. $ctx1.sendIdx["="]=2;
  58399. if($core.assert($3)){
  58400. self._handleGETRequest_respondTo_(aRequest,aResponse);
  58401. }
  58402. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  58403. if($core.assert($5)){
  58404. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  58405. }
  58406. return self;
  58407. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58408. },
  58409. args: ["aRequest", "aResponse"],
  58410. 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]",
  58411. referencedClasses: [],
  58412. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  58413. }),
  58414. $globals.FileServer);
  58415. $core.addMethod(
  58416. $core.method({
  58417. selector: "host",
  58418. protocol: 'accessing',
  58419. fn: function (){
  58420. var self=this;
  58421. return self["@host"];
  58422. },
  58423. args: [],
  58424. source: "host\x0a\x09^ host",
  58425. referencedClasses: [],
  58426. messageSends: []
  58427. }),
  58428. $globals.FileServer);
  58429. $core.addMethod(
  58430. $core.method({
  58431. selector: "host:",
  58432. protocol: 'accessing',
  58433. fn: function (hostname){
  58434. var self=this;
  58435. self["@host"]=hostname;
  58436. return self;
  58437. },
  58438. args: ["hostname"],
  58439. source: "host: hostname\x0a\x09host := hostname",
  58440. referencedClasses: [],
  58441. messageSends: []
  58442. }),
  58443. $globals.FileServer);
  58444. $core.addMethod(
  58445. $core.method({
  58446. selector: "initialize",
  58447. protocol: 'initialization',
  58448. fn: function (){
  58449. var self=this;
  58450. return $core.withContext(function($ctx1) {
  58451. var $1;
  58452. (
  58453. $ctx1.supercall = true,
  58454. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  58455. $ctx1.supercall = false;
  58456. self["@http"]=self._require_("http");
  58457. $ctx1.sendIdx["require:"]=1;
  58458. self["@util"]=self._require_("util");
  58459. $ctx1.sendIdx["require:"]=2;
  58460. self["@url"]=self._require_("url");
  58461. $1=self._class();
  58462. $ctx1.sendIdx["class"]=1;
  58463. self["@host"]=$recv($1)._defaultHost();
  58464. self["@port"]=$recv(self._class())._defaultPort();
  58465. self["@username"]=nil;
  58466. self["@password"]=nil;
  58467. self["@fallbackPage"]=nil;
  58468. return self;
  58469. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  58470. },
  58471. args: [],
  58472. 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.",
  58473. referencedClasses: [],
  58474. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  58475. }),
  58476. $globals.FileServer);
  58477. $core.addMethod(
  58478. $core.method({
  58479. selector: "isAuthenticated:",
  58480. protocol: 'private',
  58481. fn: function (aRequest){
  58482. var self=this;
  58483. var header,token,auth,parts;
  58484. return $core.withContext(function($ctx1) {
  58485. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  58486. var $early={};
  58487. try {
  58488. $2=$recv(self["@username"])._isNil();
  58489. $ctx1.sendIdx["isNil"]=1;
  58490. $1=$recv($2)._and_((function(){
  58491. return $core.withContext(function($ctx2) {
  58492. return $recv(self["@password"])._isNil();
  58493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58494. }));
  58495. $ctx1.sendIdx["and:"]=1;
  58496. if($core.assert($1)){
  58497. return true;
  58498. }
  58499. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  58500. $ctx1.sendIdx["at:"]=1;
  58501. if(($receiver = $3) == null || $receiver.isNil){
  58502. header="";
  58503. } else {
  58504. header=$3;
  58505. }
  58506. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  58507. throw $early=[false];
  58508. }),(function(){
  58509. return $core.withContext(function($ctx2) {
  58510. $4=$recv(header)._tokenize_(" ");
  58511. $ctx2.sendIdx["tokenize:"]=1;
  58512. if(($receiver = $4) == null || $receiver.isNil){
  58513. token="";
  58514. } else {
  58515. token=$4;
  58516. }
  58517. token;
  58518. $5=$recv(token)._at_((2));
  58519. $ctx2.sendIdx["at:"]=2;
  58520. auth=self._base64Decode_($5);
  58521. auth;
  58522. parts=$recv(auth)._tokenize_(":");
  58523. parts;
  58524. $8=self["@username"];
  58525. $9=$recv(parts)._at_((1));
  58526. $ctx2.sendIdx["at:"]=3;
  58527. $7=$recv($8).__eq($9);
  58528. $ctx2.sendIdx["="]=1;
  58529. $6=$recv($7)._and_((function(){
  58530. return $core.withContext(function($ctx3) {
  58531. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  58532. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  58533. }));
  58534. if($core.assert($6)){
  58535. throw $early=[true];
  58536. } else {
  58537. throw $early=[false];
  58538. }
  58539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58540. }));
  58541. return self;
  58542. }
  58543. catch(e) {if(e===$early)return e[0]; throw e}
  58544. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  58545. },
  58546. args: ["aRequest"],
  58547. 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].",
  58548. referencedClasses: [],
  58549. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  58550. }),
  58551. $globals.FileServer);
  58552. $core.addMethod(
  58553. $core.method({
  58554. selector: "password:",
  58555. protocol: 'accessing',
  58556. fn: function (aPassword){
  58557. var self=this;
  58558. self["@password"]=aPassword;
  58559. return self;
  58560. },
  58561. args: ["aPassword"],
  58562. source: "password: aPassword\x0a\x09password := aPassword.",
  58563. referencedClasses: [],
  58564. messageSends: []
  58565. }),
  58566. $globals.FileServer);
  58567. $core.addMethod(
  58568. $core.method({
  58569. selector: "port",
  58570. protocol: 'accessing',
  58571. fn: function (){
  58572. var self=this;
  58573. return self["@port"];
  58574. },
  58575. args: [],
  58576. source: "port\x0a\x09^ port",
  58577. referencedClasses: [],
  58578. messageSends: []
  58579. }),
  58580. $globals.FileServer);
  58581. $core.addMethod(
  58582. $core.method({
  58583. selector: "port:",
  58584. protocol: 'accessing',
  58585. fn: function (aNumber){
  58586. var self=this;
  58587. self["@port"]=aNumber;
  58588. return self;
  58589. },
  58590. args: ["aNumber"],
  58591. source: "port: aNumber\x0a\x09port := aNumber",
  58592. referencedClasses: [],
  58593. messageSends: []
  58594. }),
  58595. $globals.FileServer);
  58596. $core.addMethod(
  58597. $core.method({
  58598. selector: "require:",
  58599. protocol: 'private',
  58600. fn: function (aModuleString){
  58601. var self=this;
  58602. return $core.withContext(function($ctx1) {
  58603. return $recv(require)._value_(aModuleString);
  58604. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  58605. },
  58606. args: ["aModuleString"],
  58607. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  58608. referencedClasses: [],
  58609. messageSends: ["value:"]
  58610. }),
  58611. $globals.FileServer);
  58612. $core.addMethod(
  58613. $core.method({
  58614. selector: "respondAuthenticationRequiredTo:",
  58615. protocol: 'request handling',
  58616. fn: function (aResponse){
  58617. var self=this;
  58618. return $core.withContext(function($ctx1) {
  58619. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  58620. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  58621. $recv(aResponse)._end();
  58622. return self;
  58623. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  58624. },
  58625. args: ["aResponse"],
  58626. 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.",
  58627. referencedClasses: [],
  58628. messageSends: ["writeHead:options:", "write:", "end"]
  58629. }),
  58630. $globals.FileServer);
  58631. $core.addMethod(
  58632. $core.method({
  58633. selector: "respondCreatedTo:",
  58634. protocol: 'request handling',
  58635. fn: function (aResponse){
  58636. var self=this;
  58637. return $core.withContext(function($ctx1) {
  58638. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58639. $recv(aResponse)._end();
  58640. return self;
  58641. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58642. },
  58643. args: ["aResponse"],
  58644. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58645. referencedClasses: [],
  58646. messageSends: ["writeHead:options:", "end"]
  58647. }),
  58648. $globals.FileServer);
  58649. $core.addMethod(
  58650. $core.method({
  58651. selector: "respondDirectoryNamed:from:to:",
  58652. protocol: 'request handling',
  58653. fn: function (aDirname,aUrl,aResponse){
  58654. var self=this;
  58655. return $core.withContext(function($ctx1) {
  58656. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  58657. $2=$recv(aUrl)._pathname();
  58658. $ctx1.sendIdx["pathname"]=1;
  58659. $1=$recv($2)._endsWith_("/");
  58660. if($core.assert($1)){
  58661. $3=$recv(aDirname).__comma("index.html");
  58662. $ctx1.sendIdx[","]=1;
  58663. self._respondFileNamed_to_($3,aResponse);
  58664. } else {
  58665. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  58666. $7=$recv(aUrl)._search();
  58667. if(($receiver = $7) == null || $receiver.isNil){
  58668. $6="";
  58669. } else {
  58670. $6=$7;
  58671. }
  58672. $4=$recv($5).__comma($6);
  58673. $ctx1.sendIdx[","]=2;
  58674. self._respondRedirect_to_($4,aResponse);
  58675. }
  58676. return self;
  58677. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  58678. },
  58679. args: ["aDirname", "aUrl", "aResponse"],
  58680. 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]",
  58681. referencedClasses: [],
  58682. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  58683. }),
  58684. $globals.FileServer);
  58685. $core.addMethod(
  58686. $core.method({
  58687. selector: "respondFileNamed:to:",
  58688. protocol: 'request handling',
  58689. fn: function (aFilename,aResponse){
  58690. var self=this;
  58691. var type,filename;
  58692. return $core.withContext(function($ctx1) {
  58693. var $1,$2,$3,$4;
  58694. filename=aFilename;
  58695. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  58696. return $core.withContext(function($ctx2) {
  58697. $1=$recv(ex)._notNil();
  58698. if($core.assert($1)){
  58699. $2=console;
  58700. $3=$recv(filename).__comma(" does not exist");
  58701. $ctx2.sendIdx[","]=1;
  58702. $recv($2)._log_($3);
  58703. return self._respondNotFoundTo_(aResponse);
  58704. } else {
  58705. type=$recv(self._class())._mimeTypeFor_(filename);
  58706. type;
  58707. $4=$recv(type).__eq("application/javascript");
  58708. if($core.assert($4)){
  58709. type=$recv(type).__comma(";charset=utf-8");
  58710. type;
  58711. }
  58712. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  58713. $recv(aResponse)._write_encoding_(file,"binary");
  58714. return $recv(aResponse)._end();
  58715. }
  58716. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  58717. }));
  58718. return self;
  58719. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  58720. },
  58721. args: ["aFilename", "aResponse"],
  58722. 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]]",
  58723. referencedClasses: [],
  58724. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  58725. }),
  58726. $globals.FileServer);
  58727. $core.addMethod(
  58728. $core.method({
  58729. selector: "respondInternalErrorTo:",
  58730. protocol: 'request handling',
  58731. fn: function (aResponse){
  58732. var self=this;
  58733. return $core.withContext(function($ctx1) {
  58734. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58735. $recv(aResponse)._write_("500 Internal server error");
  58736. $recv(aResponse)._end();
  58737. return self;
  58738. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  58739. },
  58740. args: ["aResponse"],
  58741. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  58742. referencedClasses: [],
  58743. messageSends: ["writeHead:options:", "write:", "end"]
  58744. }),
  58745. $globals.FileServer);
  58746. $core.addMethod(
  58747. $core.method({
  58748. selector: "respondNotCreatedTo:",
  58749. protocol: 'request handling',
  58750. fn: function (aResponse){
  58751. var self=this;
  58752. return $core.withContext(function($ctx1) {
  58753. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58754. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  58755. $recv(aResponse)._end();
  58756. return self;
  58757. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58758. },
  58759. args: ["aResponse"],
  58760. 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.",
  58761. referencedClasses: [],
  58762. messageSends: ["writeHead:options:", "write:", "end"]
  58763. }),
  58764. $globals.FileServer);
  58765. $core.addMethod(
  58766. $core.method({
  58767. selector: "respondNotFoundTo:",
  58768. protocol: 'request handling',
  58769. fn: function (aResponse){
  58770. var self=this;
  58771. return $core.withContext(function($ctx1) {
  58772. var $2,$1;
  58773. $2=self._fallbackPage();
  58774. $ctx1.sendIdx["fallbackPage"]=1;
  58775. $1=$recv($2)._isNil();
  58776. if(!$core.assert($1)){
  58777. return self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  58778. }
  58779. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  58780. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  58781. $ctx1.sendIdx["write:"]=1;
  58782. $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>");
  58783. $ctx1.sendIdx["write:"]=2;
  58784. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  58785. $ctx1.sendIdx["write:"]=3;
  58786. $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>");
  58787. $ctx1.sendIdx["write:"]=4;
  58788. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  58789. $ctx1.sendIdx["write:"]=5;
  58790. $recv(aResponse)._write_("</ul></p></body></html>");
  58791. $recv(aResponse)._end();
  58792. return self;
  58793. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  58794. },
  58795. args: ["aResponse"],
  58796. 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",
  58797. referencedClasses: [],
  58798. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  58799. }),
  58800. $globals.FileServer);
  58801. $core.addMethod(
  58802. $core.method({
  58803. selector: "respondOKTo:",
  58804. protocol: 'request handling',
  58805. fn: function (aResponse){
  58806. var self=this;
  58807. return $core.withContext(function($ctx1) {
  58808. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58809. $recv(aResponse)._end();
  58810. return self;
  58811. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  58812. },
  58813. args: ["aResponse"],
  58814. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58815. referencedClasses: [],
  58816. messageSends: ["writeHead:options:", "end"]
  58817. }),
  58818. $globals.FileServer);
  58819. $core.addMethod(
  58820. $core.method({
  58821. selector: "respondRedirect:to:",
  58822. protocol: 'request handling',
  58823. fn: function (aString,aResponse){
  58824. var self=this;
  58825. return $core.withContext(function($ctx1) {
  58826. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  58827. $recv(aResponse)._end();
  58828. return self;
  58829. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  58830. },
  58831. args: ["aString", "aResponse"],
  58832. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  58833. referencedClasses: [],
  58834. messageSends: ["writeHead:options:", "end"]
  58835. }),
  58836. $globals.FileServer);
  58837. $core.addMethod(
  58838. $core.method({
  58839. selector: "start",
  58840. protocol: 'starting',
  58841. fn: function (){
  58842. var self=this;
  58843. return $core.withContext(function($ctx1) {
  58844. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  58845. self._checkDirectoryLayout();
  58846. $1=$recv(self["@http"])._createServer_((function(request,response){
  58847. return $core.withContext(function($ctx2) {
  58848. return self._handleRequest_respondTo_(request,response);
  58849. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  58850. }));
  58851. $recv($1)._on_do_("error",(function(error){
  58852. return $core.withContext(function($ctx2) {
  58853. $2=console;
  58854. $3="Error starting server: ".__comma(error);
  58855. $ctx2.sendIdx[","]=1;
  58856. return $recv($2)._log_($3);
  58857. $ctx2.sendIdx["log:"]=1;
  58858. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58859. }));
  58860. $ctx1.sendIdx["on:do:"]=1;
  58861. $recv($1)._on_do_("listening",(function(){
  58862. return $core.withContext(function($ctx2) {
  58863. $4=console;
  58864. $8=self._host();
  58865. $ctx2.sendIdx["host"]=1;
  58866. $7="Starting file server on http://".__comma($8);
  58867. $6=$recv($7).__comma(":");
  58868. $ctx2.sendIdx[","]=3;
  58869. $10=self._port();
  58870. $ctx2.sendIdx["port"]=1;
  58871. $9=$recv($10)._asString();
  58872. $5=$recv($6).__comma($9);
  58873. $ctx2.sendIdx[","]=2;
  58874. return $recv($4)._log_($5);
  58875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58876. }));
  58877. $recv($1)._listen_host_(self._port(),self._host());
  58878. return self;
  58879. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  58880. },
  58881. args: [],
  58882. 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.",
  58883. referencedClasses: [],
  58884. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  58885. }),
  58886. $globals.FileServer);
  58887. $core.addMethod(
  58888. $core.method({
  58889. selector: "startOn:",
  58890. protocol: 'starting',
  58891. fn: function (aPort){
  58892. var self=this;
  58893. return $core.withContext(function($ctx1) {
  58894. self._port_(aPort);
  58895. self._start();
  58896. return self;
  58897. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  58898. },
  58899. args: ["aPort"],
  58900. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  58901. referencedClasses: [],
  58902. messageSends: ["port:", "start"]
  58903. }),
  58904. $globals.FileServer);
  58905. $core.addMethod(
  58906. $core.method({
  58907. selector: "username:",
  58908. protocol: 'accessing',
  58909. fn: function (aUsername){
  58910. var self=this;
  58911. self["@username"]=aUsername;
  58912. return self;
  58913. },
  58914. args: ["aUsername"],
  58915. source: "username: aUsername\x0a\x09username := aUsername.",
  58916. referencedClasses: [],
  58917. messageSends: []
  58918. }),
  58919. $globals.FileServer);
  58920. $core.addMethod(
  58921. $core.method({
  58922. selector: "validateBasePath",
  58923. protocol: 'private',
  58924. fn: function (){
  58925. var self=this;
  58926. return $core.withContext(function($ctx1) {
  58927. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  58928. $1=self["@fs"];
  58929. $2=self._basePath();
  58930. $ctx1.sendIdx["basePath"]=1;
  58931. $recv($1)._stat_then_($2,(function(err,stat){
  58932. return $core.withContext(function($ctx2) {
  58933. if(($receiver = err) == null || $receiver.isNil){
  58934. $3=$recv(stat)._isDirectory();
  58935. if(!$core.assert($3)){
  58936. $4=console;
  58937. $7=self._basePath();
  58938. $ctx2.sendIdx["basePath"]=2;
  58939. $6="Warning: --base-path parameter ".__comma($7);
  58940. $ctx2.sendIdx[","]=2;
  58941. $5=$recv($6).__comma(" is not a directory.");
  58942. $ctx2.sendIdx[","]=1;
  58943. return $recv($4)._warn_($5);
  58944. $ctx2.sendIdx["warn:"]=1;
  58945. }
  58946. } else {
  58947. $8=console;
  58948. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  58949. $ctx2.sendIdx[","]=3;
  58950. return $recv($8)._warn_($9);
  58951. }
  58952. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  58953. }));
  58954. return self;
  58955. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  58956. },
  58957. args: [],
  58958. 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.' ]].",
  58959. referencedClasses: [],
  58960. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  58961. }),
  58962. $globals.FileServer);
  58963. $core.addMethod(
  58964. $core.method({
  58965. selector: "withBasePath:",
  58966. protocol: 'private',
  58967. fn: function (aBaseRelativePath){
  58968. var self=this;
  58969. return $core.withContext(function($ctx1) {
  58970. return $recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  58971. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  58972. },
  58973. args: ["aBaseRelativePath"],
  58974. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  58975. referencedClasses: [],
  58976. messageSends: ["join:with:", "basePath"]
  58977. }),
  58978. $globals.FileServer);
  58979. $core.addMethod(
  58980. $core.method({
  58981. selector: "writeData:toFileNamed:",
  58982. protocol: 'private',
  58983. fn: function (data,aFilename){
  58984. var self=this;
  58985. return $core.withContext(function($ctx1) {
  58986. $recv(console)._log_(aFilename);
  58987. return self;
  58988. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  58989. },
  58990. args: ["data", "aFilename"],
  58991. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  58992. referencedClasses: [],
  58993. messageSends: ["log:"]
  58994. }),
  58995. $globals.FileServer);
  58996. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  58997. $core.addMethod(
  58998. $core.method({
  58999. selector: "commandLineSwitches",
  59000. protocol: 'accessing',
  59001. fn: function (){
  59002. var self=this;
  59003. var switches;
  59004. return $core.withContext(function($ctx1) {
  59005. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  59006. return $core.withContext(function($ctx2) {
  59007. return $recv(each)._selector();
  59008. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59009. }));
  59010. $ctx1.sendIdx["collect:"]=1;
  59011. switches=$recv(switches)._select_((function(each){
  59012. return $core.withContext(function($ctx2) {
  59013. return $recv(each)._match_("^[^:]*:$");
  59014. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59015. }));
  59016. switches=$recv(switches)._collect_((function(each){
  59017. return $core.withContext(function($ctx2) {
  59018. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  59019. $ctx2.sendIdx["replace:with:"]=1;
  59020. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  59021. }));
  59022. return switches;
  59023. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  59024. },
  59025. args: [],
  59026. 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",
  59027. referencedClasses: [],
  59028. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  59029. }),
  59030. $globals.FileServer.klass);
  59031. $core.addMethod(
  59032. $core.method({
  59033. selector: "createServerWithArguments:",
  59034. protocol: 'initialization',
  59035. fn: function (options){
  59036. var self=this;
  59037. var server,popFront,front,optionName,optionValue,switches;
  59038. return $core.withContext(function($ctx1) {
  59039. var $1,$2,$3,$4,$5,$6,$7,$8;
  59040. var $early={};
  59041. try {
  59042. switches=self._commandLineSwitches();
  59043. server=self._new();
  59044. $recv(options)._ifEmpty_((function(){
  59045. throw $early=[server];
  59046. }));
  59047. $1=$recv($recv(options)._size())._even();
  59048. if(!$core.assert($1)){
  59049. $recv(console)._log_("Using default parameters.");
  59050. $ctx1.sendIdx["log:"]=1;
  59051. $2=console;
  59052. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  59053. $ctx1.sendIdx[","]=1;
  59054. $recv($2)._log_($3);
  59055. $ctx1.sendIdx["log:"]=2;
  59056. $4=console;
  59057. $5="Use any of the following ones: ".__comma(switches);
  59058. $ctx1.sendIdx[","]=2;
  59059. $recv($4)._log_($5);
  59060. $ctx1.sendIdx["log:"]=3;
  59061. return server;
  59062. }
  59063. popFront=(function(args){
  59064. return $core.withContext(function($ctx2) {
  59065. front=$recv(args)._first();
  59066. front;
  59067. $recv(args)._remove_(front);
  59068. return front;
  59069. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  59070. });
  59071. $recv((function(){
  59072. return $core.withContext(function($ctx2) {
  59073. return $recv(options)._notEmpty();
  59074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  59075. }))._whileTrue_((function(){
  59076. return $core.withContext(function($ctx2) {
  59077. optionName=$recv(popFront)._value_(options);
  59078. $ctx2.sendIdx["value:"]=1;
  59079. optionName;
  59080. optionValue=$recv(popFront)._value_(options);
  59081. optionValue;
  59082. $6=$recv(switches)._includes_(optionName);
  59083. if($core.assert($6)){
  59084. optionName=self._selectorForCommandLineSwitch_(optionName);
  59085. optionName;
  59086. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  59087. } else {
  59088. $7=console;
  59089. $8=$recv(optionName).__comma(" is not a valid commandline option");
  59090. $ctx2.sendIdx[","]=3;
  59091. $recv($7)._log_($8);
  59092. $ctx2.sendIdx["log:"]=4;
  59093. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  59094. }
  59095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  59096. }));
  59097. return server;
  59098. }
  59099. catch(e) {if(e===$early)return e[0]; throw e}
  59100. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  59101. },
  59102. args: ["options"],
  59103. 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.",
  59104. referencedClasses: ["Array"],
  59105. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  59106. }),
  59107. $globals.FileServer.klass);
  59108. $core.addMethod(
  59109. $core.method({
  59110. selector: "defaultBasePath",
  59111. protocol: 'accessing',
  59112. fn: function (){
  59113. var self=this;
  59114. return "./";
  59115. },
  59116. args: [],
  59117. source: "defaultBasePath\x0a\x09^ './'",
  59118. referencedClasses: [],
  59119. messageSends: []
  59120. }),
  59121. $globals.FileServer.klass);
  59122. $core.addMethod(
  59123. $core.method({
  59124. selector: "defaultHost",
  59125. protocol: 'accessing',
  59126. fn: function (){
  59127. var self=this;
  59128. return "127.0.0.1";
  59129. },
  59130. args: [],
  59131. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  59132. referencedClasses: [],
  59133. messageSends: []
  59134. }),
  59135. $globals.FileServer.klass);
  59136. $core.addMethod(
  59137. $core.method({
  59138. selector: "defaultMimeTypes",
  59139. protocol: 'accessing',
  59140. fn: function (){
  59141. var self=this;
  59142. 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"]);
  59143. },
  59144. args: [],
  59145. 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}",
  59146. referencedClasses: [],
  59147. messageSends: []
  59148. }),
  59149. $globals.FileServer.klass);
  59150. $core.addMethod(
  59151. $core.method({
  59152. selector: "defaultPort",
  59153. protocol: 'accessing',
  59154. fn: function (){
  59155. var self=this;
  59156. return (4000);
  59157. },
  59158. args: [],
  59159. source: "defaultPort\x0a\x09^ 4000",
  59160. referencedClasses: [],
  59161. messageSends: []
  59162. }),
  59163. $globals.FileServer.klass);
  59164. $core.addMethod(
  59165. $core.method({
  59166. selector: "main",
  59167. protocol: 'initialization',
  59168. fn: function (){
  59169. var self=this;
  59170. var fileServer,args;
  59171. return $core.withContext(function($ctx1) {
  59172. var $1;
  59173. var $early={};
  59174. try {
  59175. args=$recv(process)._argv();
  59176. $recv(args)._removeFrom_to_((1),(3));
  59177. $recv(args)._detect_ifNone_((function(each){
  59178. return $core.withContext(function($ctx2) {
  59179. $1=$recv(each).__eq("--help");
  59180. if($core.assert($1)){
  59181. return $recv($globals.FileServer)._printHelp();
  59182. }
  59183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59184. }),(function(){
  59185. return $core.withContext(function($ctx2) {
  59186. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  59187. fileServer;
  59188. throw $early=[$recv(fileServer)._start()];
  59189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59190. }));
  59191. return self;
  59192. }
  59193. catch(e) {if(e===$early)return e[0]; throw e}
  59194. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  59195. },
  59196. args: [],
  59197. 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]",
  59198. referencedClasses: ["FileServer"],
  59199. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  59200. }),
  59201. $globals.FileServer.klass);
  59202. $core.addMethod(
  59203. $core.method({
  59204. selector: "mimeTypeFor:",
  59205. protocol: 'accessing',
  59206. fn: function (aString){
  59207. var self=this;
  59208. return $core.withContext(function($ctx1) {
  59209. return $recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  59210. return "text/plain";
  59211. }));
  59212. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  59213. },
  59214. args: ["aString"],
  59215. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  59216. referencedClasses: [],
  59217. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  59218. }),
  59219. $globals.FileServer.klass);
  59220. $core.addMethod(
  59221. $core.method({
  59222. selector: "mimeTypes",
  59223. protocol: 'accessing',
  59224. fn: function (){
  59225. var self=this;
  59226. return $core.withContext(function($ctx1) {
  59227. var $1,$receiver;
  59228. $1=self["@mimeTypes"];
  59229. if(($receiver = $1) == null || $receiver.isNil){
  59230. self["@mimeTypes"]=self._defaultMimeTypes();
  59231. return self["@mimeTypes"];
  59232. } else {
  59233. return $1;
  59234. }
  59235. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  59236. },
  59237. args: [],
  59238. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  59239. referencedClasses: [],
  59240. messageSends: ["ifNil:", "defaultMimeTypes"]
  59241. }),
  59242. $globals.FileServer.klass);
  59243. $core.addMethod(
  59244. $core.method({
  59245. selector: "printHelp",
  59246. protocol: 'accessing',
  59247. fn: function (){
  59248. var self=this;
  59249. return $core.withContext(function($ctx1) {
  59250. $recv(console)._log_("Available commandline options are:");
  59251. $ctx1.sendIdx["log:"]=1;
  59252. $recv(console)._log_("--help");
  59253. $ctx1.sendIdx["log:"]=2;
  59254. $recv(self._commandLineSwitches())._do_((function(each){
  59255. return $core.withContext(function($ctx2) {
  59256. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  59257. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59258. }));
  59259. return self;
  59260. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  59261. },
  59262. args: [],
  59263. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  59264. referencedClasses: [],
  59265. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  59266. }),
  59267. $globals.FileServer.klass);
  59268. $core.addMethod(
  59269. $core.method({
  59270. selector: "selectorForCommandLineSwitch:",
  59271. protocol: 'accessing',
  59272. fn: function (aSwitch){
  59273. var self=this;
  59274. return $core.withContext(function($ctx1) {
  59275. var $1;
  59276. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  59277. return $core.withContext(function($ctx2) {
  59278. return $recv($recv(each)._second())._asUppercase();
  59279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59280. }));
  59281. $ctx1.sendIdx["replace:with:"]=1;
  59282. return $recv($1).__comma(":");
  59283. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  59284. },
  59285. args: ["aSwitch"],
  59286. 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 ]), ':'",
  59287. referencedClasses: [],
  59288. messageSends: [",", "replace:with:", "asUppercase", "second"]
  59289. }),
  59290. $globals.FileServer.klass);
  59291. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  59292. $core.addMethod(
  59293. $core.method({
  59294. selector: "bowerInstallThenDo:",
  59295. protocol: 'action',
  59296. fn: function (aBlock){
  59297. var self=this;
  59298. var child;
  59299. return $core.withContext(function($ctx1) {
  59300. var $1,$3,$2;
  59301. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  59302. $1=child;
  59303. $recv($1)._on_do_("error",aBlock);
  59304. $ctx1.sendIdx["on:do:"]=1;
  59305. $recv($1)._on_do_("close",(function(code){
  59306. return $core.withContext(function($ctx2) {
  59307. $3=$recv(code).__eq((0));
  59308. if($core.assert($3)){
  59309. $2=nil;
  59310. } else {
  59311. $2=code;
  59312. }
  59313. return $recv(aBlock)._value_($2);
  59314. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59315. }));
  59316. return self;
  59317. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59318. },
  59319. args: ["aBlock"],
  59320. 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 ]) ]",
  59321. referencedClasses: [],
  59322. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59323. }),
  59324. $globals.Initer);
  59325. $core.addMethod(
  59326. $core.method({
  59327. selector: "finishMessage",
  59328. protocol: 'action',
  59329. fn: function (){
  59330. var self=this;
  59331. return $core.withContext(function($ctx1) {
  59332. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  59333. $recv((function(){
  59334. }))._valueWithTimeout_((600));
  59335. return self;
  59336. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  59337. },
  59338. args: [],
  59339. 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",
  59340. referencedClasses: ["String"],
  59341. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  59342. }),
  59343. $globals.Initer);
  59344. $core.addMethod(
  59345. $core.method({
  59346. selector: "gruntInitThenDo:",
  59347. protocol: 'action',
  59348. fn: function (aBlock){
  59349. var self=this;
  59350. var child,sanitizedTemplatePath;
  59351. return $core.withContext(function($ctx1) {
  59352. var $1,$3,$2;
  59353. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  59354. $ctx1.sendIdx["replace:with:"]=1;
  59355. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  59356. $1=child;
  59357. $recv($1)._on_do_("error",aBlock);
  59358. $ctx1.sendIdx["on:do:"]=1;
  59359. $recv($1)._on_do_("close",(function(code){
  59360. return $core.withContext(function($ctx2) {
  59361. $3=$recv(code).__eq((0));
  59362. if($core.assert($3)){
  59363. $2=nil;
  59364. } else {
  59365. $2=code;
  59366. }
  59367. return $recv(aBlock)._value_($2);
  59368. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59369. }));
  59370. return self;
  59371. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  59372. },
  59373. args: ["aBlock"],
  59374. 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 ]) ]",
  59375. referencedClasses: [],
  59376. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59377. }),
  59378. $globals.Initer);
  59379. $core.addMethod(
  59380. $core.method({
  59381. selector: "gruntThenDo:",
  59382. protocol: 'action',
  59383. fn: function (aBlock){
  59384. var self=this;
  59385. var child;
  59386. return $core.withContext(function($ctx1) {
  59387. var $1,$3,$2;
  59388. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  59389. $1=child;
  59390. $recv($1)._on_do_("error",aBlock);
  59391. $ctx1.sendIdx["on:do:"]=1;
  59392. $recv($1)._on_do_("close",(function(code){
  59393. return $core.withContext(function($ctx2) {
  59394. $3=$recv(code).__eq((0));
  59395. if($core.assert($3)){
  59396. $2=nil;
  59397. } else {
  59398. $2=code;
  59399. }
  59400. return $recv(aBlock)._value_($2);
  59401. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59402. }));
  59403. return self;
  59404. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59405. },
  59406. args: ["aBlock"],
  59407. 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 ]) ]",
  59408. referencedClasses: [],
  59409. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59410. }),
  59411. $globals.Initer);
  59412. $core.addMethod(
  59413. $core.method({
  59414. selector: "initialize",
  59415. protocol: 'initialization',
  59416. fn: function (){
  59417. var self=this;
  59418. return $core.withContext(function($ctx1) {
  59419. (
  59420. $ctx1.supercall = true,
  59421. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  59422. $ctx1.supercall = false;
  59423. self["@childProcess"]=$recv(require)._value_("child_process");
  59424. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  59425. return self;
  59426. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  59427. },
  59428. args: [],
  59429. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  59430. referencedClasses: [],
  59431. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  59432. }),
  59433. $globals.Initer);
  59434. $core.addMethod(
  59435. $core.method({
  59436. selector: "npmInstallThenDo:",
  59437. protocol: 'action',
  59438. fn: function (aBlock){
  59439. var self=this;
  59440. var child;
  59441. return $core.withContext(function($ctx1) {
  59442. var $1;
  59443. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  59444. $1=$recv(child)._stdout();
  59445. $ctx1.sendIdx["stdout"]=1;
  59446. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  59447. return self;
  59448. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59449. },
  59450. args: ["aBlock"],
  59451. 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 }",
  59452. referencedClasses: [],
  59453. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  59454. }),
  59455. $globals.Initer);
  59456. $core.addMethod(
  59457. $core.method({
  59458. selector: "npmScriptForModule:named:",
  59459. protocol: 'npm',
  59460. fn: function (aString,anotherString){
  59461. var self=this;
  59462. var modulePath,packageJson,binSection,scriptPath;
  59463. return $core.withContext(function($ctx1) {
  59464. var $1,$3,$4,$2,$5;
  59465. $1=self["@path"];
  59466. $3=$recv($globals.JSObjectProxy)._on_(require);
  59467. $4=$recv(aString).__comma("/package.json");
  59468. $ctx1.sendIdx[","]=1;
  59469. $2=$recv($3)._resolve_($4);
  59470. modulePath=$recv($1)._dirname_($2);
  59471. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  59472. binSection=$recv(packageJson)._at_("bin");
  59473. $ctx1.sendIdx["at:"]=1;
  59474. $5=$recv(binSection)._isString();
  59475. if($core.assert($5)){
  59476. scriptPath=binSection;
  59477. } else {
  59478. scriptPath=$recv(binSection)._at_(anotherString);
  59479. }
  59480. return $recv(self["@path"])._join_with_(modulePath,scriptPath);
  59481. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  59482. },
  59483. args: ["aString", "anotherString"],
  59484. 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",
  59485. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  59486. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  59487. }),
  59488. $globals.Initer);
  59489. $core.addMethod(
  59490. $core.method({
  59491. selector: "start",
  59492. protocol: 'action',
  59493. fn: function (){
  59494. var self=this;
  59495. return $core.withContext(function($ctx1) {
  59496. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  59497. self._gruntInitThenDo_((function(error){
  59498. return $core.withContext(function($ctx2) {
  59499. if(($receiver = error) == null || $receiver.isNil){
  59500. return self._bowerInstallThenDo_((function(error2){
  59501. return $core.withContext(function($ctx3) {
  59502. if(($receiver = error2) == null || $receiver.isNil){
  59503. return self._npmInstallThenDo_((function(error3){
  59504. return $core.withContext(function($ctx4) {
  59505. if(($receiver = error3) == null || $receiver.isNil){
  59506. return self._gruntThenDo_((function(error4){
  59507. return $core.withContext(function($ctx5) {
  59508. if(($receiver = error4) == null || $receiver.isNil){
  59509. self._finishMessage();
  59510. return $recv(process)._exit();
  59511. } else {
  59512. $7=console;
  59513. $recv($7)._log_("grunt exec error:");
  59514. $ctx5.sendIdx["log:"]=7;
  59515. $recv($7)._log_(error4);
  59516. return $recv(process)._exit_((104));
  59517. }
  59518. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  59519. }));
  59520. } else {
  59521. $5=console;
  59522. $recv($5)._log_("npm install exec error:");
  59523. $ctx4.sendIdx["log:"]=5;
  59524. $6=$recv($5)._log_(error3);
  59525. $ctx4.sendIdx["log:"]=6;
  59526. $6;
  59527. return $recv(process)._exit_((103));
  59528. $ctx4.sendIdx["exit:"]=3;
  59529. }
  59530. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  59531. }));
  59532. } else {
  59533. $3=console;
  59534. $recv($3)._log_("bower install exec error:");
  59535. $ctx3.sendIdx["log:"]=3;
  59536. $4=$recv($3)._log_(error2);
  59537. $ctx3.sendIdx["log:"]=4;
  59538. $4;
  59539. return $recv(process)._exit_((102));
  59540. $ctx3.sendIdx["exit:"]=2;
  59541. }
  59542. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  59543. }));
  59544. } else {
  59545. $1=console;
  59546. $recv($1)._log_("grunt-init exec error:");
  59547. $ctx2.sendIdx["log:"]=1;
  59548. $2=$recv($1)._log_(error);
  59549. $ctx2.sendIdx["log:"]=2;
  59550. $2;
  59551. return $recv(process)._exit_((101));
  59552. $ctx2.sendIdx["exit:"]=1;
  59553. }
  59554. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  59555. }));
  59556. return self;
  59557. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  59558. },
  59559. args: [],
  59560. 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 ]]]]]]]]",
  59561. referencedClasses: [],
  59562. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  59563. }),
  59564. $globals.Initer);
  59565. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  59566. $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.";
  59567. $core.addMethod(
  59568. $core.method({
  59569. selector: "addVariableNamed:to:",
  59570. protocol: 'private',
  59571. fn: function (aString,anObject){
  59572. var self=this;
  59573. var newClass,newObject;
  59574. return $core.withContext(function($ctx1) {
  59575. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  59576. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  59577. newObject=$recv(newClass)._new();
  59578. self._setPreviousVariablesFor_from_(newObject,anObject);
  59579. return newObject;
  59580. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  59581. },
  59582. args: ["aString", "anObject"],
  59583. 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",
  59584. referencedClasses: [],
  59585. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  59586. }),
  59587. $globals.Repl);
  59588. $core.addMethod(
  59589. $core.method({
  59590. selector: "assignNewVariable:do:",
  59591. protocol: 'private',
  59592. fn: function (buffer,aBlock){
  59593. var self=this;
  59594. return $core.withContext(function($ctx1) {
  59595. var $2,$3,$1,$receiver;
  59596. return self._parseAssignment_do_(buffer,(function(name,expr){
  59597. var varName,value;
  59598. return $core.withContext(function($ctx2) {
  59599. if(($receiver = name) == null || $receiver.isNil){
  59600. varName=self._nextResultName();
  59601. } else {
  59602. varName=name;
  59603. }
  59604. varName;
  59605. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  59606. self["@session"];
  59607. $recv((function(){
  59608. return $core.withContext(function($ctx3) {
  59609. $2=$recv(varName).__comma(" := ");
  59610. if(($receiver = expr) == null || $receiver.isNil){
  59611. $3=buffer;
  59612. } else {
  59613. $3=expr;
  59614. }
  59615. $1=$recv($2).__comma($3);
  59616. $ctx3.sendIdx[","]=1;
  59617. value=self._eval_on_($1,self["@session"]);
  59618. return value;
  59619. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  59620. }))._on_do_($globals.Error,(function(e){
  59621. return $core.withContext(function($ctx3) {
  59622. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  59623. value=nil;
  59624. return value;
  59625. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  59626. }));
  59627. return $recv(aBlock)._value_value_(varName,value);
  59628. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  59629. }));
  59630. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  59631. },
  59632. args: ["buffer", "aBlock"],
  59633. 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]",
  59634. referencedClasses: ["Error", "ConsoleErrorHandler"],
  59635. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  59636. }),
  59637. $globals.Repl);
  59638. $core.addMethod(
  59639. $core.method({
  59640. selector: "clearScreen",
  59641. protocol: 'actions',
  59642. fn: function (){
  59643. var self=this;
  59644. var esc,cls;
  59645. return $core.withContext(function($ctx1) {
  59646. var $1;
  59647. esc=$recv($globals.String)._fromCharCode_((27));
  59648. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  59649. $ctx1.sendIdx[","]=2;
  59650. cls=$recv($1).__comma("[0;0f");
  59651. $ctx1.sendIdx[","]=1;
  59652. $recv($recv(process)._stdout())._write_(cls);
  59653. $recv(self["@interface"])._prompt();
  59654. return self;
  59655. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  59656. },
  59657. args: [],
  59658. 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",
  59659. referencedClasses: ["String"],
  59660. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  59661. }),
  59662. $globals.Repl);
  59663. $core.addMethod(
  59664. $core.method({
  59665. selector: "close",
  59666. protocol: 'actions',
  59667. fn: function (){
  59668. var self=this;
  59669. return $core.withContext(function($ctx1) {
  59670. $recv($recv(process)._stdin())._destroy();
  59671. return self;
  59672. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  59673. },
  59674. args: [],
  59675. source: "close\x0a\x09process stdin destroy",
  59676. referencedClasses: [],
  59677. messageSends: ["destroy", "stdin"]
  59678. }),
  59679. $globals.Repl);
  59680. $core.addMethod(
  59681. $core.method({
  59682. selector: "commands",
  59683. protocol: 'accessing',
  59684. fn: function (){
  59685. var self=this;
  59686. return self["@commands"];
  59687. },
  59688. args: [],
  59689. source: "commands\x0a\x09^ commands",
  59690. referencedClasses: [],
  59691. messageSends: []
  59692. }),
  59693. $globals.Repl);
  59694. $core.addMethod(
  59695. $core.method({
  59696. selector: "createInterface",
  59697. protocol: 'actions',
  59698. fn: function (){
  59699. var self=this;
  59700. return $core.withContext(function($ctx1) {
  59701. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  59702. $recv(self["@interface"])._on_do_("line",(function(buffer){
  59703. return $core.withContext(function($ctx2) {
  59704. return self._processLine_(buffer);
  59705. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  59706. }));
  59707. $ctx1.sendIdx["on:do:"]=1;
  59708. $recv(self["@interface"])._on_do_("close",(function(){
  59709. return $core.withContext(function($ctx2) {
  59710. return self._close();
  59711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59712. }));
  59713. self._printWelcome();
  59714. self._setupHotkeys();
  59715. self._setPrompt();
  59716. $recv(self["@interface"])._prompt();
  59717. return self;
  59718. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  59719. },
  59720. args: [],
  59721. 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",
  59722. referencedClasses: [],
  59723. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  59724. }),
  59725. $globals.Repl);
  59726. $core.addMethod(
  59727. $core.method({
  59728. selector: "encapsulateVariable:withValue:in:",
  59729. protocol: 'private',
  59730. fn: function (aString,anObject,aClass){
  59731. var self=this;
  59732. var compiler;
  59733. return $core.withContext(function($ctx1) {
  59734. var $1,$4,$3,$2,$5,$6;
  59735. compiler=$recv($globals.Compiler)._new();
  59736. $1=compiler;
  59737. $4=$recv(aString).__comma(": anObject ^ ");
  59738. $ctx1.sendIdx[","]=3;
  59739. $3=$recv($4).__comma(aString);
  59740. $ctx1.sendIdx[","]=2;
  59741. $2=$recv($3).__comma(" := anObject");
  59742. $ctx1.sendIdx[","]=1;
  59743. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  59744. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  59745. $5=compiler;
  59746. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  59747. $ctx1.sendIdx[","]=4;
  59748. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  59749. return self;
  59750. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  59751. },
  59752. args: ["aString", "anObject", "aClass"],
  59753. 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'.",
  59754. referencedClasses: ["Compiler"],
  59755. messageSends: ["new", "install:forClass:protocol:", ","]
  59756. }),
  59757. $globals.Repl);
  59758. $core.addMethod(
  59759. $core.method({
  59760. selector: "eval:",
  59761. protocol: 'actions',
  59762. fn: function (buffer){
  59763. var self=this;
  59764. return $core.withContext(function($ctx1) {
  59765. return self._eval_on_(buffer,$recv($globals.DoIt)._new());
  59766. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  59767. },
  59768. args: ["buffer"],
  59769. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  59770. referencedClasses: ["DoIt"],
  59771. messageSends: ["eval:on:", "new"]
  59772. }),
  59773. $globals.Repl);
  59774. $core.addMethod(
  59775. $core.method({
  59776. selector: "eval:on:",
  59777. protocol: 'actions',
  59778. fn: function (buffer,anObject){
  59779. var self=this;
  59780. var result;
  59781. return $core.withContext(function($ctx1) {
  59782. var $1;
  59783. $recv(buffer)._ifNotEmpty_((function(){
  59784. return $core.withContext(function($ctx2) {
  59785. return $recv((function(){
  59786. return $core.withContext(function($ctx3) {
  59787. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  59788. return result;
  59789. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59790. }))._tryCatch_((function(e){
  59791. return $core.withContext(function($ctx3) {
  59792. $1=$recv(e)._isSmalltalkError();
  59793. if($core.assert($1)){
  59794. return $recv(e)._resignal();
  59795. } else {
  59796. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  59797. }
  59798. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  59799. }));
  59800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59801. }));
  59802. return result;
  59803. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  59804. },
  59805. args: ["buffer", "anObject"],
  59806. 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",
  59807. referencedClasses: ["Compiler"],
  59808. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  59809. }),
  59810. $globals.Repl);
  59811. $core.addMethod(
  59812. $core.method({
  59813. selector: "executeCommand:",
  59814. protocol: 'private',
  59815. fn: function (aString){
  59816. var self=this;
  59817. return $core.withContext(function($ctx1) {
  59818. var $1;
  59819. var $early={};
  59820. try {
  59821. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  59822. return $core.withContext(function($ctx2) {
  59823. $1=$recv(names)._includes_(aString);
  59824. if($core.assert($1)){
  59825. $recv(cmd)._value();
  59826. throw $early=[true];
  59827. }
  59828. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  59829. }));
  59830. return false;
  59831. }
  59832. catch(e) {if(e===$early)return e[0]; throw e}
  59833. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  59834. },
  59835. args: ["aString"],
  59836. 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",
  59837. referencedClasses: [],
  59838. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  59839. }),
  59840. $globals.Repl);
  59841. $core.addMethod(
  59842. $core.method({
  59843. selector: "initialize",
  59844. protocol: 'initialization',
  59845. fn: function (){
  59846. var self=this;
  59847. return $core.withContext(function($ctx1) {
  59848. (
  59849. $ctx1.supercall = true,
  59850. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  59851. $ctx1.supercall = false;
  59852. self["@session"]=$recv($globals.DoIt)._new();
  59853. self["@readline"]=$recv(require)._value_("readline");
  59854. $ctx1.sendIdx["value:"]=1;
  59855. self["@util"]=$recv(require)._value_("util");
  59856. self._setupCommands();
  59857. return self;
  59858. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  59859. },
  59860. args: [],
  59861. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  59862. referencedClasses: ["DoIt"],
  59863. messageSends: ["initialize", "new", "value:", "setupCommands"]
  59864. }),
  59865. $globals.Repl);
  59866. $core.addMethod(
  59867. $core.method({
  59868. selector: "instanceVariableNamesFor:",
  59869. protocol: 'private',
  59870. fn: function (aClass){
  59871. var self=this;
  59872. return $core.withContext(function($ctx1) {
  59873. var $1,$2,$receiver;
  59874. $1=$recv(aClass)._superclass();
  59875. $ctx1.sendIdx["superclass"]=1;
  59876. if(($receiver = $1) == null || $receiver.isNil){
  59877. return $recv(aClass)._instanceVariableNames();
  59878. } else {
  59879. $2=$recv(aClass)._instanceVariableNames();
  59880. $ctx1.sendIdx["instanceVariableNames"]=1;
  59881. return $recv($2)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  59882. }
  59883. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  59884. },
  59885. args: ["aClass"],
  59886. 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]",
  59887. referencedClasses: [],
  59888. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  59889. }),
  59890. $globals.Repl);
  59891. $core.addMethod(
  59892. $core.method({
  59893. selector: "isIdentifier:",
  59894. protocol: 'private',
  59895. fn: function (aString){
  59896. var self=this;
  59897. return $core.withContext(function($ctx1) {
  59898. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  59899. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  59900. },
  59901. args: ["aString"],
  59902. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  59903. referencedClasses: [],
  59904. messageSends: ["match:", "asRegexp"]
  59905. }),
  59906. $globals.Repl);
  59907. $core.addMethod(
  59908. $core.method({
  59909. selector: "isVariableDefined:",
  59910. protocol: 'private',
  59911. fn: function (aString){
  59912. var self=this;
  59913. return $core.withContext(function($ctx1) {
  59914. return $recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  59915. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  59916. },
  59917. args: ["aString"],
  59918. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  59919. referencedClasses: [],
  59920. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  59921. }),
  59922. $globals.Repl);
  59923. $core.addMethod(
  59924. $core.method({
  59925. selector: "nextResultName",
  59926. protocol: 'private',
  59927. fn: function (){
  59928. var self=this;
  59929. return $core.withContext(function($ctx1) {
  59930. var $1,$receiver;
  59931. $1=self["@resultCount"];
  59932. if(($receiver = $1) == null || $receiver.isNil){
  59933. self["@resultCount"]=(1);
  59934. } else {
  59935. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  59936. }
  59937. return "res".__comma($recv(self["@resultCount"])._asString());
  59938. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  59939. },
  59940. args: [],
  59941. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  59942. referencedClasses: [],
  59943. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  59944. }),
  59945. $globals.Repl);
  59946. $core.addMethod(
  59947. $core.method({
  59948. selector: "onKeyPress:",
  59949. protocol: 'private',
  59950. fn: function (key){
  59951. var self=this;
  59952. return $core.withContext(function($ctx1) {
  59953. var $1;
  59954. $1=$recv($recv(key)._ctrl())._and_((function(){
  59955. return $core.withContext(function($ctx2) {
  59956. return $recv($recv(key)._name()).__eq("l");
  59957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59958. }));
  59959. if($core.assert($1)){
  59960. self._clearScreen();
  59961. }
  59962. return self;
  59963. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  59964. },
  59965. args: ["key"],
  59966. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  59967. referencedClasses: [],
  59968. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  59969. }),
  59970. $globals.Repl);
  59971. $core.addMethod(
  59972. $core.method({
  59973. selector: "parseAssignment:do:",
  59974. protocol: 'private',
  59975. fn: function (aString,aBlock){
  59976. var self=this;
  59977. var assignment;
  59978. return $core.withContext(function($ctx1) {
  59979. var $2,$1;
  59980. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  59981. return $core.withContext(function($ctx2) {
  59982. return $recv(s)._trimBoth();
  59983. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  59984. }));
  59985. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  59986. return $core.withContext(function($ctx2) {
  59987. $2=$recv(assignment)._first();
  59988. $ctx2.sendIdx["first"]=1;
  59989. return self._isIdentifier_($2);
  59990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59991. }));
  59992. if($core.assert($1)){
  59993. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  59994. $ctx1.sendIdx["value:value:"]=1;
  59995. } else {
  59996. return $recv(aBlock)._value_value_(nil,nil);
  59997. }
  59998. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  59999. },
  60000. args: ["aString", "aBlock"],
  60001. 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 ]",
  60002. referencedClasses: [],
  60003. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  60004. }),
  60005. $globals.Repl);
  60006. $core.addMethod(
  60007. $core.method({
  60008. selector: "presentResultNamed:withValue:",
  60009. protocol: 'private',
  60010. fn: function (varName,value){
  60011. var self=this;
  60012. return $core.withContext(function($ctx1) {
  60013. var $3,$2,$1;
  60014. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  60015. $ctx1.sendIdx[","]=3;
  60016. $2=$recv($3).__comma(" = ");
  60017. $ctx1.sendIdx[","]=2;
  60018. $1=$recv($2).__comma($recv(value)._asString());
  60019. $ctx1.sendIdx[","]=1;
  60020. $recv($globals.Transcript)._show_($1);
  60021. $recv($globals.Transcript)._cr();
  60022. $recv(self["@interface"])._prompt();
  60023. return self;
  60024. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  60025. },
  60026. args: ["varName", "value"],
  60027. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  60028. referencedClasses: ["Transcript"],
  60029. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  60030. }),
  60031. $globals.Repl);
  60032. $core.addMethod(
  60033. $core.method({
  60034. selector: "printWelcome",
  60035. protocol: 'actions',
  60036. fn: function (){
  60037. var self=this;
  60038. return $core.withContext(function($ctx1) {
  60039. $recv($globals.Transcript)._show_("Type :q to exit.");
  60040. $recv($globals.Transcript)._cr();
  60041. return self;
  60042. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  60043. },
  60044. args: [],
  60045. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  60046. referencedClasses: ["Transcript"],
  60047. messageSends: ["show:", "cr"]
  60048. }),
  60049. $globals.Repl);
  60050. $core.addMethod(
  60051. $core.method({
  60052. selector: "processLine:",
  60053. protocol: 'private',
  60054. fn: function (buffer){
  60055. var self=this;
  60056. var show;
  60057. return $core.withContext(function($ctx1) {
  60058. var $1,$2;
  60059. show=(function(varName,value){
  60060. return $core.withContext(function($ctx2) {
  60061. return self._presentResultNamed_withValue_(varName,value);
  60062. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  60063. });
  60064. $1=self._executeCommand_(buffer);
  60065. if(!$core.assert($1)){
  60066. $2=self._isVariableDefined_(buffer);
  60067. if($core.assert($2)){
  60068. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  60069. } else {
  60070. self._assignNewVariable_do_(buffer,show);
  60071. }
  60072. }
  60073. return self;
  60074. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  60075. },
  60076. args: ["buffer"],
  60077. 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]]",
  60078. referencedClasses: [],
  60079. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  60080. }),
  60081. $globals.Repl);
  60082. $core.addMethod(
  60083. $core.method({
  60084. selector: "prompt",
  60085. protocol: 'accessing',
  60086. fn: function (){
  60087. var self=this;
  60088. return "amber >> ";
  60089. },
  60090. args: [],
  60091. source: "prompt\x0a\x09^ 'amber >> '",
  60092. referencedClasses: [],
  60093. messageSends: []
  60094. }),
  60095. $globals.Repl);
  60096. $core.addMethod(
  60097. $core.method({
  60098. selector: "setPreviousVariablesFor:from:",
  60099. protocol: 'private',
  60100. fn: function (newObject,oldObject){
  60101. var self=this;
  60102. return $core.withContext(function($ctx1) {
  60103. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  60104. return $core.withContext(function($ctx2) {
  60105. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  60106. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60107. }));
  60108. return self;
  60109. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  60110. },
  60111. args: ["newObject", "oldObject"],
  60112. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  60113. referencedClasses: [],
  60114. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  60115. }),
  60116. $globals.Repl);
  60117. $core.addMethod(
  60118. $core.method({
  60119. selector: "setPrompt",
  60120. protocol: 'actions',
  60121. fn: function (){
  60122. var self=this;
  60123. return $core.withContext(function($ctx1) {
  60124. $recv(self["@interface"])._setPrompt_(self._prompt());
  60125. return self;
  60126. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  60127. },
  60128. args: [],
  60129. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  60130. referencedClasses: [],
  60131. messageSends: ["setPrompt:", "prompt"]
  60132. }),
  60133. $globals.Repl);
  60134. $core.addMethod(
  60135. $core.method({
  60136. selector: "setupCommands",
  60137. protocol: 'initialization',
  60138. fn: function (){
  60139. var self=this;
  60140. return $core.withContext(function($ctx1) {
  60141. var $2,$1;
  60142. $2=$recv([":q"]).__minus_gt((function(){
  60143. return $core.withContext(function($ctx2) {
  60144. return $recv(process)._exit();
  60145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60146. }));
  60147. $ctx1.sendIdx["->"]=1;
  60148. $1=[$2,$recv([""]).__minus_gt((function(){
  60149. return $core.withContext(function($ctx2) {
  60150. return $recv(self["@interface"])._prompt();
  60151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60152. }))];
  60153. self["@commands"]=$recv($globals.Dictionary)._from_($1);
  60154. return self;
  60155. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  60156. },
  60157. args: [],
  60158. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  60159. referencedClasses: ["Dictionary"],
  60160. messageSends: ["from:", "->", "exit", "prompt"]
  60161. }),
  60162. $globals.Repl);
  60163. $core.addMethod(
  60164. $core.method({
  60165. selector: "setupHotkeys",
  60166. protocol: 'initialization',
  60167. fn: function (){
  60168. var self=this;
  60169. return $core.withContext(function($ctx1) {
  60170. var $receiver;
  60171. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  60172. return $core.withContext(function($ctx2) {
  60173. if(($receiver = key) == null || $receiver.isNil){
  60174. return key;
  60175. } else {
  60176. return self._onKeyPress_(key);
  60177. }
  60178. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  60179. }));
  60180. return self;
  60181. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  60182. },
  60183. args: [],
  60184. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  60185. referencedClasses: [],
  60186. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  60187. }),
  60188. $globals.Repl);
  60189. $core.addMethod(
  60190. $core.method({
  60191. selector: "subclass:withVariable:",
  60192. protocol: 'private',
  60193. fn: function (aClass,varName){
  60194. var self=this;
  60195. return $core.withContext(function($ctx1) {
  60196. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  60197. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  60198. },
  60199. args: ["aClass", "varName"],
  60200. 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'",
  60201. referencedClasses: ["ClassBuilder"],
  60202. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  60203. }),
  60204. $globals.Repl);
  60205. $core.addMethod(
  60206. $core.method({
  60207. selector: "subclassNameFor:",
  60208. protocol: 'private',
  60209. fn: function (aClass){
  60210. var self=this;
  60211. return $core.withContext(function($ctx1) {
  60212. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  60213. $2=$recv(aClass)._name();
  60214. $ctx1.sendIdx["name"]=1;
  60215. $1=$recv($2)._matchesOf_("\x5cd+$");
  60216. $ctx1.sendIdx["matchesOf:"]=1;
  60217. if(($receiver = $1) == null || $receiver.isNil){
  60218. return $recv($recv(aClass)._name()).__comma("2");
  60219. } else {
  60220. var counter;
  60221. $6=$recv(aClass)._name();
  60222. $ctx1.sendIdx["name"]=2;
  60223. $5=$recv($6)._matchesOf_("\x5cd+$");
  60224. $4=$recv($5)._first();
  60225. $3=$recv($4)._asNumber();
  60226. counter=$recv($3).__plus((1));
  60227. counter;
  60228. $7=$recv(aClass)._name();
  60229. $ctx1.sendIdx["name"]=3;
  60230. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  60231. }
  60232. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  60233. },
  60234. args: ["aClass"],
  60235. 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'].",
  60236. referencedClasses: [],
  60237. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  60238. }),
  60239. $globals.Repl);
  60240. $core.addMethod(
  60241. $core.method({
  60242. selector: "main",
  60243. protocol: 'initialization',
  60244. fn: function (){
  60245. var self=this;
  60246. return $core.withContext(function($ctx1) {
  60247. $recv(self._new())._createInterface();
  60248. return self;
  60249. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  60250. },
  60251. args: [],
  60252. source: "main\x0a\x09self new createInterface",
  60253. referencedClasses: [],
  60254. messageSends: ["createInterface", "new"]
  60255. }),
  60256. $globals.Repl.klass);
  60257. });
  60258. (function () {
  60259. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  60260. amber.initialize().then(function () {
  60261. amber.globals.AmberCli._main();
  60262. });
  60263. });
  60264. }());
  60265. //jshint eqnull:true
  60266. define('amber/kernel-runtime',[],function () {
  60267. "use strict";
  60268. DNUBrik.deps = ["selectors", "messageSend", "manipulation", "root"];
  60269. function DNUBrik(brikz, st) {
  60270. var selectorsBrik = brikz.selectors;
  60271. var messageNotUnderstood = brikz.messageSend.messageNotUnderstood;
  60272. var installJSMethod = brikz.manipulation.installJSMethod;
  60273. var nilAsClass = brikz.root.nilAsClass;
  60274. /* Method not implemented handlers */
  60275. function makeDnuHandler(pair, targetClasses) {
  60276. var jsSelector = pair.js;
  60277. var fn = createHandler(pair.st);
  60278. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  60279. targetClasses.forEach(function (target) {
  60280. installJSMethod(target.fn.prototype, jsSelector, fn);
  60281. });
  60282. }
  60283. this.makeDnuHandler = makeDnuHandler;
  60284. /* Dnu handler method */
  60285. function createHandler(stSelector) {
  60286. return function () {
  60287. return messageNotUnderstood(this, stSelector, arguments);
  60288. };
  60289. }
  60290. selectorsBrik.selectorPairs.forEach(function (pair) {
  60291. makeDnuHandler(pair, []);
  60292. });
  60293. }
  60294. function ManipulationBrik(brikz, st) {
  60295. function installJSMethod(obj, jsSelector, fn) {
  60296. Object.defineProperty(obj, jsSelector, {
  60297. value: fn,
  60298. enumerable: false, configurable: true, writable: true
  60299. });
  60300. }
  60301. function installMethod(method, klass) {
  60302. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  60303. }
  60304. this.installMethod = installMethod;
  60305. this.installJSMethod = installJSMethod;
  60306. }
  60307. RuntimeClassesBrik.deps = ["selectors", "dnu", "classes", "manipulation"];
  60308. function RuntimeClassesBrik(brikz, st) {
  60309. var selectors = brikz.selectors;
  60310. var classes = brikz.classes.classes;
  60311. var wireKlass = brikz.classes.wireKlass;
  60312. var installMethod = brikz.manipulation.installMethod;
  60313. var installJSMethod = brikz.manipulation.installJSMethod;
  60314. var detachedRootClasses = [];
  60315. function markClassDetachedRoot(klass) {
  60316. detachedRootClasses.addElement(klass);
  60317. klass.detachedRoot = true;
  60318. }
  60319. this.detachedRootClasses = function () {
  60320. return detachedRootClasses;
  60321. };
  60322. /* Initialize a class in its class hierarchy. Handle both classes and
  60323. metaclasses. */
  60324. function initClassAndMetaclass(klass) {
  60325. initClass(klass);
  60326. if (klass.klass && !klass.meta) {
  60327. initClass(klass.klass);
  60328. }
  60329. }
  60330. classes().forEach(initClassAndMetaclass);
  60331. st._classAdded = initClassAndMetaclass;
  60332. function initClass(klass) {
  60333. wireKlass(klass);
  60334. if (klass.detachedRoot) {
  60335. copySuperclass(klass);
  60336. }
  60337. installMethods(klass);
  60338. }
  60339. function copySuperclass(klass) {
  60340. var myproto = klass.fn.prototype,
  60341. superproto = klass.superclass.fn.prototype;
  60342. selectors.selectorPairs.forEach(function (selectorPair) {
  60343. var jsSelector = selectorPair.js;
  60344. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  60345. });
  60346. }
  60347. function installMethods(klass) {
  60348. var methods = klass.methods;
  60349. Object.keys(methods).forEach(function (selector) {
  60350. installMethod(methods[selector], klass);
  60351. });
  60352. }
  60353. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  60354. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  60355. markClassDetachedRoot(klass);
  60356. klass.fn = constructor;
  60357. initClass(klass);
  60358. };
  60359. }
  60360. FrameBindingBrik.deps=["globals", "runtimeClasses"];
  60361. function FrameBindingBrik(brikz, st) {
  60362. var globals = brikz.smalltalkGlobals.globals;
  60363. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  60364. setClassConstructor(globals.Number, Number);
  60365. setClassConstructor(globals.BlockClosure, Function);
  60366. setClassConstructor(globals.Boolean, Boolean);
  60367. setClassConstructor(globals.Date, Date);
  60368. setClassConstructor(globals.String, String);
  60369. setClassConstructor(globals.Array, Array);
  60370. setClassConstructor(globals.RegularExpression, RegExp);
  60371. setClassConstructor(globals.Error, Error);
  60372. setClassConstructor(globals.Promise, Promise);
  60373. }
  60374. RuntimeMethodsBrik.deps = ["manipulation", "dnu", "runtimeClasses"];
  60375. function RuntimeMethodsBrik(brikz, st) {
  60376. var installMethod = brikz.manipulation.installMethod;
  60377. var installJSMethod = brikz.manipulation.installJSMethod;
  60378. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  60379. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  60380. st._methodAdded = function (method, klass) {
  60381. installMethod(method, klass);
  60382. propagateMethodChange(klass, method, klass);
  60383. };
  60384. st._selectorsAdded = function (newSelectors) {
  60385. var targetClasses = detachedRootClasses();
  60386. newSelectors.forEach(function (pair) {
  60387. makeDnuHandler(pair, targetClasses);
  60388. });
  60389. };
  60390. st._methodRemoved = function (method, klass) {
  60391. delete klass.fn.prototype[method.jsSelector];
  60392. propagateMethodChange(klass, method, null);
  60393. };
  60394. function propagateMethodChange(klass, method, exclude) {
  60395. var selector = method.selector;
  60396. var jsSelector = method.jsSelector;
  60397. st.traverseClassTree(klass, function (subclass) {
  60398. if (subclass != exclude) {
  60399. initMethodInClass(subclass, selector, jsSelector);
  60400. }
  60401. });
  60402. }
  60403. function initMethodInClass(klass, selector, jsSelector) {
  60404. if (klass.detachedRoot && !klass.methods[selector]) {
  60405. installJSMethod(klass.fn.prototype, jsSelector, klass.superclass.fn.prototype[jsSelector]);
  60406. }
  60407. }
  60408. }
  60409. PrimitivesBrik.deps = ["smalltalkGlobals"];
  60410. function PrimitivesBrik(brikz, st) {
  60411. var globals = brikz.smalltalkGlobals.globals;
  60412. var oid = 0;
  60413. /* Unique ID number generator */
  60414. st.nextId = function () {
  60415. oid += 1;
  60416. return oid;
  60417. };
  60418. /* Converts a JavaScript object to valid Smalltalk Object */
  60419. st.readJSObject = function (js) {
  60420. if (js == null)
  60421. return null;
  60422. var readObject = js.constructor === Object;
  60423. var readArray = js.constructor === Array;
  60424. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  60425. for (var i in js) {
  60426. if (readObject) {
  60427. object._at_put_(i, st.readJSObject(js[i]));
  60428. }
  60429. if (readArray) {
  60430. object[i] = st.readJSObject(js[i]);
  60431. }
  60432. }
  60433. return object;
  60434. };
  60435. /* Boolean assertion */
  60436. st.assert = function (shouldBeBoolean) {
  60437. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  60438. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  60439. shouldBeBoolean = shouldBeBoolean.valueOf();
  60440. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  60441. }
  60442. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  60443. };
  60444. /* List of all reserved words in JavaScript. They may not be used as variables
  60445. in Smalltalk. */
  60446. // list of reserved JavaScript keywords as of
  60447. // http://es5.github.com/#x7.6.1.1
  60448. // and
  60449. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  60450. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  60451. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  60452. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  60453. 'try', 'typeof', 'var', 'void', 'while', 'with',
  60454. // Amber protected words: these should not be compiled as-is when in code
  60455. 'arguments',
  60456. // ES5: future use: http://es5.github.com/#x7.6.1.2
  60457. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  60458. // ES5: future use in strict mode
  60459. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  60460. 'public', 'static', 'yield'];
  60461. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  60462. }
  60463. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  60464. function RuntimeBrik(brikz, st) {
  60465. var globals = brikz.smalltalkGlobals.globals;
  60466. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  60467. function SmalltalkMethodContext(home, setup) {
  60468. this.sendIdx = {};
  60469. this.homeContext = home;
  60470. this.setup = setup || function () {
  60471. };
  60472. this.supercall = false;
  60473. }
  60474. // Fallbacks
  60475. SmalltalkMethodContext.prototype.locals = {};
  60476. SmalltalkMethodContext.prototype.receiver = null;
  60477. SmalltalkMethodContext.prototype.selector = null;
  60478. SmalltalkMethodContext.prototype.lookupClass = null;
  60479. SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals, lookupClass) {
  60480. this.receiver = receiver;
  60481. this.selector = selector;
  60482. this.locals = locals || {};
  60483. this.lookupClass = lookupClass;
  60484. if (this.homeContext) {
  60485. this.homeContext.evaluatedSelector = selector;
  60486. }
  60487. };
  60488. SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
  60489. this.locals = locals || {};
  60490. this.outerContext = ctx;
  60491. this.index = index || 0;
  60492. };
  60493. SmalltalkMethodContext.prototype.init = function () {
  60494. var home = this.homeContext;
  60495. if (home) {
  60496. home.init();
  60497. }
  60498. this.setup(this);
  60499. };
  60500. SmalltalkMethodContext.prototype.method = function () {
  60501. var method;
  60502. var lookup = this.lookupClass || this.receiver.klass;
  60503. while (!method && lookup) {
  60504. method = lookup.methods[st.js2st(this.selector)];
  60505. lookup = lookup.superclass;
  60506. }
  60507. return method;
  60508. };
  60509. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  60510. /* This is the current call context object.
  60511. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  60512. In JS code, use api.getThisContext() (see below).
  60513. */
  60514. var thisContext = null;
  60515. st.withContext = function (worker, setup) {
  60516. if (thisContext) {
  60517. return inContext(worker, setup);
  60518. } else {
  60519. return inContextWithErrorHandling(worker, setup);
  60520. }
  60521. };
  60522. /*
  60523. Runs worker function so that error handler is not set up
  60524. if there isn't one. This is accomplished by unconditional
  60525. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  60526. which then stops error handler setup (see st.withContext above).
  60527. The effect is, $core.seamless(fn)'s exceptions are not
  60528. handed into ST error handler and caller should process them.
  60529. */
  60530. st.seamless = function (worker) {
  60531. return inContext(worker, function (ctx) {
  60532. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  60533. });
  60534. };
  60535. function inContextWithErrorHandling(worker, setup) {
  60536. try {
  60537. return inContext(worker, setup);
  60538. } catch (error) {
  60539. handleError(error);
  60540. thisContext = null;
  60541. // Rethrow the error in any case.
  60542. error.amberHandled = true;
  60543. throw error;
  60544. }
  60545. }
  60546. function inContext(worker, setup) {
  60547. var oldContext = thisContext;
  60548. thisContext = new SmalltalkMethodContext(thisContext, setup);
  60549. var result = worker(thisContext);
  60550. thisContext = oldContext;
  60551. return result;
  60552. }
  60553. /* Wrap a JavaScript exception in a Smalltalk Exception.
  60554. In case of a RangeError, stub the stack after 100 contexts to
  60555. avoid another RangeError later when the stack is manipulated. */
  60556. function wrappedError(error) {
  60557. var errorWrapper = globals.JavaScriptException._on_(error);
  60558. // Add the error to the context, so it is visible in the stack
  60559. try {
  60560. errorWrapper._signal();
  60561. } catch (ex) {
  60562. }
  60563. var context = st.getThisContext();
  60564. if (isRangeError(error)) {
  60565. stubContextStack(context);
  60566. }
  60567. errorWrapper._context_(context);
  60568. return errorWrapper;
  60569. }
  60570. /* Stub the context stack after 100 contexts */
  60571. function stubContextStack(context) {
  60572. var currentContext = context;
  60573. var contexts = 0;
  60574. while (contexts < 100) {
  60575. if (currentContext) {
  60576. currentContext = currentContext.homeContext;
  60577. }
  60578. contexts++;
  60579. }
  60580. if (currentContext) {
  60581. currentContext.homeContext = undefined;
  60582. }
  60583. }
  60584. function isRangeError(error) {
  60585. return error instanceof RangeError;
  60586. }
  60587. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  60588. (See the Smalltalk class ErrorHandler and its subclasses */
  60589. function handleError(error) {
  60590. if (!error.smalltalkError) {
  60591. error = wrappedError(error);
  60592. }
  60593. globals.ErrorHandler._handleError_(error);
  60594. }
  60595. /* Handle thisContext pseudo variable */
  60596. st.getThisContext = function () {
  60597. if (thisContext) {
  60598. thisContext.init();
  60599. return thisContext;
  60600. } else {
  60601. return null;
  60602. }
  60603. };
  60604. }
  60605. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  60606. function MessageSendBrik(brikz, st) {
  60607. var globals = brikz.smalltalkGlobals.globals;
  60608. var nilAsReceiver = brikz.root.nilAsReceiver;
  60609. /* Send message programmatically. Used to implement #perform: & Co. */
  60610. st.send2 = function (receiver, selector, args, klass) {
  60611. var method, jsSelector = st.st2js(selector);
  60612. if (receiver == null) {
  60613. receiver = nilAsReceiver;
  60614. }
  60615. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  60616. if (method) {
  60617. return method.apply(receiver, args || []);
  60618. } else {
  60619. return messageNotUnderstood(receiver, selector, args);
  60620. }
  60621. };
  60622. function invokeDnuMethod(receiver, stSelector, args) {
  60623. return receiver._doesNotUnderstand_(
  60624. globals.Message._new()
  60625. ._selector_(stSelector)
  60626. ._arguments_([].slice.call(args))
  60627. );
  60628. }
  60629. /* Handles #dnu: *and* JavaScript method calls.
  60630. if the receiver has no klass, we consider it a JS object (outside of the
  60631. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  60632. function messageNotUnderstood(receiver, stSelector, args) {
  60633. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  60634. return invokeDnuMethod(receiver, stSelector, args);
  60635. }
  60636. /* Call a method of a JS object, or answer a property if it exists.
  60637. Converts keyword-based selectors by using the first
  60638. keyword only, but keeping all message arguments.
  60639. Example:
  60640. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)"
  60641. Else try wrapping a JSObjectProxy around the receiver. */
  60642. var propertyName = st.st2prop(stSelector);
  60643. if (!(propertyName in receiver)) {
  60644. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  60645. }
  60646. return accessJavaScript(receiver, propertyName, args);
  60647. }
  60648. /* If the object property is a function, then call it, except if it starts with
  60649. an uppercase character (we probably want to answer the function itself in this
  60650. case and send it #new from Amber).
  60651. */
  60652. function accessJavaScript(receiver, propertyName, args) {
  60653. var propertyValue = receiver[propertyName];
  60654. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  60655. return propertyValue.apply(receiver, args || []);
  60656. } else if (args.length > 0) {
  60657. receiver[propertyName] = args[0];
  60658. return receiver;
  60659. } else {
  60660. return propertyValue;
  60661. }
  60662. }
  60663. st.accessJavaScript = accessJavaScript;
  60664. this.messageNotUnderstood = messageNotUnderstood;
  60665. }
  60666. /* Making smalltalk that can run */
  60667. function configureWithRuntime(brikz) {
  60668. brikz.dnu = DNUBrik;
  60669. brikz.manipulation = ManipulationBrik;
  60670. brikz.runtimeClasses = RuntimeClassesBrik;
  60671. brikz.frameBinding = FrameBindingBrik;
  60672. brikz.runtimeMethods = RuntimeMethodsBrik;
  60673. brikz.messageSend = MessageSendBrik;
  60674. brikz.runtime = RuntimeBrik;
  60675. brikz.primitives = PrimitivesBrik;
  60676. brikz.rebuild();
  60677. }
  60678. return configureWithRuntime;
  60679. });
  60680. // Depend on each module that is loaded lazily.
  60681. // Add to packager tasks as dependency,
  60682. // so the lazy-loaded modules are included.
  60683. define('amber/lazypack',['./kernel-runtime'], {});
  60684. require(["app"]);
  60685. });
  60686. define.require('__wrap__');
  60687. }((function amdefine(module, requireFn) {
  60688. 'use strict';
  60689. var defineCache = {},
  60690. loaderCache = {},
  60691. alreadyCalled = false,
  60692. path = require('path'),
  60693. makeRequire, stringRequire;
  60694. /**
  60695. * Trims the . and .. from an array of path segments.
  60696. * It will keep a leading path segment if a .. will become
  60697. * the first path segment, to help with module name lookups,
  60698. * which act like paths, but can be remapped. But the end result,
  60699. * all paths that use this function should look normalized.
  60700. * NOTE: this method MODIFIES the input array.
  60701. * @param {Array} ary the array of path segments.
  60702. */
  60703. function trimDots(ary) {
  60704. var i, part;
  60705. for (i = 0; ary[i]; i+= 1) {
  60706. part = ary[i];
  60707. if (part === '.') {
  60708. ary.splice(i, 1);
  60709. i -= 1;
  60710. } else if (part === '..') {
  60711. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  60712. //End of the line. Keep at least one non-dot
  60713. //path segment at the front so it can be mapped
  60714. //correctly to disk. Otherwise, there is likely
  60715. //no path mapping for a path starting with '..'.
  60716. //This can still fail, but catches the most reasonable
  60717. //uses of ..
  60718. break;
  60719. } else if (i > 0) {
  60720. ary.splice(i - 1, 2);
  60721. i -= 2;
  60722. }
  60723. }
  60724. }
  60725. }
  60726. function normalize(name, baseName) {
  60727. var baseParts;
  60728. //Adjust any relative paths.
  60729. if (name && name.charAt(0) === '.') {
  60730. //If have a base name, try to normalize against it,
  60731. //otherwise, assume it is a top-level require that will
  60732. //be relative to baseUrl in the end.
  60733. if (baseName) {
  60734. baseParts = baseName.split('/');
  60735. baseParts = baseParts.slice(0, baseParts.length - 1);
  60736. baseParts = baseParts.concat(name.split('/'));
  60737. trimDots(baseParts);
  60738. name = baseParts.join('/');
  60739. }
  60740. }
  60741. return name;
  60742. }
  60743. /**
  60744. * Create the normalize() function passed to a loader plugin's
  60745. * normalize method.
  60746. */
  60747. function makeNormalize(relName) {
  60748. return function (name) {
  60749. return normalize(name, relName);
  60750. };
  60751. }
  60752. function makeLoad(id) {
  60753. function load(value) {
  60754. loaderCache[id] = value;
  60755. }
  60756. load.fromText = function (id, text) {
  60757. //This one is difficult because the text can/probably uses
  60758. //define, and any relative paths and requires should be relative
  60759. //to that id was it would be found on disk. But this would require
  60760. //bootstrapping a module/require fairly deeply from node core.
  60761. //Not sure how best to go about that yet.
  60762. throw new Error('amdefine does not implement load.fromText');
  60763. };
  60764. return load;
  60765. }
  60766. makeRequire = function (systemRequire, exports, module, relId) {
  60767. function amdRequire(deps, callback) {
  60768. if (typeof deps === 'string') {
  60769. //Synchronous, single module require('')
  60770. return stringRequire(systemRequire, exports, module, deps, relId);
  60771. } else {
  60772. //Array of dependencies with a callback.
  60773. //Convert the dependencies to modules.
  60774. deps = deps.map(function (depName) {
  60775. return stringRequire(systemRequire, exports, module, depName, relId);
  60776. });
  60777. //Wait for next tick to call back the require call.
  60778. if (callback) {
  60779. process.nextTick(function () {
  60780. callback.apply(null, deps);
  60781. });
  60782. }
  60783. }
  60784. }
  60785. amdRequire.toUrl = function (filePath) {
  60786. if (filePath.indexOf('.') === 0) {
  60787. return normalize(filePath, path.dirname(module.filename));
  60788. } else {
  60789. return filePath;
  60790. }
  60791. };
  60792. return amdRequire;
  60793. };
  60794. //Favor explicit value, passed in if the module wants to support Node 0.4.
  60795. requireFn = requireFn || function req() {
  60796. return module.require.apply(module, arguments);
  60797. };
  60798. function runFactory(id, deps, factory) {
  60799. var r, e, m, result;
  60800. if (id) {
  60801. e = loaderCache[id] = {};
  60802. m = {
  60803. id: id,
  60804. uri: __filename,
  60805. exports: e
  60806. };
  60807. r = makeRequire(requireFn, e, m, id);
  60808. } else {
  60809. //Only support one define call per file
  60810. if (alreadyCalled) {
  60811. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  60812. }
  60813. alreadyCalled = true;
  60814. //Use the real variables from node
  60815. //Use module.exports for exports, since
  60816. //the exports in here is amdefine exports.
  60817. e = module.exports;
  60818. m = module;
  60819. r = makeRequire(requireFn, e, m, module.id);
  60820. }
  60821. //If there are dependencies, they are strings, so need
  60822. //to convert them to dependency values.
  60823. if (deps) {
  60824. deps = deps.map(function (depName) {
  60825. return r(depName);
  60826. });
  60827. }
  60828. //Call the factory with the right dependencies.
  60829. if (typeof factory === 'function') {
  60830. result = factory.apply(m.exports, deps);
  60831. } else {
  60832. result = factory;
  60833. }
  60834. if (result !== undefined) {
  60835. m.exports = result;
  60836. if (id) {
  60837. loaderCache[id] = m.exports;
  60838. }
  60839. }
  60840. }
  60841. stringRequire = function (systemRequire, exports, module, id, relId) {
  60842. //Split the ID by a ! so that
  60843. var index = id.indexOf('!'),
  60844. originalId = id,
  60845. prefix, plugin;
  60846. if (index === -1) {
  60847. id = normalize(id, relId);
  60848. //Straight module lookup. If it is one of the special dependencies,
  60849. //deal with it, otherwise, delegate to node.
  60850. if (id === 'require') {
  60851. return makeRequire(systemRequire, exports, module, relId);
  60852. } else if (id === 'exports') {
  60853. return exports;
  60854. } else if (id === 'module') {
  60855. return module;
  60856. } else if (loaderCache.hasOwnProperty(id)) {
  60857. return loaderCache[id];
  60858. } else if (defineCache[id]) {
  60859. runFactory.apply(null, defineCache[id]);
  60860. return loaderCache[id];
  60861. } else {
  60862. if(systemRequire) {
  60863. return systemRequire(originalId);
  60864. } else {
  60865. throw new Error('No module with ID: ' + id);
  60866. }
  60867. }
  60868. } else {
  60869. //There is a plugin in play.
  60870. prefix = id.substring(0, index);
  60871. id = id.substring(index + 1, id.length);
  60872. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  60873. if (plugin.normalize) {
  60874. id = plugin.normalize(id, makeNormalize(relId));
  60875. } else {
  60876. //Normalize the ID normally.
  60877. id = normalize(id, relId);
  60878. }
  60879. if (loaderCache[id]) {
  60880. return loaderCache[id];
  60881. } else {
  60882. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  60883. return loaderCache[id];
  60884. }
  60885. }
  60886. };
  60887. //Create a define function specific to the module asking for amdefine.
  60888. function define(id, deps, factory) {
  60889. if (Array.isArray(id)) {
  60890. factory = deps;
  60891. deps = id;
  60892. id = undefined;
  60893. } else if (typeof id !== 'string') {
  60894. factory = id;
  60895. id = deps = undefined;
  60896. }
  60897. if (deps && !Array.isArray(deps)) {
  60898. factory = deps;
  60899. deps = undefined;
  60900. }
  60901. if (!deps) {
  60902. deps = ['require', 'exports', 'module'];
  60903. }
  60904. //Set up properties for this module. If an ID, then use
  60905. //internal cache. If no ID, then use the external variables
  60906. //for this node module.
  60907. if (id) {
  60908. //Put the module in deep freeze until there is a
  60909. //require call for it.
  60910. defineCache[id] = [id, deps, factory];
  60911. } else {
  60912. runFactory(id, deps, factory);
  60913. }
  60914. }
  60915. //define.require, which has access to all the values in the
  60916. //cache. Useful for AMD modules that all have IDs in the file,
  60917. //but need to finally export a value to node based on one of those
  60918. //IDs.
  60919. define.require = function (id) {
  60920. if (loaderCache[id]) {
  60921. return loaderCache[id];
  60922. }
  60923. if (defineCache[id]) {
  60924. runFactory.apply(null, defineCache[id]);
  60925. return loaderCache[id];
  60926. }
  60927. };
  60928. define.amd = {};
  60929. return define;
  60930. }(module)), require));